diff --git a/src/components/AuditInformation/AuditInformation.js b/src/components/AuditInformation/AuditInformation.js
new file mode 100644
index 0000000..6d25d7c
--- /dev/null
+++ b/src/components/AuditInformation/AuditInformation.js
@@ -0,0 +1,198 @@
+/* eslint-disable no-const-assign,prefer-destructuring */
+/**
+ * Created by mar105 on 2019-01-04.
+ */
+// , Switch, Icon
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Tabs, Avatar, message, Select, Input, Button } from 'antd';
+import * as commonFunc from './../Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
+import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
+import styles from './../../index.less';
+import CommonView from './../Common/CommonView';
+import CommonBase from './../Common/CommonBase';/* 获取配置及数据 */
+import * as commonUtils from './../../utils/utils';/* 通用方法 */
+import * as commonBusiness from './../Common/commonBusiness';/* 单据业务功能 */
+import commonConfig from './../../utils/config';
+import * as commonServices from './../../services/services';/* 服务类 */
+
+const { TabPane } = Tabs;
+const { Option } = Select;
+const { Content } = Layout;
+
+class AuditInformation extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ }
+ componentWillReceiveProps(nextProps) {
+ const {
+ formData, currentId, checkData, app,
+ } = nextProps;
+ let { masterConfig, canSendMsg } = nextProps;
+ const { userinfo } = app;
+ if (commonUtils.isEmptyArr(masterConfig) && formData.length > 0) {
+ const sId = currentId !== undefined ? currentId : '';
+ /* 数据Id */
+ masterConfig = formData.filter(item => !item.bGrd)[0];
+ const checkConfig = formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult')[0];
+ const checkColumn = commonFunc.getHeaderConfig(checkConfig);
+ this.handleGetData(masterConfig, checkConfig);
+ this.props.onSaveState({
+ masterConfig, sId, pageLoading: false, checkConfig, checkColumn, checked: true, canSendMsg: false,
+ });
+ } else if (commonUtils.isNotEmptyArr(checkData) && (JSON.stringify(this.props.checkData) !== JSON.stringify(checkData))) {
+ const iIndex = checkData.findIndex(item => item.sResult !== '1' && item.sResult !== '2' && item.sCheckPersonId === userinfo.sId);
+ if (iIndex > -1) {
+ canSendMsg = true;
+ }
+ this.props.onSaveState({ canSendMsg });
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const { checkColumn, masterConfig } = nextProps;
+ return commonUtils.isNotEmptyArr(checkColumn) || commonUtils.isNotEmptyObject(masterConfig);
+ }
+ /** 获取主表数据 */
+ handleGetData = async (masterConfig, checkConfig) => {
+ const { currentId } = this.props; /* 当前页签数据 */
+ const sId = currentId !== undefined ? currentId : '';
+ await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' } });
+ const { masterData } = this.props;
+ if (!commonUtils.isEmptyObject(checkConfig) && !commonUtils.isEmptyObject(masterData)) {
+ this.props.handleGetDataSet({
+ name: 'check', configData: checkConfig, condition: { sSqlCondition: { sBillId: masterData.sBillId } },
+ });
+ }
+ };
+ handleForm = (form) => {
+ this.form = form;
+ };
+ handleSelectChange = (value) => {
+ let iReply = 1;
+ if (value === 'approve') {
+ iReply = 1;
+ } else if (value === 'refuse') {
+ iReply = 0;
+ }
+ this.props.onSaveState({ iReply });
+ };
+ handleSwitchChange = (value) => {
+ this.props.onSaveState({ checked: value });
+ };
+ handleSubmit = async () => {
+ const {
+ sModelsId, masterData, masterConfig, checkConfig,
+ } = this.props;
+ let { iReply } = this.props;
+ const sReply = document.getElementById('sReply').value;
+ iReply = commonUtils.isEmptyNumber(iReply) ? 1 : iReply;
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_System_ReplyCheckMsg',
+ paramsMap: {
+ sMsgGuid: masterData.sId,
+ sBillGuid: masterData.sBillId,
+ iReply,
+ sReply,
+ },
+ };
+ const returnData = (await commonServices.postValueService(this.props.app.token, value, url)).data;
+ if (returnData.code === 1) {
+ if (returnData.dataset.rows[0].dataSet.outData[0].sCode === 1) {
+ this.handleGetData(masterConfig, checkConfig);
+ message.success(returnData.msg);
+ } else {
+ message.error(returnData.dataset.rows[0].dataSet.outData[0].sReturn);
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(returnData);
+ }
+ };
+ render() {
+ const { pageLoading, masterData } = this.props;
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ return (
+
+
+
+ );
+ }
+}
+
+const WorkOrderComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, onSelectChange, onSubmit, checked,
+ } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ const propsType = {
+ ...props,
+ onChange: props.onMasterChange,
+ };
+ const style = checked ? 'block' : 'none';
+ /*
+
显示审核记录:
+ }
+ unCheckedChildren={}
+ onChange={onSwitchChange}
+ />
+
+ */
+ return (
+
+ );
+});
+
+export default CommonBase(AuditInformation);
diff --git a/src/components/Common/CommonCalculator.js b/src/components/Common/CommonCalculator.js
new file mode 100644
index 0000000..5faf9e5
--- /dev/null
+++ b/src/components/Common/CommonCalculator.js
@@ -0,0 +1,105 @@
+/* eslint-disable function-paren-newline */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Row, Col, Button } from 'antd';
+import * as commonUtils from '../../utils/utils';
+import commonConfig from '../../utils/config';
+import * as commonFunc from './commonFunc';
+import styles from '../../index.less';
+
+const FormItem = Form.Item;
+
+class CommonCalculatorComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ this.assignmentWillProps(this.props);
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.assignmentWillProps(nextProps);
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({ disabled: props.enabled === undefined ? true : !props.enabled });
+ }
+
+ handleClick = (e, child) => {
+ this.props.onButtonChange('calculator', child);
+ }
+
+ handleField = () => {
+ this.props.onField();
+ };
+
+ render() {
+ const { disabled } = this.state; /* 中文部分 */
+ const { masterConfig, gdsformconst, gdsjurisdiction } = this.props;
+ const gdsconfigformslave = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '') : [];
+ const barContent = [];
+ const button = JSON.parse(JSON.stringify(commonConfig.jsqData));
+ button.forEach((btn) => {
+ const btnConfig = commonFunc.getConfig('', btn.sName, gdsconfigformslave, gdsformconst, gdsjurisdiction, btn.showName);
+ if (btnConfig.bVisible) {
+ barContent.push(
+
+
+ );
+ }
+ });
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {barContent}
+
+
+
+
+
+ );
+ }
+}
+
+export default CommonCalculatorComponent;
diff --git a/src/components/Common/CommonImportDataEvent.js b/src/components/Common/CommonImportDataEvent.js
new file mode 100644
index 0000000..a4f7a21
--- /dev/null
+++ b/src/components/Common/CommonImportDataEvent.js
@@ -0,0 +1,267 @@
+/* eslint-disable array-callback-return,no-undef,prefer-destructuring */
+import React, { Component } from 'react';
+import { message } from 'antd';
+import commonConfig from '../../utils/config';
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonServices from './../../services/services'; /* 服务类 */
+import * as commonFunc from '../Common/commonFunc';
+
+// const { confirm } = Modal;
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ this.form = {};
+ /* 表单对象 */
+ }
+ componentWillReceiveProps(nextProps) {
+ const { isReceive, formData, app } = nextProps;
+
+ if (!isReceive && formData.length > 0) {
+ const templateConfig = formData.filter(item => item.bGrd);
+ let selectOptions = '{';
+ templateConfig.forEach((item, i) => {
+ if (i !== 0) { selectOptions = selectOptions.concat(','); }
+ selectOptions = selectOptions.concat(`"${item.sId}"`).concat(':').concat(`"${item.showName}"`);
+ });
+ selectOptions = selectOptions.concat('}');
+
+ const importConfigTypes = [];
+
+ const DataTemplate = commonFunc.showMessage(app.commonConst, 'DataTemplate');/* 数据模板 */
+ const BtnUploadCheck = commonFunc.showMessage(app.commonConst, 'BtnUploadCheck');/* 上传校验 */
+ const importData = commonFunc.showMessage(app.commonConst, 'importData');/* 导入数据 */
+ const BtnExportTemplate = commonFunc.showMessage(app.commonConst, 'BtnExportTemplate');/* 导出模板 */
+ importConfigTypes.push(commonFunc.getImitateGdsconfigTypes(DataTemplate, 'sMasterId', 'sMasterId', false, 'const', selectOptions, false));
+ importConfigTypes.push(commonFunc.getImitateGdsconfigTypes(BtnUploadCheck, 'btnUpload', '', false, '', '', true));
+ importConfigTypes.push(commonFunc.getImitateGdsconfigTypes(importData, 'btnSave', '', false, '', '', false));
+ importConfigTypes.push(commonFunc.getImitateGdsconfigTypes(BtnExportTemplate, 'btnExport', '', false, '', '', false));
+
+ const currConfig = {};
+ currConfig.rowGdsconfig = [{ gdsconfigformslave: importConfigTypes }];
+
+ const masterData = {};
+ masterData.handleType = '';
+ masterData.sId = commonUtils.createSid();
+
+ this.props.onSaveState({
+ masterData,
+ templateConfig,
+ isReceive: true,
+ masterConfig: currConfig,
+ pageLoading: false,
+ enabled: true,
+ });
+ this.handleGetChangeData({ name: 'importMenu' }, 'importMenu');
+ }
+ }
+
+ shouldComponentUpdate(nextProps, nextState) {
+ let flag = true;
+ /* 追加弹出框数值回填放行判断ppopupPane */
+ if (nextProps.sTabId === nextProps.app.currentPane.key || ((nextProps.app.ppopupPane !== undefined
+ && nextProps.app.ppopupPane.mainConfig !== undefined)
+ ? nextProps.sTabId === nextProps.app.ppopupPane.mainConfig.key : false)) {
+ if (nextState.disabled !== this.state.disabled) {
+ return true;
+ }
+ flag = true;
+ } else {
+ flag = false;
+ }
+ return flag;
+ }
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+ /* save */
+ handleValidateSave = async () => {
+ const {
+ token, sModelsId, sJurisdictionClassifyId, sUserId, treeSaveParams, app,
+ } = this.props;
+ const value = {};
+ if ((commonUtils.isEmptyArr(sJurisdictionClassifyId) || commonUtils.isEmptyArr(sUserId)) && commonUtils.isEmptyArr(treeSaveParams)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NotEmptyJurisdictionGroup'));
+ return;
+ }
+ value.data = treeSaveParams;
+ const dataUrl = `${commonConfig.server_host}/sysjurisdiction/addSysjurisdiction?sModelsId=${sModelsId}`;
+ const dataReturn = (await commonServices.postValueService(token, value, dataUrl)).data;
+ /* 成功的话返回数据 */
+ if (dataReturn.code === 1) { /* 成功 */
+ message.success(dataReturn.msg);
+ return dataReturn;
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ return false;
+ }
+ }
+
+ /* get */
+ handleGetChangeData = async (params, urlKey) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const { name, gdsconfigformmasterId } = params; // name,
+ let dataUrl = '';// ImportMenu
+ if (urlKey === 'importMenu') { // yw_获取导入模板菜单
+ dataUrl = `${commonConfig.server_host}import/getImportMenu?sModelsId=${sModelsId}`;
+ } else if (urlKey === 'exportTemplet') { // yw_导出将要导入的模板execl
+ dataUrl = `${commonConfig.server_host}import/exportTemplet?gdsconfigformmasterId=${gdsconfigformmasterId}&token=${token}`;
+ }
+ const dataReturn = (await commonServices.getService(token, dataUrl)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ this.props.onSaveState({ [`${name}Data`]: returnData });
+ } else {
+ this.props.getServiceError(dataReturn);
+ }
+ }
+
+ /* post */
+ handlePostData = async (params, urlKey) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const {
+ name, gdsconfigformmasterId, file, execlData, sTableName,
+ } = params; // name,
+ let dataUrl = '';
+ const value = {};
+ if (urlKey === 'checkExcel') { // yw_校验导入模板数据
+ value.gdsconfigformmasterId = gdsconfigformmasterId;
+ value.file = file;
+ dataUrl = `${commonConfig.server_host}import/checkExcel?sModelsId=${sModelsId}`;
+ } else if (urlKey === 'addImport') {
+ dataUrl = `${commonConfig.server_host}import/addImport?sModelsId=${sModelsId}`;
+ value.sTableName = sTableName;
+ value.execlData = execlData;
+ }
+ const dataReturn = (await commonServices.postValueService(token, value, dataUrl)).data;
+ if (dataReturn.code === 1) {
+ if (urlKey === 'checkExcel') {
+ const returnData = dataReturn.dataset.rows;
+ const allInitArr = [];
+ const allInitMap = new Map();
+ this.handleAllCheckKeys(allInitArr, allInitMap, returnData);
+ this.props.onSaveState({ [`${name}Data`]: returnData, treeAllCheckKeys: allInitArr, treeAllNodes: allInitMap });
+ } else if (urlKey === 'addImport') {
+ this.props.onSaveState({ nocanbeInsertData: [], canbeInsertData: [] });
+ message.info(dataReturn.msg);
+ }
+ } else {
+ this.props.getServiceError(dataReturn);
+ }
+ }
+
+ /** 修改主表数据 */
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData) => {
+ const addState = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ const gdsconfigformmasterId = {};
+ const { templateConfig } = this.props;
+ if (sFieldName === 'sMasterId') {
+ addState.gdsconfigformmasterId = changeValue[sFieldName];
+ const iIndex = templateConfig.findIndex(item => item.sId === changeValue[sFieldName]);
+ const configTypes = [];// importMenuData
+ configTypes.push(commonFunc.getImitateGdsconfigTypes('原因', 'sReason', 'sReason', false, '', '', false));
+
+ const canbeInsertConfig = templateConfig[iIndex];
+ const canbeInsertColumn = commonFunc.getHeaderConfig(canbeInsertConfig);
+
+ const nocanbeInsertConfig = { gdsconfigformslave: configTypes.concat(templateConfig[iIndex].gdsconfigformslave) };
+ const nocanbeInsertColumn = commonFunc.getHeaderConfig(nocanbeInsertConfig);
+
+ addState.nocanbeInsertConfig = nocanbeInsertConfig;
+ addState.nocanbeInsertColumn = nocanbeInsertColumn;
+ addState.canbeInsertConfig = canbeInsertConfig;
+ addState.canbeInsertColumn = canbeInsertColumn;
+ addState.nocanbeInsertData = [];
+ addState.canbeInsertData = [];
+ }
+ this.props.onSaveState({ gdsconfigformmasterId, ...addState });
+ };
+
+ handleUploadChange = (sControlName, info) => {
+ /* 获取上传后的一些信息 */
+ const { file } = info;
+ let { [`${sControlName}UploadInfo`]: uploads } = this.props;
+ if (commonUtils.isEmptyArr(uploads)) {
+ uploads = [];
+ uploads.push(file);
+ } else {
+ uploads.push(file);
+ }
+ this.props.onSaveState({ [`${sControlName}UploadInfo`]: uploads });
+ };
+
+ /* 按钮点击功能 */
+ handleBtnClick = (e, btnName) => {
+ const {
+ masterData, app, canbeInsertData, nocanbeInsertData,
+ } = this.props;
+ const { token } = app;
+ const { sMasterId, sTableName } = masterData;
+ if (btnName === 'btnExport') {
+ if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(sMasterId)) {
+ // window.location.href = `${commonConfig.server_host}import/exportTemplet?gdsconfigformmasterId=${sMasterId}&token=${token}`;
+ const url = `${commonConfig.server_host}import/exportTemplet?gdsconfigformmasterId=${sMasterId}&token=${token}`;
+ window.open(url);
+ } else {
+ const chooseImprtTemplete = commonFunc.showMessage(app.commonConst, 'chooseImprtTemplete');/* 请选择要导出的模板 */
+ message.error(chooseImprtTemplete);
+ }
+ } else if (btnName === 'btnSave') {
+ if (commonUtils.isNotEmptyArr(nocanbeInsertData) && commonUtils.isNotEmptyArr(canbeInsertData) && commonUtils.isNotEmptyObject(sTableName) && nocanbeInsertData.length === canbeInsertData.length) {
+ this.handlePostData({ name: 'addImport', execlData: canbeInsertData, sTableName }, 'addImport');
+ } else {
+ message.error(commonFunc.showMessage(app.commonConst, 'ErrorImport')); /* 有错误数据,不能导入 */
+ }
+ }
+ };
+
+ /* 按钮点击功能 */
+ handleShowUploadData = (response) => {
+ const { masterData } = this.props;
+
+ if (response.code === 1) {
+ const returnData = response.dataset.rows[0];
+ const {
+ nocanbeInsert, canbeInsert, sTableName,
+ } = returnData;
+
+ masterData.sTableName = sTableName;
+ this.props.onSaveState({
+ masterData,
+ nocanbeInsertData: nocanbeInsert.concat(canbeInsert),
+ canbeInsertData: canbeInsert,
+ });
+ } else {
+ message.error(response.msg);
+ }
+ };
+
+ render() {
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonJurisdictionNewEvent.js b/src/components/Common/CommonJurisdictionNewEvent.js
new file mode 100644
index 0000000..d9eca03
--- /dev/null
+++ b/src/components/Common/CommonJurisdictionNewEvent.js
@@ -0,0 +1,808 @@
+/* eslint-disable array-callback-return,no-undef,prefer-destructuring */
+import React, { Component } from 'react';
+import { Modal, message } from 'antd';
+import commonConfig from '../../utils/config';
+import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonServices from './../../services/services';
+import * as commonFunc from './commonFunc'; /* 服务类 */
+
+const { confirm } = Modal;
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ this.form = {};
+ /* 表单对象 */
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ formData, currentId, groupConfig, treeData, formRoute,
+ } = nextProps;
+ let { bReceived } = nextProps;
+ const sId = currentId !== undefined ? currentId : '';
+
+ if (commonUtils.isEmptyObject(groupConfig) && bReceived === undefined) {
+ const masterConfig = formData.filter(item => !item.bGrd)[0];
+ this.handleGetChangeData({ name: 'tree' }, 'SysjurisdictionTree');
+ bReceived = true;
+ const group = this.initColumnConfig('group', [
+ this.imitateTableColumn('序号', 'iOrder', 'iOrder', 60),
+ this.imitateTableColumn('权限组', 'sName', 'sId', 350)]);
+
+
+ const userGroup = this.initColumnConfig('userGroup', [
+ this.imitateTableColumn('序号', 'iOrder', 'iOrder', 60),
+ this.imitateTableColumn('组成员', 'sUserName', 'sUsersId', 350)]);
+
+ const user = this.initColumnConfig('userView', [
+ this.imitateTableColumn('序号', 'iOrder', 'iOrder', 60),
+ this.imitateTableColumn('用户', 'sUserName', 'sId', 120),
+ this.imitateTableColumn('权限组', 'sGroupName', 'sGroupName', 350)]);
+
+ const groupUser = this.imitateTableColumnConfig('groupUser', [this.imitateTableColumn('所属分组', 'sGroupName', 'sGroupsId')]);
+
+ const checkedNodes = this.imitateTableColumnConfig('checkedNodes', [this.imitateTableColumn('名称', 'showName', 'sId')]);
+
+ const tree = this.imitateTableColumnConfig('tree', [this.imitateTableColumn('名称', 'showName', 'key')]);
+
+ const search = this.imitateTableColumnConfig('search', [this.imitateTableColumn('名称', 'showName', 'sAllId', 300)]);
+
+ let treeKeyName = 'key';
+ if (formRoute === '/indexPage/systemPermission') {
+ treeKeyName = 'sId';
+ }
+ this.props.onSaveState({
+ masterConfig,
+ sId,
+ bReceived,
+ treeKeyName,
+ showLine: false,
+ // pageLoading: false,
+ ...tree,
+ ...group,
+ ...user,
+ ...userGroup,
+ ...groupUser,
+ ...checkedNodes,
+ ...search,
+ });
+ }
+ if (commonUtils.isNotEmptyArr(treeData) && bReceived) {
+ this.handleGetChangeData({ name: 'group' }, 'GroupData');
+ this.handleGetChangeData({ name: 'userView' }, 'UserData');
+ this.props.onSaveState({
+ bReceived: false,
+ pageLoading: false,
+ });
+ }
+ }
+
+
+ shouldComponentUpdate(nextProps, nextState) {
+ let flag = true;
+ /* 追加弹出框数值回填放行判断ppopupPane */
+ if (nextProps.sTabId === nextProps.app.currentPane.key || ((nextProps.app.ppopupPane !== undefined
+ && nextProps.app.ppopupPane.mainConfig !== undefined)
+ ? nextProps.sTabId === nextProps.app.ppopupPane.mainConfig.key : false)) {
+ if (nextState.disabled !== this.state.disabled) {
+ return true;
+ }
+ flag = true;
+ } else {
+ flag = false;
+ }
+ return flag;
+ }
+
+ componentWillUpdate(nextProps) {
+ const { masterData, sModelsType, elemachineData } = nextProps;
+ if (sModelsType === 'element/teamInfo' && masterData !== undefined) {
+ if (commonUtils.isNotEmptyObject(elemachineData)) {
+ elemachineData.forEach((row, index) => {
+ if (row.sMachineId === masterData.sMachineId) {
+ elemachineData[index].bDefault = true;
+ } else {
+ elemachineData[index].bDefault = false;
+ }
+ });
+ }
+ }
+ }
+
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+
+ handleValidateSave = async () => {
+ const {
+ token, sModelsId, sJurisdictionClassifyId, sUserId, treeAllNodes, treeCheckedKeys = [], treeAllCheckKeys,
+ app,
+ } = this.props;
+ const value = {};
+ if ((commonUtils.isEmptyArr(sJurisdictionClassifyId) && commonUtils.isEmptyArr(sUserId))) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NotEmptyJurisdictionGroup'));/* 组员,所属或权限组不能为空! */
+ this.props.onSaveState({
+ loading: false,
+ });
+ return;
+ }
+ if (commonUtils.isNotEmptyArr(sJurisdictionClassifyId) && commonUtils.isEmptyArr(sUserId)) {
+ value.sJurisdictionClassifyId = sJurisdictionClassifyId[0];
+ } else if (commonUtils.isNotEmptyArr(sUserId) && commonUtils.isEmptyArr(sJurisdictionClassifyId)) {
+ value.sUserId = sUserId[0];
+ } else {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NotEmptyGroup'));/* 组或者组员不能为空 */
+ this.props.onSaveState({
+ loading: false,
+ });
+ return;
+ }
+ /*
+ if (commonUtils.isNotEmptyArr(treeCheckedKeys) && treeCheckedKeys.length === treeAllCheckKeys.length) {
+ message.warn('请选择不需要的权限!');
+ return;
+ }
+ */
+ const newCheckedKeys = []; /* 所有选中节点 */
+ const saveData = [];
+
+ // 取 选中数据 用-分割后的最后一个值
+ const treeCheckedKeysNew = treeCheckedKeys.map((item) => {
+ const list = item.split('-');
+ return list[list.length - 1];
+ });
+
+ treeAllCheckKeys.forEach((key) => {
+ const iIndex = treeCheckedKeysNew.indexOf(key);
+ if (iIndex > -1) {
+ newCheckedKeys.push(key);
+ }
+ });
+ newCheckedKeys.forEach((key) => {
+ const nodes = treeAllNodes.get(key);
+ saveData.push({
+ sId: nodes.sId,
+ sParentId: nodes.sParentId,
+ // sKey: nodes[`${skeyName}`],
+ sKey: nodes.key,
+ sName: commonUtils.isNotEmptyObject(nodes) && commonUtils.isNotEmptyObject(nodes.sName) ? nodes.sName : '',
+ sAction: commonUtils.isNotEmptyObject(nodes) && commonUtils.isNotEmptyObject(nodes.sAction) ? nodes.sAction : '',
+ showName: nodes.showName,
+ });
+ });
+
+ value.data = saveData;
+ value.sTreeAllKet = treeAllCheckKeys;
+
+ const dataUrl = `${commonConfig.server_host}/sysjurisdictionNew/addSysjurisdictionNew?sModelsId=${sModelsId}`;
+ const dataReturn = (await commonServices.postValueService(token, value, dataUrl)).data;
+ /* 成功的话返回数据 */
+ if (dataReturn.code === 1) { /* 成功 */
+ message.success(dataReturn.msg);
+ this.props.onSaveState({ enabled: false, loading: false });
+ return dataReturn;
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ this.props.onSaveState({
+ loading: false,
+ });
+ return false;
+ }
+ }
+
+ /** 点击修改按钮操作 */
+ handleEdit = () => {
+ this.props.onSaveState({ enabled: true, loading: false });
+ }
+ handleCancel = (obj) => {
+ // const { groupUserData } = this.props;
+ // const onGetChangeData = this.handleGetChangeData;
+ const onSaveStateOk = this.props.onSaveState;
+ confirm({
+ title: obj.title,
+ onOk() {
+ // const sId = commonUtils.isNotEmptyArr(groupUserData) && groupUserData.length > 0 ? groupUserData[0].sId : '';
+ onSaveStateOk({ enabled: false });
+ // onGetChangeData({ name: 'authority', sId }, 'GroupAuthority');
+ },
+ onCancel() {
+ },
+ });
+ }
+
+ handleGetSisformulaData = (masterConfig) => {
+ this.handleGetSlaveData('One', null, masterConfig);
+ }
+
+ handleGetSlaveData = (getType, sName, currConfig) => {
+ const { currentId } = this.props;
+ /* 当前页签数据 */
+ const sId = currentId !== undefined ? currentId : '';
+ if (getType === 'One') {
+ this.props.handleGetDataOne({
+ name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' },
+ });
+ }
+ if (getType === 'Set') {
+ this.props.handleGetDataSet({
+ name: sName, configData: currConfig, condition: { sSqlCondition: { sParentId: sId } },
+ });
+ }
+ }
+ /* 获取分组列表
+ yw_权限分配
+ 获取分组列表
+ 获取人员列表
+ qx_获取权限树
+ qx_根据组sId获取已选择权限
+ qx_根据人sId获取已选择权限
+ qx_根据组sId获取组人员
+ 根据人员sId获取所属分组
+ 保存组已选权限
+ * */
+ handleGetChangeData = async (params, urlKey) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const { name, sId, treeComponentName } = params; // name,
+ let dataUrl = '';
+ if (urlKey === 'SysjurisdictionTree') { // 树结构
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getSysjurisdictionTreeNew?sModelsId=${sModelsId}`;
+ } else if (urlKey === 'GroupData') { // 组
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getGroupDataNew?sModelsId=${sModelsId}`;
+ } else if (urlKey === 'UserData') { // 用户
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getUserDataNew?sModelsId=${sModelsId}`;
+ } else if (urlKey === 'UserGroupId') { // 组成员
+ if (commonUtils.isNotEmptyObject(sId)) {
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getsUserGroupIdNew/${sId}?sModelsId=${sModelsId}`;
+ }
+ } else if (urlKey === 'GroupAuthority') { // 组权限
+ if (commonUtils.isNotEmptyObject(sId)) {
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getHaveAuthorityGroupIdNew/${sId}?sModelsId=${sModelsId}`;
+ }
+ } else if (urlKey === 'UserAuthority') { // 用户所有权限查询 :用户权限,组权限
+ if (commonUtils.isNotEmptyObject(sId)) {
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getHaveAuthorityUserIdNew/${sId}?sModelsId=${sModelsId}`;
+ }
+ }
+ if (commonUtils.isNotEmptyObject(dataUrl)) {
+ const dataReturn = (await commonServices.getService(token, dataUrl)).data;
+ if (commonUtils.isNotEmptyObject(dataReturn) && dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ let addState = {};
+ if (urlKey === 'SysjurisdictionTree') { // 树结构
+ const allInitArr = [];
+ const allInitMap = new Map();
+ this.handleAllCheckKeys(allInitArr, allInitMap, returnData);
+ this.props.onSaveState({ [`${name}Data`]: returnData, treeAllCheckKeys: allInitArr, treeAllNodes: allInitMap });
+ } else if (urlKey === 'GroupData') { // 获取组后默认查询组权限,以及组成员
+ this.props.onSaveState({ [`${name}Data`]: returnData });
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ this.handleTableSelectRowChange('group', [returnData[0].sId]); // 查询第一组成员
+ }
+ } else if (urlKey === 'UserData') { // 获取成员后默认 成员自己的权限,以及成员所属组
+ this.props.onSaveState({ [`${name}Data`]: returnData });
+ // if (commonUtils.isNotEmptyArr(returnData)) {
+ // this.handleGetChangeData({ name: 'groupUser', sId: returnData[0].sId }, 'GroupUserId'); // 查询第一个成员归属组
+ // }
+ } else if (urlKey === 'GroupAuthority' || urlKey === 'UserAuthority') {
+ let groupAuth = '';
+ let groupAuthData = [];
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ if (commonUtils.isNotEmptyObject(returnData[0])) {
+ groupAuth = commonUtils.isNotEmptyObject(returnData[0]) ? returnData[0].sKeys : [];
+ groupAuthData = commonUtils.isNotEmptyObject(groupAuth) ? groupAuth.split(',') : [];
+ }
+ }
+ addState = this.handleCheckedNodeForFunction(treeComponentName, groupAuthData);
+ this.props.onSaveState({
+ [`${name}Data`]: returnData, userAuth: undefined, sJurisdictionClassifyId: sId, sUserId: undefined, ...addState,
+ });
+ } else if (false && urlKey === 'UserAuthority') {
+ let gAuth = '';
+ let groupAuthData = [];
+ let uAuth = '';
+ let userAuthData = [];
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ if (commonUtils.isNotEmptyObject(returnData[0])) {
+ const { groupAuth, userAuth } = returnData[0];
+ if (commonUtils.isNotEmptyObject(groupAuth)) {
+ gAuth = groupAuth.sKeys;
+ groupAuthData = gAuth.split(',');
+ }
+
+ if (commonUtils.isNotEmptyObject(userAuth)) {
+ uAuth = userAuth.sKeys;
+ userAuthData = uAuth.split(',');
+ }
+ }
+ }
+ addState = this.handleGroupForFunction(treeComponentName, groupAuthData, userAuthData);
+ this.props.onSaveState({
+ [`${name}Data`]: returnData, userAuthData, sJurisdictionClassifyId: undefined, sUserId: sId, ...addState,
+ });
+ } else {
+ this.props.onSaveState({ [`${name}Data`]: returnData });
+ }
+ } else {
+ this.props.getServiceError(dataReturn);
+ }
+ }
+ }
+
+ // 模拟 列
+ imitateTableColumn = (title, dataIndex, key, width) => {
+ return {
+ title, dataIndex, key, width,
+ };
+ }
+ // 模拟config的 gdsconfigformslave 配置
+ imitateTableConfig = (title, dataIndex, width) => {
+ return {
+ bCanInput: false,
+ bFilter: false,
+ bFind: false,
+ bFirstEmpty: false,
+ bIsOther: false,
+ bNewRecord: false,
+ bNotEmpty: false,
+ bNotRepeat: false,
+ bReadonly: true,
+ bSum: false,
+ bTree: false,
+ bVisible: true,
+ iColValue: 1,
+ iFitWidth: width,
+ sBrandsId: '1111111111',
+ sChinese: title,
+ sChineseDropDown: '',
+ sControlName: 'BtnLast',
+ sId: commonUtils.createSid(),
+ sParentId: '11811781131121915102156308120',
+ sSubsidiaryId: '1111111111',
+ showName: title,
+ sName: dataIndex,
+ };
+ }
+ // 根据模拟列,模拟列配置
+ imitateTableColumnConfig = (name, columns) => {
+ const gdsconfigformslave = [];
+ columns.forEach((itmes) => {
+ gdsconfigformslave.push(this.imitateTableConfig(itmes.title, itmes.dataIndex, itmes.width));
+ });
+ const config = { bGrd: true, gdsconfigformslave };
+ return { [`${name}Column`]: columns, [`${name}Config`]: config };
+ }
+
+ initColumnConfig = (name, columns) => {
+ const gdsconfigformslave = [];
+ columns.forEach((itmes) => {
+ gdsconfigformslave.push(this.imitateTableConfig(itmes.title, itmes.dataIndex, itmes.width));
+ });
+ const config = { bGrd: true, gdsconfigformslave };
+ const newColumns = commonFunc.getHeaderConfig(config);
+ return { [`${name}Column`]: newColumns, [`${name}Config`]: config };
+ }
+
+
+ /** 处理选择行发生改变 */
+ handleTableSelectRowChange = (name, selectedRowKeys) => {
+ const addState = {};
+ if (name === 'group') {
+ this.handleGetChangeData({ name: 'userGroup', sId: selectedRowKeys }, 'UserGroupId');
+ this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'GroupAuthority');
+ addState.groupSelectedRowKeys = selectedRowKeys;
+ } else if (name === 'userView') {
+ // this.handleGetChangeData({ name: 'groupUser', sId: selectedRowKeys }, 'GroupUserId');
+ this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'UserAuthority');
+ addState.userViewSelectedRowKeys = selectedRowKeys;
+ } else if (name === 'userGroup') {
+ this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'UserAuthority');
+ addState.userGroupSelectedRowKeys = selectedRowKeys;
+ } else if (name === 'groupUser') {
+ this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'GroupAuthority');
+ addState.groupUserSelectedRowKeys = selectedRowKeys;
+ }
+ this.props.onSaveState({ ...addState });
+ }
+
+ handleCheckBoxCheck = (componentName, checkedKeys) => {
+ this.handleCheckedForFunction(componentName, checkedKeys);
+ }
+
+ /* 选择权限同时处理保存的数据以及将要展现的已选择权限 */
+ handleCheckedForFunction = (componentName, checkedKeys) => {
+ const {
+ treeAllNodes,
+ } = this.props;
+ const data = [];
+ const checkedData = [];
+ if (commonUtils.isNotEmptyArr(treeAllNodes) && treeAllNodes.size > 0) {
+ const newCheckedKeys = [];
+ if (commonUtils.isNotEmptyArr(checkedKeys) && checkedKeys[0] !== null) {
+ checkedKeys.forEach((key, i) => {
+ if (checkedKeys.indexOf(key) === i) {
+ newCheckedKeys.push(key);
+ }
+ });
+ newCheckedKeys.forEach((key) => {
+ const nodes = treeAllNodes.get(key);
+ if (commonUtils.isNotEmptyObject(nodes)) {
+ checkedData.push({ sId: nodes.sId, showName: nodes.showName });
+ }
+ });
+ }
+ this.props.onSaveState({
+ [`${componentName}CheckedKeys`]: newCheckedKeys,
+ treeSaveParams: data,
+ checkedNodesData: checkedData,
+ });
+ }
+ }
+
+ /* 拿接口返回的节点进行选中 */
+ handleCheckedNodeForFunction = (componentName, haveCheckedKeys) => {
+ // eslint-disable-next-line no-unused-vars
+ const { treeAllNodes, treeAllCheckKeys } = this.props;
+ const addState = {};
+ const checkedData = [];
+ let checkKeys = [];
+ checkKeys = haveCheckedKeys;
+ // if (commonUtils.isNotEmptyArr(unCheckedKeys)) {
+ // for (const checkId of unCheckedKeys) {
+ // treeAllCheckKeys.forEach((key) => {
+ // if (checkId.includes(key)) {
+ // checkKeys.forEach((item, index) => {
+ // if (item === key) {
+ // checkKeys.splice(index, 1);
+ // }
+ // });
+ // }
+ // });
+ // }
+ // }
+ checkKeys.forEach((key) => {
+ const nodes = treeAllNodes.get(key);
+ if (commonUtils.isNotEmptyObject(nodes)) {
+ checkedData.push({ sId: nodes.sId, showName: nodes.showName });
+ }
+ });
+ addState[`${componentName}CheckedKeys`] = checkKeys;
+ addState.checkedNodesData = checkedData;
+ addState.disabledCheckedKeys = [];
+ return addState;
+ }
+
+
+ handleUnCheckedForFunction = (componentName, unCheckedKeys) => {
+ const { treeAllNodes, treeAllCheckKeys } = this.props;
+ const addState = {};
+ const checkedData = [];
+ let checkKeys = [];
+ checkKeys = checkKeys.concat(treeAllCheckKeys);
+
+ if (commonUtils.isNotEmptyArr(unCheckedKeys)) {
+ for (const checkId of unCheckedKeys) {
+ treeAllCheckKeys.forEach((key) => {
+ if (checkId.includes(key)) {
+ checkKeys.forEach((item, index) => {
+ if (item === key) {
+ checkKeys.splice(index, 1);
+ }
+ });
+ }
+ });
+ }
+ }
+ checkKeys.forEach((key) => {
+ const nodes = treeAllNodes.get(key);
+ if (commonUtils.isNotEmptyObject(nodes)) {
+ checkedData.push({ sId: nodes.sId, showName: nodes.showName });
+ }
+ });
+ addState[`${componentName}CheckedKeys`] = checkKeys;
+ addState.checkedNodesData = checkedData;
+ addState.disabledCheckedKeys = [];
+ return addState;
+ }
+
+ handleGroupForFunction = (treeComponentName, groupAuthData, userAuthData) => {
+ const { treeAllNodes, treeAllCheckKeys } = this.props;
+ const addState = {};
+ const checkedData = [];
+ let checkKeys = [];
+ let userAuthDataNew = [];
+ checkKeys = checkKeys.concat(treeAllCheckKeys);
+ if (commonUtils.isEmptyArr(userAuthData)) { /* 只有组权限 没有用户权限时 */
+ userAuthDataNew = JSON.parse(JSON.stringify(groupAuthData)); /* 深拷贝 */
+ userAuthData = userAuthDataNew;
+ }
+ if (commonUtils.isNotEmptyArr(userAuthData)) {
+ treeAllCheckKeys.forEach((key) => {
+ for (const checkId of userAuthData) {
+ if (checkId.includes(key)) {
+ checkKeys.forEach((item, index) => {
+ if (item === key) {
+ checkKeys.splice(index, 1);
+ }
+ });
+ }
+ }
+ });
+ checkKeys.forEach((key) => {
+ const nodes = treeAllNodes.get(key);
+ if (commonUtils.isNotEmptyObject(nodes)) {
+ checkedData.push({ sId: nodes.sId, showName: nodes.showName });
+ }
+ });
+ }
+
+ let groupCheckKeys = [];
+ if (commonUtils.isNotEmptyArr(groupAuthData)) {
+ groupCheckKeys = groupCheckKeys.concat(treeAllCheckKeys);
+ treeAllCheckKeys.forEach((key) => {
+ for (const checkId of groupAuthData) {
+ if (checkId === key) {
+ groupCheckKeys.splice(groupCheckKeys.indexOf(key), 1);
+ }
+ }
+ });
+ } else {
+ groupCheckKeys = treeAllCheckKeys; /* 组权限没有 */
+ }
+ addState[`${treeComponentName}CheckedKeys`] = checkKeys.concat(groupCheckKeys);
+ addState.checkedNodesData = checkedData;
+ addState.disabledCheckedKeys = groupCheckKeys;
+ return addState;
+ };
+
+ handleAllCheckKeys = (arrObj, mapObj, returnData) => {
+ const { treeKeyName } = this.props;
+ returnData.forEach((item) => {
+ if (commonUtils.isNotEmptyArr(item.children) && item.children.length > 0) {
+ arrObj.push(item[`${treeKeyName}`]);
+ mapObj.set(item[`${treeKeyName}`], item);
+ this.handleAllCheckKeys(arrObj, mapObj, item.children);
+ } else {
+ arrObj.push(item[`${treeKeyName}`]);
+ mapObj.set(item[`${treeKeyName}`], item);
+ }
+ });
+ };
+ handleRefresh = () => {
+ this.handleGetChangeData({ name: 'tree' }, 'SysjurisdictionTree');
+ this.handleGetChangeData({ name: 'group' }, 'GroupData');
+ this.handleGetChangeData({ name: 'user' }, 'UserData');
+ this.props.onSaveState({
+ treeAllCheckKeys: undefined,
+ treeAllNodes: undefined,
+ });
+ }
+ handleSearch = async (sSearchValue) => {
+ const { sModelsId } = this.props;
+ const url = `${commonConfig.server_host}gdsmodule/getGdsmoduleList?sModelsId=${sModelsId}&sName=${sSearchValue}`;
+ const dataReturn = (await commonServices.getService(this.props.app.token, url)).data;
+ if (dataReturn.code === 1) {
+ /* 数据查询成功 */
+ this.props.onSaveState({ searchData: dataReturn.dataset.rows });
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ }
+ handleSetTreeOptionData = (name, optionName, value) => {
+ this.props.onSaveState({ [`${name}${optionName}Keys`]: value });
+ }
+
+ handleSearchTable = async (searchValue, type) => {
+ const { token, sModelsId } = this.props;
+ let dataUrl = '';
+ if (commonUtils.isNotEmptyObject(type)) {
+ if (type === 'group') {
+ /* 组权限 */
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getGroupDataNew?sSearchName=${searchValue}&sModelsId=${sModelsId}`;
+ } else if (type === 'userView') { /* 用户权限 */
+ dataUrl = `${commonConfig.server_host}sysjurisdictionNew/getUserDataNew?sSearchName=${searchValue}&sModelsId=${sModelsId}`;
+ }
+ if (commonUtils.isNotEmptyObject(dataUrl)) {
+ const dataReturn = (await commonServices.getService(token, dataUrl)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyArr(type)) {
+ this.props.onSaveState({ [`${type}Data`]: returnData });
+ }
+ }
+ }
+ }
+ }
+
+ /* 查询组权限 */
+ handleSearchGroup = async (searchValue) => {
+ this.handleSearchTable(searchValue, 'group');
+ }
+
+ /* 查询用户权限 */
+ handleSearchUser = async (searchValue) => {
+ this.handleSearchTable(searchValue, 'userView');
+ }
+ /** 按钮操作事件 */
+ handleButtonClick = (name, isFresh) => {
+ if (name.includes('BtnRepairGroup')) {
+ const { sJurisdictionClassifyId } = this.props;
+ if (commonUtils.isNotEmptyArr(sJurisdictionClassifyId)) {
+ const filterData = this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName === name));
+ const btnConfig = commonUtils.isNotEmptyArr(filterData) ? filterData[0] : {};// sButtonEnabled sButtonParam
+ console.log(333, btnConfig);
+ if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
+ /* 找到组配置 */
+ const sToGroupConfig = this.props.masterConfig.gdsconfigformslave.filter(item => item.sName === 'sCopyToGroupName');
+ console.log(332, sToGroupConfig);
+ if (commonUtils.isNotEmptyArr(sToGroupConfig)) {
+ this.props.onSaveState({ groupModalVisible: true, sToGroupConfig, sGroupId: sJurisdictionClassifyId }); /* 打开复制从窗体sJurisdictionClassifyId */
+ }
+ }
+ } else {
+ message.error('请选择组权限');
+ }
+ } else if (name.includes('BtnRepairUser')) {
+ const { userViewSelectedRowKeys } = this.props;
+ if (commonUtils.isNotEmptyArr(userViewSelectedRowKeys)) {
+ const filterData = this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName === name));
+ const btnConfig = commonUtils.isNotEmptyArr(filterData) ? filterData[0] : {};// sButtonEnabled sButtonParam
+ console.log(filterData, filterData);
+ if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
+ /* 找到组配置 */
+ const sToUserConfig = this.props.masterConfig.gdsconfigformslave.filter(item => item.sName === 'sCopyToUserName');
+ console.log(332, sToUserConfig);
+ if (commonUtils.isNotEmptyArr(sToUserConfig)) {
+ this.props.onSaveState({ userModalVisible: true, sToUserConfig });
+ }
+ }
+ } else {
+ message.error('请选择用户权限');
+ }
+ } else if (name === 'BtnOut') {
+ this.handleOut();
+ } else if (name === 'BtnDesignFunction') {
+ this.handleDesignFunction();
+ } else if (name === 'BtnRefresh') {
+ const {
+ slaveConfig, slavePagination, slaveFilterCondition, slaveOrderBy,
+ } = this.props;
+ this.props.onSaveState({
+ clearArray: [], searchText: '', slaveSelectedRowKeys: [], slaveSelectedData: [], slaveInfoSelectedRowKeys: [], slaveInfoSelectedData: [], treeSelectedKeys: [], treeFilterCondition: [], loading: false, pageLoading: true, isFresh,
+ });
+ if (slavePagination === undefined) return;
+ this.handleGetData(slaveConfig, slaveFilterCondition, slavePagination.current, slavePagination.pageSize, slaveOrderBy, true); /* 刷新方法 */
+ // if (formRoute === '/indexPage/materialRequirementsPlanning') {
+ // if (commonUtils.isNotEmptyObject(slaveInfoConfig)) {
+ // this.handleGetDataInfo(slaveInfoConfig, slaveFilterCondition, 1);
+ // }
+ // }
+ /* 判断是否要加载过滤树数据 */
+ const filterTreeConfigArr = slaveConfig.gdsconfigformslave.filter(item => item.bTree);
+ if (commonUtils.isNotEmptyArr(filterTreeConfigArr)) {
+ const filterTreeConfig = filterTreeConfigArr[0];
+ this.handleGetFilterTreeData(filterTreeConfig, slaveFilterCondition, 1);
+ }
+ const { clearArray } = this.props;
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ } else if (name === 'BtnOutJurisdiction') {
+ const { activeKey, app, sModelsId } = this.props;
+ const { userinfo, token } = app;
+ const { sBrandsId, sSubsidiaryId } = userinfo;
+ const sType = activeKey === '3' ? 'user' : 'group';
+ const url = `${commonConfig.server_host}sysjurisdictionNew/exportSysjurisdiction/${sBrandsId}/${sSubsidiaryId}/${sType}?sModelsId=${sModelsId}&token=${token}`;
+ window.open(url);
+ }
+ };
+
+ handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
+ const { app, sModelsId } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ // this.props.onButtonClick('BtnRefresh');
+ // this.handleRefresh();
+ this.handleGetChangeData({ name: 'group' }, 'GroupData');
+ this.handleGetChangeData({ name: 'userView' }, 'UserData');
+ this.props.onSaveState({ groupModalVisible: false, userModalVisible: false });
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
+ }
+ this.props.onSaveState({ loading: false });
+ }
+
+ handleCopyGroupModalOk =() => {
+ const { sJurisdictionClassifyId, masterData } = this.props;
+ const filterData = this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName === 'BtnRepairGroup'));
+ const btnConfig = commonUtils.isNotEmptyArr(filterData) ? filterData[0] : {};// sButtonEnabled sButtonParam
+ if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
+ const inParams = [];
+ const addState = {};
+ addState.key = 'group';
+ const val = [{
+ sGroupId: commonUtils.isNotEmptyArr(sJurisdictionClassifyId) ? sJurisdictionClassifyId[0] : '',
+ sToGroupId: commonUtils.isNotEmptyObject(masterData) && masterData.sCopyToGroupId,
+ }];
+ addState.value = val;
+ inParams.push({ ...addState });
+ this.handleProcedureCall(btnConfig, 'Sp_BtnEventCopyGroupJurisdiction', JSON.stringify({ params: inParams, changeValue: 'group' }));
+ }
+ };
+
+ handleCopyUserModalOk =() => {
+ const { userViewSelectedRowKeys, masterData } = this.props;
+ const filterData = this.props.masterConfig.gdsconfigformslave.filter(item => (item.sControlName === 'BtnRepairUser'));
+ const btnConfig = commonUtils.isNotEmptyArr(filterData) ? filterData[0] : {};// sButtonEnabled sButtonParam
+ if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
+ const inParams = [];
+ const addState = {};
+ addState.key = 'user';
+ const val = [{
+ sUserId: commonUtils.isNotEmptyArr(userViewSelectedRowKeys) ? userViewSelectedRowKeys[0] : '',
+ sToUserId: commonUtils.isNotEmptyObject(masterData) && masterData.sCopyToUserId,
+ }];
+ addState.value = val;
+ inParams.push({ ...addState });
+ this.handleProcedureCall(btnConfig, 'Sp_BtnEventCopyUserJurisdiction', JSON.stringify({ params: inParams, changeValue: 'user' }));
+ }
+ };
+
+ handleModalCancel = (modelVisible) => {
+ this.props.onSaveState({
+ [modelVisible]: false,
+ });
+ };
+
+ render() {
+ const { masterData } = this.props;
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonProductionPlanEvent.js b/src/components/Common/CommonProductionPlanEvent.js
new file mode 100644
index 0000000..682a9c0
--- /dev/null
+++ b/src/components/Common/CommonProductionPlanEvent.js
@@ -0,0 +1,1055 @@
+/* eslint-disable prefer-destructuring,no-await-in-loop,semi,no-unused-vars */
+import React, { Component } from 'react';
+import { message } from 'antd'; // Form, Modal, InputNumber
+// import reactComponentDebounce from 'react-component-debounce';
+import moment from 'moment';
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */
+import * as commonServices from '../../services/services'; /* 服务类 */
+import commonConfig from '../../utils/config';
+import * as commonFunc from './commonFunc'; /* 通用单据方法 */
+
+/*
+const { confirm } = Modal;
+const FormItem = Form.Item;
+const InputNumberA = reactComponentDebounce(800)(InputNumber);
+*/
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.form = {}; /* 表单对象 */
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ app, formData, currentId, masterData, searchSolution, sGroupByList, teamSelectedRowKeys, teamData,
+ } = nextProps;
+ const { teamFilterCondition } = this.props;
+ let {
+ isReceive, teamConfig, slaveConfig, slaveInfoConfig,
+ } = nextProps;
+ const { currentPane } = app;
+ const { otherCondition } = currentPane;
+ if (formData.length > 0 && commonUtils.isEmptyObject(teamConfig) && commonUtils.isEmptyArr(searchSolution)) {
+ isReceive = false;
+ const sId = currentId !== undefined ? currentId : '';
+ const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'eleteam')[0];
+
+ teamConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo_WorkCenter')[0];
+ slaveConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo' && item.sGrd !== 'slaveInfo')[0];
+ slaveInfoConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo' && item.sGrd === 'slaveInfo')[0];
+ const productionPlanConfig = formData.filter(item => item.sTbName === 'MftProductionPlanSlave')[0];
+
+ const teamColumn = commonFunc.getHeaderConfig(teamConfig);
+ const slaveColumn = commonFunc.getHeaderConfig(slaveConfig);
+ const slaveInfoColumn = commonFunc.getHeaderConfig(slaveInfoConfig);
+ const productionPlanColumn = commonFunc.getHeaderConfig(productionPlanConfig);
+
+ let currfilterCondition = [];
+ if (commonUtils.isNotEmptyObject(masterData) && !commonUtils.isEmpty(masterData.sSearchSolutionId) && commonUtils.isNotEmptyArr(searchSolution)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1 && !commonUtils.isEmpty(searchSolution[iIndex].sCondition)) {
+ currfilterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ }
+ }
+ this.handleGetData('team', teamConfig, currfilterCondition, undefined, '', false, sGroupByList);
+ // this.handleGetData('slave', slaveConfig, [], undefined, '', false, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, [], undefined, '', false, undefined);
+
+ this.props.onSaveState({
+ masterConfig,
+ teamConfig,
+ teamColumn,
+ slaveConfig,
+ slaveColumn,
+ slaveInfoConfig,
+ slaveInfoColumn,
+ productionPlanConfig,
+ productionPlanColumn,
+ sId,
+ pageLoading: false,
+ enabled: true,
+ dragPermission: false,
+ dragAndDropSwitch: false,
+ isReceive,
+ masterData: {},
+ tableBtnEnabled: true,
+ // stateOption: objValue,
+ });
+ } else if (commonUtils.isEmptyStr(teamSelectedRowKeys) && commonUtils.isEmptyArr(teamFilterCondition) && commonUtils.isNotEmptyArr(teamData) && !isReceive) {
+ let iIndex = -1;
+ if (otherCondition) {
+ iIndex = otherCondition.findIndex(item => item.bFilterName === 'sMachineId');
+ }
+ if (iIndex !== -1) {
+ const newIndex = teamData.findIndex(item => item.sMachineId === otherCondition[iIndex].bFilterValue);
+ if (newIndex === -1) {
+ this.handleCallBack({ ...teamData[0] });
+ } else {
+ this.handleCallBack({ ...teamData[newIndex] });
+ }
+ } else {
+ this.handleCallBack({ ...teamData[0] });
+ }
+ this.props.onSaveState({ isReceive: true });
+ } else if (commonUtils.isEmptyStr(teamSelectedRowKeys) && commonUtils.isEmptyArr(currentPane.filterCondition) && commonUtils.isEmptyArr(teamFilterCondition) && commonUtils.isNotEmptyArr(teamData) && !isReceive) {
+ this.handleGetData('slave', slaveConfig, [], undefined, '', false, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, [], undefined, '', false, undefined);
+ this.props.onSaveState({ isReceive: true, teamSelectedRowKeys: teamData[0].sId });
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const {
+ slaveColumn,
+ } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn);
+ }
+
+ componentDidUpdate(prevProps) {
+ const {
+ slaveSelectedRowKeys, moveEnabled, tableBtnEnabled,
+ } = prevProps;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && !moveEnabled && tableBtnEnabled) {
+ this.props.onSaveState({ moveEnabled: true });
+ } else if ((commonUtils.isEmptyArr(slaveSelectedRowKeys) && moveEnabled && tableBtnEnabled) || (moveEnabled && !tableBtnEnabled)) {
+ this.props.onSaveState({ moveEnabled: false });
+ }
+ }
+
+ onChangeMachine = async () => {
+ const { sModelsId, masterData, slaveInfoSelectedRowKeys } = this.props;
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_Manufacture_ProductionPlanInfo_ChangeMachine',
+ paramsMap: {
+ bSplit: masterData.bSplit,
+ iSplitNum: masterData.iSplitNum,
+ sMachineId: masterData.sMachineId,
+ sTeamId: masterData.sTeamId,
+ tStartDate: masterData.tStartDate,
+ sProInParam: JSON.stringify({ params: { key: 'slaveInfo', value: { sId: slaveInfoSelectedRowKeys } } }),
+ },
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, value, url)).data;
+ if (dataReturn.code === 1) {
+ /* 数据查询成功 */
+ this.handleRefresh();
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ }
+
+ /** 获取表数据 */
+ handleGetData = async (sName, slaveConfig, slaveFilterCondition, page, slaveOrderBy, clearSelectData, sGroupByListNew, nextProps, isWait) => {
+ const { app } = commonUtils.isEmpty(nextProps) ? this.props : nextProps;
+ const sGroupByList = sGroupByListNew !== undefined ? commonUtils.isEmptyArr(sGroupByListNew) ? null : sGroupByListNew : this.props.sGroupByList;
+ const conditonValues = app.currentPane.conditonValues;
+ const filterCondition = app.currentPane.filterCondition;
+ let bFilter = [];
+ if (!commonUtils.isEmptyArr(slaveFilterCondition)) {
+ slaveFilterCondition[0].bFilterName = slaveFilterCondition[0].bFilterName.replace('_pro', '');
+ bFilter.push(...slaveFilterCondition);
+ }
+ if (!commonUtils.isEmptyArr(filterCondition)) {
+ bFilter.push(...filterCondition);
+ }
+ const addState = {};
+ const pageNum = commonUtils.isEmpty(page) ? 1 : page;
+ addState.pageNum = pageNum;
+ addState.pageSize = ''; // commonConfig.pageSize;
+ if (sName === 'team' && commonUtils.isNotEmptyArr(filterCondition)) {
+ bFilter = [];
+ const addFilter = {};
+ addFilter.bFilterName = `${filterCondition[0].bFilterName}_pro`;
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = filterCondition[0].bFilterValue;
+ bFilter.push(addFilter);
+ }
+ const returnData = await this.props.handleGetDataSet({
+ name: sName,
+ configData: slaveConfig,
+ condition: {
+ ...addState, bFilter, sFilterOrderBy: slaveOrderBy, sSqlCondition: conditonValues, sGroupList: sGroupByList,
+ },
+ flag: true,
+ clearSelectData,
+ isWait,
+ });
+ this.props.onSaveState({ Loading: false });
+ if (isWait) {
+ return { ...returnData };
+ }
+ };
+
+ // 搜索 查询
+ handleGetSearchData = (config, filterCondition) => {
+ const {
+ teamConfig, sGroupByList, teamSelectedRowKeys,
+ } = this.props;
+ const iIndex = filterCondition.findIndex(item => item.bFilterName === 'sTeamId' && item.bFilterCondition === '=' && item.bFilterValue === teamSelectedRowKeys[0]);
+ const filter = [];
+ filterCondition.forEach((itme, i) => {
+ if (iIndex !== i) { filter.push(itme); }
+ });
+ this.handleGetData('team', teamConfig, filter, undefined, '', false, sGroupByList);
+ };
+
+ handleGetSlaveData = (config, filterCondition) => {
+ const {
+ slaveConfig, slaveInfoConfig, teamData, teamSelectedRowKeys,
+ } = this.props;
+ const iIndex = filterCondition.findIndex(item => item.bFilterName === 'sTeamId' && item.bFilterCondition === '=' && item.bFilterValue === teamSelectedRowKeys[0]);
+ const filter = [];
+ filterCondition.forEach((itme, i) => {
+ if (iIndex !== i) { filter.push(itme); }
+ });
+
+ const addFilter = {};
+ addFilter.bFilterName = 'sTeamId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = teamData[0].sId;
+ filter.push(addFilter);
+
+ this.handleGetData('slave', slaveConfig, filter, undefined, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, undefined);
+ };
+
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+
+ /** toolbar保存 */
+ handleSaveData = async (params) => {
+ const {
+ token, sModelsId,
+ } = this.props;
+ const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
+ if (commonUtils.isNotEmptyObject(returnData)) {
+ this.handleRefresh();
+ if (this.props.app.currentPane.refresh !== undefined) {
+ this.props.app.currentPane.refresh();
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /** 保存校验 */
+ handleValidateSave = () => {
+ this.form.validateFields((err) => {
+ /* 验证通过与不通过走不同的流程 */
+ if (err) { /* 验证失败 */
+ /* 直接渲染显示错误提示 */
+ for (const key of Object.keys(err)) {
+ message.error(err[key].errors[0].message);
+ }
+ } else { /* 验证成功 */
+ const {
+ slaveConfig, slaveData, slaveDelData, app, productionPlanConfig, productionPlanDelData, tableBtnEnabled, charGanttData, bGantt,
+ slaveInfoData, slaveInfoDelData,
+ } = this.props;
+ const data = [];
+ if (commonUtils.isEmptyArr(slaveData)) {
+ message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空!
+ return;
+ } else {
+ /* 如果是甘特图视图,则进入甘特图视图保存逻辑 */
+ if (bGantt && commonUtils.isNotEmptyObject(charGanttData)) {
+ const data = [];
+ const addState = {}
+ const charGanttDataFormate = [];
+ charGanttData.data.forEach((val) => {
+ val.start_date = moment(val.start_date).format('YYYY-MM-DD H:m');
+ val.end_date = moment(val.end_date).format('YYYY-MM-DD H:m');
+ charGanttDataFormate.push(val);
+ })
+ addState.name = 'slave';
+ addState.sTable = 'MftProductionPlanSlave';
+ addState.column = charGanttDataFormate;
+ data.push(addState);
+ this.handleSaveData({ data, sClientType: '1' });
+ return;
+ }
+ const productionPlanData = [];
+ const slaveFilter = slaveData.filter(item => item.sDivRowNew);
+ if (commonUtils.isNotEmptyArr(slaveFilter)) {
+ slaveFilter.forEach((item, i) => {
+ const index = slaveData.findIndex(itemS => itemS.sSlaveId === item.sSlaveId);
+ if (index <= slaveData.length) {
+ // slaveData[index].sDivRowNew = '';
+ slaveData[index + 1].sDivRow = item.sDivRowNew;
+ slaveData[index + 1].sDivRowNew = '';
+ }
+ });
+ }
+ for (const item of slaveData) {
+ const {
+ sSlaveId, handleType, iOrder, tStartDate, sMemo, dAdjustHour, sDivRowNew, sDivRow,
+ } = item;
+ if (commonUtils.isEmptyObject(sDivRowNew)) {
+ const sIds = sSlaveId.split('-');
+ sIds.forEach((newItem) => {
+ const addState = {};
+ addState.sId = newItem;
+ if (commonUtils.isEmpty(iOrder)) {
+ message.error('序号必填!');
+ return;
+ }
+ if (commonUtils.isEmpty(tStartDate)) {
+ message.error('时间必填!');
+ return;
+ }
+ addState.iOrder = iOrder;
+ /* 20210406 zhuzong要求排程保存时候 必传iOrder,tStartDate,sMemo,dAdjustHour 四个参数 */
+ addState.tStartDate = tStartDate;
+ // if (commonUtils.isNotEmptyObject(sMemo)) {
+ // addState.sMemo = sMemo;
+ // }
+ // if (dAdjustHour !== undefined) {
+ // addState.dAdjustHour = dAdjustHour;
+ // }
+ addState.sMemo = sMemo;
+ addState.dAdjustHour = dAdjustHour;
+ addState.handleType = handleType;
+ if (sDivRow) {
+ addState.sDivRow = sDivRow;
+ } else {
+ addState.sDivRow = '';
+ }
+ productionPlanData.push(addState);
+ });
+ }
+ }
+ data.push(commonBusiness.mergeData('productionPlan', productionPlanConfig.sTbName, productionPlanData, productionPlanDelData));
+ data.push(commonBusiness.mergeData('slaveInfo', productionPlanConfig.sTbName, slaveInfoData, slaveInfoDelData));
+ }
+ if (!commonBusiness.validateTable(slaveConfig, slaveData)) {
+ return;
+ }
+ // data.push(commonBusiness.mergeData('slave', 'MftProductionPlanSlave', slaveData, slaveDelData));
+ this.handleSaveData({ data, sClientType: '1' });
+ }
+ });
+ };
+
+ /* 数据删除成功跳转到新路由即pane */
+ handleDelDataSuccess = (props) => {
+ const { app } = props;
+ let { panes, currentPane } = app;
+ /* 删除单据后退出当前路由后,标签panes变化后的集合 */
+ panes = panes.filter(pane => pane.key !== currentPane.key);
+ /* 跳转到panes集合的最后一个路由,因为panes集合一定含有主页路由所以panes的集合大于等于1 */
+ currentPane = panes[panes.length - 1];
+ this.props.onRemovePane(panes, currentPane);
+ };
+
+ /** 表格数据更改 */
+ // name 不写完整的state名称作用为了要用到total // (name, changeValue, sId, dropDownData)
+ handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ const { sModelsId } = this.props;
+ this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, false);
+ if (name === 'slave') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ if (sFieldName === 'iOrder') {
+ /* 修改汇总表数据后,slaveInfo表iOrder同步更改 */
+ const { slaveInfoData, slaveData } = this.props;
+ const iIndex = slaveData.findIndex(item => item.sId === sId);
+ if (iIndex > -1) {
+ const tableDataRow = slaveData[iIndex];
+ let childrenData = [];
+ childrenData = tableDataRow.childrenData;
+ if (commonUtils.isNotEmptyArr(childrenData)) {
+ childrenData.forEach((child) => {
+ const index = slaveInfoData.findIndex(item => item.sId === child.sId);
+ const addState = {};
+ addState.handleType = 'update';
+ addState.iOrder = tableDataRow.iOrder;
+ if (index > -1) {
+ slaveInfoData[index] = { ...slaveInfoData[index], ...addState }
+ }
+ });
+ this.props.onSaveState({ slaveData, slaveInfoData });
+ }
+ }
+ }
+ }
+ };
+ // 打印
+ handleBtnPrint = (sActiveId, checked) => {
+ const {
+ app, sModelsId, slaveConfig, slaveSelectedRowKeys, slaveFilterCondition, reportData,
+ } = this.props;
+ const { token } = app;
+ let slaveFilterConditionNew = slaveFilterCondition === undefined ? [] : [...slaveFilterCondition];
+
+ let sids = '';
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ if (sids !== '') {
+ slaveFilterConditionNew = [];
+ const sidsNew = commonUtils.isNotEmptyObject(sids) ? sids.replace(/-/g, ',') : '';
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sidsNew;
+ slaveFilterConditionNew.push(addFilter);
+ }
+
+ const queryFilter = {};
+ queryFilter[slaveConfig.sId] = { bFilter: slaveFilterConditionNew };
+
+ const queryFilterJson = encodeURIComponent(JSON.stringify(queryFilter));
+ /* 拿到打印报表名称 */
+ let printReportName = 'report';
+ if (commonUtils.isNotEmptyArr(reportData)) {
+ const iIndex = reportData.findIndex(item => item.sId === sActiveId);
+ if (iIndex > -1) {
+ printReportName = reportData[iIndex].sReportName;
+ }
+ }
+ const urlPrint = `${commonConfig.file_host}printReport/printPdf/${sActiveId}/${printReportName}.pdf?${checked ? 'fileType=.xlsx&' : ''}queryFilter=${queryFilterJson}&sModelsId=${sModelsId}&sMaintableId=${slaveConfig.sId}&token=${encodeURIComponent(token)}`;
+ window.open(urlPrint);
+ };
+ /* 导出Excel */
+ handleOut = () => {
+ const {
+ slaveConfig, sFilterOrderBy, slaveSelectedRowKeys, slaveFilterCondition, sGroupByList,
+ } = this.props;
+
+ const newfilterCondition = slaveFilterCondition === undefined ? [] : slaveFilterCondition;
+
+ let sids = '';
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sids;
+ newfilterCondition.push(addFilter);
+ }
+
+ let url = `${commonConfig.server_host}excel/export/${slaveConfig.sId}?sModelsId=${slaveConfig.sParentId}&token=${this.props.app.token}`;
+ if (commonUtils.isNotEmptyArr(newfilterCondition)) {
+ url = `${url}&bFilter=${encodeURIComponent(JSON.stringify(newfilterCondition))}`;
+ }
+ if (sFilterOrderBy !== undefined && sFilterOrderBy !== '' && Object.keys(sFilterOrderBy).length > 0) {
+ url = `${url}&sFilterOrderBy=${encodeURIComponent(JSON.stringify(sFilterOrderBy))}`;
+ }
+ if (commonUtils.isNotEmptyArr(sGroupByList)) {
+ url = `${url}&sGroupList=${encodeURIComponent(JSON.stringify(sGroupByList))}`;
+ }
+ window.open(url);
+ };
+ handleConfirmDataChange = (value) => {
+ const {
+ masterData,
+ } = this.props;
+ masterData.dOutsideQty = value;
+
+ this.props.onSaveState({ masterData });
+ };
+ // 按钮操作
+ handleButtonClick = (name) => {
+ if (name === 'BtnRefresh') {
+ this.handleRefresh();
+ } else if (name === 'BtnOut') {
+ this.handleOut();
+ } else if (name === 'BtnDesignFunction') {
+ this.handleDesignFunction();
+ }
+ };
+ handleDesignFunction = () => {
+ this.props.onSaveState({ visibleStatement: true });
+ };
+ handleUpdated = async (params) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+
+ const url = `${commonConfig.server_host}productionPlan/getProcessOperation?sModelsId=${sModelsId}`;
+ const { data } = await commonServices.postValueService(token, params, url);
+
+ if (data.code === 1) {
+ /* 数据查询成功 */
+ return true;
+ } else { /* 失败 */
+ this.props.getServiceError(data);
+ return false;
+ }
+ };
+
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
+ const { sModelsId } = this.props;
+ if (sFieldName === 'sMachineId') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ }
+ if (isWait) {
+ return this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ } else {
+ this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ }
+ };
+
+ handleCalculate = () => {
+ const { sModelsId, slaveData } = this.props;
+ const materialsInfo = [];
+ const slaveDataNew = [];
+ slaveData.forEach(async (item) => {
+ const index = materialsInfo.findIndex(obj => obj.sMaterialsId === item.sMaterialsId);
+ item.bMaterialAdequate = 0;
+ if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ const url = `${commonConfig.server_host}eleMaterialsStock/getEleMaterialsStoreCurrQty?sModelsId=${sModelsId}`;
+ const body = {
+ sMaterialsId: item.sMaterialsId, /* 查询条件 */
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, body, url)).data;
+ if (dataReturn.code === 1) {
+ if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows[0])) {
+ const materials = dataReturn.dataset.rows[0];
+ if (commonUtils.isNotEmptyNumber(materials.dAuxiliaryQty) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materials.dAuxiliaryQty > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ }
+ } else if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ if (commonUtils.isNotEmptyNumber(materialsInfo[index].sMaterialsId) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materialsInfo[index].sMaterialsId > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ slaveDataNew.push(item);
+ });
+ this.props.onSaveState({ slaveData: slaveDataNew });
+ };
+
+ handleTitleChange = async (name, slavePagination, filters, sorter, extra) => {
+ // const tableBtnEnabled = commonUtils.isNotEmptyObject(filters) && commonUtils.isEmptyObject(sorter);
+ const addState = {}; // 搜索时不能使用排序保存,否则数据会出不来。
+ if (commonUtils.isNotEmptyObject(sorter)) {
+ const slaveData = [];
+ extra.currentDataSource.forEach((item, iIndex) => {
+ const slaveTableRow = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ slaveData.push(slaveTableRow);
+ });
+ if (slaveData.length === this.props.slaveData.length) {
+ addState.slaveData = slaveData;
+ }
+ }
+ this.props.onSaveState({
+ ...addState, slavePagination, pageLoading: false,
+ });
+ // this.props.onSaveState({
+ // tableBtnEnabled: false, pageLoading: true,
+ // });
+ // const { [`${name}Config`]: tableConfig, [`${name}FilterCondition`]: tableFilterCondition, sGroupByList } = this.props;
+ // const sort = sorter.order === 'ascend' ? 'asc' : 'desc';
+ // const slaveOrderBy = Object.keys(sorter).length > 0 ? { [sorter.columnKey]: sort } : ''; // 后端未支持空对象, 先用空表示
+ // const addState = await this.handleGetData(name, tableConfig, tableFilterCondition, undefined, slaveOrderBy, '', sGroupByList, this.props, true);
+ // if (addState === undefined) return;
+ // const { [`${name}Data`]: tempData } = addState;
+ // if (commonUtils.isNotEmptyArr(addState[`${name}Data`])) {
+ // addState[`${name}Data`].forEach((item, iIndex) => {
+ // addState[`${name}Data`][iIndex] = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ // });
+ // }
+ // this.props.onSaveState({ ...addState });
+ // setTimeout(() => {
+ // /* 刷新commList页面数据 */
+ // this.props.onSaveState({ pageLoading: false });
+ // }, 3600);
+ };
+ /** 处理选择行发生改变 */
+ handleCallBack = (child) => {
+ const {
+ slaveConfig, slaveInfoConfig, teamFilterCondition, bGantt,
+ } = this.props;
+ const filter = [];
+ let addFilter = {};
+ if (child.sType === '1') {
+ addFilter.bFilterName = 'sProcessId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sMachineId;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'sState';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = '0';
+ filter.push(addFilter);
+ } else if (child.sType === '2') {
+ addFilter.bFilterName = 'sMachineId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sMachineId;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'date_format(tStartDate, \'%y-%m-%d\')';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.tStartDate;
+ filter.push(addFilter);
+ }
+ if (commonUtils.isNotEmptyArr(teamFilterCondition)) {
+ filter.push(...teamFilterCondition);
+ }
+ this.handleGetData('slave', slaveConfig, filter, undefined, '', false, undefined);
+ /* 甘特图视图下 点击卡片刷新 */
+ if (bGantt) {
+ this.handleGanttChar('', filter)
+ }
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, '', false, undefined);
+ const rowKeys = [];
+ rowKeys.push(child.sId);
+ this.props.onSaveState({
+ teamSelectedRowKeys: rowKeys,
+ });
+ };
+
+ /* 获取甘特图数据 */
+ handleGanttChar = async (ganttChart, slaveFilterCondition) => {
+ const {
+ token, sModelsId, formRoute,
+ } = this.props;
+ const char = {};
+ if (commonUtils.isNotEmptyObject(ganttChart)) {
+ char.sProcedureName = ganttChart.sProcedureName;
+ char.paramsMap = ganttChart.paramsMap;
+ } else {
+ char.sProcedureName = 'Sp_Process_CommonGtChar';
+ char.paramsMap = {
+ };
+ }
+ let charGanttData = {};
+ const value = {
+ sProName: char.sProcedureName,
+ paramsMap: char.prodParamsMap,
+ bFilter: slaveFilterCondition,
+ };
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ const { data: returnData } = await commonServices.postValueService(token, value, url);
+ if (returnData.code === 1) {
+ const { dataset } = returnData;
+ if (commonUtils.isNotEmptyObject(dataset)) {
+ const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ } else {
+ charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ } else {
+ message.error(returnData.msg);
+ }
+ };
+
+ /* 获取稽查模型数据 */
+ handleCheckModel = async (chart, slaveFilterCondition, other) => {
+ const { app, sModelsId } = this.props;
+ const obj = {};
+ if (commonUtils.isNotEmptyObject(obj)) {
+ obj.sProcedureName = chart.sProcedureName;
+ obj.paramsMap = chart.paramsMap;
+ } else {
+ obj.sProcedureName = 'Sp_Manufacture_GetAPSstate';
+ obj.paramsMap = {
+ };
+ }
+ const value = {
+ sProName: obj.sProcedureName,
+ bFilter: slaveFilterCondition,
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ bCheckModel: true })
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleCheckModel(chart, slaveFilterCondition, { iFlag: 1 }) });
+ }
+ };
+
+ /* 重算时间调用接口 执行存储过程 */
+ handleChangeTimer = async (other) => {
+ const {
+ app, sModelsId, slaveFilterCondition, slaveSelectedRowKeys, slaveData, masterData,
+ } = this.props;
+ let value = {};
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ this.props.onSaveState({ bChangeTimerEnable: false })
+ const slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId));
+ const minSelectedData = this.arrayMin(slaveSelectedData); /* iOrder最小的 */
+ if (commonUtils.isNotEmptyArr(minSelectedData) && commonUtils.isNotEmptyObject(minSelectedData.sMachineId)) {
+ value = {
+ sProName: 'Sp_Manufacture_SetTime',
+ sProInParam: JSON.stringify({
+ sMachineId: minSelectedData.sMachineId,
+ iOrder: minSelectedData.iOrder,
+ tCStartTime: masterData.tStartDate,
+ }),
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ changeTimerVisible: false, bChangeTimerEnable: true })
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleChangeTimer({ iFlag: 1 }) });
+ }
+ } else {
+ message.error('不能重置时间!');
+ }
+ } else {
+ message.error('请选择一行数据!');
+ }
+ };
+
+ // 查找数组中最小值
+ arrayMin = (arrs) => {
+ let min = arrs[0];
+ for (let i = 1, ilen = arrs.length; i < ilen; i += 1) {
+ if (arrs[i].iOrder < min.iOrder) {
+ min = arrs[i];
+ }
+ }
+ return min;
+ }
+
+ /*
+ handleRefresh = async () => {
+ const {
+ clearArray, slaveConfig, slaveInfoConfig, teamFilterCondition, slaveFilterCondition,
+ } = this.props;
+ this.props.onSaveState({
+ clearArray: [], searchText: '', teamSelectedData: [], slaveSelectedRowKeys: [], slaveSelectedData: [], slaveInfoSelectedRowKeys: [], slaveInfoSelectedData: [], tableBtnEnabled: true,
+ }); // teamSelectedRowKeys: [],
+ this.handleGetData('slave', slaveConfig, slaveFilterCondition, undefined, '', false, undefined);
+ this.handleGetData('slaveInfo', slaveInfoConfig, slaveFilterCondition, undefined, '', false, undefined);
+
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ this.props.onSaveState({
+ loading: false,
+ });
+ }
+*/
+ handleRefresh = async () => {
+ const {
+ clearArray, teamConfig, teamFilterCondition, slaveFilterCondition, teamSelectedRowKeys,
+ } = this.props;
+ let { expKeys } = this.props;
+ const addState = await this.handleGetData('team', teamConfig, teamFilterCondition, undefined, '', false, undefined, this.props, true);
+ if (addState === undefined) return;
+ this.props.onSaveState({
+ ...addState,
+ clearArray: [],
+ searchText: '',
+ teamSelectedData: [],
+ slaveSelectedRowKeys: [],
+ slaveSelectedData: [],
+ slaveInfoData: [], /* 刷新后清除slaveInfoData */
+ slaveInfoSelectedRowKeys: [],
+ slaveInfoSelectedData: [],
+ tableBtnEnabled: true,
+ machineEnabled: false,
+ sortedInfo: {},
+ });
+ const { teamData } = addState;
+ const newIndex = teamData.findIndex(item => item.sId === teamSelectedRowKeys[0]);
+ if (newIndex === -1) {
+ this.handleCallBack({ ...teamData[0] });
+ } else {
+ this.handleCallBack({ ...teamData[newIndex] });
+ }
+
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ /* 刷新后关闭所有expKeys */
+ expKeys = [];
+ /* 刷新后清除slaveInfoData */
+ this.props.onSaveState({
+ loading: false, expKeys,
+ });
+ }
+
+ handleResetTableSearch = () => {
+ this.props.onSaveState({ clearArray: [] });
+ this.handleRefresh();
+ }
+ // 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
+ handleBtnEent = (btnConfig, btnName, sValue) => {
+ const { masterData } = this.props;
+ const sButtonParam = btnConfig.sButtonParam;
+ const btn = JSON.parse(sButtonParam);
+ const sProName = btn.sproName;
+ const inParams = [];
+ const inMap = btn.inMap;
+ const inlist = inMap.split(',');
+
+ const masterArr = [];
+ const slaveArr = [];
+ const slaveInfoArr = [];
+ const controlArr = [];
+ const materialsArr = [];
+ const processArr = [];
+
+ if (inlist.length > 0) {
+ inlist.forEach((item) => {
+ const itemArr = item.split('.');
+ if (itemArr.length > 0) {
+ const sname = itemArr[0];
+ const stype = itemArr[1];
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'master') {
+ masterArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slave') {
+ slaveArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slaveInfo') {
+ slaveInfoArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'control') {
+ controlArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'materials') {
+ materialsArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'process') {
+ processArr.push(stype);
+ }
+ }
+ });
+
+ if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
+ const addState = {};
+ addState.key = 'master';
+ const val = [];
+ const currVal = {};
+ masterArr.forEach((filed) => {
+ currVal[`${filed}`] = masterData[`${filed}`];
+ });
+ val.push(currVal);
+ addState.value = val;
+ inParams.push({ ...addState });
+ }
+ if (commonUtils.isNotEmptyArr(slaveArr)) {
+ const addState = this.handleProParams('slave', slaveArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
+ const addState = this.handleProParams('slaveInfo', slaveInfoArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(controlArr)) {
+ const addState = this.handleProParams('control', controlArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(materialsArr)) {
+ const addState = this.handleProParams('materials', materialsArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(processArr)) {
+ const addState = this.handleProParams('process', processArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ }
+
+ this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParams, changeValue: sValue }));
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+ // 存储过程按钮调用存储过程
+ handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
+ const { app, sModelsId, sCurrMemoProps } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ /**
+ * 修改日期:2021-03-26
+ * 修改人:吕杰
+ * 区域:以下 2 行
+ * BUG:
+ * 说明:执行完接口调用后关闭弹窗
+ * 原代码:
+ */
+ sCurrMemoProps.bVisibleMemo = false;
+ this.props.onSaveState({ loading: false, sCurrMemoProps });
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
+ }
+ }
+ /* 点击展开图标时,调用接口获取嵌套字表数据 */
+ handleOnExpand = async (expanded, record) => {
+ const { sModelsId, expKeys } = this.props;
+ let { slaveInfoData } = this.props;
+ const { sSlaveId } = record;
+ /* 添加移除展开的sId */
+ let newExp = commonUtils.isNotEmptyArr(expKeys) ? expKeys : [];
+ if (expanded) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ newExp.push(record.sSlaveId);
+ }
+ } else {
+ newExp = newExp.filter(item => item !== record.sSlaveId);
+ }
+ this.props.onSaveState({ expKeys: newExp });
+ let childrenData = [];
+ if (commonUtils.isNotEmptyArr(slaveInfoData) && commonUtils.isNotEmptyObject(sSlaveId)) {
+ childrenData = slaveInfoData.filter(item => sSlaveId.split('-').includes(item.sId));
+ }
+ if (expanded && commonUtils.isEmptyArr(childrenData)) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ const planLoadingSate = {};
+ planLoadingSate.sId = sSlaveId;
+ planLoadingSate.planLoading = true;
+ this.props.onSaveState({ planLoadingSate });
+ const { token } = this.props;
+ const url = `${commonConfig.server_host}workOrderPlan/getProductionPlanInfo?sModelsId=${sModelsId}`;
+ const value = { sSlaveId };
+ const dataReturn = (await commonServices.postValueService(token, value, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ childrenData = returnData;
+ if (commonUtils.isEmptyArr(slaveInfoData)) {
+ slaveInfoData = [];
+ }
+ childrenData.forEach((child) => {
+ // const iIndex = slaveInfoData.findIndex(item => item.sId === child.sId);
+ // if (iIndex === -1) {
+ // slaveInfoData.push(child);
+ // }
+ slaveInfoData.push(child);
+ });
+ }
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({
+ planLoadingSate, slaveInfoData,
+ });
+ } else {
+ this.props.getServiceError(dataReturn);
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({ planLoadingSate });
+ }
+ }
+ }
+ }
+ handlePartNameClick =(sName, showConfig, record) => {
+ if (commonUtils.isNotEmptyObject(sName) && commonUtils.isNotEmptyObject(showConfig) && commonUtils.isNotEmptyObject(record)) {
+ this.props.onSaveState({ workScheduleConfig: showConfig, workScheduleRecord: record, workScheduleVisible: true });
+ }
+ }
+ handleCloseModel = (modelVisible) => {
+ this.props.onSaveState({ [modelVisible]: false });
+ };
+ render() {
+ const { masterData } = this.props;
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonProductionPlanOutsideEvent.js b/src/components/Common/CommonProductionPlanOutsideEvent.js
new file mode 100644
index 0000000..7097957
--- /dev/null
+++ b/src/components/Common/CommonProductionPlanOutsideEvent.js
@@ -0,0 +1,937 @@
+/* eslint-disable prefer-destructuring,no-await-in-loop,semi,no-unused-vars */
+/**
+ * Created by mar105 on 2019-01-08.
+ */
+import React, { Component } from 'react';
+import { message } from 'antd'; // Form, Modal, InputNumber
+// import reactComponentDebounce from 'react-component-debounce';
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */
+import * as commonServices from '../../services/services'; /* 服务类 */
+import commonConfig from '../../utils/config';
+import * as commonFunc from './commonFunc'; /* 通用单据方法 */
+
+/*
+const { confirm } = Modal;
+const FormItem = Form.Item;
+const InputNumberA = reactComponentDebounce(800)(InputNumber);
+*/
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.form = {}; /* 表单对象 */
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ app, formData, currentId, masterData, searchSolution, sGroupByList, teamSelectedRowKeys, teamData,
+ } = nextProps;
+ const { teamFilterCondition } = this.props;
+ let {
+ isReceive, teamConfig, slaveConfig, slaveInfoConfig,
+ } = nextProps;
+ const { currentPane } = app;
+ const { otherCondition } = currentPane;
+ if (formData.length > 0 && commonUtils.isEmptyObject(teamConfig) && commonUtils.isEmptyArr(searchSolution)) {
+ isReceive = false;
+ const sId = currentId !== undefined ? currentId : '';
+ const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'eleteam')[0];
+
+ teamConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo_WorkCenter2')[0];
+ slaveConfig = formData.filter(item => item.sTbName === 'Viw_OpsOutsideProcess')[0];
+ slaveInfoConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo' && item.sGrd === 'slaveInfo')[0];
+ const productionPlanConfig = formData.filter(item => item.sTbName === 'opsoutsideprocessslave')[0];
+
+ const teamColumn = commonFunc.getHeaderConfig(teamConfig);
+ const slaveColumn = commonFunc.getHeaderConfig(slaveConfig);
+ let slaveInfoColumn = [];
+ if (commonUtils.isNotEmptyObject(slaveInfoConfig)) {
+ slaveInfoColumn = commonFunc.getHeaderConfig(slaveInfoConfig)
+ }
+ const productionPlanColumn = commonFunc.getHeaderConfig(productionPlanConfig);
+
+ let currfilterCondition = [];
+ if (commonUtils.isNotEmptyObject(masterData) && !commonUtils.isEmpty(masterData.sSearchSolutionId) && commonUtils.isNotEmptyArr(searchSolution)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1 && !commonUtils.isEmpty(searchSolution[iIndex].sCondition)) {
+ currfilterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ }
+ }
+ this.handleGetData('team', teamConfig, currfilterCondition, undefined, '', false, sGroupByList);
+ // this.handleGetData('slave', slaveConfig, [], undefined, '', false, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, [], undefined, '', false, undefined);
+
+ this.props.onSaveState({
+ masterConfig,
+ teamConfig,
+ teamColumn,
+ slaveConfig,
+ slaveColumn,
+ slaveInfoConfig,
+ slaveInfoColumn,
+ productionPlanConfig,
+ productionPlanColumn,
+ sId,
+ pageLoading: false,
+ enabled: true,
+ dragPermission: false,
+ dragAndDropSwitch: false,
+ isReceive,
+ masterData: {},
+ tableBtnEnabled: true,
+ // stateOption: objValue,
+ });
+ } else if (commonUtils.isEmptyStr(teamSelectedRowKeys) && commonUtils.isEmptyArr(teamFilterCondition) && commonUtils.isNotEmptyArr(teamData) && !isReceive) {
+ const iIndex = otherCondition.findIndex(item => item.bFilterName === 'sMachineId');
+ if (iIndex !== -1) {
+ const newIndex = teamData.findIndex(item => item.sMachineId === otherCondition[iIndex].bFilterValue);
+ if (newIndex === -1) {
+ this.handleCallBack({ ...teamData[0] });
+ } else {
+ this.handleCallBack({ ...teamData[newIndex] });
+ }
+ } else {
+ this.handleCallBack({ ...teamData[0] });
+ }
+ this.props.onSaveState({ isReceive: true });
+ } else if (commonUtils.isEmptyStr(teamSelectedRowKeys) && commonUtils.isEmptyArr(currentPane.filterCondition) && commonUtils.isEmptyArr(teamFilterCondition) && commonUtils.isNotEmptyArr(teamData) && !isReceive) {
+ this.handleGetData('slave', slaveConfig, [], undefined, '', false, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, [], undefined, '', false, undefined);
+ this.props.onSaveState({ isReceive: true, teamSelectedRowKeys: teamData[0].sId });
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const {
+ slaveColumn,
+ } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn);
+ }
+
+ componentDidUpdate(prevProps) {
+ const {
+ slaveSelectedRowKeys, moveEnabled, tableBtnEnabled,
+ } = prevProps;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && !moveEnabled && tableBtnEnabled) {
+ this.props.onSaveState({ moveEnabled: true });
+ } else if ((commonUtils.isEmptyArr(slaveSelectedRowKeys) && moveEnabled && tableBtnEnabled) || (moveEnabled && !tableBtnEnabled)) {
+ this.props.onSaveState({ moveEnabled: false });
+ }
+ }
+
+ onChangeMachine = async () => {
+ const { sModelsId, masterData, slaveInfoSelectedRowKeys } = this.props;
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_Manufacture_ProductionPlanInfo_ChangeMachine',
+ paramsMap: {
+ bSplit: masterData.bSplit,
+ iSplitNum: masterData.iSplitNum,
+ sMachineId: masterData.sMachineId,
+ sTeamId: masterData.sTeamId,
+ tStartDate: masterData.tStartDate,
+ sProInParam: JSON.stringify({ params: { key: 'slaveInfo', value: { sId: slaveInfoSelectedRowKeys } } }),
+ },
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, value, url)).data;
+ if (dataReturn.code === 1) {
+ /* 数据查询成功 */
+ this.handleRefresh();
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ }
+
+ /** 获取表数据 */
+ handleGetData = async (sName, slaveConfig, slaveFilterCondition, page, slaveOrderBy, clearSelectData, sGroupByListNew, nextProps, isWait) => {
+ const { app } = commonUtils.isEmpty(nextProps) ? this.props : nextProps;
+ const sGroupByList = sGroupByListNew !== undefined ? commonUtils.isEmptyArr(sGroupByListNew) ? null : sGroupByListNew : this.props.sGroupByList;
+ const conditonValues = app.currentPane.conditonValues;
+ const filterCondition = app.currentPane.filterCondition;
+ let bFilter = [];
+ if (!commonUtils.isEmptyArr(slaveFilterCondition)) {
+ slaveFilterCondition[0].bFilterName = slaveFilterCondition[0].bFilterName.replace('_pro', '');
+ bFilter.push(...slaveFilterCondition);
+ }
+ if (!commonUtils.isEmptyArr(filterCondition)) {
+ bFilter.push(...filterCondition);
+ }
+ const addState = {};
+ const pageNum = commonUtils.isEmpty(page) ? 1 : page;
+ addState.pageNum = pageNum;
+ addState.pageSize = ''; // commonConfig.pageSize;
+ if (sName === 'team' && commonUtils.isNotEmptyArr(filterCondition)) {
+ bFilter = [];
+ const addFilter = {};
+ addFilter.bFilterName = `${filterCondition[0].bFilterName}_pro`;
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = filterCondition[0].bFilterValue;
+ bFilter.push(addFilter);
+ }
+ const returnData = await this.props.handleGetDataSet({
+ name: sName,
+ configData: slaveConfig,
+ condition: {
+ ...addState, bFilter, sFilterOrderBy: slaveOrderBy, sSqlCondition: conditonValues, sGroupList: sGroupByList,
+ },
+ flag: true,
+ clearSelectData,
+ isWait,
+ });
+ this.props.onSaveState({ Loading: false });
+ if (isWait) {
+ return { ...returnData };
+ }
+ };
+
+ // 搜索 查询
+ handleGetSearchData = (config, filterCondition) => {
+ const {
+ teamConfig, sGroupByList, teamSelectedRowKeys,
+ } = this.props;
+ const iIndex = filterCondition.findIndex(item => item.bFilterName === 'sTeamId' && item.bFilterCondition === '=' && item.bFilterValue === teamSelectedRowKeys[0]);
+ const filter = [];
+ filterCondition.forEach((itme, i) => {
+ if (iIndex !== i) { filter.push(itme); }
+ });
+ this.handleGetData('team', teamConfig, filter, undefined, '', false, sGroupByList);
+ };
+
+ handleGetSlaveData = (config, filterCondition) => {
+ const {
+ slaveConfig, slaveInfoConfig, teamData, teamSelectedRowKeys,
+ } = this.props;
+ const iIndex = filterCondition.findIndex(item => item.bFilterName === 'sTeamId' && item.bFilterCondition === '=' && item.bFilterValue === teamSelectedRowKeys[0]);
+ const filter = [];
+ filterCondition.forEach((itme, i) => {
+ if (iIndex !== i) { filter.push(itme); }
+ });
+
+ const addFilter = {};
+ addFilter.bFilterName = 'sTeamId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = teamData[0].sId;
+ filter.push(addFilter);
+
+ this.handleGetData('slave', slaveConfig, filter, undefined, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, undefined);
+ };
+
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+
+ /** toolbar保存 */
+ handleSaveData = async (params) => {
+ const {
+ token, sModelsId,
+ } = this.props;
+ const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
+ if (commonUtils.isNotEmptyObject(returnData)) {
+ this.handleRefresh();
+ if (this.props.app.currentPane.refresh !== undefined) {
+ this.props.app.currentPane.refresh();
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /** 保存校验 */
+ handleValidateSave = () => {
+ this.form.validateFields((err) => {
+ /* 验证通过与不通过走不同的流程 */
+ if (err) { /* 验证失败 */
+ /* 直接渲染显示错误提示 */
+ for (const key of Object.keys(err)) {
+ message.error(err[key].errors[0].message);
+ }
+ } else { /* 验证成功 */
+ const {
+ slaveConfig, slaveData, slaveDelData, app, productionPlanConfig, productionPlanDelData, tableBtnEnabled, charGanttData, bGantt,
+ } = this.props;
+ const data = [];
+ if (commonUtils.isEmptyArr(slaveData)) {
+ message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空!
+ return;
+ } else {
+ /* 如果是甘特图视图,则进入甘特图视图保存逻辑 */
+ if (bGantt && commonUtils.isNotEmptyObject(charGanttData)) {
+ const data = [];
+ const addState = {}
+ addState.name = 'slave';
+ addState.sTable = 'MftProductionPlanSlave';
+ addState.column = charGanttData.data;
+ data.push(addState);
+ this.handleSaveData({ data, sClientType: '1' });
+ return;
+ }
+ const productionPlanData = [];
+ for (const item of slaveData) {
+ const {
+ sSlaveId, handleType, iOrder, tStartDate, sMemo, dAdjustHour,
+ } = item;
+ const sIds = sSlaveId.split('-');
+ sIds.forEach((newItem) => {
+ const addState = {};
+ addState.sId = newItem;
+ if (commonUtils.isEmpty(iOrder)) {
+ message.error('序号必填!');
+ return;
+ }
+ if (commonUtils.isEmpty(tStartDate)) {
+ message.error('时间必填!');
+ return;
+ }
+ addState.iOrder = iOrder;
+ /* 20210406 zhuzong要求排程保存时候 必传iOrder,tStartDate,sMemo,dAdjustHour 四个参数 */
+ addState.tStartDate = tStartDate;
+ if (commonUtils.isNotEmptyObject(sMemo)) {
+ addState.sMemo = sMemo;
+ }
+ if (dAdjustHour !== undefined) {
+ addState.dAdjustHour = dAdjustHour;
+ }
+ addState.handleType = handleType;
+ productionPlanData.push(addState);
+ });
+ }
+ data.push(commonBusiness.mergeData('productionPlan', productionPlanConfig.sTbName, productionPlanData, productionPlanDelData));
+ }
+ if (!commonBusiness.validateTable(slaveConfig, slaveData)) {
+ return;
+ }
+ // data.push(commonBusiness.mergeData('slave', 'MftProductionPlanSlave', slaveData, slaveDelData));
+ this.handleSaveData({ data, sClientType: '1' });
+ }
+ });
+ };
+
+ /* 数据删除成功跳转到新路由即pane */
+ handleDelDataSuccess = (props) => {
+ const { app } = props;
+ let { panes, currentPane } = app;
+ /* 删除单据后退出当前路由后,标签panes变化后的集合 */
+ panes = panes.filter(pane => pane.key !== currentPane.key);
+ /* 跳转到panes集合的最后一个路由,因为panes集合一定含有主页路由所以panes的集合大于等于1 */
+ currentPane = panes[panes.length - 1];
+ this.props.onRemovePane(panes, currentPane);
+ };
+
+ /** 表格数据更改 */
+ // name 不写完整的state名称作用为了要用到total // (name, changeValue, sId, dropDownData)
+ handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ const { sModelsId } = this.props;
+ this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, false);
+ if (name === 'slave') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ if (sFieldName === 'iOrder') {
+ /* 修改汇总表数据后,slaveInfo表iOrder同步更改 */
+ const { slaveInfoData, slaveData } = this.props;
+ const iIndex = slaveData.findIndex(item => item.sId === sId);
+ if (iIndex > -1) {
+ const tableDataRow = slaveData[iIndex];
+ let childrenData = [];
+ childrenData = tableDataRow.childrenData;
+ if (commonUtils.isNotEmptyArr(childrenData)) {
+ childrenData.forEach((child) => {
+ const index = slaveInfoData.findIndex(item => item.sId === child.sId);
+ const addState = {};
+ addState.handleType = 'update';
+ addState.iOrder = tableDataRow.iOrder;
+ if (index > -1) {
+ slaveInfoData[index] = { ...slaveInfoData[index], ...addState }
+ }
+ });
+ this.props.onSaveState({ slaveData, slaveInfoData });
+ }
+ }
+ }
+ }
+ };
+ // 打印
+ handleBtnPrint = (sActiveId, checked) => {
+ const {
+ app, sModelsId, slaveConfig, slaveSelectedRowKeys, slaveFilterCondition, reportData,
+ } = this.props;
+ const { token } = app;
+ let slaveFilterConditionNew = slaveFilterCondition === undefined ? [] : [...slaveFilterCondition];
+
+ let sids = '';
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ if (sids !== '') {
+ slaveFilterConditionNew = [];
+ const sidsNew = commonUtils.isNotEmptyObject(sids) ? sids.replace(/-/g, ',') : '';
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sidsNew;
+ slaveFilterConditionNew.push(addFilter);
+ }
+
+ const queryFilter = {};
+ queryFilter[slaveConfig.sId] = { bFilter: slaveFilterConditionNew };
+
+ const queryFilterJson = encodeURIComponent(JSON.stringify(queryFilter));
+ /* 拿到打印报表名称 */
+ let printReportName = 'report';
+ if (commonUtils.isNotEmptyArr(reportData)) {
+ const iIndex = reportData.findIndex(item => item.sId === sActiveId);
+ if (iIndex > -1) {
+ printReportName = reportData[iIndex].sReportName;
+ }
+ }
+ const urlPrint = `${commonConfig.file_host}printReport/printPdf/${sActiveId}/${printReportName}.pdf?${checked ? 'fileType=.xlsx&' : ''}queryFilter=${queryFilterJson}&sModelsId=${sModelsId}&sMaintableId=${slaveConfig.sId}&token=${encodeURIComponent(token)}`;
+ window.open(urlPrint);
+ };
+ /* 导出Excel */
+ handleOut = () => {
+ const {
+ slaveConfig, sFilterOrderBy, slaveSelectedRowKeys, slaveFilterCondition, sGroupByList,
+ } = this.props;
+
+ const newfilterCondition = slaveFilterCondition === undefined ? [] : slaveFilterCondition;
+
+ let sids = '';
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ // const addFilter = {};
+ // addFilter.bFilterName = 'sId';
+ // addFilter.bFilterCondition = 'in';
+ // addFilter.bFilterValue = sids;
+ // newfilterCondition.push(addFilter);
+
+ let url = `${commonConfig.server_host}excel/export/${slaveConfig.sId}?sModelsId=${slaveConfig.sParentId}&token=${this.props.app.token}`;
+ if (commonUtils.isNotEmptyArr(newfilterCondition)) {
+ url = `${url}&bFilter=${encodeURIComponent(JSON.stringify(newfilterCondition))}`;
+ }
+ if (sFilterOrderBy !== undefined && sFilterOrderBy !== '' && Object.keys(sFilterOrderBy).length > 0) {
+ url = `${url}&sFilterOrderBy=${encodeURIComponent(JSON.stringify(sFilterOrderBy))}`;
+ }
+ if (commonUtils.isNotEmptyArr(sGroupByList)) {
+ url = `${url}&sGroupList=${encodeURIComponent(JSON.stringify(sGroupByList))}`;
+ }
+ window.open(url);
+ };
+ handleConfirmDataChange = (value) => {
+ const {
+ masterData,
+ } = this.props;
+ masterData.dOutsideQty = value;
+
+ this.props.onSaveState({ masterData });
+ };
+ // 按钮操作
+ handleButtonClick = (name) => {
+ if (name === 'BtnRefresh') {
+ this.handleRefresh();
+ } else if (name === 'BtnOut') {
+ this.handleOut();
+ } else if (name === 'BtnDesignFunction') {
+ this.handleDesignFunction();
+ }
+ };
+ handleDesignFunction = () => {
+ this.props.onSaveState({ visibleStatement: true });
+ };
+ handleUpdated = async (params) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+
+ const url = `${commonConfig.server_host}productionPlan/getProcessOperation?sModelsId=${sModelsId}`;
+ const { data } = await commonServices.postValueService(token, params, url);
+
+ if (data.code === 1) {
+ /* 数据查询成功 */
+ return true;
+ } else { /* 失败 */
+ this.props.getServiceError(data);
+ return false;
+ }
+ };
+
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
+ const { sModelsId } = this.props;
+ if (sFieldName === 'sMachineId') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ }
+ if (isWait) {
+ return this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ } else {
+ this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ }
+ };
+
+ handleCalculate = () => {
+ const { sModelsId, slaveData } = this.props;
+ const materialsInfo = [];
+ const slaveDataNew = [];
+ slaveData.forEach(async (item) => {
+ const index = materialsInfo.findIndex(obj => obj.sMaterialsId === item.sMaterialsId);
+ item.bMaterialAdequate = 0;
+ if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ const url = `${commonConfig.server_host}eleMaterialsStock/getEleMaterialsStoreCurrQty?sModelsId=${sModelsId}`;
+ const body = {
+ sMaterialsId: item.sMaterialsId, /* 查询条件 */
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, body, url)).data;
+ if (dataReturn.code === 1) {
+ if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows[0])) {
+ const materials = dataReturn.dataset.rows[0];
+ if (commonUtils.isNotEmptyNumber(materials.dAuxiliaryQty) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materials.dAuxiliaryQty > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ }
+ } else if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ if (commonUtils.isNotEmptyNumber(materialsInfo[index].sMaterialsId) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materialsInfo[index].sMaterialsId > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ slaveDataNew.push(item);
+ });
+ this.props.onSaveState({ slaveData: slaveDataNew });
+ };
+
+ handleTitleChange = async (name, slavePagination, filters, sorter, extra) => {
+ // const tableBtnEnabled = commonUtils.isNotEmptyObject(filters) && commonUtils.isEmptyObject(sorter);
+ const addState = {}; // 搜索时不能使用排序保存,否则数据会出不来。
+ if (commonUtils.isNotEmptyObject(sorter)) {
+ const slaveData = [];
+ extra.currentDataSource.forEach((item, iIndex) => {
+ const slaveTableRow = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ slaveData.push(slaveTableRow);
+ });
+ if (slaveData.length === this.props.slaveData.length) {
+ addState.slaveData = slaveData;
+ }
+ }
+ this.props.onSaveState({
+ ...addState, slavePagination, pageLoading: false,
+ });
+ // this.props.onSaveState({
+ // tableBtnEnabled: false, pageLoading: true,
+ // });
+ // const { [`${name}Config`]: tableConfig, [`${name}FilterCondition`]: tableFilterCondition, sGroupByList } = this.props;
+ // const sort = sorter.order === 'ascend' ? 'asc' : 'desc';
+ // const slaveOrderBy = Object.keys(sorter).length > 0 ? { [sorter.columnKey]: sort } : ''; // 后端未支持空对象, 先用空表示
+ // const addState = await this.handleGetData(name, tableConfig, tableFilterCondition, undefined, slaveOrderBy, '', sGroupByList, this.props, true);
+ // if (addState === undefined) return;
+ // const { [`${name}Data`]: tempData } = addState;
+ // if (commonUtils.isNotEmptyArr(addState[`${name}Data`])) {
+ // addState[`${name}Data`].forEach((item, iIndex) => {
+ // addState[`${name}Data`][iIndex] = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ // });
+ // }
+ // this.props.onSaveState({ ...addState });
+ // setTimeout(() => {
+ // /* 刷新commList页面数据 */
+ // this.props.onSaveState({ pageLoading: false });
+ // }, 3600);
+ };
+ /** 处理选择行发生改变 */
+ handleCallBack = (child) => {
+ const {
+ slaveConfig, slaveInfoConfig, teamFilterCondition, bGantt,
+ } = this.props;
+ const filter = [];
+ const addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sMachineId;
+ filter.push(addFilter);
+ // if (child.sType === '1') {
+ // addFilter.bFilterName = 'sProcessId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.sMachineId;
+ // filter.push(addFilter);
+ // addFilter = {};
+ // addFilter.bFilterName = 'sState';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = '0';
+ // filter.push(addFilter);
+ // } else if (child.sType === '2') {
+ // addFilter.bFilterName = 'sMachineId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.sMachineId;
+ // filter.push(addFilter);
+ // addFilter = {};
+ // addFilter.bFilterName = 'date_format(tStartDate, \'%y-%m-%d\')';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.tStartDate;
+ // filter.push(addFilter);
+ // }
+ if (commonUtils.isNotEmptyArr(teamFilterCondition)) {
+ filter.push(...teamFilterCondition);
+ }
+ this.handleGetData('slave', slaveConfig, filter, undefined, '', false, undefined);
+ /* 甘特图视图下 点击卡片刷新 */
+ if (bGantt) {
+ this.handleGanttChar('', filter)
+ }
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, '', false, undefined);
+ const rowKeys = [];
+ rowKeys.push(child.sId);
+ this.props.onSaveState({
+ teamSelectedRowKeys: rowKeys,
+ });
+ };
+
+ /* 获取甘特图数据 */
+ handleGanttChar = async (ganttChart, slaveFilterCondition) => {
+ const {
+ token, sModelsId, formRoute,
+ } = this.props;
+ const char = {};
+ if (commonUtils.isNotEmptyObject(ganttChart)) {
+ char.sProcedureName = ganttChart.sProcedureName;
+ char.paramsMap = ganttChart.paramsMap;
+ } else {
+ char.sProcedureName = 'Sp_Process_CommonGtChar';
+ char.paramsMap = {
+ };
+ }
+ let charGanttData = {};
+ const value = {
+ sProName: char.sProcedureName,
+ paramsMap: char.prodParamsMap,
+ bFilter: slaveFilterCondition,
+ };
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ const { data: returnData } = await commonServices.postValueService(token, value, url);
+ if (returnData.code === 1) {
+ const { dataset } = returnData;
+ if (commonUtils.isNotEmptyObject(dataset)) {
+ const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ } else {
+ charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ } else {
+ message.error(returnData.msg);
+ }
+ };
+ /*
+ handleRefresh = async () => {
+ const {
+ clearArray, slaveConfig, slaveInfoConfig, teamFilterCondition, slaveFilterCondition,
+ } = this.props;
+ this.props.onSaveState({
+ clearArray: [], searchText: '', teamSelectedData: [], slaveSelectedRowKeys: [], slaveSelectedData: [], slaveInfoSelectedRowKeys: [], slaveInfoSelectedData: [], tableBtnEnabled: true,
+ }); // teamSelectedRowKeys: [],
+ this.handleGetData('slave', slaveConfig, slaveFilterCondition, undefined, '', false, undefined);
+ this.handleGetData('slaveInfo', slaveInfoConfig, slaveFilterCondition, undefined, '', false, undefined);
+
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ this.props.onSaveState({
+ loading: false,
+ });
+ }
+*/
+ handleRefresh = async () => {
+ const {
+ clearArray, teamConfig, teamFilterCondition, slaveFilterCondition, teamSelectedRowKeys,
+ } = this.props;
+ let { expKeys } = this.props;
+ const addState = await this.handleGetData('team', teamConfig, teamFilterCondition, undefined, '', false, undefined, this.props, true);
+ if (addState === undefined) return;
+ this.props.onSaveState({
+ ...addState,
+ clearArray: [],
+ searchText: '',
+ teamSelectedData: [],
+ slaveSelectedRowKeys: [],
+ slaveSelectedData: [],
+ slaveInfoData: [], /* 刷新后清除slaveInfoData */
+ slaveInfoSelectedRowKeys: [],
+ slaveInfoSelectedData: [],
+ tableBtnEnabled: true,
+ machineEnabled: false,
+ sortedInfo: {},
+ });
+ const { teamData } = addState;
+ const newIndex = teamData.findIndex(item => item.sId === teamSelectedRowKeys[0]);
+ if (newIndex === -1) {
+ this.handleCallBack({ ...teamData[0] });
+ } else {
+ this.handleCallBack({ ...teamData[newIndex] });
+ }
+
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ /* 刷新后关闭所有expKeys */
+ expKeys = [];
+ /* 刷新后清除slaveInfoData */
+ this.props.onSaveState({
+ loading: false, expKeys,
+ });
+ }
+
+ handleResetTableSearch = () => {
+ this.props.onSaveState({ clearArray: [] });
+ this.handleRefresh();
+ }
+ // 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
+ handleBtnEent = (btnConfig, btnName, sValue) => {
+ const { masterData } = this.props;
+ const sButtonParam = btnConfig.sButtonParam;
+ const btn = JSON.parse(sButtonParam);
+ const sProName = btn.sproName;
+ const inParams = [];
+ const inMap = btn.inMap;
+ const inlist = inMap.split(',');
+
+ const masterArr = [];
+ const slaveArr = [];
+ const slaveInfoArr = [];
+ const controlArr = [];
+ const materialsArr = [];
+ const processArr = [];
+
+ if (inlist.length > 0) {
+ inlist.forEach((item) => {
+ const itemArr = item.split('.');
+ if (itemArr.length > 0) {
+ const sname = itemArr[0];
+ const stype = itemArr[1];
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'master') {
+ masterArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slave') {
+ slaveArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slaveInfo') {
+ slaveInfoArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'control') {
+ controlArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'materials') {
+ materialsArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'process') {
+ processArr.push(stype);
+ }
+ }
+ });
+
+ if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
+ const addState = {};
+ addState.key = 'master';
+ const val = [];
+ const currVal = {};
+ masterArr.forEach((filed) => {
+ currVal[`${filed}`] = masterData[`${filed}`];
+ });
+ val.push(currVal);
+ addState.value = val;
+ inParams.push({ ...addState });
+ }
+ if (commonUtils.isNotEmptyArr(slaveArr)) {
+ const addState = this.handleProParams('slave', slaveArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
+ const addState = this.handleProParams('slaveInfo', slaveInfoArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(controlArr)) {
+ const addState = this.handleProParams('control', controlArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(materialsArr)) {
+ const addState = this.handleProParams('materials', materialsArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(processArr)) {
+ const addState = this.handleProParams('process', processArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ }
+
+ this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParams, changeValue: sValue }));
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+ // 存储过程按钮调用存储过程
+ handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
+ const { app, sModelsId, sCurrMemoProps } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ /**
+ * 修改日期:2021-03-26
+ * 修改人:吕杰
+ * 区域:以下 2 行
+ * BUG:
+ * 说明:执行完接口调用后关闭弹窗
+ * 原代码:
+ */
+ sCurrMemoProps.bVisibleMemo = false;
+ this.props.onSaveState({ loading: false, sCurrMemoProps });
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
+ }
+ }
+ /* 点击展开图标时,调用接口获取嵌套字表数据 */
+ handleOnExpand = async (expanded, record) => {
+ const { sModelsId, expKeys } = this.props;
+ let { slaveInfoData } = this.props;
+ const { sSlaveId } = record;
+ /* 添加移除展开的sId */
+ let newExp = commonUtils.isNotEmptyArr(expKeys) ? expKeys : [];
+ if (expanded) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ newExp.push(record.sSlaveId);
+ }
+ } else {
+ newExp = newExp.filter(item => item !== record.sSlaveId);
+ }
+ this.props.onSaveState({ expKeys: newExp });
+ let childrenData = [];
+ if (commonUtils.isNotEmptyArr(slaveInfoData) && commonUtils.isNotEmptyObject(sSlaveId)) {
+ childrenData = slaveInfoData.filter(item => sSlaveId.split('-').includes(item.sId));
+ }
+ if (expanded && commonUtils.isEmptyArr(childrenData)) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ const planLoadingSate = {};
+ planLoadingSate.sId = sSlaveId;
+ planLoadingSate.planLoading = true;
+ this.props.onSaveState({ planLoadingSate });
+ const { token } = this.props;
+ const url = `${commonConfig.server_host}workOrderPlan/getProductionPlanInfo?sModelsId=${sModelsId}`;
+ const value = { sSlaveId };
+ const dataReturn = (await commonServices.postValueService(token, value, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ childrenData = returnData;
+ if (commonUtils.isEmptyArr(slaveInfoData)) {
+ slaveInfoData = [];
+ }
+ childrenData.forEach((child) => {
+ // const iIndex = slaveInfoData.findIndex(item => item.sId === child.sId);
+ // if (iIndex === -1) {
+ // slaveInfoData.push(child);
+ // }
+ slaveInfoData.push(child);
+ });
+ }
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({
+ planLoadingSate, slaveInfoData,
+ });
+ } else {
+ this.props.getServiceError(dataReturn);
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({ planLoadingSate });
+ }
+ }
+ }
+ }
+ render() {
+ const { masterData } = this.props;
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonProductionPlanTreeEvent.js b/src/components/Common/CommonProductionPlanTreeEvent.js
new file mode 100644
index 0000000..2153885
--- /dev/null
+++ b/src/components/Common/CommonProductionPlanTreeEvent.js
@@ -0,0 +1,1685 @@
+/* eslint-disable */
+/* eslint-disable prefer-destructuring,no-await-in-loop,semi,no-unused-vars */
+/**
+ * Created by mar105 on 2019-01-08.
+ */
+import React, { Component } from 'react';
+import { message } from 'antd'; // Form, Modal, InputNumber
+// import reactComponentDebounce from 'react-component-debounce';
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */
+import * as commonServices from '../../services/services'; /* 服务类 */
+import commonConfig from '../../utils/config';
+import * as commonFunc from './commonFunc'; /* 通用单据方法 */
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ treeData: [],
+ };
+ this.filterCondition = [];
+ this.treeChild = {};
+ this.form = {}; /* 表单对象 */
+ this.timer = null;
+ this.intervel = 0;
+ this.defaultSelect = false;
+ }
+
+ componentDidMount() {
+ const fromRedirect = () => {
+ this.defaultSelect = this.props.app.currentPane.copyTo.sWorkOrderProcessId;
+ this.handleGetSearchData(null, [
+ {
+ bFilterCondition: "like",
+ bFilterName: "sWorkCenterName",
+ bFilterValue: this.props.app.currentPane.copyTo.sWorkCenterName
+ }
+ ], true);
+ }
+ this.intervel = 0;
+ this.timer = setInterval(() => {
+ if (this.props && this.props.app && this.props.app.currentPane && this.props.app.currentPane.copyTo && this.props.app.currentPane.copyTo.sWorkCenterName) {
+ fromRedirect();
+ clearInterval(this.timer);
+ this.timer = null;
+ } else {
+ if (this.filterCondition.length) {
+ this.handleGetSearchData(null, this.filterCondition);
+ clearInterval(this.timer);
+ this.timer = null;
+ } else {
+ if (this.intervel > 3) {
+ this.handleGetTreeData([]);
+ clearInterval(this.timer);
+ this.timer = null;
+ } else {
+ this.intervel ++;
+ }
+ }
+ }
+ // if (this.filterCondition.length) {
+ // if (this.props && this.props.app && this.props.app.currentPane && this.props.app.currentPane.copyTo && this.props.app.currentPane.copyTo.sWorkCenterName) {
+ // fromRedirect();
+ // } else {
+ // this.handleGetSearchData(null, this.filterCondition);
+ // }
+ // clearInterval(this.timer);
+ // this.timer = null;
+ // } else {
+ // if (this.intervel > 3) {
+ // if (this.props && this.props.app && this.props.app.currentPane && this.props.app.currentPane.copyTo && this.props.app.currentPane.copyTo.sWorkCenterName) {
+ // fromRedirect();
+ // } else {
+ // this.handleGetTreeData([]);
+ // }
+ // clearInterval(this.timer);
+ // this.timer = null;
+ // } else {
+ // this.intervel ++;
+ // }
+ // }
+ }, 500)
+ // this.handleGetTreeData([]);
+ // this.handleGetSearchData();
+ }
+
+ componentWillUnmount() {
+ clearInterval(this.timer);
+ this.timer = null;
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ app, formData, currentId, masterData, searchSolution, sGroupByList, teamSelectedRowKeys, teamData,
+ } = nextProps;
+ const { teamFilterCondition } = this.props;
+ let {
+ isReceive, teamConfig, slaveConfig, slaveInfoConfig, treeLoaded
+ } = nextProps;
+ const { currentPane } = app;
+ const { otherCondition } = currentPane;
+ if (formData.length > 0 && !treeLoaded && searchSolution !== undefined) {
+ isReceive = false;
+ const sId = currentId !== undefined ? currentId : '';
+ const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'eleteam')[0];
+ treeLoaded = true;
+ // teamConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo_WorkCenter')[0];
+ slaveConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo' && item.sGrd !== 'slaveInfo')[0];
+ slaveInfoConfig = formData.filter(item => item.sTbName === 'Sp_Manufacture_ProductionPlanInfo' && item.sGrd === 'slaveInfo')[0];
+ // const productionPlanConfig = formData.filter(item => item.sTbName === 'MftProductionPlanSlave')[0];
+ const workOutsideConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.sTbName.toUpperCase() === 'Sp_Manufacture_ProductionPlanInfo'.toUpperCase() && item.showName === '排程从表(外发)')) ?
+ formData.filter(item => item.sTbName.toUpperCase() === 'Sp_Manufacture_ProductionPlanInfo'.toUpperCase() && item.showName === '排程从表(外发)')[0] : [];
+ const workOutConfirmConfig =commonUtils.isNotEmptyArr(formData.filter(item => item.sTbName.toUpperCase() === 'viw_qlyoutsideproducttest_opsoutsideprocess'.toUpperCase())) ?
+ formData.filter(item => item.sTbName.toUpperCase() === 'viw_qlyoutsideproducttest_opsoutsideprocess'.toUpperCase())[0] : [];
+
+ // let teamColumn = {};
+ // if (teamConfig) {
+ // teamColumn = commonFunc.getHeaderConfig(teamConfig)
+ // }
+ const slaveColumn = commonFunc.getHeaderConfig(slaveConfig);
+ const slavePageSize = commonUtils.isNotEmptyNumber(slaveConfig.iPageSize) && slaveConfig.iPageSize !== 0 ? slaveConfig.iPageSize : commonConfig.pageSize;
+ const slaveInfoColumn = slaveInfoConfig ? commonFunc.getHeaderConfig(slaveInfoConfig) : null;
+ // let productionPlanColumn = {};
+ // if (productionPlanConfig) {
+ // productionPlanColumn = commonFunc.getHeaderConfig(productionPlanConfig);
+ // }
+ let workOutsideColumn = [];
+ if(commonUtils.isNotEmptyObject(workOutsideConfig)) {
+ workOutsideColumn = commonFunc.getHeaderConfig(workOutsideConfig);
+ }
+ let workOutConfirmColumn = [];
+ if(commonUtils.isNotEmptyObject(workOutConfirmConfig)) {
+ workOutConfirmColumn = commonFunc.getHeaderConfig(workOutConfirmConfig);
+ }
+ const workOutsideSize = commonUtils.isNotEmptyObject(workOutsideConfig) && commonUtils.isNotEmptyNumber(workOutsideConfig.iPageSize) && workOutsideConfig.iPageSize !== 0 ? workOutsideConfig.iPageSize : commonConfig.pageSize;
+ const workOutConfirmSize = commonUtils.isNotEmptyObject(workOutConfirmConfig) && commonUtils.isNotEmptyNumber(workOutConfirmConfig.iPageSize) && workOutConfirmConfig.iPageSize !== 0 ? workOutConfirmConfig.iPageSize : commonConfig.pageSize;
+
+ let currfilterCondition = [];
+ if (commonUtils.isNotEmptyObject(masterData) && !commonUtils.isEmpty(masterData.sSearchSolutionId) && commonUtils.isNotEmptyArr(searchSolution)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1 && !commonUtils.isEmpty(searchSolution[iIndex].sCondition)) {
+ currfilterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ this.filterCondition = currfilterCondition;
+ }
+ }
+ // this.handleGetData('team', teamConfig, currfilterCondition, undefined, '', false, sGroupByList);
+ // this.handleGetData('slave', slaveConfig, [], undefined, '', false, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, [], undefined, '', false, undefined);
+ this.props.onSaveState({
+ treeLoaded: treeLoaded,
+ masterConfig,
+ // teamConfig,
+ // teamColumn,
+ slaveConfig,
+ slaveColumn,
+ slaveInfoConfig,
+ slaveInfoColumn,
+ slavePageSize,
+ // productionPlanConfig,
+ // productionPlanColumn,
+ workOutsideConfig,
+ workOutsideColumn,
+ workOutConfirmConfig,
+ workOutConfirmColumn,
+ workOutsideSize,
+ workOutConfirmSize,
+ sId,
+ pageLoading: false,
+ enabled: true,
+ dragPermission: false,
+ dragAndDropSwitch: false,
+ isReceive,
+ masterData: {},
+ tableBtnEnabled: true,
+ sortEnabled: true,
+ // stateOption: objValue,
+ });
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const {
+ slaveColumn,
+ } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn);
+ }
+
+ componentDidUpdate(prevProps) {
+ // const {
+ // slaveSelectedRowKeys, moveEnabled, tableBtnEnabled, slaveFilterCondition,
+ // } = prevProps;
+ // let arr = [];
+ // if (slaveFilterCondition) {
+ // // 选中机台即可排序
+ // arr = slaveFilterCondition.filter(val => val.bFilterName === 'sMachineId')
+ // }
+ // if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && !moveEnabled && tableBtnEnabled) {
+ // this.props.onSaveState({ moveEnabled: true });
+ // // 控制选择机台可选,单独判断;
+ // if (arr.length > 0) {
+ // this.props.onSaveState({ sortEnabled: true });
+ // } else {
+ // this.props.onSaveState({ sortEnabled: true });
+ // }
+ // } else if ((commonUtils.isEmptyArr(slaveSelectedRowKeys) && moveEnabled && tableBtnEnabled) || (moveEnabled && !tableBtnEnabled)) {
+ // this.props.onSaveState({ moveEnabled: false });
+ // // 控制选择机台可选,单独判断;
+ // if (arr.length > 0) {
+ // this.props.onSaveState({ sortEnabled: true });
+ // } else {
+ // this.props.onSaveState({ sortEnabled: true });
+ // }
+ // }
+ }
+
+ onChangeMachine = async () => {
+ const { sModelsId, masterData, slaveInfoSelectedRowKeys } = this.props;
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_Manufacture_ProductionPlanInfo_ChangeMachine',
+ paramsMap: {
+ bSplit: masterData.bSplit,
+ iSplitNum: masterData.iSplitNum,
+ sMachineId: masterData.sMachineId,
+ // sWorkCenterId: masterData.sWorkCenterId,
+ sTeamId: masterData.sTeamId,
+ tStartDate: masterData.tStartDate,
+ sProInParam: JSON.stringify({ params: { key: 'slaveInfo', value: { sId: slaveInfoSelectedRowKeys } } }),
+ },
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, value, url)).data;
+ if (dataReturn.code === 1) {
+ /* 数据查询成功 */
+ this.handleRefresh(1);
+ this.handleGetTreeData([]); /* 更换机台后更新Tree */
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sWorkCenterId: '', sMachineId: '', sTeamId: '' } });
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ }
+ handleGetTableConfig = async (name, sModelsId) => { /* 混刷 */
+ if (commonUtils.isNotEmptyObject(sModelsId)) {
+ const newConfig = await this.props.onGetTableConfig(name, sModelsId);
+ if (commonUtils.isNotEmptyObject(newConfig)) {
+ this.props.onSaveState({ [`${[name]}Config`]: newConfig });
+ }
+ }
+ }
+ /* 快捷键跳转 */
+ handleViewClick = (name, sName, record, index, myConfig) => {
+ if (sName === 'myTableConfig') {
+ this.handleQuickViewClick(name, sName, record, index, myConfig);
+ }else if(sName === 'sHistroyQty') {
+ const { slaveConfig }= this.props;
+ let sHistoryQtyConfig = {};
+ if(commonUtils.isNotEmptyObject(slaveConfig)) {
+ const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sHistroyQty');
+ if(iIndex > -1) {
+ sHistoryQtyConfig = slaveConfig.gdsconfigformslave[iIndex];
+ }
+ }
+ this.props.onSaveState({ sHistoryQtyConfig: sHistoryQtyConfig, sHistoryQtyRecord: record, sHistoryQtyVisible: true });
+ } else {
+ this.props.onViewClick(name, sName, record, index, myConfig);
+ }
+ }
+ /* 单独设置界面 */
+ handleQuickViewClick = async (name, sName, record, index, myConfigArr) => {
+ const {
+ slaveConfig,
+ slaveData,
+ // dispatch,
+ slaveFilterCondition,
+ slavePagination,
+ // slaveOrderBy,
+ // sModelsType,
+ formRoute,
+ // treeFilterCondition,
+ // app,
+ // iPageSize,
+ sModelsId,
+ // slaveSelectedData,
+ // masterData,
+ // employeeConfig,
+ } = this.props;
+
+ let picArr = slaveConfig.gdsconfigformslave.filter(item => (item.sName === sName));
+ if (commonUtils.isNotEmptyArr(myConfigArr)) {
+ picArr = myConfigArr;
+ }
+
+ if (picArr.length > 0) {
+ const getConfig = this.handleGetTableConfig;
+ const tableDataRow = record;
+ const iIndex = index;
+ const [{ sActiveId }] = picArr;
+ let [{ sActiveKey }] = picArr;
+ const sFormId = sActiveId === '1' ? commonUtils.isEmpty(tableDataRow.sFormId) ? tableDataRow.sSrcFormId : tableDataRow.sFormId : sActiveId;
+ if (commonUtils.isNotEmptyObject(sActiveKey) && sActiveKey.includes('.')) { /* 接口按钮跳转 如果有slave.对应字段 则需要取出对应字段 */
+ const index = sActiveKey.lastIndexOf('.');
+ sActiveKey = sActiveKey.substring(index + 1, sActiveKey.length);
+ }
+ const sNameUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}&sName=${formRoute}`;
+ const filterCondition = [];
+ const conditionValues = this.props.getSqlCondition(picArr[0], name, tableDataRow);
+ if (!commonUtils.isEmpty(conditionValues)) {
+ Object.keys(conditionValues).forEach((item) => {
+ if ((item === 'tStartDate_pro' || item.substring(0, 1) === 'p')) {
+ if (!commonUtils.isEmpty(conditionValues[item]) && conditionValues[item].length >= 2) {
+ const tStartDate = moment(conditionValues[item][0]).format(this.sDateFormat);
+ const tEndDate = moment(conditionValues[item][1]).add(1, 'days').format(this.sDateFormat);
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: `${tStartDate},${tEndDate}`,
+ });
+ }
+ } else if ((item === 'mStartDate_pro' || item.substring(0, 1) === 'm')) {
+ if (!commonUtils.isEmpty(conditionValues[item])) {
+ const tStartDate = moment(conditionValues[item]).startOf('month').format(this.sDateFormat);
+ const tEndDate = moment(conditionValues[item]).endOf('month').add(1, 'days').format(this.sDateFormat);
+ filterCondition.push({
+ bFilterName: `t${item.substring(1, item.length)}`,
+ bFilterCondition: '=',
+ bFilterValue: `${tStartDate},${tEndDate}`,
+ });
+ }
+ } else if (item.substring(0, 1) === 't') {
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: moment(conditionValues[item]).format(this.sDateFormat),
+ });
+ } else {
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: conditionValues[item],
+ });
+ }
+ });
+ }
+ this.props.dispatch({
+ type: 'content/onRouter',
+ payload: {
+ url: sNameUrl,
+ refresh: getConfig.bind(this, name, sModelsId), /* 刷新方法 */
+ sTabId: commonUtils.createSid(),
+ sParentId: this.state.sTabId,
+ urlDataType: 'newPane',
+ checkedId: myConfigArr[0].sId,
+ sName: myConfigArr[0].sName,
+ bFilter: slaveFilterCondition,
+ pageSize: commonConfig.pageSize,
+ pages: slavePagination,
+ currentData: slaveData,
+ conditonValues: conditionValues,
+ newKey: tableDataRow[sActiveKey],
+ currentIndex: iIndex,
+ filterCondition,
+ },
+ });
+ }
+ };
+ /** 获取表数据 */
+ handleGetData = async (sName, slaveConfig, slaveFilterCondition, page, slaveOrderBy, clearSelectData, sGroupByListNew, nextProps, isWait) => {
+ const {
+ app, workOutsideConfig, slavePageSize, workOutsideSize, workOutConfirmSize, workOutConfirmConfig
+ } = commonUtils.isEmpty(nextProps) ? this.props : nextProps;
+ const sGroupByList = sGroupByListNew !== undefined ? commonUtils.isEmptyArr(sGroupByListNew) ? null : sGroupByListNew : this.props.sGroupByList;
+ const conditonValues = app.currentPane.conditonValues;
+ // const filterCondition = app.currentPane.filterCondition;
+ const filterCondition = '';
+ const bFilter = [];
+ if (!commonUtils.isEmptyArr(slaveFilterCondition)) {
+ slaveFilterCondition[0].bFilterName = slaveFilterCondition[0].bFilterName.replace('_pro', '');
+ bFilter.push(...slaveFilterCondition);
+ }
+ if (!commonUtils.isEmptyArr(filterCondition)) {
+ bFilter.push(...filterCondition);
+ }
+ const addState = {};
+ const pageNum = commonUtils.isEmpty(page) ? 1 : page;
+ addState.pageNum = pageNum;
+ addState.pageSize = commonUtils.isNotEmptyNumber(slavePageSize) && slavePageSize !== 0 ? slavePageSize : commonConfig.pageSize;
+
+ /* 判断是否是外发 */
+ let bOutSide = false;
+ const outsideIndex = bFilter.findIndex(item => item.bFilterName === 'iBillOutside_pro' && item.bFilterValue === 1);
+ bOutSide = outsideIndex > -1;
+ if (bOutSide) {
+ addState.pageSize = commonUtils.isNotEmptyNumber(workOutsideSize) && workOutsideSize !== 0 ? workOutsideSize : commonConfig.pageSize; // 发外设定页码;
+ }
+ let bOutConfirm = false;
+ const outconfirmIndex = bFilter.findIndex(item => item.bFilterName === 'iBillConfirm_pro' && item.bFilterValue === 1);
+ bOutConfirm = outconfirmIndex > -1;
+ if (bOutConfirm) {
+ addState.pageSize = commonUtils.isNotEmptyNumber(workOutConfirmSize) && workOutConfirmSize !== 0 ? workOutConfirmSize : commonConfig.pageSize; // 发外设定页码;
+ }
+
+ let configData = null;
+ if (bOutSide) {
+ configData = workOutsideConfig;
+ } else if(bOutConfirm) {
+ configData = workOutConfirmConfig;
+ } else {
+ configData = slaveConfig
+ }
+
+ this.props.onSaveState({ pageLoading: true });
+ bFilter.forEach((item, idx) => {
+ if (item.bFilterName === "iBillOutside_pro" || item.bFilterName === "iBillConfirm_pro") {
+ bFilter.splice(idx, 1);
+ }
+ })
+ const returnData = await this.props.handleGetDataSet({
+ name: sName,
+ configData,
+ condition: {
+ ...addState, bFilter, sFilterOrderBy: slaveOrderBy, sSqlCondition: conditonValues, sGroupList: sGroupByList,
+ },
+ flag: true,
+ clearSelectData,
+ isWait: true,
+ });
+
+ let addState1 = {};
+ if (!isWait) {
+ addState1 = { ...addState1, ...returnData };
+ }
+
+ addState1 = { ...addState1, pageLoading: false, Loading: false, loading: false };
+
+ if (this.defaultSelect) {
+ let key = this.props.slaveData.filter(item => item.sWorkOrderProcessId === this.defaultSelect);
+ if (key.length > 0) {
+ addState1 = { ...addState1, slaveSelectedRowKeys: [key[0].sId] };
+ // this.props.onSaveState({ slaveSelectedRowKeys: [key[0].sId] });
+ this.defaultSelect = false;
+ }
+ }
+ this.props.onSaveState(addState1);
+ if (isWait) {
+ return { ...returnData };
+ }
+ };
+
+ handleGetSearchData = (config, filterCondition, isCopyTo) => {
+ this.treeChild = {}
+ this.filterCondition = filterCondition;
+ this.props.onSaveState({
+ slaveData: [],
+ });
+ if (!isCopyTo) {
+ this.handleGetSlaveData(config, filterCondition, true);
+ }
+ this.handleGetTreeData(filterCondition);
+ this.handleResetSearch();
+ };
+
+ refreshTreeData = () => {
+ this.handleGetTreeData(this.filterCondition)
+ };
+
+ handleGetSlaveData = (config, filterCondition, isRoot) => {
+ const {
+ slaveConfig, slaveInfoConfig, teamData, teamSelectedRowKeys,
+ } = this.props;
+ const iIndex = filterCondition.findIndex(item => item.bFilterName === 'sTeamId' && item.bFilterCondition === '=' && item.bFilterValue === teamSelectedRowKeys[0]);
+ const filter = [];
+ filterCondition.forEach((itme, i) => {
+ if (iIndex !== i) { filter.push(itme); }
+ });
+
+ if (!isRoot) {
+ const addFilter = {};
+ addFilter.bFilterName = 'sTeamId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = teamData[0].sId;
+ filter.push(addFilter);
+ }
+ this.handleGetData('slave', slaveConfig, filter, undefined, undefined);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, undefined);
+ };
+
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+
+ /** toolbar保存 */
+ handleSaveData = async (params, bFresh) => {
+ const {
+ token, sModelsId,
+ } = this.props;
+ const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
+ if (commonUtils.isNotEmptyObject(returnData)) {
+ if(!bFresh) { /* 默认刷新 */
+ this.handleRefresh(1);
+ if (this.props.app.currentPane.refresh !== undefined) {
+ this.props.app.currentPane.refresh();
+ }
+ }
+ return true;
+ } else {
+ this.props.onSaveState({ pageLoading: false, Loading: false, loading: false });
+ return false;
+ }
+ };
+
+ /** 保存校验 */
+ handleValidateSave = (bFresh) => {
+ this.form.validateFields((err) => {
+ /* 验证通过与不通过走不同的流程 */
+ if (err) { /* 验证失败 */
+ /* 直接渲染显示错误提示 */
+ for (const key of Object.keys(err)) {
+ message.error(err[key].errors[0].message);
+ }
+ } else { /* 验证成功 */
+ const {
+ slaveConfig, slaveData, slaveDelData, app, productionPlanDelData, tableBtnEnabled, charGanttData, bGantt,
+ } = this.props;
+ const data = [];
+ if (commonUtils.isEmptyArr(slaveData)) {
+ message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空!
+ return;
+ } else {
+ /* 如果是甘特图视图,则进入甘特图视图保存逻辑 */
+ if (bGantt && commonUtils.isNotEmptyObject(charGanttData)) {
+ const data = [];
+ const addState = {}
+ addState.name = 'slave';
+ addState.sTable = 'MftProductionPlanSlave';
+ addState.column = charGanttData.data;
+ data.push(addState);
+ this.handleSaveData({ data, sClientType: '1' });
+ return;
+ }
+ const productionPlanData = [];
+ const slaveFilter = slaveData.filter(item => item.sDivRowNew);
+ if(commonUtils.isNotEmptyArr(slaveFilter)) {
+ slaveFilter.forEach((item, i) => {
+ const index = slaveData.findIndex(itemS => itemS.sSlaveId === item.sSlaveId);
+ if(index < slaveData.length ){
+ // slaveData[index].sDivRowNew = '';
+ if (slaveData[index + 1]) {
+ slaveData[index + 1].sDivRow = item.sDivRowNew;
+ slaveData[index + 1].sDivRowNew = '';
+ }
+ }
+ });
+ }
+
+ let requestDataConfig = []
+ if (Array.isArray(slaveConfig?.gdsconfigformslave)) {
+ requestDataConfig = slaveConfig.gdsconfigformslave.find(i => i && ['requestDataConfig'].includes(i.sControlName))?.sActiveKey;
+ try {
+ requestDataConfig = JSON.parse(requestDataConfig);
+ if (!Array.isArray(requestDataConfig)) throw '';
+ } catch (error) {
+ requestDataConfig = [];
+ }
+ }
+
+ for (const item of slaveData) {
+ const {
+ sSlaveId, handleType, iOrder, tStartDate, sMemo, dAdjustHour, sDivRowNew, sDivRow,bEmploy, sDivRowTmp, sDivRowGroupBy, sAPSCodeDirection, dQty2,
+ dProcessfeesendQty, sMachineId, dCalcHourTz1, dTxHour, tCutDate, dFirstQty,
+ } = item;
+ if (commonUtils.isEmptyObject(sDivRowNew)) {
+ const sIds = sSlaveId.split('-');
+ sIds.forEach((newItem) => {
+ const addState = {};
+ addState.sId = newItem;
+ if (commonUtils.isEmpty(iOrder)) {
+ message.error('序号必填!');
+ return;
+ }
+ if (commonUtils.isEmpty(tStartDate)) {
+ message.error('时间必填!');
+ return;
+ }
+ addState.iOrder = iOrder;
+ /* 20210406 zhuzong要求排程保存时候 必传iOrder,tStartDate,sMemo,dAdjustHour 四个参数 */
+ addState.tStartDate = tStartDate;
+ // if (commonUtils.isNotEmptyObject(sMemo)) {
+ // addState.sMemo = sMemo;
+ // }
+ // if (dAdjustHour !== undefined) {
+ // addState.dAdjustHour = dAdjustHour;
+ // }
+ addState.sMemo = sMemo;
+ addState.dAdjustHour = dAdjustHour;
+ addState.dCalcHourTz1 = dCalcHourTz1;
+ addState.handleType = handleType;
+ addState.sDivRowTmp = sDivRowTmp;
+ addState.sDivRowGroupBy = sDivRowGroupBy;
+ addState.sAPSCodeDirection = sAPSCodeDirection;
+ addState.dQty2 = dQty2;
+ addState.dProcessfeesendQty = dProcessfeesendQty;
+ addState.sMachineId = sMachineId;
+ addState.dTxHour = dTxHour;
+ addState.tCutDate = tCutDate;
+ addState.dFirstQty = dFirstQty;
+ requestDataConfig.forEach( i => {
+ addState[i] = item[i];
+ });
+ if (sDivRow) {
+ addState.sDivRow = sDivRow;
+ } else {
+ addState.sDivRow = '';
+ }
+ if (bEmploy) {
+ addState.bEmploy = true;
+ } else {
+ addState.bEmploy = false;
+ }
+
+ productionPlanData.push(addState);
+ });
+ }
+ }
+ data.push(commonBusiness.mergeData('productionPlan', 'MftProductionPlanSlave', productionPlanData, productionPlanDelData));
+ }
+ if (!commonBusiness.validateTable(slaveConfig, slaveData)) {
+ return;
+ }
+ // data.push(commonBusiness.mergeData('slave', 'MftProductionPlanSlave', slaveData, slaveDelData));
+ this.handleSaveData({ data, sClientType: '1', optName:'保存' }, bFresh);
+ }
+ });
+ };
+
+ /* 数据删除成功跳转到新路由即pane */
+ handleDelDataSuccess = (props) => {
+ const { app } = props;
+ let { panes, currentPane } = app;
+ /* 删除单据后退出当前路由后,标签panes变化后的集合 */
+ panes = panes.filter(pane => pane.key !== currentPane.key);
+ /* 跳转到panes集合的最后一个路由,因为panes集合一定含有主页路由所以panes的集合大于等于1 */
+ currentPane = panes[panes.length - 1];
+ this.props.onRemovePane(panes, currentPane);
+ };
+
+ /** 表格数据更改 */
+ // name 不写完整的state名称作用为了要用到total // (name, changeValue, sId, dropDownData)
+ handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ const { sModelsId } = this.props;
+ this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, false);
+ if (name === 'slave') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ if (sFieldName === 'iOrder') {
+ /* 修改汇总表数据后,slaveInfo表iOrder同步更改 */
+ const { slaveInfoData, slaveData } = this.props;
+ const iIndex = slaveData.findIndex(item => item.sId === sId);
+ if (iIndex > -1) {
+ const tableDataRow = slaveData[iIndex];
+ let childrenData = [];
+ childrenData = tableDataRow.childrenData;
+ if (commonUtils.isNotEmptyArr(childrenData)) {
+ childrenData.forEach((child) => {
+ const index = slaveInfoData.findIndex(item => item.sId === child.sId);
+ const addState = {};
+ addState.handleType = 'update';
+ addState.iOrder = tableDataRow.iOrder;
+ if (index > -1) {
+ slaveInfoData[index] = { ...slaveInfoData[index], ...addState }
+ }
+ });
+ this.props.onSaveState({ slaveData, slaveInfoData });
+ }
+ }
+ }
+ }
+ };
+ // 打印
+ handleBtnPrint = (sActiveId, checked) => {
+ const {
+ app, sModelsId, slaveConfig, slaveSelectedRowKeys, slaveFilterCondition, reportData,
+ } = this.props;
+ const { token } = app;
+ let slaveFilterConditionNew = slaveFilterCondition === undefined ? [] : [...slaveFilterCondition];
+
+ let sids = '';
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ }
+ if (sids !== '') {
+ slaveFilterConditionNew = [];
+ const sidsNew = commonUtils.isNotEmptyObject(sids) ? sids.replace(/-/g, ',') : '';
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sidsNew;
+ slaveFilterConditionNew.push(addFilter);
+ }
+
+ const queryFilter = {};
+ queryFilter[slaveConfig.sId] = { bFilter: slaveFilterConditionNew };
+
+ const queryFilterJson = encodeURIComponent(JSON.stringify(queryFilter));
+ /* 拿到打印报表名称 */
+ let printReportName = 'report';
+ if (commonUtils.isNotEmptyArr(reportData)) {
+ const iIndex = reportData.findIndex(item => item.sId === sActiveId);
+ if (iIndex > -1) {
+ printReportName = reportData[iIndex].sReportName;
+ }
+ }
+ const urlPrint = `${commonConfig.file_host}printReport/printPdf/${sActiveId}/${printReportName}.pdf?${checked ? 'fileType=.xlsx&' : ''}queryFilter=${queryFilterJson}&sModelsId=${sModelsId}&sMaintableId=${slaveConfig.sId}&token=${encodeURIComponent(token)}`;
+ window.open(urlPrint);
+ };
+ /* 导出Excel */
+ handleOut = () => {
+ const {
+ slaveConfig, sFilterOrderBy, slaveSelectedRowKeys, slaveFilterCondition, sGroupByList,
+ } = this.props;
+
+ const newfilterCondition = slaveFilterCondition === undefined ? [] : slaveFilterCondition;
+
+ let sids = '';
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ // const addFilter = {};
+ // addFilter.bFilterName = 'sId';
+ // addFilter.bFilterCondition = 'in';
+ // addFilter.bFilterValue = sids;
+ // newfilterCondition.push(addFilter);
+
+ let url = `${commonConfig.server_host}excel/export/${slaveConfig.sId}?sModelsId=${slaveConfig.sParentId}&token=${this.props.app.token}`;
+ if (commonUtils.isNotEmptyArr(newfilterCondition)) {
+ url = `${url}&bFilter=${encodeURIComponent(JSON.stringify(newfilterCondition))}`;
+ }
+ if (sFilterOrderBy !== undefined && sFilterOrderBy !== '' && Object.keys(sFilterOrderBy).length > 0) {
+ url = `${url}&sFilterOrderBy=${encodeURIComponent(JSON.stringify(sFilterOrderBy))}`;
+ }
+ if (commonUtils.isNotEmptyArr(sGroupByList)) {
+ url = `${url}&sGroupList=${encodeURIComponent(JSON.stringify(sGroupByList))}`;
+ }
+ window.open(url);
+ };
+ handleConfirmDataChange = (value) => {
+ const {
+ masterData,
+ } = this.props;
+ masterData.dOutsideQty = value;
+
+ this.props.onSaveState({ masterData });
+ };
+ // 按钮操作
+ handleButtonClick = (name) => {
+ if (name === 'BtnRefresh') {
+ this.handleRefresh(1);
+ } else if (name === 'BtnOut') {
+ this.handleOut();
+ } else if (name === 'BtnDesignFunction') {
+ this.handleDesignFunction();
+ } else if (name.includes('BtnJdfUpdate')) { /* JDF更新 */
+ const downType = name.split('.')[1].toLowerCase();
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const sType = `download${downType}`;
+ const url = `${commonConfig.server_host}xs/updatejmf/7?sModelsId=${sModelsId}&token=${token}`;
+ console.log('BtnJdfUpdate', url);
+ // const url = `${commonConfig.server_host}xs/${sType}?sModelsId=${sModelsId}&token=${token}`;
+ window.open(url);
+ } else if (name.includes('BtnJdfCreate')) { /* JDF创建 */
+ const downType = name.split('.')[1].toLowerCase();
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const sType = `download${downType}`;
+ const url = `${commonConfig.server_host}xs/sendjmf?sModelsId=${sModelsId}&token=${token}`;
+ console.log('BtnJdfCreate', url);
+ // const url = `${commonConfig.server_host}xs/${sType}?sModelsId=${sModelsId}&token=${token}`;
+ window.open(url);
+ } else if (name.includes('BtnDown')) {
+ const downType = name.split('.')[1].toLowerCase();
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+ const sType = `download${downType}`;
+ const url = `${commonConfig.server_host}xs/downloadjdf/add/xly.jdf?sModelsId=${sModelsId}&token=${token}`;
+ window.open(url);
+ }
+ };
+ handleDesignFunction = () => {
+ this.props.onSaveState({ visibleStatement: true });
+ };
+ handleUpdated = async (params) => {
+ const { app, sModelsId } = this.props;
+ const { token } = app;
+
+ const url = `${commonConfig.server_host}productionPlan/getProcessOperation?sModelsId=${sModelsId}`;
+ const { data } = await commonServices.postValueService(token, params, url);
+
+ if (data.code === 1) {
+ /* 数据查询成功 */
+ return true;
+ } else { /* 失败 */
+ this.props.getServiceError(data);
+ return false;
+ }
+ };
+
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
+ const { sModelsId, slaveData, slaveSelectedRowKeys } = this.props;
+ let { masterData } = this.props;
+ if (sFieldName === 'sMachineId') {
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sTeamId', []);
+ }else if(sFieldName === 'iSplitNum') {
+ let returnData = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true, masterData);
+ let masterDataNew = {};
+ if(commonUtils.isNotEmptyObject(returnData)) {
+ masterDataNew = returnData.masterData;
+ }
+ let iIndex = commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) ? slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId)) : -1;
+ let slaveRow = {};
+ if(iIndex > -1) {
+ slaveRow = slaveData[iIndex];
+ }
+ let dProcessSyQty = commonUtils.isEmptyObject(slaveRow) ? 0 : commonUtils.convertToNum(slaveRow.dProcessQty - commonUtils.isNull(masterDataNew.iSplitNum, 0)) ;
+ if(dProcessSyQty < 0) {
+ // masterData ={ ...masterDataNew, dProcessSyQty :0};
+ message.error('超出最大数量' + slaveRow.dProcessQty);
+ return;
+ }else {
+ masterData ={ ...masterDataNew, dProcessSyQty};
+ }
+ this.props.onSaveState ( { masterData });
+ }
+ if (isWait) {
+ if (sFieldName !== 'iSplitNum') {
+ return this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ }
+ } else {
+ // if(sFieldName?.includes('sThird-')) {
+ // return;
+ // }
+ this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ }
+ };
+
+ handleCalculate = () => {
+ const { sModelsId, slaveData } = this.props;
+ const materialsInfo = [];
+ const slaveDataNew = [];
+ slaveData.forEach(async (item) => {
+ const index = materialsInfo.findIndex(obj => obj.sMaterialsId === item.sMaterialsId);
+ item.bMaterialAdequate = 0;
+ if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ const url = `${commonConfig.server_host}eleMaterialsStock/getEleMaterialsStoreCurrQty?sModelsId=${sModelsId}`;
+ const body = {
+ sMaterialsId: item.sMaterialsId, /* 查询条件 */
+ };
+ const dataReturn = (await commonServices.postValueService(this.props.app.token, body, url)).data;
+ if (dataReturn.code === 1) {
+ if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows[0])) {
+ const materials = dataReturn.dataset.rows[0];
+ if (commonUtils.isNotEmptyNumber(materials.dAuxiliaryQty) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materials.dAuxiliaryQty > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ }
+ } else if (commonUtils.isNotEmptyStr(item.sMaterialsId) && index === -1) {
+ if (commonUtils.isNotEmptyNumber(materialsInfo[index].sMaterialsId) && commonUtils.isNotEmptyNumber(item.dPrintQty) && materialsInfo[index].sMaterialsId > item.dPrintQty) {
+ item.bMaterialAdequate = 1;
+ materialsInfo[index].dAuxiliaryQty = materialsInfo[index].sMaterialsId - item.dPrintQty;
+ }
+ }
+ slaveDataNew.push(item);
+ });
+ this.props.onSaveState({ slaveData: slaveDataNew });
+ };
+
+ handleTitleChange = async (name, slavePagination, filters, sorter, extra) => {
+ // const tableBtnEnabled = commonUtils.isNotEmptyObject(filters) && commonUtils.isEmptyObject(sorter);
+ const addState = {}; // 搜索时不能使用排序保存,否则数据会出不来。
+ if (commonUtils.isNotEmptyObject(sorter)) {
+ const slaveData = [];
+ extra.currentDataSource.forEach((item, iIndex) => {
+ const slaveTableRow = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ slaveData.push(slaveTableRow);
+ });
+ if (slaveData.length === this.props.slaveData.length) {
+ addState.slaveData = slaveData;
+ }
+ }
+ this.props.onSaveState({
+ ...addState, slavePagination, pageLoading: false,
+ });
+ // this.props.onSaveState({
+ // tableBtnEnabled: false, pageLoading: true,
+ // });
+ // const { [`${name}Config`]: tableConfig, [`${name}FilterCondition`]: tableFilterCondition, sGroupByList } = this.props;
+ // const sort = sorter.order === 'ascend' ? 'asc' : 'desc';
+ // const slaveOrderBy = Object.keys(sorter).length > 0 ? { [sorter.columnKey]: sort } : ''; // 后端未支持空对象, 先用空表示
+ // const addState = await this.handleGetData(name, tableConfig, tableFilterCondition, undefined, slaveOrderBy, '', sGroupByList, this.props, true);
+ // if (addState === undefined) return;
+ // const { [`${name}Data`]: tempData } = addState;
+ // if (commonUtils.isNotEmptyArr(addState[`${name}Data`])) {
+ // addState[`${name}Data`].forEach((item, iIndex) => {
+ // addState[`${name}Data`][iIndex] = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ // });
+ // }
+ // this.props.onSaveState({ ...addState });
+ // setTimeout(() => {
+ // /* 刷新commList页面数据 */
+ // this.props.onSaveState({ pageLoading: false });
+ // }, 3600);
+ };
+ /** 处理选择行发生改变s */
+ handleCallBack = (child) => {
+ if (!child) {
+ return;
+ }
+ this.treeChild = child;
+ const {
+ slaveConfig, slaveInfoConfig, teamFilterCondition, bGantt, masterData,
+ } = this.props;
+ let filter = [];
+ let addFilter = {};
+ if (child.sType === '1') {
+ addFilter.bFilterName = 'sProcessId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sMachineId;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'sState';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = '0';
+ filter.push(addFilter);
+ }
+ if (child.sType === '2') {
+ addFilter.bFilterName = 'sMachineId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sMachineId;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'date_format(tStartDate, \'%y-%m-%d\')';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.tStartDate;
+ filter.push(addFilter);
+ }
+ if (child.sType === 'workcenter') {
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sId;
+ filter.push(addFilter);
+ }
+ if (child.sType === 'workoutsid') {
+ // addFilter.bFilterName = 'sWorkOutsidId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.sId;
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.pid;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'iBillOutside_pro';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = 1;
+ filter.push(addFilter);
+ }
+ if (child.sType === 'workoutconfirm') {
+ // addFilter.bFilterName = 'sWorkOutsidId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.sId;
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.pid;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'iBillConfirm_pro';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = 1;
+ filter.push(addFilter);
+ }
+ if (child.sType === 'machine') {
+ addFilter.bFilterName = 'sMachineId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sId;
+ filter.push(addFilter);
+ // addFilter = {};
+ // addFilter.bFilterName = 'sProcessId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = child.sProcessId;
+ // filter.push(addFilter);
+ }
+ if (child.sType === 'process') {
+ addFilter.bFilterName = 'sProcessId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sId;
+ filter.push(addFilter);
+ addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = child.sWorkCenterId;
+ filter.push(addFilter);
+ }
+ if (commonUtils.isNotEmptyArr(teamFilterCondition)) {
+ filter.push(...teamFilterCondition);
+ }
+ filter = filter.concat(this.filterCondition);
+ this.handleGetData('slave', slaveConfig, filter, undefined, '', false, undefined);
+ /* 甘特图视图下 点击卡片刷新 */
+ if (bGantt) {
+ this.handleGanttChar('', filter)
+ }
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filter, undefined, '', false, undefined);
+ const rowKeys = [];
+ rowKeys.push(child.sId);
+ /* 清空选择机台信息 */
+ if(commonUtils.isNotEmptyObject(masterData)) {
+ masterData.sMachineId = '';
+ masterData.sMachineName = '';
+ masterData.sWorkCenterId = '';
+ masterData.sWorkCenterName = '';
+ }
+ this.props.onSaveState({
+ teamSelectedRowKeys: rowKeys, masterData
+ });
+ };
+
+ /* 获取甘特图数据 */
+ handleGanttChar = async (ganttChart, slaveFilterCondition) => {
+ const {
+ token, sModelsId, formRoute,
+ } = this.props;
+ const char = {};
+ if (commonUtils.isNotEmptyObject(ganttChart)) {
+ char.sProcedureName = ganttChart.sProcedureName;
+ char.paramsMap = ganttChart.paramsMap;
+ } else {
+ char.sProcedureName = 'Sp_Process_CommonGtChar';
+ char.paramsMap = {
+ };
+ }
+ let charGanttData = {};
+ const value = {
+ sProName: char.sProcedureName,
+ paramsMap: char.prodParamsMap,
+ bFilter: slaveFilterCondition,
+ };
+ this.props.onSaveState({ pageLoading: true });
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ const { data: returnData } = await commonServices.postValueService(token, value, url);
+ if (returnData.code === 1) {
+ const { dataset } = returnData;
+ if (commonUtils.isNotEmptyObject(dataset)) {
+ const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ } else {
+ charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ } else {
+ message.error(returnData.msg);
+ }
+ };
+
+ handleGetTreeData = async (filter) => {
+ this.props.onSaveState({ treeLoading: true });
+ const {
+ sModelsId, app,
+ } = this.props;
+ const { token } = app;
+ const value = {
+ bFilter: filter,
+ };
+ const url = `${commonConfig.server_host}productionPlan/getProductionPlanTree?sModelsId=${sModelsId}`;
+ const { data: returnData } = await commonServices.postValueService(token, value, url);
+ if (returnData !== undefined && returnData.code === 1) {
+ this.setState({
+ treeData: returnData.dataset.rows,
+ });
+ // if (Object.keys(this.treeChild).length === 0) {
+ // this.handleCallBack(returnData.dataset.rows[0]);
+ // }
+ } else {
+ this.props.getServiceError(returnData);
+ }
+ // this.props.onSaveState({ pageLoading: false });
+ this.props.onSaveState({ treeLoading: false });
+ }
+
+
+ /* 获取稽查模型数据 */
+ handleCheckModel = async (chart, slaveFilterCondition, other) => {
+ const { app, sModelsId } = this.props;
+ const obj = {};
+ if (commonUtils.isNotEmptyObject(obj)) {
+ obj.sProcedureName = chart.sProcedureName;
+ obj.paramsMap = chart.paramsMap;
+ } else {
+ obj.sProcedureName = 'Sp_Manufacture_GetAPSstate';
+ obj.paramsMap = {
+ };
+ }
+ const value = {
+ sProName: obj.sProcedureName,
+ // sProInParam: obj.paramsMap,
+ bFilter: slaveFilterCondition,
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ bCheckModel: true })
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleCheckModel(chart, slaveFilterCondition, { iFlag: 1 }) });
+ }
+ };
+
+ /* 重算时间调用接口 执行存储过程 */
+ handleChangeTimer1 = async (other) => {
+ const {
+ app, sModelsId, slaveFilterCondition, slaveSelectedRowKeys, slaveData, masterData,
+ } = this.props;
+ let value = {};
+ this.props.onSaveState({
+ loadingTimer: true
+ });
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ const slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) && commonUtils.isEmptyObject(item.sDivRowNew));
+ const minSelectedData = this.arrayMin(slaveSelectedData); /* iOrder最小的 */
+ if (commonUtils.isNotEmptyArr(minSelectedData) && commonUtils.isNotEmptyObject(minSelectedData.sMachineId)) {
+ // addFilter.bFilterName = 'sTeamId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = teamData[0].sId;
+ // filter.push(addFilter);;
+ value = {
+ sProName: 'Sp_Manufacture_SetTime',
+ sProInParam: JSON.stringify({
+ sMachineId: minSelectedData.sMachineId,
+ iOrder: minSelectedData.iOrder,
+ tCStartTime: masterData.tStartDate,
+ sSlaveId: commonUtils.isNotEmptyObject(minSelectedData.sSlaveId) ? minSelectedData.sSlaveId : minSelectedData.sId,
+ }),
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ changeTimerVisible: false, loadingTimer:false })
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleChangeTimer({ iFlag: 1 }) });
+ }
+ } else {
+ message.error('不能重置时间!');
+ this.props.onSaveState({ loadingTimer:false })
+ }
+ } else {
+ message.error('请选择一行数据!');
+ this.props.onSaveState({ loadingTimer:false })
+ }
+ };
+
+
+ /* 重算时间调用接口 执行存储过程 */
+ handleChangeTimer = async (other) => {
+ const {
+ app, sModelsId, slaveFilterCondition, slaveSelectedRowKeys, slaveData, masterData,
+ } = this.props;
+ let value = {};
+ this.props.onSaveState({
+ pageLoading: true
+ });
+ if (commonUtils.isNotEmptyObject(this.treeChild) && commonUtils.isNotEmptyObject(this.treeChild.sMachineId)) {
+ const sMachineId = this.treeChild.sMachineId;
+ const slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) && commonUtils.isEmptyObject(item.sDivRowNew));
+ const minSelectedData = this.arrayMin(slaveSelectedData); /* iOrder最小的 */
+ if (commonUtils.isNotEmptyObject(sMachineId)) {
+ // addFilter.bFilterName = 'sTeamId';
+ // addFilter.bFilterCondition = '=';
+ // addFilter.bFilterValue = teamData[0].sId;
+ // filter.push(addFilter);;
+ value = {
+ sProName: 'Sp_Manufacture_SetTime',
+ sProInParam: JSON.stringify({
+ sMachineId: sMachineId,
+ // iOrder: minSelectedData.iOrder,
+ // tCStartTime: masterData.tStartDate,
+ // sSlaveId: commonUtils.isNotEmptyObject(minSelectedData.sSlaveId) ? minSelectedData.sSlaveId : minSelectedData.sId,
+ }),
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleRefresh(1);
+ this.handleGetTreeData([]);
+ // this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ changeTimerVisible: false, loadingTimer:false })
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleChangeTimer({ iFlag: 1 }) });
+ }
+ } else {
+ message.error('不能重置时间!');
+ this.props.onSaveState({ pageLoading:false })
+ }
+ } else {
+ message.error('请选择左侧机台!');
+ this.props.onSaveState({ pageLoading:false })
+ }
+ };
+
+
+ /* 锁定调用接口 执行存储过程 */
+ handleLock= async (other) => {
+ const {
+ app, sModelsId, slaveFilterCondition, slaveSelectedRowKeys, slaveData, masterData,
+ } = this.props;
+ let value = {};
+ this.props.onSaveState({
+ pageLoading: true
+ });
+ if (commonUtils.isNotEmptyObject(this.treeChild) && commonUtils.isNotEmptyObject(this.treeChild.sMachineId)) {
+ const sMachineId = this.treeChild.sMachineId;
+ const slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) && commonUtils.isEmptyObject(item.sDivRowNew));
+ const minSelectedData = this.arrayMin(slaveSelectedData); /* iOrder最小的 */
+ const sRowData =[];
+ if(commonUtils.isNotEmptyArr(slaveSelectedData)) {
+ slaveSelectedData.forEach((item, index) => {
+ const tableRow = {};
+ tableRow.sId =item.sSlaveId;
+ tableRow.iBtnCd =item.iBtnCd;
+ sRowData.push(tableRow);
+ });
+ }
+ console.log('ssss', sRowData);
+ if (commonUtils.isNotEmptyObject(sMachineId)) {
+ /* 先走保存 */
+ await this.handleValidateSave(true);
+ value = {
+ sProName: 'Sp_productionPlan_BtnEventLockSd',
+ sProInParam: JSON.stringify({
+ sMachineId: sMachineId,
+ sRowData,
+ // iOrder: minSelectedData.iOrder,
+ // tCStartTime: masterData.tStartDate,
+ // sSlaveId: commonUtils.isNotEmptyObject(minSelectedData.sSlaveId) ? minSelectedData.sSlaveId : minSelectedData.sId,
+ }),
+ };
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ changeTimerVisible: false, pageLoading:false })
+ } else {
+ this.props.getServiceError({ ...returnData});
+ this.props.onSaveState({ pageLoading:false })
+ }
+ } else {
+ message.error('请选择左侧机台!');
+ this.props.onSaveState({ pageLoading:false })
+ }
+ } else {
+ message.error('请选择左侧机台!');
+ this.props.onSaveState({ pageLoading:false })
+ }
+ };
+
+
+ /* 超期计算 */
+ handleOverExec= async (other) => {
+ const {
+ app, sModelsId, slaveFilterCondition, slaveSelectedRowKeys, slaveData, masterData,
+ } = this.props;
+ let value = {};
+ this.props.onSaveState({
+ pageLoading: true
+ });
+ let sRowData = [];
+ if (commonUtils.isNotEmptyObject(this.treeChild) && commonUtils.isNotEmptyObject(this.treeChild.sMachineId)) {
+ const sMachineId = this.treeChild.sMachineId;
+ const slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) && commonUtils.isEmptyObject(item.sDivRowNew));
+ const minSelectedData = this.arrayMin(slaveSelectedData); /* iOrder最小的 */
+ if(commonUtils.isNotEmptyArr(slaveSelectedData)) {
+ slaveSelectedData.forEach((item, index) => {
+ const tableRow = {};
+ tableRow.sId =item.sSlaveId;
+ sRowData.push(tableRow);
+ });
+ }
+
+ /* 先走保存 */
+ await this.handleValidateSave(true);
+ value = {
+ sProName: 'Sp_productionPlan_BtnEventCnl',
+ sProInParam: JSON.stringify({
+ sMachineId: sMachineId,
+ sRowData,
+ }),
+ };
+ console.log('sRowData', sRowData);
+ console.log('value', value);
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ // this.handleButtonClick('BtnRefresh');
+ this.handleRefresh(1);
+ this.handleGetTreeData([]);
+ this.props.onSaveState({ pageLoading: false })
+ } else {
+ this.props.getServiceError({ ...returnData});
+ this.props.onSaveState({ pageLoading:false })
+ }
+ } else {
+ message.error('请选择左侧机台!');
+ this.props.onSaveState({ pageLoading:false })
+ }
+ };
+ // 查找数组中最小值
+ arrayMin = (arrs) => {
+ let min = arrs[0];
+ for (let i = 1, ilen = arrs.length; i < ilen; i += 1) {
+ if (arrs[i].iOrder < min.iOrder) {
+ min = arrs[i];
+ }
+ }
+ return min;
+ }
+
+ /*
+ handleRefresh = async () => {
+ const {
+ clearArray, slaveConfig, slaveInfoConfig, teamFilterCondition, slaveFilterCondition,
+ } = this.props;
+ this.props.onSaveState({
+ clearArray: [], searchText: '', teamSelectedData: [], slaveSelectedRowKeys: [], slaveSelectedData: [], slaveInfoSelectedRowKeys: [], slaveInfoSelectedData: [], tableBtnEnabled: true,
+ }); // teamSelectedRowKeys: [],
+ this.handleGetData('slave', slaveConfig, slaveFilterCondition, undefined, '', false, undefined);
+ this.handleGetData('slaveInfo', slaveInfoConfig, slaveFilterCondition, undefined, '', false, undefined);
+
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ this.props.onSaveState({
+ loading: false,
+ });
+ }
+*/
+ // handleRefresh = () => {
+ // this.handleCallBack(this.treeChild);
+ // }
+
+ handleRefresh = (flag) => {
+ this.handleResetSearch(flag);
+ this.handleCallBack(this.treeChild);
+ }
+
+ handleResetSearch = (flag) => {
+ const {
+ clearArray,
+ masterData,
+ } = this.props;
+ let { expKeys } = this.props;
+ if (flag !== 1) { /* flag 不等于1 代表是清空操作 */
+ this.treeChild = {}
+ }
+ /* 清空选择机台信息 */
+ if(commonUtils.isNotEmptyObject(masterData)) {
+ masterData.sMachineId = '';
+ masterData.sMachineName = '';
+ masterData.sWorkCenterId = '';
+ masterData.sWorkCenterName = '';
+ }
+
+ this.props.onSaveState({
+ clearArray: [],
+ searchText: '',
+ teamSelectedData: [],
+ slaveSelectedRowKeys: [],
+ slaveSelectedData: [],
+ slaveInfoData: [], /* 刷新后清除slaveInfoData */
+ slaveInfoSelectedRowKeys: [],
+ slaveInfoSelectedData: [],
+ tableBtnEnabled: true,
+ machineEnabled: false,
+ sortedInfo: {},
+ masterData,
+ });
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ /* 刷新后关闭所有expKeys */
+ expKeys = [];
+ /* 刷新后清除slaveInfoData */
+ this.props.onSaveState({
+ loading: false, expKeys,
+ });
+ }
+
+ handleResetTableSearch = () => {
+ // this.props.onSaveState({ clearArray: [] });
+ this.handleRefresh(1);
+ }
+ // 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
+ handleBtnEent = (btnConfig, btnName, sValue) => {
+ const { masterData } = this.props;
+ const sButtonParam = btnConfig.sButtonParam;
+ const btn = JSON.parse(sButtonParam);
+ const sProName = btn.sproName;
+ const inParams = [];
+ const inMap = btn.inMap;
+ const inlist = inMap.split(',');
+
+ const masterArr = [];
+ const slaveArr = [];
+ const slaveInfoArr = [];
+ const controlArr = [];
+ const materialsArr = [];
+ const processArr = [];
+
+ if (inlist.length > 0) {
+ inlist.forEach((item) => {
+ const itemArr = item.split('.');
+ if (itemArr.length > 0) {
+ const sname = itemArr[0];
+ const stype = itemArr[1];
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'master') {
+ masterArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slave') {
+ slaveArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slaveInfo') {
+ slaveInfoArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'control') {
+ controlArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'materials') {
+ materialsArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'process') {
+ processArr.push(stype);
+ }
+ }
+ });
+
+ if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
+ const addState = {};
+ addState.key = 'master';
+ const val = [];
+ const currVal = {};
+ masterArr.forEach((filed) => {
+ currVal[`${filed}`] = masterData[`${filed}`];
+ });
+ val.push(currVal);
+ addState.value = val;
+ inParams.push({ ...addState });
+ }
+ if (commonUtils.isNotEmptyArr(slaveArr)) {
+ const addState = this.handleProParams('slave', slaveArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
+ const addState = this.handleProParams('slaveInfo', slaveInfoArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(controlArr)) {
+ const addState = this.handleProParams('control', controlArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(materialsArr)) {
+ const addState = this.handleProParams('materials', materialsArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(processArr)) {
+ const addState = this.handleProParams('process', processArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ }
+
+ this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParams, changeValue: sValue }));
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+ // 存储过程按钮调用存储过程
+ handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
+ const { app, sModelsId, sCurrMemoProps } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ /**
+ * 修改日期:2021-03-26
+ * 修改人:吕杰
+ * 区域:以下 2 行
+ * BUG:
+ * 说明:执行完接口调用后关闭弹窗
+ * 原代码:
+ */
+ sCurrMemoProps.bVisibleMemo = false;
+ this.props.onSaveState({ loading: false, sCurrMemoProps });
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
+ }
+ }
+ /* 点击展开图标时,调用接口获取嵌套字表数据 */
+ handleOnExpand = async (expanded, record) => {
+ const { sModelsId, expKeys } = this.props;
+ let { slaveInfoData } = this.props;
+ const { sSlaveId } = record;
+ /* 添加移除展开的sId */
+ let newExp = commonUtils.isNotEmptyArr(expKeys) ? expKeys : [];
+ if (expanded) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ newExp.push(record.sSlaveId);
+ }
+ } else {
+ newExp = newExp.filter(item => item !== record.sSlaveId);
+ }
+ this.props.onSaveState({ expKeys: newExp });
+ let childrenData = [];
+ if (commonUtils.isNotEmptyArr(slaveInfoData) && commonUtils.isNotEmptyObject(sSlaveId)) {
+ childrenData = slaveInfoData.filter(item => sSlaveId.split('-').includes(item.sId));
+ }
+ if (expanded && commonUtils.isEmptyArr(childrenData)) {
+ if (commonUtils.isNotEmptyObject(sSlaveId)) {
+ const planLoadingSate = {};
+ planLoadingSate.sId = sSlaveId;
+ planLoadingSate.planLoading = true;
+ this.props.onSaveState({ planLoadingSate });
+ const { token } = this.props;
+ const url = `${commonConfig.server_host}workOrderPlan/getProductionPlanInfo?sModelsId=${sModelsId}`;
+ const value = { sSlaveId };
+ const dataReturn = (await commonServices.postValueService(token, value, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ childrenData = returnData;
+ if (commonUtils.isEmptyArr(slaveInfoData)) {
+ slaveInfoData = [];
+ }
+ childrenData.forEach((child) => {
+ // const iIndex = slaveInfoData.findIndex(item => item.sId === child.sId);;
+ // if (iIndex === -1) {
+ // slaveInfoData.push(child);
+ // }
+ slaveInfoData.push(child);
+ });
+ }
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({
+ planLoadingSate, slaveInfoData,
+ });
+ } else {
+ this.props.getServiceError(dataReturn);
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({ planLoadingSate });
+ }
+ }
+ }
+ }
+ handlePartNameClick =(sName, showConfig, record) => {
+ if (commonUtils.isNotEmptyObject(sName) && commonUtils.isNotEmptyObject(showConfig) && commonUtils.isNotEmptyObject(record)) {
+ this.props.onSaveState({
+ workScheduleConfig: showConfig, workScheduleRecord: record, workScheduleVisible: true,
+ });
+ }
+ }
+ handleCloseModel = (modelVisible) => {
+ this.props.onSaveState({ [modelVisible]: false });
+ };
+ render() {
+ const { masterData } = this.props;
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonProductionmMainPlanEvent.js b/src/components/Common/CommonProductionmMainPlanEvent.js
new file mode 100644
index 0000000..a477b4b
--- /dev/null
+++ b/src/components/Common/CommonProductionmMainPlanEvent.js
@@ -0,0 +1,1152 @@
+/* eslint-disable */
+/* eslint-disable prefer-destructuring,no-await-in-loop,no-unused-vars */
+import React, { Component } from 'react';
+import { message } from 'antd'; // InputNumber Form, Modal,
+import * as commonUtils from '../../utils/utils'; /* 通用方法 */
+import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */
+import * as commonServices from '../../services/services'; /* 服务类 */
+import commonConfig from '../../utils/config';
+import * as commonFunc from './commonFunc'; /* 通用单据方法 */
+
+// const { confirm } = Modal;
+// const FormItem = Form.Item;
+// const InputNumberA = reactComponentDebounce(800)(InputNumber);
+
+export default (ChildComponent) => {
+ return class extends Component {
+ constructor(props) {
+ super(props);
+ this.form = {}; /* 表单对象 */
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ formData, workCenterData, machineData, searchSolution, masterData,
+ } = nextProps;
+ let {
+ masterConfig, isReceive,
+ } = nextProps;
+ if (formData.length > 0 && commonUtils.isEmptyObject(masterConfig) && searchSolution !== undefined) {
+ isReceive = false;
+ masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'mftproductionplan')[0];
+ const slaveConfig = formData.filter(item => item.bGrd && item.sTbName === 'mftproductionplan')[0];
+ const slaveInfoConfig = formData.filter(item => item.sTbName === 'Sp_productionplan_ControlProcess')[0];
+ const slaveColumn = commonFunc.getHeaderConfig(slaveConfig);
+ const slaveInfoColumn = commonFunc.getHeaderConfig(slaveInfoConfig);
+ const iPageSize = commonUtils.isNotEmptyObject(slaveConfig) && commonUtils.isNotEmptyNumber(slaveConfig.iPageSize) && slaveConfig.iPageSize !== 0 ?
+ slaveConfig.iPageSize : commonConfig.pageSize;
+ let filterCondition = [];
+ if (commonUtils.isNotEmptyObject(masterData) && !commonUtils.isEmpty(masterData.sSearchSolutionId) && commonUtils.isNotEmptyArr(searchSolution)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1 && !commonUtils.isEmpty(searchSolution[iIndex].sCondition)) {
+ filterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ }
+ }
+ this.handleGetData('slave', slaveConfig, filterCondition, undefined, undefined, false, undefined, nextProps);
+ // this.handleGetData('slaveInfo', slaveInfoConfig, filterCondition, undefined, undefined, false, undefined, nextProps);
+ this.handleGetProdData('workCenter', 'Sp_Productionplan_Pie_Char', {});
+ this.props.onSaveState({
+ masterConfig,
+ slaveConfig,
+ slaveColumn,
+ slaveInfoConfig,
+ slaveInfoColumn,
+ filterCondition,
+ enabled: true,
+ pageLoading: false,
+ moveEnabled: false,
+ tableBtnEnabled: true,
+ bGantt:false,
+ isReceive,
+ iPageSize,
+ });
+ } else if (commonUtils.isNotEmptyArr(workCenterData) && commonUtils.isEmptyObject(machineData) && !isReceive) {
+ const addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = workCenterData[0].sWorkCenterId;
+ const filterArr = [];
+ filterArr.push(addFilter);
+ // { bFilter: JSON.stringify(filterArr) }{ bFilter: JSON.stringify(filterArr) };
+ this.handleGetProdData('machine', 'Sp_Productionplan_sColumnarStack_Char', { bFilter: JSON.stringify(filterArr) });
+ this.props.onSaveState({
+ workCenterSelectedRowKeys: [workCenterData[0].sWorkCenterId ? workCenterData[0].sWorkCenterId : workCenterData[1].sWorkCenterId], isReceive: true,
+ });
+ // for (let i = 0; i < workCenterData.length; i += 1) {
+ // if (workCenterData[i].sWorkCenterId) {
+ // this.props.onSaveState({
+ // workCenterSelectedRowKeys: [workCenterData[i].sWorkCenterId ? workCenterData[0].sWorkCenterId : workCenterData[1].sWorkCenterId], isReceive: true,
+ // });
+ // break;
+ // }
+ // }
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const { slaveColumn } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn);
+ }
+ componentDidUpdate(prevProps) {
+ const {
+ slaveSelectedRowKeys, moveEnabled, tableBtnEnabled,
+ } = prevProps;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && !moveEnabled && tableBtnEnabled) {
+ this.props.onSaveState({ moveEnabled: true });
+ } else if ((commonUtils.isEmptyArr(slaveSelectedRowKeys) && moveEnabled && tableBtnEnabled) || (moveEnabled && !tableBtnEnabled)) {
+ this.props.onSaveState({ moveEnabled: false });
+ }
+ }
+ /** 获取表数据 */
+ handleGetData = async (sName, slaveConfig, slaveFiletrCondition, page, slaveOrderBy, clearSelectData, sGroupByListNew, nextProps, isWait) => {
+ const { app } = commonUtils.isEmpty(nextProps) ? this.props : nextProps;
+ const sGroupByList = sGroupByListNew !== undefined ? commonUtils.isEmptyArr(sGroupByListNew) ? null : sGroupByListNew : this.props.sGroupByList;
+ const conditonValues = app.currentPane.conditonValues;
+ const filterCondition = app.currentPane.filterCondition;
+ const bFilter = [];
+ if (!commonUtils.isEmptyArr(slaveFiletrCondition)) {
+ bFilter.push(...slaveFiletrCondition);
+ }
+ if (!commonUtils.isEmptyArr(filterCondition)) {
+ bFilter.push(...filterCondition);
+ }
+
+ const addState = {};
+ const pageNum = commonUtils.isEmpty(page) ? 1 : page;
+ addState.pageNum = pageNum;
+ addState.pageSize = '';
+ const returnData = await this.props.handleGetDataSet({
+ name: sName,
+ configData: slaveConfig,
+ condition: {
+ bFilter, sFilterOrderBy: slaveOrderBy, sSqlCondition: conditonValues, sGroupList: sGroupByList, ...addState,
+ },
+ flag: true,
+ clearSelectData,
+ isWait,
+ });
+ if (isWait) {
+ return { ...returnData };
+ }
+ };
+
+ // 搜索 查询
+ handleGetSearchData = async (name, slaveConfig, filterCondition) => {
+ // 搜索时将数据变动置空,按钮全部读取配置
+ this.props.onSaveState({ pageLoading: true, dataChanged: undefined });
+ const addState = await this.handleGetData(name, slaveConfig, filterCondition, undefined, undefined, false, undefined, this.props, true);
+ if (addState === undefined) return;
+ this.props.onSaveState({ ...addState, pageLoading: false });
+ };
+
+ // handlePaginationChange = (page) => {
+ // const { slaveConfig, slaveFilterCondition, slaveOrderBy } = this.props;
+ // this.props.handleGetDataSet({
+ // name: 'slave',
+ // configData: slaveConfig,
+ // condition: {
+ // pageNum: page, pageSize: commonConfig.pageSize, bFilter: slaveFilterCondition, sFilterOrderBy: slaveOrderBy,
+ // },
+ // });
+ // };
+
+ /** 主表控件是否全部显示 */
+ handleToggle = () => {
+ const { expand } = this.props;
+ this.props.onSaveState({ expand: !expand });
+ };
+
+ /** 表单回带 */
+ handleForm = (form) => {
+ this.form = form;
+ };
+
+ handleGetProdData = async (sName, prodName, prodParamsMap, rtFlage) => {
+ const { app, sModelsId } = this.props;
+ const value = { sProName: prodName, paramsMap: prodParamsMap };
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ } else {
+ const proData = returnData.dataset.rows[0].dataSet.proData;
+ const xyData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ if (rtFlage) {
+ return { [`${sName}Data`]: proData, [`${sName}CharData`]: xyData };
+ } else {
+ this.props.onSaveState({ [`${sName}Data`]: proData, [`${sName}CharData`]: xyData });
+ }
+ }
+ } else {
+ this.props.getServiceError(returnData);
+ }
+ };
+ /** toolbar保存 */
+ handleSaveData = async (params) => {
+ const {
+ token, sModelsId, app, slaveSelectedRowKeys,
+ } = this.props;
+ const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
+ if (commonUtils.isNotEmptyObject(returnData)) {
+ this.handleRefresh();
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_productionMainPlan_BtnPost',
+ paramsMap: {
+ sProInParam: JSON.stringify({ params: { key: 'slaveInfo', value: { sId: slaveSelectedRowKeys } } }),
+ },
+ };
+ const returnDataPost = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnDataPost.code === 1) {
+ const outData = returnDataPost.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ return false;
+ }
+ } else {
+ this.props.getServiceError(returnDataPost);
+ return false;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /** 保存校验 */
+ handleValidateSave = () => {
+ this.form.validateFields((err) => {
+ /* 验证通过与不通过走不同的流程 */
+ if (err) { /* 验证失败 */
+ /* 直接渲染显示错误提示 */
+ for (const key of Object.keys(err)) {
+ message.error(err[key].errors[0].message);
+ }
+ } else { /* 验证成功 */
+ const {
+ slaveConfig, slaveData, slaveDelData, slaveInfoConfig, slaveInfoData, slaveInfoDelData, app, slaveInfoForSaveConfig,
+ } = this.props;
+ if (commonUtils.isEmptyArr(slaveData)) {
+ message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空!
+ this.props.onSaveState({
+ loading: false,
+ });
+ return;
+ }
+ if (!commonBusiness.validateTable(slaveConfig, slaveData)) {
+ this.props.onSaveState({
+ loading: false,
+ });
+ return;
+ }
+ // if (commonUtils.isEmptyArr(slaveInfoData)) {
+ // message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空!
+ // this.props.onSaveState({
+ // loading: false,
+ // });
+ // return;
+ // }
+ // if (!commonBusiness.validateTable(slaveInfoConfig, slaveInfoData)) {
+ // this.props.onSaveState({
+ // loading: false,
+ // });
+ // return;
+ // }
+ const data = [];
+ data.push(commonBusiness.mergeData('slave', slaveConfig.sTbName, slaveData, slaveDelData));
+ data.push(commonBusiness.mergeData('slaveInfo', 'mftworkorderprocess', slaveInfoData, slaveInfoDelData));
+ this.handleSaveData({ data, sClientType: '1' });
+ }
+ });
+ };
+
+ /** 表格数据更改 */
+ // name 不写完整的state名称作用为了要用到total // (name, changeValue, sId, dropDownData)
+ handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ // 埋入数据修监听点
+ this.props.onSaveState({
+ dataChanged: true,
+ });
+ this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, false);
+ };
+ // 打印
+ handleBtnPrint = (sActiveId, checked) => {
+ const {
+ app, sModelsId, slaveConfig, slaveSelectedRowKeys, slaveFilterCondition, reportData,
+ } = this.props;
+ const { token } = app;
+ const newfilterCondition = slaveFilterCondition === undefined ? [] : [...slaveFilterCondition];
+
+ let sids = '';
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ if (sids !== '') {
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sids;
+ newfilterCondition.push(addFilter);
+ }
+
+ const queryFilter = {};
+ queryFilter[slaveConfig.sId] = { bFilter: newfilterCondition };
+ const queryFilterJson = encodeURIComponent(JSON.stringify(queryFilter));
+ /* 拿到打印报表名称 */
+ let printReportName = 'report';
+ if (commonUtils.isNotEmptyArr(reportData)) {
+ const iIndex = reportData.findIndex(item => item.sId === sActiveId);
+ if (iIndex > -1) {
+ printReportName = reportData[iIndex].sReportName;
+ }
+ }
+ const urlPrint = `${commonConfig.file_host}printReport/printPdf/${sActiveId}/${printReportName}.pdf?${checked ? 'fileType=.xlsx&' : ''}queryFilter=${queryFilterJson}&sModelsId=${sModelsId}&sMaintableId=${slaveConfig.sId}&token=${encodeURIComponent(token)}`;
+ window.open(urlPrint);
+ };
+ /* 导出Excel */
+ handleOut = () => {
+ const {
+ slaveConfig, sFilterOrderBy, slaveSelectedRowKeys, slaveFilterCondition, sGroupByList,
+ } = this.props;
+
+ const newfilterCondition = slaveFilterCondition === undefined ? [] : slaveFilterCondition;
+
+ let sids = '';
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ slaveSelectedRowKeys.forEach((item, i) => {
+ if (i === slaveSelectedRowKeys.length - 1) {
+ sids = `${sids}${item}`;
+ } else {
+ sids = `${sids}${item},`;
+ }
+ });
+ const addFilter = {};
+ addFilter.bFilterName = 'sId';
+ addFilter.bFilterCondition = 'in';
+ addFilter.bFilterValue = sids;
+ newfilterCondition.push(addFilter);
+ }
+ let url = `${commonConfig.server_host}excel/export/${slaveConfig.sId}?sModelsId=${slaveConfig.sParentId}&token=${this.props.app.token}`;
+ if (commonUtils.isNotEmptyArr(newfilterCondition)) {
+ url = `${url}&bFilter=${encodeURIComponent(JSON.stringify(newfilterCondition))}`;
+ }
+ if (sFilterOrderBy !== undefined && sFilterOrderBy !== '' && Object.keys(sFilterOrderBy).length > 0) {
+ url = `${url}&sFilterOrderBy=${encodeURIComponent(JSON.stringify(sFilterOrderBy))}`;
+ }
+ if (commonUtils.isNotEmptyArr(sGroupByList)) {
+ url = `${url}&sGroupList=${encodeURIComponent(JSON.stringify(sGroupByList))}`;
+ }
+ window.open(url);
+ };
+ handleConfirmDataChange = (value) => {
+ const {
+ masterData,
+ } = this.props;
+ masterData.dOutsideQty = value;
+
+ this.props.onSaveState({ masterData });
+ };
+ // 按钮操作
+ handleButtonClick = (itag) => {
+ if (itag === 'BtnUnifiedPlanning') {
+ let unifiedPlanningConfig = {};
+ const iIndex = this.props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === itag);
+ if (iIndex > -1) {
+ unifiedPlanningConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
+ this.handleBtnChoose('unifiedPlanning', 'BtnUnifiedPlanning', unifiedPlanningConfig);
+ }
+ } else if (itag === 'BtnRefresh') {
+ this.handleRefresh();
+ } else if (itag === 'BtnOut') {
+ this.handleOut();
+ } else if (itag === 'BtnDesignFunction') {
+ this.handleDesignFunction();
+ }
+ this.handleGetProdData('workCenter', 'Sp_Productionplan_Pie_Char', {});
+ const { workCenterSelectedRowKeys, workCenterData } = this.props;
+ if (commonUtils.isNotEmptyArr(workCenterData)) {
+ const addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = commonUtils.isEmpty(workCenterSelectedRowKeys) ? workCenterData[0].sWorkCenterId : workCenterSelectedRowKeys;
+ const filterArr = [addFilter];
+ this.handleGetProdData('machine', 'Sp_Productionplan_sColumnarStack_Char', { bFilter: JSON.stringify(filterArr) });
+ }
+ };
+
+ handleDesignFunction = () => {
+ this.props.onSaveState({ visibleStatement: true });
+ };
+
+ handleBtnChoose = async (name, sControlName, chooseConfig) => {
+ const { token } = this.props;
+ const url = `${commonConfig.server_host}/gdsmodule/getGdsmoduleById/${chooseConfig.sActiveId}?sModelsId=${chooseConfig.sActiveId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ if (dataReturn.code === 1) {
+ const [returnData] = dataReturn.dataset.rows;
+ this.props.onSaveState({ [`${name}ChooseVisible`]: true, [`${name}ChooseData`]: returnData, [`${name}Config`]: chooseConfig });
+ } else {
+ this.props.getServiceError(dataReturn);
+ }
+ };
+ /** 处理选择行发生改变 */
+ handleTableSelectRowChange = (name, selectedRowKeys) => {
+ /* 外置处理业务 */
+ const { slaveInfoData } = this.props;
+ const addState = {};
+ const slaveInfoSelectedRowKeys = [];
+ if (name === 'slave') {
+ // selectedRowKeys.includes(item)
+ const slaveInfoselectData = slaveInfoData.filter(item => selectedRowKeys.includes(item.sId));
+ if (slaveInfoselectData.length > 0) {
+ slaveInfoselectData.forEach((item) => {
+ slaveInfoSelectedRowKeys.push(item.sSlaveId);
+ });
+ }
+ addState.enabled = true;
+ addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
+ } else if (name === 'slaveInfo') {
+ addState.enabled = true;
+ addState.slaveSelectedRowKeys = [];
+ }
+ this.props.onSaveState({
+ [`${name}SelectedRowKeys`]: selectedRowKeys, searchUpDownData: {}, ...addState,
+ });
+ };
+
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
+ if (isWait) {
+ return this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ } else {
+ this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, isWait);
+ }
+ };
+
+ handleSwitchChange = (value) => {
+ this.props.onSaveState({ dragAndDropSwitch: value });
+ };
+
+ // 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
+ // handleBtnEent = async (btnConfig) => {
+ // const { masterData } = this.props;
+ // const sButtonParam = btnConfig.sButtonParam;
+ // // const sButtonParam = '{"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}';
+ // const btn = JSON.parse(sButtonParam);
+ // const sProName = btn.sproName;
+ // const inParams = [];
+ // const inMap = btn.inMap;
+ // const inlist = inMap.split(',');
+ //
+ // const masterArr = [];
+ // const slaveArr = [];
+ // const slaveInfoArr = [];
+ // const controlArr = [];
+ // const materialsArr = [];
+ // const processArr = [];
+ //
+ // if (inlist.length > 0) {
+ // inlist.forEach((item) => {
+ // const itemArr = item.split('.');
+ // if (itemArr.length > 0) {
+ // const sname = itemArr[0];
+ // const stype = itemArr[1];
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'master') {
+ // masterArr.push(stype);
+ // }
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'slave') {
+ // slaveArr.push(stype);
+ // }
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'slaveInfo') {
+ // slaveInfoArr.push(stype);
+ // }
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'control') {
+ // controlArr.push(stype);
+ // }
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'materials') {
+ // materialsArr.push(stype);
+ // }
+ // if (commonUtils.isNotEmptyStr(sname) && sname === 'process') {
+ // processArr.push(stype);
+ // }
+ // }
+ // });
+ //
+ // if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
+ // const addState = {};
+ // addState.key = 'master';
+ // const val = [];
+ // const currVal = {};
+ // masterArr.forEach((filed) => {
+ // currVal[`${filed}`] = masterData[`${filed}`];
+ // });
+ // val.push(currVal);
+ // addState.value = val;
+ // inParams.push({ ...addState });
+ // }
+ // if (commonUtils.isNotEmptyArr(slaveArr)) {
+ // const addState = this.handleProParams('slave', slaveArr);
+ // if (commonUtils.isNotEmptyObject(addState)) {
+ // inParams.push({ ...addState });
+ // }
+ // }
+ // if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
+ // const addState = this.handleProParams('slaveInfo', slaveInfoArr);
+ // if (commonUtils.isNotEmptyObject(addState)) {
+ // inParams.push({ ...addState });
+ // }
+ // }
+ // if (commonUtils.isNotEmptyArr(controlArr)) {
+ // const addState = this.handleProParams('control', controlArr);
+ // if (commonUtils.isNotEmptyObject(addState)) {
+ // inParams.push({ ...addState });
+ // }
+ // }
+ // if (commonUtils.isNotEmptyArr(materialsArr)) {
+ // const addState = this.handleProParams('materials', materialsArr);
+ // if (commonUtils.isNotEmptyObject(addState)) {
+ // inParams.push({ ...addState });
+ // }
+ // }
+ // if (commonUtils.isNotEmptyArr(processArr)) {
+ // const addState = this.handleProParams('process', processArr);
+ // if (commonUtils.isNotEmptyObject(addState)) {
+ // inParams.push({ ...addState });
+ // }
+ // }
+ // }
+ // this.handleProcedureCall(sProName, JSON.stringify({ params: inParams }));
+ // };
+ // // 根据配置解析拼接具体参数
+ // handleProParams = (sKey, arr) => {
+ // const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ // const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ // if (commonUtils.isNotEmptyArr(keyData)) {
+ // const addState = {};
+ // addState.key = sKey;
+ // const val = [];
+ // keyData.forEach((currData) => {
+ // const currVal = {};
+ // arr.forEach((filed) => {
+ // currVal[`${filed}`] = currData[`${filed}`];
+ // });
+ // val.push(currVal);
+ // });
+ // addState.value = val;
+ // return addState;
+ // } else {
+ // return undefined;
+ // }
+ // };
+ // // 存储过程按钮调用存储过程
+ // handleProcedureCall = async (proName, proInParam) => {
+ // const { app, sModelsId } = this.props;
+ // const value = { sProName: proName, sProInParam: proInParam };
+ // const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ // const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ // if (returnData.code === 1) {
+ // this.handleRefresh();
+ // } else {
+ // this.props.getServiceError(returnData);
+ // }
+ // }
+ handleChartClick = (chartName, data) => {
+ const {
+ dispatch, masterConfig, workCenterSelectedRowKeys, machineCharData, bProductionPlanOutside,
+ } = this.props;
+ if (bProductionPlanOutside) { /* 跳转到发外排程 */
+ const filterData = masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes('JumpTo.chartOutside'));
+ const sActiveId = filterData[0].sActiveId;
+ const filterArr = [];
+ const otherConditionArr = [];
+ if (commonUtils.isNotEmptyArr(filterData)) {
+ dispatch({
+ type: 'content/onRouter',
+ payload: {
+ url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`, /* 接口地址 */
+ filterCondition: filterArr,
+ otherCondition: otherConditionArr,
+ },
+ });
+ }
+ } else { /* 跳转到生产排程 */
+ const sMachineName = data[machineCharData.xName];
+ let { sActiveId } = masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes(chartName))[0];
+ sActiveId = sActiveId === '1' ? commonUtils.isEmpty(data.sFormId) ? data.sSrcFormId : data.sFormId : sActiveId;
+ const filterArr = [];
+ filterArr.push({ bFilterName: 'sWorkCenterId', bFilterCondition: '=', bFilterValue: workCenterSelectedRowKeys[0] });
+ const otherConditionArr = [];
+ otherConditionArr.push({ bFilterName: 'sMachineId', bFilterCondition: '=', bFilterValue: data[`sMachineId${sMachineName}`] });
+ const treeKey = data[`sMachineId${sMachineName}`] + workCenterSelectedRowKeys[0];
+ const sWorkCenterName = this.props.workCenterData.filter(o => o.sWorkCenterId === workCenterSelectedRowKeys[0])[0].sWorkCenterName;
+ dispatch({
+ type: 'content/onRouter',
+ payload: {
+ url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`, /* 接口地址 */
+ filterCondition: filterArr,
+ otherCondition: otherConditionArr,
+ copyTo: {
+ treeKey,
+ sWorkCenterName: sWorkCenterName
+ }
+ },
+ });
+ }
+ };
+ handleRefresh = () => {
+ const {
+ slaveConfig, slaveInfoConfig, slaveFilterCondition, slaveInfoFilterCondition,
+ } = this.props;
+ const { expKeys } = this.props;
+ this.props.onSaveState({
+ sortedInfo: {}, clearArray: [], searchText: '', slaveSelectedRowKeys: [], slaveSelectedData: [], slaveInfoSelectedRowKeys: [], slaveInfoSelectedData: [], tableBtnEnabled: true,
+ });
+ console.log('回刷', 1111);
+ this.handleGetData('slave', slaveConfig, slaveFilterCondition, undefined, undefined, true, undefined, this.props).finally(() => {
+ /* 刷新后关闭所有expKeys */
+ // expKeys = [];
+ this.props.onSaveState({
+ loading: false,
+ expKeys: [],
+ slaveInfoData: [],
+ });
+ });
+ // this.handleGetData('slaveInfo', slaveInfoConfig, slaveInfoFilterCondition, undefined, undefined, true, undefined, this.props);
+ const { clearArray } = this.props;
+ if (!commonUtils.isEmpty(clearArray)) {
+ for (const item of clearArray) {
+ const { confirm, clearFilters } = item;
+ confirm();
+ clearFilters();
+ }
+ }
+ /* 刷新后关闭所有expKeys */
+ // expKeys = [];
+ this.props.onSaveState({
+ expKeys,
+ });
+ }
+
+ /* 导出Excel */
+ // handleOut = () => {
+ // const {
+ // slaveConfig, slaveFilterCondition, slaveOrderBy, sGroupByList,
+ // } = this.props;
+ // let url = `${commonConfig.server_host}excel/export/${slaveConfig.sId}?sModelsId=${slaveConfig.sParentId}&token=${this.props.app.token}`;
+ // if (commonUtils.isNotEmptyArr(slaveFilterCondition)) {
+ // url = `${url}&bFilter=${encodeURIComponent(JSON.stringify(slaveFilterCondition))}`;
+ // }
+ // if (slaveOrderBy !== undefined && slaveOrderBy !== '' && Object.keys(slaveOrderBy).length > 0) {
+ // url = `${url}&sFilterOrderBy=${encodeURIComponent(JSON.stringify(slaveOrderBy))}`;
+ // }
+ // if (commonUtils.isNotEmptyArr(sGroupByList)) {
+ // url = `${url}&sGroupList=${encodeURIComponent(JSON.stringify(sGroupByList))}`;
+ // }
+ // window.open(url);
+ // };
+ handleTitleChange = async (name, slavePagination, filters, sorter, extra) => {
+ // 点击分页的时候不需要埋点 current
+ let dataChanged = false;
+ if (
+ (slavePagination.total === this.props.slavePagination.total)
+ &&
+ (slavePagination.current === this.props.slavePagination.current)
+ &&
+ (slavePagination.pageSize === this.props.slavePagination.pageSize)
+ ) {
+ // 埋入数据修监听点
+ dataChanged = true;
+ }
+ // this.props.onSaveState({
+ // pageLoading: true, //tableBtnEnabled: false,
+ // });
+ const tableBtnEnabled = commonUtils.isEmptyObject(filters) && commonUtils.isEmptyObject(sorter);
+ const addState = {}; // 搜索时不能使用排序保存,否则数据会出不来。
+ if (commonUtils.isNotEmptyObject(sorter)) {
+ const slaveData = [];
+ // 排序后,取新数据保存
+ extra.currentDataSource.forEach((item, iIndex) => {
+ const slaveTableRow = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ slaveData.push(slaveTableRow);
+ });
+ if (slaveData.length === this.props.slaveData.length) {
+ addState.slaveData = slaveData;
+ }
+ }
+ // const { [`${name}Config`]: tableConfig, [`${name}FilterCondition`]: tableFilterCondition, sGroupByList } = this.props;
+ // const sort = sorter.order === 'ascend' ? 'asc' : 'desc';
+ // const slaveOrderBy = Object.keys(sorter).length > 0 ? { [sorter.columnKey]: sort } : ''; // 后端未支持空对象, 先用空表示
+ // const addState = await this.handleGetData(name, tableConfig, tableFilterCondition, undefined, slaveOrderBy, '', sGroupByList, this.props, true);
+ // if (addState === undefined) return;
+ // const { [`${name}Data`]: tempData } = addState;
+ // if (commonUtils.isNotEmptyArr(addState[`${name}Data`])) {
+ // addState[`${name}Data`].forEach((item, iIndex) => {
+ // addState[`${name}Data`][iIndex] = { ...item, iOrder: iIndex + 1, handleType: 'update' };
+ // });
+ // }
+ this.props.onSaveState({
+ ...addState, slavePagination, pageLoading: false, tableBtnEnabled, dataChanged,
+ });
+ };
+
+ handleSelectCancel = () => {
+ this.props.onSaveState({ unifiedPlanningChooseVisible: false });
+ }
+ // 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
+ handleBtnEent = (btnConfig) => {
+ const { masterData } = this.props;
+ const sButtonParam = btnConfig.sButtonParam;
+ const btn = JSON.parse(sButtonParam);
+ const sProName = btn.sproName;
+ const inParams = [];
+ const inMap = btn.inMap;
+ const inlist = inMap.split(',');
+
+ const masterArr = [];
+ const slaveArr = [];
+ const slaveInfoArr = [];
+ const controlArr = [];
+ const materialsArr = [];
+ const processArr = [];
+
+ if (inlist.length > 0) {
+ inlist.forEach((item) => {
+ const itemArr = item.split('.');
+ if (itemArr.length > 0) {
+ const sname = itemArr[0];
+ const stype = itemArr[1];
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'master') {
+ masterArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slave') {
+ slaveArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'slaveInfo') {
+ slaveInfoArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'control') {
+ controlArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'materials') {
+ materialsArr.push(stype);
+ }
+ if (commonUtils.isNotEmptyStr(sname) && sname === 'process') {
+ processArr.push(stype);
+ }
+ }
+ });
+
+ if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
+ const addState = {};
+ addState.key = 'master';
+ const val = [];
+ const currVal = {};
+ masterArr.forEach((filed) => {
+ currVal[`${filed}`] = masterData[`${filed}`];
+ });
+ val.push(currVal);
+ addState.value = val;
+ inParams.push({ ...addState });
+ }
+ if (commonUtils.isNotEmptyArr(slaveArr)) {
+ const addState = this.handleProParams('slave', slaveArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
+ const addState = this.handleProParams('slaveInfo', slaveInfoArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(controlArr)) {
+ const addState = this.handleProParams('control', controlArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(materialsArr)) {
+ const addState = this.handleProParams('materials', materialsArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(processArr)) {
+ const addState = this.handleProParams('process', processArr);
+ if (commonUtils.isNotEmptyObject(addState)) {
+ inParams.push({ ...addState });
+ }
+ }
+ }
+
+ this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParams }));
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+ // 存储过程按钮调用存储过程
+ handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
+ const { app, sModelsId } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ } else {
+ this.props.onSaveState({ loading: false });
+ this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
+ }
+ }
+ /* 点击展开图标时,调用接口获取嵌套字表数据 */
+ handleOnExpand = async (expanded, record) => {
+ const { sModelsId, expKeys } = this.props;
+ let { slaveInfoData } = this.props;
+ const { sId } = record;
+ const sProductionPlanId = sId;
+ /* 添加移除展开的sId */
+ let newExp = commonUtils.isNotEmptyArr(expKeys) ? expKeys : [];
+ if (expanded) {
+ newExp.push(record.sId);
+ } else {
+ newExp = newExp.filter(item => item !== record.sId);
+ }
+ this.props.onSaveState({ expKeys: newExp });
+ let childrenData = [];
+ /* 查看是否已经获取到明细表数据 */
+ // if (commonUtils.isNotEmptyArr(slaveInfoData)) {
+ // childrenData = slaveInfoData.filter(item => item.sProductionPlanId === sProductionPlanId);
+ // }
+ if (expanded && commonUtils.isEmptyArr(childrenData)) {
+ if (commonUtils.isNotEmptyObject(sProductionPlanId)) {
+ const planLoadingSate = {};
+ planLoadingSate.sId = sProductionPlanId;
+ planLoadingSate.planLoading = true;
+ this.props.onSaveState({ planLoadingSate });
+ const { token } = this.props;
+ const url = `${commonConfig.server_host}workOrderPlan/getControlProcess/${sProductionPlanId}?sModelsId=${sModelsId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyArr(returnData)) {
+ childrenData = returnData;
+ if (commonUtils.isEmptyArr(slaveInfoData)) {
+ slaveInfoData = [];
+ }
+ childrenData.forEach((child) => {
+ const iIndex = slaveInfoData.findIndex(item => item.sId === child.sId);
+ if (iIndex === -1) {
+ slaveInfoData.push(child);
+ }
+ });
+ }
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({
+ planLoadingSate, slaveInfoData,
+ });
+ } else {
+ this.props.getServiceError(dataReturn);
+ planLoadingSate.planLoading = false;
+ this.props.onSaveState({ planLoadingSate });
+ }
+ }
+ }
+ }
+
+ handleViewClick = (name, sName, record, index, myConfig) => {
+ /* 生产主计划点击机台跳转到生产排程 */
+ if (sName === 'sMachineName') {
+ const { slaveInfoConfig, dispatch } = this.props;
+ const { sMachineName, sMachineId, sWorkCenterId } = record;
+ const filterData = slaveInfoConfig.gdsconfigformslave.filter(item => item.sName === 'sMachineName');
+ if (commonUtils.isNotEmptyArr(filterData)) {
+ let { sActiveId } = filterData[0];
+ sActiveId = sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : sActiveId;
+ const filterArr = [];
+ filterArr.push({ bFilterName: 'sWorkCenterId', bFilterCondition: '=', bFilterValue: sWorkCenterId });
+ const otherConditionArr = [];
+ otherConditionArr.push({ bFilterName: 'sMachineId', bFilterCondition: '=', bFilterValue: sMachineId });
+ // filterArr.push({ bFilterName: 'sMachineId', bFilterCondition: '=', bFilterValue: sMachineId });
+ const treeKey = record.sMachineId + record.sWorkCenterId;
+ const sWorkCenterName = record.sWorkCenterName;
+ console.log(record, 'record');
+
+ dispatch({
+ type: 'content/onRouter',
+ payload: {
+ url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}`, /* 接口地址 */
+ filterCondition: filterArr,
+ otherCondition: otherConditionArr,
+ copyTo: {
+ treeKey,
+ sWorkCenterName: sWorkCenterName,
+ sWorkOrderProcessId: record.sWorkOrderProcessId
+ }
+ },
+ });
+ }
+ } else if (sName === 'myTableConfig') {
+ this.handleQuickViewClick(name, sName, record, index, myConfig);
+ } else {
+ this.props.onViewClick(name, sName, record, index);
+ }
+ }
+ /* 获取表格数据 */
+ handleGetTableConfig = async (name, sModelsId) => {
+ if(commonUtils.isNotEmptyObject(sModelsId)) {
+ const newConfig = await this.props.onGetTableConfig(name, sModelsId);
+ if(commonUtils.isNotEmptyObject(newConfig)) {
+ const newColumn = commonFunc.getHeaderConfig(newConfig);
+ this.props.onSaveState({[`${[name]}Config`]: newConfig, [`${[name]}Column`]: newColumn })
+ }
+ }
+ }
+ /* 获取表格数据 */
+ handleGetTableConfig = async (name, sModelsId) => {
+ if(commonUtils.isNotEmptyObject(sModelsId)) {
+ const newConfig = await this.props.onGetTableConfig(name, sModelsId);
+ if(commonUtils.isNotEmptyObject(newConfig)) {
+ const newColumn = commonFunc.getHeaderConfig(newConfig);
+ this.props.onSaveState({[`${[name]}Config`]: newConfig, [`${[name]}Column`]: newColumn })
+ }
+ }
+ }
+ /* 快捷键跳转 */
+ handleQuickViewClick = async (name, sName, record, index , myConfigArr) => {
+ const {
+ slaveConfig,
+ slaveData,
+ dispatch,
+ slaveFilterCondition,
+ slavePagination,
+ slaveOrderBy,
+ sModelsType,
+ formRoute,
+ treeFilterCondition,
+ app,
+ iPageSize,
+ sModelsId,
+ // slaveSelectedData,
+ // masterData,
+ // employeeConfig,
+ } = this.props;
+ console.log('myConfigArr',myConfigArr)
+ let picArr = [];
+ if(commonUtils.isNotEmptyArr(myConfigArr)) {
+ picArr = myConfigArr;
+ }
+
+ if (picArr.length > 0) {
+ const getConfig = this.handleGetTableConfig;
+ const tableDataRow = record;
+ const iIndex = index;
+ const [{ sActiveId }] = picArr;
+ let [{ sActiveKey }] = picArr;
+ const sFormId = sActiveId === '1' ? commonUtils.isEmpty(tableDataRow.sFormId) ? tableDataRow.sSrcFormId : tableDataRow.sFormId : sActiveId;
+ if (commonUtils.isNotEmptyObject(sActiveKey) && sActiveKey.includes('.')) { /* 接口按钮跳转 如果有slave.对应字段 则需要取出对应字段 */
+ const index = sActiveKey.lastIndexOf('.');
+ sActiveKey = sActiveKey.substring(index + 1, sActiveKey.length);
+ }
+ const sNameUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}&sName=${formRoute}`;
+ const filterCondition = [];
+ const conditionValues = this.props.getSqlCondition(picArr[0], name, tableDataRow);
+ if (!commonUtils.isEmpty(conditionValues)) {
+ Object.keys(conditionValues).forEach((item) => {
+ if ((item === 'tStartDate_pro' || item.substring(0, 1) === 'p')) {
+ if (!commonUtils.isEmpty(conditionValues[item]) && conditionValues[item].length >= 2) {
+ const tStartDate = moment(conditionValues[item][0]).format(this.sDateFormat);
+ const tEndDate = moment(conditionValues[item][1]).add(1, 'days').format(this.sDateFormat);
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: `${tStartDate},${tEndDate}`,
+ });
+ }
+ } else if ((item === 'mStartDate_pro' || item.substring(0, 1) === 'm')) {
+ if (!commonUtils.isEmpty(conditionValues[item])) {
+ const tStartDate = moment(conditionValues[item]).startOf('month').format(this.sDateFormat);
+ const tEndDate = moment(conditionValues[item]).endOf('month').add(1, 'days').format(this.sDateFormat);
+ filterCondition.push({
+ bFilterName: `t${item.substring(1, item.length)}`,
+ bFilterCondition: '=',
+ bFilterValue: `${tStartDate},${tEndDate}`,
+ });
+ }
+ } else if (item.substring(0, 1) === 't') {
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: moment(conditionValues[item]).format(this.sDateFormat),
+ });
+ } else {
+ filterCondition.push({
+ bFilterName: item,
+ bFilterCondition: '=',
+ bFilterValue: conditionValues[item],
+ });
+ }
+ });
+ }
+ this.props.dispatch({
+ type: 'content/onRouter',
+ payload: {
+ url: sNameUrl,
+ refresh: getConfig.bind(this, name, sModelsId), /* 刷新方法 */
+ sTabId: commonUtils.createSid(),
+ // sParentId: this.state.sTabId,
+ urlDataType: 'newPane',
+ checkedId: myConfigArr[0].sId,
+ sName: myConfigArr[0].sName,
+ bFilter: slaveFilterCondition,
+ pageSize: commonConfig.pageSize,
+ pages: slavePagination,
+ currentData: slaveData,
+ conditonValues: conditionValues,
+ newKey: tableDataRow[sActiveKey],
+ currentIndex: iIndex,
+ filterCondition,
+ },
+ });
+ }
+ };
+ /* 获取稽查模型数据 */
+ handleCheckModel = async (chart, slaveFilterCondition, other) => {
+ const { app, sModelsId } = this.props;
+ const obj = {};
+ if (commonUtils.isNotEmptyObject(obj)) {
+ obj.sProcedureName = chart.sProcedureName;
+ obj.paramsMap = chart.paramsMap;
+ } else {
+ obj.sProcedureName = 'Sp_Manufacture_GetPlanAPSstate';
+ obj.paramsMap = {
+ };
+ }
+ const value = {
+ sProName: obj.sProcedureName,
+ bFilter: slaveFilterCondition,
+ };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ this.props.onSaveState({ pageLoading: true });
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ message.success(returnData.msg);
+ this.handleButtonClick('BtnRefresh');
+ this.props.onSaveState({ bCheckModel: true });
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleCheckModel(chart, slaveFilterCondition, { iFlag: 1 }) });
+ }
+ };
+ handleCloseModel = (modelVisible) => {
+ this.props.onSaveState({ [modelVisible]: false });
+ };
+ handlePartNameClick =(sName, showConfig, record) => {
+ if (commonUtils.isNotEmptyObject(sName) && commonUtils.isNotEmptyObject(showConfig) && commonUtils.isNotEmptyObject(record)) {
+ this.props.onSaveState({ workScheduleConfig: showConfig, workScheduleRecord: record, workScheduleVisible: true });
+ }
+ }
+ /* 获取甘特图数据 */
+ handleGanttChar = async (ganttChart, slaveFilterCondition) => {
+ const {
+ token, sModelsId, formRoute,
+ } = this.props;
+ const char = {};
+ if (commonUtils.isNotEmptyObject(ganttChart)) {
+ char.sProcedureName = ganttChart.sProcedureName;
+ char.paramsMap = ganttChart.paramsMap;
+ } else {
+ char.sProcedureName = 'Sp_WorkOrder_GtCharAll';
+ char.paramsMap = {
+ };
+ }
+ let charGanttData = {};
+ const value = {
+ sProName: char.sProcedureName,
+ paramsMap: char.prodParamsMap,
+ bFilter: slaveFilterCondition,
+ };
+ this.props.onSaveState({ pageLoading: true });
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ const { data: returnData } = await commonServices.postValueService(token, value, url);
+ if (returnData.code === 1) {
+ const { dataset } = returnData;
+ if (commonUtils.isNotEmptyObject(dataset)) {
+ const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ if (outData.sCode === -1) {
+ message.error(outData.sReturn);
+ } else {
+ charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ } else {
+ message.error(returnData.msg);
+ }
+ };
+
+ render() {
+ return (
+
+ );
+ }
+ };
+};
diff --git a/src/components/Common/CommonViewNew.js b/src/components/Common/CommonViewNew.js
new file mode 100644
index 0000000..ca4f166
--- /dev/null
+++ b/src/components/Common/CommonViewNew.js
@@ -0,0 +1,156 @@
+/**
+ * Created by mar105 on 2019-02-27.
+ */
+/* eslint-disable object-curly-newline,prefer-destructuring */
+import React, { Component } from 'react';
+import { UploadOutlined } from '@ant-design/icons';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Row, Col, Button, Upload } from 'antd';
+import config from '@/utils/config';
+import * as commonUtils from '@/utils/utils';/* 通用方法 */
+import ShowType from './CommonComponent';
+
+const FormItem = Form.Item;
+
+export default class CommonViewNew extends Component {
+ /** 构造函数 */
+ constructor(props) {
+ super(props);
+ this.state = {
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ masterData: props.masterData,
+ gdsconfigformmasterId: props.gdsconfigformmasterId,
+ };
+ }
+
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(this.props);
+ }
+
+ /** props改变的时候触发 */
+ componentWillReceiveProps(nextProps) {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(nextProps);
+ }
+
+ /** 返回true执行渲染,返回false不渲染 */
+ shouldComponentUpdate(nextProps, nextState) {
+ const {
+ masterConfig, masterData, enabled, token, gdsconfigformmasterId,
+ } = this.state;
+ return enabled !== nextState.enabled ||
+ JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
+ JSON.stringify(masterData) !== JSON.stringify(nextState.masterData) ||
+ JSON.stringify(token) !== JSON.stringify(nextState.token) ||
+ JSON.stringify(gdsconfigformmasterId) !== JSON.stringify(nextState.gdsconfigformmasterId);
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ masterData: props.masterData,
+ gdsconfigformmasterId: props.gdsconfigformmasterId,
+ });
+ }
+ handleClick = (e, btnName) => {
+ this.props.onBtnClick(e, btnName);
+ }
+ rowReturnType = (child, masterData) => {
+ const formItemLayout = { labelCol: { span: 2 }, wrapperCol: { span: 18 } };
+ const { sModelsId, app } = this.props;
+ const { enabled, gdsconfigformmasterId } = this.state;
+ const { token } = app;
+ if (child.sControlName.toLowerCase().endsWith('upload') && child.sName === '') {
+ const { showName, sControlName, needUpload } = child;
+ const uploadProps = {
+ action: `${config.server_host}import/checkExcel?sModelsId=${sModelsId}&gdsconfigformmasterId=${gdsconfigformmasterId}&token=${token}`,
+ onChange: this.props.onUploadChange.bind(this, sControlName),
+ accept: 'xls/*', // *.xls
+ beforeUpload: () => {
+ /* 查看时不可上传 */
+ if (!needUpload) {
+ return false;
+ }
+ },
+ onSuccess: (response) => {
+ this.props.onShowData(response, sControlName);
+ },
+ showUploadList: false,
+
+ };
+ // 上传使用
+ const divProps = Object.assign({}, uploadProps);
+ return (
+
+
+
+ );
+ } else if (child.sControlName.toLowerCase().startsWith('btn') && !child.sControlName.toLowerCase().endsWith('upload') && child.sName === '') {
+ const { sControlName, showName } = child;
+ return ();
+ } else if (child.sName !== '') {
+ const sMemo = child.sName.toLowerCase().endsWith('memo');
+ const iColValue = sMemo ? 21 : child.iColValue * 6; /* 跨度 */
+ const iOrder = sMemo ? 100 : child.iOrder > 100 ? 100 : child.iOrder; /* 排序 */
+ let enabledNew = (enabled && !child.bReadonly && !child.specialControl);
+ if (child.iTag === 1) {
+ enabledNew = false;
+ } else if (child.iTag === 3) {
+ enabledNew = true;
+ }
+ const showTypeProps = {
+ form: this.props.form,
+ getSqlDropDownData: this.props.getSqlDropDownData,
+ getSqlCondition: this.props.getSqlCondition,
+ handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
+ getFloatNum: this.props.getFloatNum,
+ onChange: this.props.onChange,
+ showConfig: child,
+ formItemLayout: sMemo ? formItemLayout : {},
+ textArea: sMemo,
+ enabled: enabledNew,
+ dataValue: masterData[child.sName],
+ bTable: false,
+ };
+ return (
+
+
+
+ );
+ }
+ }
+ /** 绑定showType控件 */
+ rowShowType = (rowConfig, masterData) => {
+ const showConfig = commonUtils.isNotEmptyObject(rowConfig) ? rowConfig.gdsconfigformslave.filter(item => item.bVisible) : [];
+ const children = [];
+ for (const child of showConfig) {
+ children.push(this.rowReturnType(child, masterData));
+ }
+ const rowProps = {};
+ rowProps.children = children;
+ return (
);
+ }
+
+ render() {
+ const { masterConfig } = this.state;
+ let { masterData } = this.state;
+ masterData = masterData === undefined ? {} : masterData;
+ const rowConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.rowGdsconfig : [];
+ return (
+
+ {
+ rowConfig.map((child) => {
+ return this.rowShowType(child, masterData);
+ })
+ }
+
+ );
+ }
+}
diff --git a/src/components/Common/ShowChar/CustomizedChar.js b/src/components/Common/ShowChar/CustomizedChar.js
new file mode 100644
index 0000000..c7bb457
--- /dev/null
+++ b/src/components/Common/ShowChar/CustomizedChar.js
@@ -0,0 +1,156 @@
+/* eslint-disable no-param-reassign */
+import React, { Component } from 'react';
+import { Card, Row, Col, Radio } from 'antd';
+import Bar from '@/components/Charts/Bar';
+import Columnar from '@/components/Charts/Columnar';
+import ColumnarGroup from '@/components/Charts/ColumnarGroup';
+import BrokenLine from '@/components/Charts/BrokenLine';
+import WaterWave from '@/components/Charts/WaterWave';
+import Gauge from '@/components/Charts/Gauge';
+import ColumnarStack from '@/components/Charts/ColumnarStack';
+import PieGroup from '@/components/Charts/PieGroup';
+import Pie from '@/components/Charts/Pie';
+import TimeLineGroup from '@/components/Charts/TimeLineGroup';
+import EqualColumnarStack from '@/components/Charts/EqualColumnarStack';
+// import styles from '../../Charts/index.less';
+import * as utils from '@/utils/utils';
+// import * as commonFunc from '../commonFunc';
+
+class CustomizedCharComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ componentName: props.name,
+ charConfigAndData: [], /* 总图表配置及数据 */
+ charConfigList: [], /* 配置集 */
+ gdsformconst: [], /* 常量 */
+ charMenu: [], /* 图表右查询菜单 */
+ bordered: true,
+ };
+ }
+
+ componentWillMount() {
+ const { charConfigAndData, charConfigList } = this.props;
+ this.setState({ charConfigAndData, charConfigList });
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const { charConfigAndData, charConfigList, bordered } = nextProps;
+ this.setState({ charConfigAndData, charConfigList, bordered });
+ }
+
+ shouldComponentUpdate(nextProps, nextState) {
+ /*
+ console.log('nextProps', nextProps);
+ console.log('nextState', nextState);
+ */
+ const { charConfigList, charConfigAndData } = nextState;
+ if (charConfigList !== this.state.charConfigList) return true;
+ if (charConfigAndData !== this.state.charConfigAndData) return true;
+ return false;
+ }
+
+ handleChar = (props) => {
+ const { sCharType, child } = props;
+ let content = '';
+ if (utils.isNotEmptyObject(child)) {
+ child.height = props.iHeight;
+ if (sCharType === 'sBar') {
+ /* 横向条形图 */
+ content = ;
+ } else if (sCharType === 'sColumnar') {
+ /* 纵向条形图 */
+ content = ;
+ } else if (sCharType === 'sColumnarGroup') {
+ /* 纵向条形图 */
+ content = ;
+ } else if (sCharType === 'sBrokenLine') {
+ content = ;
+ } else if (sCharType === 'sWaterWave') {
+ content = ;
+ } else if (sCharType === 'sGauge') {
+ content = ;
+ } else if (sCharType === 'sColumnarStack') {
+ content = ;
+ } else if (sCharType === 'sPieGroup') {
+ content = ;
+ } else if (sCharType === 'sPie') {
+ content = ;
+ } else if (sCharType === 'TimeLineGroup') {
+ content = ;
+ } else if (sCharType === 'sEqualColumnarStack') {
+ content = ;
+ }
+ }
+ return content;
+ };
+
+ handleExtra = (menuTypeId) => {
+ const { charMenu } = this.state;
+ let content = '';
+ const index = charMenu.findIndex(item => item.sId === menuTypeId);
+ if (index > -1) {
+ const { childConfig, radioType } = charMenu[index];
+ const props = { ...this.state, index };
+ content = (
+ this.handleChangeType(e, props)}>
+ {
+ childConfig.map((item) => {
+ const { sTypeValue, showName, sId } = item;
+ return (
+ {showName}
+ );
+ })
+ }
+ );
+ }
+ return content;
+ };
+
+ handleChangeType = (e, props) => {
+ const { charMenu, charConfigAndData, index } = props;
+ const { childConfig } = charMenu[index];
+ const radioType = e.target.value; /* 更改后的菜单 */
+ charMenu[index].radioType = radioType;
+ this.setState({ charMenu });
+ const each = charConfigAndData[index]; /* 当前图表的配置 */
+ const child = childConfig.filter(item => item.sType === 'searchType' && item.sTypeValue === radioType);
+ if (utils.isNotEmptyArr(child)) {
+ const { sName } = child[0];
+ each.sSqlCondition = {
+ [sName]: radioType,
+ };
+ }
+ this.props.onEachChar(each);
+ };
+ render() {
+ const { charConfigAndData, commonChar, childChar } = this.state;
+ return (
+
+ {
+ charConfigAndData.map((itemChar) => {
+ const {
+ showName, sId, iWidth, iOrder, childConfig,
+} = itemChar;
+ const extra = utils.isNotEmptyArr(childConfig) ? this.handleExtra(sId) : null;
+ return utils.isNotEmptyStr(showName) ? (
+
+
+ {this.handleChar(itemChar)}
+
+
+ ) : (
+
+
+ {this.handleChar(itemChar)}
+
+
+ );
+ })
+ }
+
+ );
+ }
+}
+
+export default CustomizedCharComponent;
diff --git a/src/components/Common/commonParam.js b/src/components/Common/commonParam.js
new file mode 100644
index 0000000..0ac3456
--- /dev/null
+++ b/src/components/Common/commonParam.js
@@ -0,0 +1,50 @@
+import React, { Component } from 'react';
+import { Button } from 'antd';
+import styles from '@/index.less';
+import * as commonUtils from '@/utils/utils';
+
+class commonParamComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ this.assignmentWillProps(this.props);
+ }
+ componentWillReceiveProps(nextProps) {
+ this.assignmentWillProps(nextProps);
+ }
+
+ handleDoubleClick = (e, child) => {
+ const { sReturnFieldName } = this.props;
+ const { [`${sReturnFieldName}`]: currValue } = child;
+ this.props.onDoubleClick(this.props.name, currValue);
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({ disabled: props.disabled, data: commonUtils.isEmptyArr(props.data) ? [] : props.data });
+ }
+ render() {
+ const { data, disabled } = this.state;
+ const { sReturnFieldName } = this.props;
+ return (
+
+ {
+ data.map(child => (
+
+ ))
+ }
+
+ );
+ }
+}
+
+export default commonParamComponent;
diff --git a/src/components/CommonAuto/CommonAuto.js b/src/components/CommonAuto/CommonAuto.js
new file mode 100644
index 0000000..55b8e65
--- /dev/null
+++ b/src/components/CommonAuto/CommonAuto.js
@@ -0,0 +1,393 @@
+/* eslint-disable object-curly-newline */
+import React, { Component } from 'react';
+import { message, Progress } from 'antd';
+import baseChar from '../Common/baseChar'; /* 获取图表配置及数据 */
+import styles from './index.less';
+import Bar from '../Charts/Bar';
+import Columnar from '../Charts/Columnar';
+import ColumnarGroup from '../Charts/ColumnarGroup';
+import BrokenLine from '../Charts/BrokenLine';
+import WaterWave from '../Charts/WaterWave';
+import Gauge from '../Charts/Gauge';
+import ColumnarStack from '../Charts/ColumnarStack';
+import PieGroup from '../Charts/PieGroup';
+import Pie from '../Charts/Pie';
+import TimeLineGroup from '../Charts/TimeLineGroup';
+import ColorBlock from '../Charts/ColorBlock';
+import * as commonUtils from '../../utils/utils';
+import CommonList from '../Common/CommonList';
+import Gantt from '../Charts/Gantt';
+import commonConfig from '../../utils/config';
+
+const data = {
+ data: [
+ {
+ id: 1, text: 'Task #1', start_date: '15-04-2019', duration: 3, progress: 0.6,
+ },
+ {
+ id: 2, text: 'Task #2', start_date: '18-04-2019', duration: 3, progress: 0.4,
+ },
+ ],
+ links: [
+ {
+ id: 1, source: 1, target: 2, type: '0',
+ },
+ ],
+};
+const zoom = 'Hours';
+
+class CommonAuto extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+
+ componentWillMount() {
+ setTimeout(() => {
+ // console.log('初始时间:', new Date());
+ this.timer = setInterval(() => {
+ try {
+ console.log('定时时间:', new Date(), '设定间隔:', this.props.dRefreshTime);
+ const pageNum = commonUtils.isEmpty(this.props.pageNum) ? 2 : this.props.pageNum + 1;
+ this.props.onGetData({ ...this.props }, pageNum);
+ } catch (e) {
+ console.log('error', e.message);
+ }
+ }, commonUtils.isNotEmptyNumber(this.props.dRefreshTime) && this.props.dRefreshTime !== 0 ? this.props.dRefreshTime : 100000);
+ }, 8000);
+
+ /* 获取顶元素配置的刷新时间 */
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.setState({ ...nextProps });
+ }
+ handleInitLabelData = () => {
+ const tableData = [{ iOrder: 1,
+ sChinese: '8号模切机',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "flex": "1","borderLeft": "1px solid #fff", "backgroundColor": "#E17D31" }' }, { iOrder: 2,
+ sChinese: '9号模切机',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "flex": "1","borderLeft": "1px solid #fff", "backgroundColor": "#E17D31" }' }, { iOrder: 3,
+ sChinese: '10号模切机',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "flex": "1","borderLeft": "1px solid #fff", "backgroundColor": "#07A346" }' }, { iOrder: 4,
+ sChinese: '11号模切机',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "flex": "1","borderLeft": "1px solid #fff", "backgroundColor": "#E17D31" }' }];
+ return tableData;
+ }
+ handleInitLabelData5 = () => {
+ const tableData = [{ iOrder: 1,
+ sChinese: '工单',
+ sName: '工单',
+ sType: 'sLable',
+ sTypeValue: '{ "width": "20%" }' }, { iOrder: 2,
+ sChinese: 'DY19080045-1',
+ sName: 'DY',
+ sType: 'sLable',
+ sTypeValue: '{ "width": "50%" }' }, { iOrder: 3,
+ sChinese: '90',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "width": "30%", "color": "#ff0000" }' }];
+ return tableData;
+ }
+ handleInitLabelData61 = () => {
+ const tableData = [{ iOrder: 1,
+ sChinese: '班组数据',
+ sName: '班组数据',
+ sType: 'sLable',
+ sTypeValue: '{ "width": "20%" }' }];
+ return tableData;
+ }
+ handleInitLabelData62 = () => {
+ const tableData = [{ iOrder: 2,
+ sChinese: '今日数据',
+ sName: 'DY',
+ sType: 'sLable',
+ sTypeValue: '{ "textAlign": "center", "fontSize": "1em" }' }, { iOrder: 3,
+ sChinese: '合计 90',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "fontSize": "0.85em" }' }, { iOrder: 3,
+ sChinese: '计划达成 3/4',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "fontSize": "0.85em" }' }, { iOrder: 3,
+ sChinese: '设备稼动 60%',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "fontSize": "0.85em" }' }, { iOrder: 3,
+ sChinese: '速度稼动 100%',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "fontSize": "0.85em" }' }, { iOrder: 3,
+ sChinese: '生产异常 0起',
+ sName: 'title',
+ sType: 'sLable',
+ sTypeValue: '{ "fontSize": "0.85em" }' }];
+ return tableData;
+ }
+ /* 通用自定义模板1 初始化数据 */
+ handleInitLabelDataT1 = (props) => {
+ const tableData = [];
+ const { labelConfigData } = this.state;
+ const { childConfig } = props;
+ if (commonUtils.isNotEmptyArr(labelConfigData) && commonUtils.isNotEmptyArr(childConfig)) {
+ childConfig.forEach((child) => {
+ const addState = {};
+ addState.sType = 'sLable';
+ addState.sTypeValue = '';
+ const { sName, showName } = child;
+ if (sName === 'noQuery') {
+ addState.sChinese = showName;
+ } else {
+ const filterData = labelConfigData.filter(item => item.sName === sName);
+ if (commonUtils.isNotEmptyArr(filterData)) {
+ addState.sChinese = filterData[0].sValue;
+ }
+ }
+ tableData.push(addState);
+ });
+ }
+ return tableData;
+ }
+
+ handleChar = (props) => {
+ const { sCharType, child, iHeight, sStyle } = props;
+ let content = '';
+ if (commonUtils.isNotEmptyObject(child)) {
+ child.height = props.iHeight;
+ const style = {
+ color: '#ffffff',
+ fontSize: '12px',
+ textAlign: 'left',
+ };
+ let sStyleObject = {};
+ if (commonUtils.isNotEmptyObject(sStyle)) {
+ try {
+ sStyleObject = JSON.parse(sStyle);
+ if (commonUtils.isNotEmptyObject(sStyleObject.color)) {
+ style.color = sStyleObject.color;
+ } if (commonUtils.isNotEmptyNumber(sStyleObject.fontSize && commonUtils.isNum(sStyleObject.fontSize))) {
+ style.fontSize = sStyleObject.fontSize;
+ } if (commonUtils.isNotEmptyObject(sStyleObject.textAlign)) {
+ style.textAlign = sStyleObject.textAlign;
+ }
+ } catch (e) {
+ message.error(`JSON数据配置错误!${e.message}`);
+ }
+ }
+ child.style = style;
+ child.projectName = 'commonAuto';
+ if (sCharType === 'sBar') {
+ /* 横向条形图 */
+ content = ;
+ } else if (sCharType === 'sColumnar') {
+ /* 纵向条形图 */
+ content = ;
+ } else if (sCharType === 'sColumnarGroup') {
+ /* 纵向条形图 */
+ content = ;
+ } else if (sCharType === 'sBrokenLine') {
+ content = ;
+ } else if (sCharType === 'sWaterWave') {
+ content = ;
+ } else if (sCharType === 'sGauge') {
+ content = ;
+ } else if (sCharType === 'sColumnarStack') {
+ content = ;
+ } else if (sCharType === 'sPieGroup') {
+ content = ;
+ } else if (sCharType === 'sPie') {
+ content = ;
+ } else if (sCharType === 'TimeLineGroup') {
+ content = ;
+ } else if (sCharType === 'ColorBlock') {
+ content = ;
+ } else if (sCharType === 'Gantt') {
+ content =
;
+ }
+ } else if (sCharType === 'commonList') {
+ const routing = { pathname: '/commonAuto' };
+ const listProps = { ...this.props, ...child, routing, formRoute: 'commonList', isSmall: true, iHeight, sModelsId: props.sActiveId, pageNum: this.state.pageNum, onToFirst: this.props.onToFirst };
+ content =
;
+ } else if (sCharType === 'sLabel') {
+ content = this.handleGetLabel(props);
+ } else if (sCharType === 'Progress') {
+ const processData = this.handleGetProgress(props);
+ if (commonUtils.isNotEmptyArr(processData)) {
+ const processObj = processData[0];
+ const percent = commonUtils.isNotEmptyObject(processObj.percent) ? processObj.percent : 0;
+ const status = commonUtils.isNotEmptyObject(processObj.status) ? processObj.status : 'active';
+ const strokeColor = commonUtils.isNotEmptyObject(child.strokeColor) ? processObj.status : '#2db7f5';
+ // content = ;
+ content = ;
+ }
+ }
+ return content;
+ };
+
+ handleGetAllDiv = () => {
+ const { charConfigAndData } = this.state; /* 加载自定义界面所有配置 */
+ const rootDiv = commonUtils.isNotEmptyArr(charConfigAndData) ? charConfigAndData.filter(item => item.sCharType === 'Div' && commonUtils.isEmpty(item.sCharParentId)) : []; /* 找到所有一级Div 一级没有sCharParenetId */
+ const elements = [];
+ if (commonUtils.isNotEmptyArr(rootDiv)) {
+ rootDiv.forEach((itemChar) => {
+ const { sId, sStyle } = itemChar;
+ let { sEnglish } = itemChar;
+ sEnglish = commonUtils.isNotEmptyObject(sEnglish) ? sEnglish : '';
+ let sStyleObject;
+ if (commonUtils.isNotEmptyObject(sStyle)) {
+ sStyleObject = JSON.parse(sStyle);
+ }
+ elements.push({this.handleGetChildDiv(sId)}
);
+ });
+ }
+ return elements;
+ };
+ handleGetChildDiv = (sParentId) => {
+ const { charConfigAndData, labelConfigData, location, sBackgroundImage } = this.state; /* 加载自定义界面配置 */
+ const childDiv = commonUtils.isNotEmptyArr(charConfigAndData) ? charConfigAndData.filter(item => item.sCharParentId === sParentId) : [];
+ const elements = [];
+ let backgroundImage = '';
+ let mybackground = '';
+ if (commonUtils.isNotEmptyObject(sBackgroundImage)) {
+ backgroundImage = `${commonConfig.server_host}file/download?savePathStr=${sBackgroundImage}&sModelsId=100`;
+ mybackground = `url(${backgroundImage}) no-repeat left top`;
+ }
+ childDiv.forEach((childChar) => {
+ const { sId, sStyle, sCharType } = childChar;
+ let { sEnglish } = childChar;
+ sEnglish = commonUtils.isNotEmptyObject(sEnglish) ? sEnglish : '';
+ let sStyleObject;
+ if (commonUtils.isNotEmptyObject(sStyle)) {
+ sStyleObject = JSON.parse(sStyle);
+ }
+ /* 内容区根据上传的图片设置背景 */
+ if (sEnglish === 'mybg') {
+ sStyleObject.background = mybackground;
+ sStyleObject.backgroundSize = '100% 99%';
+ }
+
+ if (sCharType === 'Div') {
+ if (commonUtils.isNotEmptyObject(location.pathname)) {
+ /* 通过接口返回的背景颜色,是否显示 控制div的样式 */
+ if (commonUtils.isNotEmptyArr(labelConfigData)) {
+ if (commonUtils.isNotEmptyObject(sStyleObject)) {
+ if (commonUtils.isNotEmptyObject(sStyleObject.backgroundColor)) {
+ const backgroundColorValue = sStyleObject.backgroundColor;
+ const iIndex = labelConfigData.findIndex(item => item.sName === backgroundColorValue);
+ if (iIndex > -1) {
+ sStyleObject.backgroundColor = labelConfigData[iIndex].sValue;
+ }
+ }
+ if (commonUtils.isNotEmptyObject(sStyleObject.display)) {
+ const displayValue = sStyleObject.display;
+ const iIndex = labelConfigData.findIndex(item => item.sName === displayValue);
+ if (iIndex > -1) {
+ const sDisplay = labelConfigData[iIndex].sValue;
+ if (sDisplay === 'none') { /* 隐藏警报灯 */
+ sStyleObject.display = labelConfigData[iIndex].sValue;
+ } else if (sDisplay === 'block') { /* 显示警报灯 */
+ sStyleObject.display = labelConfigData[iIndex].sValue;
+ }
+ }
+ }
+ }
+ /* 动态加载背景图 */
+ if (commonUtils.isNotEmptyObject(sEnglish) && sEnglish.includes('#')) {
+ const iIndex = labelConfigData.findIndex(item => item.sName === sEnglish);
+ if (iIndex > -1) {
+ sEnglish = labelConfigData[iIndex].sValue;
+ }
+ // sEnglish = 'redMid';
+ }
+ }
+ }
+ elements.push({this.handleGetChildDiv(sId)}
);
+ } else {
+ elements.push({this.handleChar(childChar)}
);
+ }
+ });
+ return elements;
+ };
+
+ handleGetLabel = (props) => {
+ const { showName } = props;
+ let allData = [];
+ if (showName.indexOf('Div-5') > -1) {
+ allData = this.handleInitLabelData5();
+ } else if (showName.indexOf('班组数据') > -1) {
+ allData = this.handleInitLabelData61();
+ } else if (showName.indexOf('今日数据') > -1) {
+ allData = this.handleInitLabelData62();
+ } else if (showName.indexOf('本月数据') > -1) {
+ allData = this.handleInitLabelData62();
+ } else if (showName.indexOf('Div-1') > -1) {
+ allData = this.handleInitLabelData();
+ } else {
+ allData = this.handleInitLabelDataT1(props);
+ }
+ if (commonUtils.isNotEmptyArr(allData)) {
+ const elements = [];
+ allData.forEach((childChar) => {
+ const { sChinese, sTypeValue } = childChar;
+ let sStyle;
+ if (commonUtils.isNotEmptyObject(sTypeValue)) {
+ try {
+ sStyle = JSON.parse(sTypeValue);
+ } catch (e) {
+ message.error(`JSON数据配置错误!${e.message}`);
+ }
+ }
+ elements.push({sChinese}
);
+ });
+ return elements;
+ }
+ };
+ /* 从根元素存储过程数据集中取步骤条数据 */
+ handleGetProgress = (props) => {
+ const { labelConfigData } = this.state; /* 根元素存储过程数据集 */
+ const { childConfig } = props;
+ const tableData = [];
+ if (commonUtils.isNotEmptyArr(labelConfigData) && commonUtils.isNotEmptyArr(childConfig)) {
+ childConfig.forEach((child) => {
+ const addState = {};
+ const { sName } = child;
+ if (sName !== 'noQuery') {
+ const filterData = labelConfigData.filter(item => item.sName === sName);
+ if (commonUtils.isNotEmptyArr(filterData)) {
+ // eslint-disable-next-line prefer-destructuring
+ const sValue = filterData[0].sValue;
+ if (commonUtils.isNotEmptyObject(sValue)) {
+ addState.sType = 'Progress';
+ addState.percent = sValue;
+ }
+ }
+ }
+ tableData.push(addState);
+ });
+ }
+ return tableData;
+ };
+
+ render() {
+ return (
+
+ {
+ this.handleGetAllDiv()
+ }
+
+ );
+ }
+}
+
+export default baseChar(CommonAuto);
diff --git a/src/components/CommonAuto/index.less b/src/components/CommonAuto/index.less
new file mode 100644
index 0000000..2c8b611
--- /dev/null
+++ b/src/components/CommonAuto/index.less
@@ -0,0 +1,358 @@
+.rootDiv{
+ font-size: 1em;
+ color: #ffffff!important;
+ background: url(../../assets/commonAuto/bg.jpg) center top;
+}
+/* 大屏图表样式 */
+:global{
+ .rootbg{
+ background: url(../../assets/commonAuto/bg.jpg);
+ }
+ .headbg{
+ background: url(../../assets/commonAuto/headbg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mainDiv{
+ background: url(../../assets/commonAuto/bg.jpg) no-repeat center top;
+ background-size: 100% 100%;
+ }
+ .qcDiv{
+ background: url(../../assets/commonAuto/qcbg.png) no-repeat center top;
+ background-size: 100% 100%;
+ }
+ .processDiv{
+ .ant-progress-show-info .ant-progress-outer{
+ padding:1px!important;
+ margin: 0px;
+ }
+ .ant-progress-text{
+ display: none!important;
+ }
+ }
+ .qcLight{
+ background: url(../../assets/commonAuto/qclight.gif) no-repeat center top;
+ background-size: 100% 100%;
+ }
+ .commonAuto{
+ color: #ffffff!important;
+ font-size: 1rem!important;
+ opacity: 0.5;
+ }
+
+ /* ---------模板2-生产车间设备看板界面布局Begin----------------- */
+
+ /* 背景布局 */
+ .mtDiv{
+ background: url(../../assets/commonAuto/template/bg.png) no-repeat center top;
+ background-size: 100% 100%;
+ }
+ /* 头部区域*/
+ .mtheadbg{
+ background: url(../../assets/commonAuto/template/headbg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+
+ /* 内容布局 */
+ .mtmainbg{
+ background: url(../../assets/commonAuto/template/main.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 内容左区 */
+ .mtleftbox{
+ background: url(../../assets/commonAuto/template/leftbox.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtareabg{
+ background: url(../../assets/commonAuto/template/card.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mticon1{
+ width: 2.68rem;
+ height: 2.68rem;
+ background: url(../../assets/commonAuto/template/icon-1.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 内容中区 */
+ .mtmid1box{
+ background: url(../../assets/commonAuto/template/midbox_1.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtmachinebox{
+ background: url(../../assets/commonAuto/template/machine.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtmidcontent{
+ background: url(../../assets/commonAuto/template/mid_top.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtchartbg{
+ background: url(../../assets/commonAuto/template/chartbg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtmid2box{
+ background: url(../../assets/commonAuto/template/midbox_2.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 内容右区 */
+ .mtrightbox{
+ background: url(../../assets/commonAuto/template/rightbox.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+
+ /* ---------模板2-生产车间设备看板界面布局End----------------- */
+
+
+ /* ---------模板2-班组车间设备看板界面布局Begin----------------- */
+.mtmainbox{
+ background: url(../../assets/commonAuto/template/index/mainbox.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg2{
+ background: url(../../assets/commonAuto/template/index/ct2bg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg3{
+ background: url(../../assets/commonAuto/template/index/ct3bg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg4{
+ background: url(../../assets/commonAuto/template/index/ct4bg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg5{
+ background: url(../../assets/commonAuto/template/index/ct2bg.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg6left{
+ background: url(../../assets/commonAuto/template/index/ct6bg-1.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .mtbg6right{
+ background: url(../../assets/commonAuto/template/index/ct6bg-2.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 纵向饼形图 竖向排列 */
+ //.piecolumn { position: relative;left: 27%;} .piecolumn .index__legendBlock___13qn5.index__hasLegend___26XLE .index__chart___112d8 { margin: -43px 0px 0px 0px !important;} .piecolumn .index__pie___r_Mgc .index__legend___q03ab { position: relative !important;margin: 0px 0px 0px 0px !important;}
+ // .piecolumn { position: relative;left: 27%;} .piecolumn .legendBlock___13qn5.hasLegend___26XLE .chart___112d8 { margin: -43px 0px 0px 0px !important;} .piecolumn .pie___r_Mgc .legend___q03ab { position: relative !important;margin: 0px 0px 0px 0px !important;}
+ /* ---------模板2-班组车间设备看板界面布局End----------------- */
+
+ /* ---------模板3-设备实时数据Begin----------------- */
+ /* 白色 -无排程*/
+ .whiteSmall{
+ background: url(../../assets/commonAuto/template/device/small/white_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .whiteMid{
+ background: url(../../assets/commonAuto/template/device/mid/white_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .whiteBig{
+ background: url(../../assets/commonAuto/template/device/big/white_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 灰色 -下班 */
+ .graySmall{
+ background: url(../../assets/commonAuto/template/device/small/gray_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .grayMid{
+ background: url(../../assets/commonAuto/template/device/mid/gray_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .grayBig{
+ background: url(../../assets/commonAuto/template/device/big/gray_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 紫红 -故障 */
+ .violetRedSmall{
+ background: url(../../assets/commonAuto/template/device/small/violetred_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .violetRedMid{
+ background: url(../../assets/commonAuto/template/device/mid/violetred_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .violetRedBig{
+ background: url(../../assets/commonAuto/template/device/big/violetred_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 绿色 -正常 */
+ .greenSmall{
+ background: url(../../assets/commonAuto/template/device/small/green_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .greenMid{
+ background: url(../../assets/commonAuto/template/device/mid/green_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .greenBig{
+ background: url(../../assets/commonAuto/template/device/big/green_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 黄色 -超期 */
+ .yellowSmall{
+ background: url(../../assets/commonAuto/template/device/small/yellow_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .yellowMid{
+ background: url(../../assets/commonAuto/template/device/mid/yellow_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .yellowBig{
+ background: url(../../assets/commonAuto/template/device/big/yellow_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 橘黄色 -超30分 */
+ .orangeSmall{
+ background: url(../../assets/commonAuto/template/device/small/orange_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .orangeMid{
+ background: url(../../assets/commonAuto/template/device/mid/orange_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .orangeBig{
+ background: url(../../assets/commonAuto/template/device/big/orange_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 红色 -超60分 */
+ .redSmall{
+ background: url(../../assets/commonAuto/template/device/small/red_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .redMid{
+ background: url(../../assets/commonAuto/template/device/mid/red_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .redBig{
+ background: url(../../assets/commonAuto/template/device/big/red_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* 深红 -超90分 */
+ .deepRedSmall{
+ background: url(../../assets/commonAuto/template/device/small/deepred_small.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .deepRedMid{
+ background: url(../../assets/commonAuto/template/device/mid/deepred_mid.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ .deepRedBig{
+ background: url(../../assets/commonAuto/template/device/big/deepred_big.png) no-repeat center center;
+ background-size: 100% 100%
+ }
+ /* ---------模板3-设备实时数据End----------------- */
+ #commonSreen {
+ .pie-sub-title {
+ color: #fff !important;
+ font-size: 0.7rem;
+ opacity: 0.5;
+ }
+
+ .pie-stat {
+ color: #fff !important;
+ font-size: 1rem;
+ opacity: 0.5;
+ }
+
+ .areabg {
+ background: url(../../assets/commonAuto/line.png);
+ }
+
+ .ant-divider, .ant-divider-vertical {
+ opacity: 0.5;
+ }
+
+ .FastFilter__fastFilter___2eRwK {
+ display: none;
+ }
+
+ .ant-layout {
+ background: none !important;
+ padding: 0px 0px 0px 0px!important;
+ }
+ /* 设置表格背景颜色 */
+ .ant-table{
+ background: none!important;
+ }
+
+ .xly-list { /* 大屏列表 */
+ /* 设置表头颜色 */
+ .ant-table-thead > tr > th {
+ background: none!important;
+ opacity: 0.8;
+ color: #fff !important;
+ }
+ /* 表格不设置边框 */
+ .ant-table.ant-table-bordered > .ant-table-container > .ant-table-content > table, .ant-table.ant-table-bordered > .ant-table-container > .ant-table-header > table{
+ border:none!important;
+ }
+ .ant-table.ant-table-bordered > .ant-table-container{
+ border: none!important;
+ }
+ .ant-table-header{
+ background: none!important;
+ }
+ .ant-table-thead{
+ background: none!important;
+ }
+ .ant-table-column-sorter{
+ display: none;
+ }
+ .ant-table-body{
+ overflow: hidden!important;
+ }
+ /* 设置悬浮行颜色 */
+ tbody tr:not(.selected-record-row):not(.ant-table-expanded-row-level-1):hover{
+ background: none!important;
+ }
+ .selected-record-row{
+ background:none!important;
+ }
+ /* 设置标题滚动条 */
+ .ant-table-bordered .ant-table-thead > tr > th.ant-table-cell-scrollbar{
+ display: none!important;
+ }
+
+ td {
+ color: #fff !important;
+ font-size: 0.8rem!important;
+ }
+ .ant-select-selection--single{
+ border: none !important;
+ }
+ td,td .ant-input[disabled],td .ant-input-number-input[disabled],td .ant-input-number{
+ border-right: none!important;
+ }
+ .ant-table-bordered .ant-table-tbody > tr > td{
+ border-bottom: none!important;
+ background: none!important;
+ }
+ .ant-table-bordered .ant-table-thead > tr > th{
+ border: none!important;
+ }
+ table tr th{
+ font-size: 0.8rem!important;
+ }
+ .ant-table-scroll{
+ overflow: hidden!important;
+ }
+ .ant-table-pagination.ant-pagination{
+ display: none!important;
+ }
+ .ant-table-tbody > tr:hover > td {
+ background: none!important;
+ cursor: pointer;
+ }
+ }
+ /* 设置滚动条宽度 */
+ .ant-table-fixed-header .ant-table-scroll .ant-table-header::-webkit-scrollbar {
+ width: 1px!important;
+ background: none;
+ }
+ .ant-table-body::-webkit-scrollbar {
+ width: 1px!important;
+ background: none;
+ }
+ }
+}
diff --git a/src/components/CommonImportDataEvent/importDataInfo.js b/src/components/CommonImportDataEvent/importDataInfo.js
new file mode 100644
index 0000000..55af16a
--- /dev/null
+++ b/src/components/CommonImportDataEvent/importDataInfo.js
@@ -0,0 +1,94 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Tabs, Spin } from 'antd';
+import styles from '@/index.less';
+import * as commonFunc from '@/components/Common/commonFunc';
+import CommonBase from '@/components/Common/CommonBase';
+import CommonImportDataComponet from '@/components/Common/CommonImportDataEvent';
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import CommonView from '@/components/Common/CommonViewNew';
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+
+/* 通用方法 */
+const { Content } = Layout;
+const { TabPane } = Tabs;
+
+class ImportDataInfo extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ this.form = {}; /* 表单对象 */
+ }
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const ImportDataComponet = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, app,
+ } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ const nocanbeInsertProps = {
+ ...commonBusiness.getTableTypes('nocanbeInsert', props),
+ tableProps: { rowKey: 'rowIndex', rowSelection: null },
+ enabled: false,
+ };
+ const tabVerifyResult = commonFunc.showMessage(app.commonConst, 'tabVerifyResult');/* 校验结果 */
+ /*
+ const canbeInsertProps = {
+ ...commonBusiness.getTableTypes('canbeInsert', props),
+ tableProps: { rowKey: 'rowIndex', rowSelection: null },
+ enabled: false,
+ };
+
+
+
+
+
+*/
+ return (
+
+ );
+});
+
+export default CommonBase(CommonImportDataComponet(ImportDataInfo));
+
diff --git a/src/components/JurisdictionAllotEvent/SystemPermissionInfo.js b/src/components/JurisdictionAllotEvent/SystemPermissionInfo.js
new file mode 100644
index 0000000..bba5557
--- /dev/null
+++ b/src/components/JurisdictionAllotEvent/SystemPermissionInfo.js
@@ -0,0 +1,308 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Tabs, Spin, Row, Col, Input } from 'antd';
+import styles from '../../index.less';
+import selfstyles from './SystemPermissionInfo.less';
+import Toolbar from '../Common/ToolBar/ToolBarNew';
+import * as commonFunc from '../Common/commonFunc';
+import CommonBase from '../Common/CommonBase';
+import CommonJurisdictionEvent from '../Common/CommonJurisdictionNewEvent';
+import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
+import StaticEditTree from '../Common/Tree/StaticTree';
+import AntdDraggableModal from '../Common/AntdDraggableModal';
+import * as commonUtils from '../../utils/utils';
+import ShowType from '../Common/CommonComponent';
+
+const { Header, Content } = Layout;
+const { TabPane } = Tabs;
+const { Search } = Input;
+
+const FormItem = Form.Item;
+class SystemPermissionComponentInfo extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ this.form = {}; /* 表单对象 */
+ }
+ onTabChange = (key) => {
+ this.props.onSaveState({ activeKey: key });
+ };
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const SystemPermissionComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, activeKey, enabled, groupModalVisible, sToGroupConfig, userModalVisible, sToUserConfig, app, masterData,
+ } = props;
+
+ // const tableHeight = (window.innerHeight - 300) / 2;
+
+ const groupProps = {
+ ...commonBusiness.getTableTypes('group', props),
+ tableProps: { rowSelection: null, AutoTableHeight: 330 },
+ // rowSelectionType: 'radio',
+ enabled: false,
+ };
+
+
+ const userGroupProps = {
+ ...commonBusiness.getTableTypes('userGroup', props),
+ tableProps: { rowSelection: null, AutoTableHeight: 150 },
+ enabled: false,
+ };
+ // const groupUserProps = {
+ // ...commonBusiness.getTableTypes('groupUser', props),
+ // tableProps: { rowSelection: null, rowKey: 'sGroupsId', AutoTableHeight: tableHeight },
+ // enabled: false,
+ // };
+
+ /* 查看用户权限 */
+ const userProps = {
+ ...commonBusiness.getTableTypes('userView', props),
+ tableProps: { rowSelection: null, AutoTableHeight: window.innerHeight - 250 },
+ enabled: false,
+ };
+ /* 切换到查看用户权限页签时 Tree不能编辑 */
+ let treeDisabled = !enabled;
+ if (props && activeKey) {
+ if (props.activeKey === '3') {
+ treeDisabled = true;
+ } else {
+ treeDisabled = !enabled;
+ }
+ }
+ const name = 'search';
+ const treeProps = {
+ ...commonBusiness.getTreeTypes('tree', props),
+ isSearch: true,
+ [`${name}Column`]: props[`${name}Column`],
+ [`${name}Config`]: props[`${name}Config`],
+ [`${name}Data`]: props[`${name}Data`],
+ getFloatNum: props.getFloatNum,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getDateFormat: props.getDateFormat,
+ onDoubleClick: props.onDoubleClick,
+ disabled: treeDisabled,
+ sKeyName: 'key',
+ };
+ console.log('treeProps', treeProps);
+ const sCopyGroup = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sCopyGroup')) ? commonFunc.showMessage(app.commonConst, 'sCopyGroup') : '复制组权限';/* 复制组权限 */
+ const sCopyUser = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sCopyUser')) ? commonFunc.showMessage(app.commonConst, 'sCopyUser') : '复制人员权限';/* 复制组权限 */
+
+ /* 回带表单 */
+ onReturnForm(form);
+ return (
+
+ );
+});
+
+export default CommonBase(CommonJurisdictionEvent(SystemPermissionComponentInfo));
+
diff --git a/src/components/JurisdictionAllotEvent/SystemPermissionInfo.less b/src/components/JurisdictionAllotEvent/SystemPermissionInfo.less
new file mode 100644
index 0000000..e95fd94
--- /dev/null
+++ b/src/components/JurisdictionAllotEvent/SystemPermissionInfo.less
@@ -0,0 +1,23 @@
+.clayout {
+ position: relative;
+ margin: 82px 0 0 0;
+ background: #f0f2f5!important;
+ //height: 100%!important; 控制按照视窗高度
+}
+:global {
+ #SysPermissionList .ant-tabs-tab {
+ //padding: 0 65px!important;
+ padding: 0!important;
+ width: 180px;
+ .ant-tabs-tab-btn{
+ width: 100%;
+ text-align: center!important;
+ }
+ }
+ .xly-jurisdiction #staticEditTree .ant-tree-treenode{
+ height: 30px;
+ }
+ .xly-jurisdiction #staticEditTree .ant-tree-treenode:first-child{
+ margin-top: 5px;
+ }
+}
diff --git a/src/components/PrintLabel/PrintLabel.js b/src/components/PrintLabel/PrintLabel.js
new file mode 100644
index 0000000..73bb731
--- /dev/null
+++ b/src/components/PrintLabel/PrintLabel.js
@@ -0,0 +1,68 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin } from 'antd';// Tabs, Form,
+import styles from '../../index.less';
+import Toolbar from '../Common/ToolBar/ToolBarNew';
+import * as commonFunc from '../Common/commonFunc';
+import CommonBase from '../Common/CommonBase';
+import CommonSales from '../Common/CommonBillEvent';
+import CommonView from '../Common/CommonView';
+
+const { Header, Content } = Layout;
+
+class printLabelComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ this.form = {}; /* 表单对象 */
+ }
+
+
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const PrintLabelComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData, masterConfig } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form, masterConfig);
+ return obj;
+ },
+})((props) => {
+ const { form, onReturnForm } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ return (
+
+ );
+});
+
+export default CommonBase(CommonSales(printLabelComponent));
diff --git a/src/components/ProductionReport/ProductionReport.js b/src/components/ProductionReport/ProductionReport.js
new file mode 100644
index 0000000..2ed2c4b
--- /dev/null
+++ b/src/components/ProductionReport/ProductionReport.js
@@ -0,0 +1,1361 @@
+/* eslint-disable */
+/* eslint-disable no-const-assign,prefer-destructuring */
+/**
+ * Created by mar105 on 2019-01-04.
+ */
+
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import {
+ Layout,
+ Spin,
+ Tabs,
+ Avatar,
+ message,
+ Modal,
+ Button,
+ Table,
+ Checkbox,
+ Row,
+ Col,
+} from 'antd';
+import CommonSales from './../Common/CommonBillEvent';/* 继承销售模块业务功能 */
+import * as commonFunc from './../Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
+import Toolbar from './../Common/ToolBar/ToolBarNew';
+import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
+import styles from './../../index.less';
+import CommonView from './../Common/CommonView';
+import CommonBase from './../Common/CommonBase';/* 获取配置及数据 */
+import * as commonUtils from './../../utils/utils';/* 通用方法 */
+import * as commonBusiness from './../Common/commonBusiness';/* 单据业务功能 */
+import commonConfig from './../../utils/config';
+import * as commonServices from './../../services/services';
+import AntdDraggableModal from '../Common/AntdDraggableModal';/* 服务类 */
+
+
+const { Header, Content } = Layout;
+const { TabPane } = Tabs;
+const { confirm } = Modal;
+
+class ProductionReport extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ }
+
+ componentWillReceiveProps(nextProps) {
+ let {
+ employeeColumn,
+ } = nextProps;
+ const { formData, currentId } = nextProps;
+ if (commonUtils.isEmptyArr(employeeColumn) && formData.length > 0) {
+ const sId = currentId !== undefined ? currentId : '';
+ /* 数据Id */
+ const masterConfig = formData.filter(item => !item.bGrd)[0];
+ /* bGrd代表是否是表格 */
+ const slaveConfig = formData.filter(item => item.bGrd && item.sTbName !== 'sysbillcheckresult')[0];
+ const slaveColumn = commonFunc.getHeaderConfig(slaveConfig);
+ let checkConfig ={};
+ let checkColumn ={};
+ if(commonUtils.isNotEmptyArr( formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult'))) {
+ checkConfig = formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult')[0];
+ checkColumn = commonFunc.getHeaderConfig(checkConfig);
+ }
+
+ const employeeConfig = formData.filter(item => item.sTbName.toUpperCase() === 'mftproductionreportemployee'.toUpperCase())[0];
+ employeeColumn = commonFunc.getHeaderConfig(employeeConfig, employeeColumn);
+
+ let addState = {};
+ if (sId === '') {
+ const config = {};
+ config.masterConfig = masterConfig;
+ config.slaveConfig = slaveConfig;
+ addState = this.handleAdd(config, nextProps.app.currentPane.copyTo, true);
+ } else {
+ this.props.onGetData(masterConfig, slaveConfig, checkConfig);
+ this.handleGetData(employeeConfig);
+ }
+ this.props.onSaveState({
+ masterConfig,
+ slaveConfig,
+ slaveColumn,
+ checkConfig,
+ checkColumn,
+ sId,
+ pageLoading: false,
+ employeeConfig,
+ employeeColumn,
+ ...addState,
+ });
+ }
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const { employeeColumn, slaveConfig } = nextProps;
+ return typeof slaveConfig === 'object' && Object.keys(slaveConfig).length > 0 && commonUtils.isNotEmptyArr(employeeColumn);
+ }
+
+ onTabChange = async (key) => {
+ if (key == 99) {
+ return;
+ }
+ let addState = {};
+ let tag = `slave${key}`;
+
+ const { [`${tag}Config`] : tableConfig, [`${tag}Data`] : tableData, [`${tag}FilterCondition`]: tableFilterCondition, slaveOrderBy, [`${tag}Pagination`] : tablePagination, slaveSelectedRowKeys } = this.props;
+ if(commonUtils.isEmptyArr(tableData)) {
+ const iPageSize = tableConfig.bPagination ? tableConfig.iPageSize : 10000 ; /* 根据后台主表配置bPagination判断 是否分页, 不分页默认10000,分页根据分页来 */
+ this.props.onSaveState({ pageLoading: true });
+ addState = await this.props.onGetDataOne(tag, tableConfig, tableFilterCondition, commonUtils.isEmpty(tablePagination) ? 1 : tablePagination.current, commonUtils.isEmpty(tablePagination) ? iPageSize : tablePagination.pageSize, slaveOrderBy, undefined, true);
+ }
+ this.props.onSaveState({ activeKey: key ,...addState, pageLoading: false});
+ };
+
+ /* 获取表数据 */
+ handleGetData = (employeeConfig, extraState = {}) => {
+ const { currentId } = this.props; /* 当前页签数据 */
+ const sId = currentId !== undefined ? currentId : ''; /* 数据Id */
+ this.props.handleGetDataSet({
+ name: 'employee', configData: employeeConfig, condition: { sSqlCondition: { sParentId: sId } },
+ });
+ this.props.onSaveState({ pageLoading: false, loading: false, ...extraState });
+ };
+
+ handleForm = (form) => {
+ this.form = form;
+ };
+
+ handleSave = async () => {
+ await this.form.validateFields(async (err) => {
+ /* 验证通过与不通过走不同的流程 */
+ if (err) { /* 验证失败 */
+ /* 直接渲染显示错误提示 */
+ for (const key of Object.keys(err)) {
+ message.warning(err[key].errors[0].message);
+ }
+ } else { /* 验证成功 */
+ const {
+ masterConfig, masterData, slaveConfig, slaveData, slaveDelData, employeeConfig, employeeData, employeeDelData, token, sModelsId,
+ } = this.props;
+ if (!commonBusiness.validateTable(slaveConfig, slaveData, this.props, '2') || !commonBusiness.validateTable(employeeConfig, employeeData, this.props, '3')) {
+ return;
+ }
+
+ for (const tableDataRow of slaveData) {
+ const sWageId = tableDataRow.sWageId;
+ if (commonUtils.isNotEmptyObject(sWageId)) {
+ tableDataRow.dWageMoney = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sWageId,
+ });
+ }
+ const sFactCapacityId = tableDataRow.sFactCapacityId;
+ if (commonUtils.isNotEmptyObject(sFactCapacityId)) { /* 调用工时公式,计算工时 */
+ tableDataRow.dHour = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sFactCapacityId,
+ });
+ }
+ const dWageMoneyTotal = tableDataRow.dWageMoney;
+ let dProportionTotal = 0;
+ const employeeSlaveData = employeeData.filter(item => item.sSlaveId === tableDataRow.sId);
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += item.dProportion;
+ }
+ });
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeData.findIndex(item1 => item1.sId === item.sId);
+ employeeData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ /* 选择计件方案后 算总金额 */
+ const dWageMoney = commonUtils.isNotEmptyNumber(dWageMoneyTotal) ? commonUtils.convertFixNum(dWageMoneyTotal, 6) : 0;
+ const dTimeMoney = commonUtils.isNotEmptyNumber(tableDataRow.dTimeMoney) ? commonUtils.convertFixNum(tableDataRow.dTimeMoney, 6) : 0;
+ const dLossMoney = commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney) ? commonUtils.convertFixNum(tableDataRow.dLossMoney, 6) : 0;
+ tableDataRow.dAllMoney = commonUtils.convertFixNum((dWageMoney + dTimeMoney) - dLossMoney, 6);
+ tableDataRow.handleType = commonUtils.isEmpty(tableDataRow.handleType) ? 'update' : tableDataRow.handleType;
+ }
+
+ const data = [];
+ data.push(commonBusiness.mergeData('master', masterConfig.sTbName, [masterData]));
+ data.push(commonBusiness.mergeData('slave', slaveConfig.sTbName, slaveData, slaveDelData));
+ data.push(commonBusiness.mergeData('employee', employeeConfig.sTbName, employeeData, employeeDelData));
+ await this.props.onSaveData({ data, sClientType: '1' });
+ this.handleGetData(employeeConfig);
+ }
+ });
+ };
+
+ /** 控制选择控制表时,显示部件工序与成品工序 */
+ handleFilterData = (name, dataIndex, value, record) => {
+ return (commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(value.toLowerCase()));
+ };
+
+ /** 添加表格空行 */
+ handleTableAdd = async (name, isWait) => {
+ /* 外置处理业务 */
+ const {
+ slaveData, slaveSelectedRowKeys, sModelsId, token,
+ } = this.props;
+ let {
+ employeeData,
+ } = this.props;
+ if (name === 'employee') {
+ if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
+ message.warn('请选择班组');
+ return;
+ }
+ if (slaveSelectedRowKeys.length !== 1) {
+ message.warn('请选择一条数据');
+ return;
+ }
+ const iIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]);
+ if (iIndex > -1) {
+ if (commonUtils.isEmpty(slaveData[iIndex].sTeamName)) {
+ message.warn('班组名称不能为空');
+ return;
+ }
+ }
+ const employeeSlaveData = employeeData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0]);
+ if (commonUtils.isEmptyObject(employeeSlaveData)) {
+ const sTeamId = slaveData[iIndex].sTeamId;
+ const sSlaveId = slaveData[iIndex].sId;
+ const sParentId = slaveData[iIndex].sParentId;
+ const url = `${commonConfig.server_host}eleteamemployee/getEleteamemployee?sModelsId=${sModelsId}&sTeamId=${sTeamId}&sSlaveId=${sSlaveId}&sParentId=${sParentId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyObject(returnData)) {
+ returnData.forEach((child) => {
+ employeeSlaveData.push({
+ sId: child.sId,
+ sParentId: child.sParentId,
+ sSlaveId: child.sSlaveId,
+ sEmployeeId: child.sEmployeeId,
+ handleType: 'add',
+ });
+ });
+ employeeData = employeeData.concat(employeeSlaveData);
+ } else {
+ const employeeSlaveDataAdd = {};
+ employeeSlaveDataAdd.sId = commonUtils.createSid();
+ employeeSlaveDataAdd.sParentId = slaveData[iIndex].sParentId;
+ employeeSlaveDataAdd.sSlaveId = slaveData[iIndex].sId;
+ employeeSlaveDataAdd.handleType = 'add';
+ employeeData = employeeData.concat(employeeSlaveDataAdd);
+ }
+ }
+ this.props.onSaveState({ [`${name}Data`]: employeeData });
+ } else {
+ const employeeSlaveDataAdd = {};
+ employeeSlaveDataAdd.sId = commonUtils.createSid();
+ employeeSlaveDataAdd.sParentId = slaveData[iIndex].sParentId;
+ employeeSlaveDataAdd.sSlaveId = slaveData[iIndex].sId;
+ employeeSlaveDataAdd.handleType = 'add';
+ employeeData = employeeData.concat(employeeSlaveDataAdd);
+ this.props.onSaveState({ [`${name}Data`]: employeeData });
+ }
+ } else {
+ return this.props.onDataRowAdd(name, isWait);
+ }
+ };
+ /** 删除表格数据 */
+ otherTableDel = (name, tableSelectedRowKeys) => {
+ const tableData = this.props[`${name}Data`];
+ let tableDelData = this.props[`${name}DelData`];
+ tableDelData = commonUtils.isEmptyArr(tableDelData) ? [] : tableDelData;
+ for (const sId of tableSelectedRowKeys) {
+ /* 看看删除集合和从表中是否都存在该条数据 */
+ let tableDataIndex = tableData.findIndex(item => item.sControlId === sId);
+ while (tableDataIndex > -1) {
+ /* 删除从表中的数据并存入删除集合中 */
+ const slaveDataFilter = tableData[tableDataIndex];
+ tableData.splice(tableDataIndex, 1);
+ slaveDataFilter.handleType = 'del';
+ tableDelData.push(slaveDataFilter);
+ tableDataIndex = tableData.findIndex(item => item.sControlId === sId);
+ }
+ }
+ return { [`${name}Data`]: tableData, [`${name}DelData`]: tableDelData, [`${name}SelectedRowKeys`]: [] };
+ };
+ /** 删除表格数据 */
+ handleTableDel = (name, flag, tableSelectedRowKeys) => {
+ if (name === 'slave') {
+ const tableSelectedRowKeys = this.props[`${name}SelectedRowKeys`];
+ if (commonUtils.isNotEmptyArr(tableSelectedRowKeys)) {
+ const employeeReturnData = this.otherTableDel('employee', tableSelectedRowKeys);
+ // const processReturnData = this.otherTableDel('process', tableSelectedRowKeys);
+ const slaveReturnData = this.props.onDataRowDel(name, true, tableSelectedRowKeys);
+ this.props.onSaveState({
+ ...employeeReturnData,
+ ...slaveReturnData,
+ });
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ const { slaveData, employeeData } = this.props;
+ const iIndex = employeeData.findIndex(item => item.sId === tableSelectedRowKeys.toString());
+ let sSlaveId = '';
+ if (iIndex > -1) {
+ sSlaveId = employeeData[iIndex].sSlaveId;
+ }
+ const returnData = this.props.onDataRowDel(name, true, tableSelectedRowKeys);
+ if (commonUtils.isNotEmptyArr(returnData.employeeData)) {
+ const iSlaveIndex = slaveData.findIndex(item => item.sId === sSlaveId);
+ let dProportionTotal = 0;
+ const returnDataIndex = returnData.employeeData.findIndex(item => item.sSlaveId === sSlaveId);
+ const returnFilterData = returnData.employeeData.filter(item => item.sSlaveId === sSlaveId);
+ if (returnDataIndex > -1) {
+ returnFilterData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += commonUtils.convertFixNum(item.dProportion, 6);
+ dProportionTotal = commonUtils.convertFixNum(dProportionTotal, 6);
+ }
+ });
+ }
+ if (returnDataIndex > -1) {
+ returnFilterData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = returnData.employeeData.findIndex(item1 => item1.sId === item.sId);
+ returnData.employeeData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ }
+ }
+ this.props.onSaveState({ ...returnData });
+ }
+ };
+
+ /* 上一条、下一条、首条、末条 */
+ handleSearchData = async (handleType) => {
+ const {
+ employeeConfig,
+ } = this.props;
+ const bReturn = await this.props.onSearchData(handleType);
+ if (bReturn) {
+ this.handleGetData(employeeConfig);
+ }
+ };
+ handleEdit = () => {
+ const { employeeConfig } = this.props;
+ this.props.onEdit(() => {
+ this.handleGetData(employeeConfig, { loading: false, enabled: true });
+ });
+ };
+ /** 获取主表、从表、审核表、员工表数据 */
+ handleGetTableData = (masterConfig, slaveConfig, checkConfig, employeeConfig) => {
+ const { currentId } = this.props; /* 当前页签数据 */
+ const sId = currentId !== undefined ? currentId : '';
+ this.props.handleGetDataOne({
+ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' },
+ });
+ this.props.handleGetDataSet({
+ name: 'slave', configData: slaveConfig, condition: { sSqlCondition: { sParentId: sId } },
+ });
+ this.props.handleGetDataSet({
+ name: 'check', configData: checkConfig, condition: { sSqlCondition: { sParentId: sId } },
+ });
+ this.props.handleGetDataSet({
+ name: 'employee', configData: employeeConfig, condition: { sSqlCondition: { sParentId: sId } },
+ });
+ };
+ /* 取消操作 */
+ handleCancel = (obj) => {
+ /* 待用数据声明 */
+ const {
+ masterConfig, slaveConfig, checkConfig, employeeConfig,
+ } = this.props;
+ const onGetDataOk = this.handleGetTableData;
+ const onSaveStateOk = this.props.onSaveState;
+ confirm({
+ title: obj.title,
+ onOk() {
+ onGetDataOk(masterConfig, slaveConfig, checkConfig, employeeConfig);
+ onSaveStateOk({ enabled: false });
+ },
+ onCancel() {
+ },
+ });
+ };
+ /** 点击新增按钮 */
+ handleAdd = async (config, copyTo) => {
+ let configNew = {};
+ if (commonUtils.isEmptyObject(config)) {
+ const { masterConfig, slaveConfig } = this.props;
+ configNew.masterConfig = masterConfig;
+ configNew.slaveConfig = slaveConfig;
+ } else {
+ configNew = config;
+ }
+ const { token, sModelsId } = this.props;
+ const state = await this.props.onAdd(configNew, copyTo, true);
+ const { masterData, slaveData } = state;
+ const employeeData = [];
+ if (commonUtils.isNotEmptyObject(copyTo)) {
+ const copyToControlConfig = copyTo.config.filter(item => item.sControlName.toLowerCase() === `${copyTo.name}.employee`.toLowerCase());
+ const employeeAssignField = commonUtils.isNotEmptyArr(copyToControlConfig) ? copyToControlConfig[0].sAssignField : '';
+
+ const newCopyTo = {};
+ newCopyTo.masterData = copyTo.masterData;
+ newCopyTo.slaveData = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
+ if (commonUtils.isNotEmptyObject(copyTo.employeeData)) {
+ copyTo.employeeData.forEach((employeeItem) => {
+ newCopyTo.employeeData = employeeItem;
+ let employeeRow = commonFunc.getDefaultData(config.employeeConfig, newCopyTo); // 取默认值
+ employeeRow = { ...employeeRow, ...commonFunc.getAssignFieldValue(employeeAssignField, employeeItem, newCopyTo) }; // 取赋值字段
+ employeeRow.handleType = 'add';
+ employeeRow.sId = commonUtils.createSid();
+ employeeRow.sParentId = masterData.sId;
+ employeeData.push(employeeRow);
+ });
+ }
+
+ if (commonUtils.isNotEmptyArr(slaveData)) {
+ for (const tableDataRow of slaveData) {
+ const sWageId = tableDataRow.sWageId;
+ if (commonUtils.isNotEmptyObject(sWageId)) {
+ tableDataRow.dWageMoney = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sWageId,
+ });
+ }
+ /* 调用折算公式,算换算数量 */
+ const sConversionFormulaId = tableDataRow.sConversionFormulaId;
+ if (commonUtils.isNotEmptyObject(sConversionFormulaId)) {
+ tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sConversionFormulaId,
+ });
+ }
+
+ /* 调用工时公式,算工时 */
+ const sFactCapacityId = tableDataRow.sFactCapacityId;
+ if (commonUtils.isNotEmptyObject(sFactCapacityId)) {
+ tableDataRow.dHour = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sFactCapacityId,
+ });
+ }
+
+ if (!commonUtils.isEmpty(tableDataRow.sTeamId) && commonUtils.isEmptyObject(copyTo.employeeData)) {
+ const url = `${commonConfig.server_host}eleteamemployee/getEleteamemployee?sModelsId=${sModelsId}&sTeamId=${tableDataRow.sTeamId}&sSlaveId=${tableDataRow.sId}&sParentId=${tableDataRow.sParentId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ returnData.forEach((child) => {
+ employeeData.push({
+ sId: child.sId,
+ sParentId: child.sParentId,
+ sSlaveId: child.sSlaveId,
+ sEmployeeId: child.sEmployeeId,
+ sEmployeeName: child.sEmployeeName,
+ dProportion: child.dProportion !== 0 ? child.dProportion : commonUtils.convertFixNum(1 / returnData.length, 6),
+ handleType: 'add',
+ });
+ });
+ /* 班组变化时,算每个工作人员计件工资 */
+ const dWageMoneyTotal = tableDataRow.dWageMoney;
+ if (commonUtils.isNotEmptyNumber(dWageMoneyTotal)) {
+ let dProportionTotal = 0;
+ employeeData.filter(item => item.sSlaveId === tableDataRow.sId).forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += commonUtils.convertFixNum(item.dProportion, 6);
+ dProportionTotal = commonUtils.convertFixNum(dProportionTotal, 6);
+ }
+ });
+ employeeData.filter(item => item.sSlaveId === tableDataRow.sId).forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeData.findIndex(item1 => item1.sId === item.sId);
+ employeeData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * dWageMoneyTotal, 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+
+ const dWageMoney = commonUtils.isNotEmptyNumber(tableDataRow.dWageMoney) ? commonUtils.convertFixNum(tableDataRow.dWageMoney, 6) : 0;
+ const dTimeMoney = commonUtils.isNotEmptyNumber(tableDataRow.dTimeMoney) ? commonUtils.convertFixNum(tableDataRow.dTimeMoney, 6) : 0;
+ const dLossMoney = commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney) ? commonUtils.convertFixNum(tableDataRow.dLossMoney, 6) : 0;
+ tableDataRow.dAllMoney = commonUtils.convertFixNum((dWageMoney + dTimeMoney) - dLossMoney, 6);
+ }
+ /* 上报参数 如果没值则取默认值 */
+ if (commonUtils.isNotEmptyObject(tableDataRow)) {
+ const tableDataRowNew = JSON.parse(JSON.stringify(tableDataRow));
+ /* 若sParamValue1为0或空时 将sParamDefault1值赋值给sParamValue1 */
+ for (const key of Object.keys(tableDataRowNew)) {
+ if (key.includes('sParamDefault')) {
+ const sParamValueName = key.replace('Default', 'Value');
+ if (commonUtils.isNotEmptyNumber(tableDataRowNew[key]) && tableDataRowNew[key] > 0) {
+ if (commonUtils.isEmptyNumber(tableDataRowNew[sParamValueName]) || tableDataRowNew[sParamValueName] === '0') {
+ tableDataRow[sParamValueName] = tableDataRowNew[key];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ const stateNew = {
+ ...state,
+ employeeData,
+ employeeSelectedRowKeys: [],
+ };
+ this.props.onSaveState(stateNew);
+ };
+ /** 表格数据更改 */
+ handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ /* 从CommonBase获取默认参数 */
+ if (name === 'slave') {
+ const {
+ sModelsId, masterData, [`${name}Data`]: tableData, token, employeeDelData: employeeDelDataOld,
+ } = this.props;
+ let {
+ employeeData,
+ } = this.props;
+ const employeeDelData = commonUtils.isEmptyArr(employeeDelDataOld) ? [] : employeeDelDataOld;
+ const tableDataRow = await this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ if (tableDataRow === undefined) return;
+ const iIndex = tableData.findIndex(item => item.sId === sId);
+ tableData[iIndex] = tableDataRow;
+ /* 改变上报数量时,调用折算公式,进行计算 */
+ if (sFieldName === 'dProcessQty' || sFieldName === 'sConversionFormulaId' || sFieldName === 'sConversionFormulaName') {
+ const sConversionFormulaId = tableDataRow.sConversionFormulaId;
+ tableData[iIndex].dConversionQty = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sConversionFormulaId,
+ });
+ }
+ if (sFieldName === 'sTeamName' || sFieldName === 'sTeamId') {
+ const sTeamId = tableData[iIndex].sTeamId;
+ const sSlaveId = tableData[iIndex].sId;
+ const sParentId = tableData[iIndex].sParentId;
+ // let handleType = tableData[iIndex].handleType;/* 获取操作类型 */
+ // handleType = commonUtils.isEmpty(handleType) ? 'update' : handleType;
+ const url = `${commonConfig.server_host}eleteamemployee/getEleteamemployee?sModelsId=${sModelsId}&sTeamId=${sTeamId}&sSlaveId=${sSlaveId}&sParentId=${sParentId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ if (dataReturn.code === 1) {
+ employeeData.filter(item => item.sSlaveId === sId).forEach((item) => {
+ item.handleType = 'del';
+ employeeDelData.push(item);
+ });
+ const returnData = dataReturn.dataset.rows;
+ const employeeDataNew = employeeData.filter(item => item.sSlaveId !== sId);
+ const employeeSlaveData = [];
+ returnData.forEach((child) => {
+ employeeSlaveData.push({
+ sId: child.sId,
+ sParentId: child.sParentId,
+ sSlaveId: child.sSlaveId,
+ sEmployeeId: child.sEmployeeId,
+ sEmployeeName: child.sEmployeeName,
+ dProportion: child.dProportion !== 0 ? child.dProportion : commonUtils.convertFixNum(1 / returnData.length, 6),
+ handleType: 'add',
+ });
+ });
+ /* 班组变化时,算每个工作人员计件工资 */
+ let dProportionTotal = 0;
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += commonUtils.convertFixNum(item.dProportion, 6);
+ dProportionTotal = commonUtils.convertFixNum(dProportionTotal, 6);
+ }
+ });
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeSlaveData.findIndex(item1 => item1.sId === item.sId);
+ employeeSlaveData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableDataRow.dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ employeeData = employeeDataNew.concat(employeeSlaveData);
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ } else if (sFieldName === 'dProcessQty' || sFieldName === 'sWageId' || sFieldName === 'sWageName') {
+ const sFactCapacityId = tableDataRow.sFactCapacityId; /* 获取工时的公式id */
+ if (commonUtils.isNotEmptyObject(sFactCapacityId)) { /* 调用工时公式,计算工时 */
+ const dHour = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sFactCapacityId,
+ });
+ if (!commonUtils.isEmpty(dHour)) {
+ tableData[iIndex].dHour = dHour;
+ }
+ }
+ const sWageId = tableDataRow.sWageId;
+ if (commonUtils.isNotEmptyObject(sWageId)) {
+ tableData[iIndex].dWageMoney = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sWageId,
+ });
+ }
+ const dWageMoneyTotal = tableData[iIndex].dWageMoney;
+ let dProportionTotal = 0;
+ const employeeSlaveData = employeeData.filter(item => item.sSlaveId === sId);
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += item.dProportion;
+ }
+ });
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeData.findIndex(item1 => item1.sId === item.sId);
+ employeeData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ /* 选择计件方案后 算总金额 */
+ const dWageMoney = commonUtils.isNotEmptyNumber(dWageMoneyTotal) ? commonUtils.convertFixNum(dWageMoneyTotal, 6) : 0;
+ const dTimeMoney = commonUtils.isNotEmptyNumber(tableDataRow.dTimeMoney) ? commonUtils.convertFixNum(tableDataRow.dTimeMoney, 6) : 0;
+ const dLossMoney = commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney) ? commonUtils.convertFixNum(tableDataRow.dLossMoney, 6) : 0;
+ tableDataRow.dAllMoney = commonUtils.convertFixNum((dWageMoney + dTimeMoney) - dLossMoney, 6);
+ } else if (sFieldName === 'dTimeMoney' || sFieldName === 'dLossMoney') {
+ /* 总金额=计件工资+工时工资-损失金额 */
+ let dProportionTotal = 0;
+ const employeeSlaveData = employeeData.filter(item => item.sSlaveId === sId);
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += item.dProportion;
+ }
+ });
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeData.findIndex(item1 => item1.sId === item.sId);
+ employeeData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(tableData[iIndex].dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ const dWageMoney = commonUtils.isNotEmptyNumber(tableDataRow.dWageMoney) ? commonUtils.convertFixNum(tableDataRow.dWageMoney, 6) : 0;
+ const dTimeMoney = commonUtils.isNotEmptyNumber(tableDataRow.dTimeMoney) ? commonUtils.convertFixNum(tableDataRow.dTimeMoney, 6) : 0;
+ const dLossMoney = commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney) ? commonUtils.convertFixNum(tableDataRow.dLossMoney, 6) : 0;
+ tableDataRow.dAllMoney = commonUtils.convertFixNum((dWageMoney + dTimeMoney) - dLossMoney, 6);
+ } else if (sFieldName === 'sProcessName') { /* 切换工序时 上报动态参数赋值 */
+ if (commonUtils.isNotEmptyObject(tableDataRow.sReportParam)) {
+ tableData[iIndex] = { ...tableDataRow, ...commonUtils.convertStrToObj(tableDataRow.sReportParam) };
+ /* 上报参数 如果没值则取默认值 */
+ if (commonUtils.isNotEmptyObject(tableData[iIndex])) {
+ const tableDataRowNew = JSON.parse(JSON.stringify(tableData[iIndex]));
+ /* 若sParamValue1为0或空时 将sParamDefault1值赋值给sParamValue1 */
+ for (const key of Object.keys(tableDataRowNew)) {
+ if (key.includes('sParamDefault')) {
+ const sParamValueName = key.replace('Default', 'Value');
+ if (commonUtils.isNotEmptyNumber(tableDataRowNew[key]) && tableDataRowNew[key] > 0) {
+ if (commonUtils.isEmptyNumber(tableDataRowNew[sParamValueName]) || tableDataRowNew[sParamValueName] === '0') {
+ tableDataRowNew[sParamValueName] = tableDataRowNew[key];
+ }
+ }
+ }
+ }
+ tableData[iIndex] = { ...tableData[iIndex], ...tableDataRowNew };
+ }
+ } else { /* 没有上报参数时 清除已有的上报参数下拉 */
+ // eslint-disable-next-line no-plusplus
+ for (let i = 1; i < 11; i++) {
+ if (!commonUtils.isEmpty(tableData[iIndex][`sParamDropDown${i.toString()}`])) {
+ tableData[iIndex][`sParamDropDown${i.toString()}`] = [];
+ }
+ if (!commonUtils.isEmpty(tableData[iIndex][`sParamValue${i.toString()}`]) && tableData[iIndex][`sParamValue${i.toString()}`] !== '0') {
+ tableData[iIndex][`sParamValue${i.toString()}`] = '';
+ }
+ if (!commonUtils.isEmpty(tableData[iIndex][`sParam${i.toString()}`])) {
+ tableData[iIndex][`sParam${i.toString()}`] = '';
+ }
+ }
+ }
+ } else if (sFieldName === 'sFactCapacityId' || sFieldName === 'sFactCapacityName' || sFieldName === 'sMachineName') {
+ const sFactCapacityId = tableDataRow.sFactCapacityId;
+ if (commonUtils.isNotEmptyObject(sFactCapacityId)) { /* 获取工时 */
+ const dHour = await commonBusiness.getFormulaValue({
+ token, sModelsId, masterData, tableDataRow, sComputeId: sFactCapacityId,
+ });
+ if (!commonUtils.isEmpty(dHour)) {
+ tableData[iIndex].dHour = dHour;
+ }
+ }
+ }
+
+ this.props.onSaveState({
+ [`${name}Data`]: tableData, employeeData, employeeDelData, enabled: true,
+ });
+ } else if (name === 'employee') {
+ /* 班组变化时,算每个工作人员计件工资 */
+ const {
+ slaveData, [`${name}Data`]: tableData,
+ } = this.props;
+ const tableDataRow = await this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ if (tableDataRow === undefined) return;
+ const iIndex = tableData.findIndex(item => item.sId === sId);
+ tableData[iIndex] = tableDataRow;
+
+ const iSlaveIndex = slaveData.findIndex(item => item.sId === tableDataRow.sSlaveId);
+ let dProportionTotal = 0;
+ tableData.filter(item => item.sSlaveId === tableDataRow.sSlaveId).forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += commonUtils.convertFixNum(item.dProportion, 6);
+ dProportionTotal = commonUtils.convertFixNum(dProportionTotal, 6);
+ }
+ });
+ tableData.filter(item => item.sSlaveId === tableDataRow.sSlaveId).forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = tableData.findIndex(item1 => item1.sId === item.sId);
+ tableData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveData[iSlaveIndex].dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+
+ this.props.onSaveState({ [`${name}Data`]: tableData, slaveData, enabled: true });
+ } else {
+ this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData);
+ }
+ };
+ /* 非列表联动下拉 */
+ handleMasterChange = async (name, sFieldName, changeValue, sId, dropDownData) => {
+ /* 数据集类型,对象型为Map 数组型为List */
+ const { masterConfig, sModelsId, app } = this.props;
+ let { masterData } = this.props;
+ const { token } = app;
+ let { sBackProcessClassifyData } = this.props;
+
+ let { sAllPartsName } = masterData;
+ if (sFieldName === 'sProductId') {
+ await this.handleBackProcessData();
+ let allPartsName = [];
+ if (sAllPartsName !== undefined) {
+ allPartsName = sAllPartsName.split(',');
+ }
+
+ if (allPartsName.length > 0 && masterConfig.gdsconfigformslave.filter(item => item.sName === `sMaterialsName${allPartsName[0]}`).length > 0 &&
+ (sBackProcessClassifyData !== undefined && sBackProcessClassifyData !== '' && sBackProcessClassifyData.length > 0 &&
+ masterConfig.gdsconfigformslave.filter(item => item.sName === `${sBackProcessClassifyData[0].sId}${allPartsName[0]}`).length > 0)) {
+ let iIndex;
+ allPartsName.forEach((sPartsName) => {
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === `dSumPQty${sPartsName}`);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === `sMaterialsName${sPartsName}`);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === `iPrintModePo${sPartsName}`);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === `iPositiveColor${sPartsName}`);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+
+ if (sBackProcessClassifyData !== '') {
+ sBackProcessClassifyData.filter(processClassify => processClassify.sType !== '3').forEach((processClassify) => {
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === processClassify.sId + sPartsName);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+ });
+ }
+ });
+ if (sBackProcessClassifyData !== '') {
+ sBackProcessClassifyData.filter(processClassify => processClassify.sType === '3').forEach((processClassify) => {
+ iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sName === processClassify.sId);
+ if (iIndex > -1) {
+ masterConfig.gdsconfigformslave.splice(iIndex, 1);
+ }
+ });
+ }
+ }
+
+
+ let sProductClassifyId;
+ if (changeValue !== null && changeValue !== undefined) {
+ sProductClassifyId = changeValue.sProductClassifyId;
+ sAllPartsName = changeValue.sAllPartsName;
+ } else {
+ sProductClassifyId = masterData.sProductClassifyId;
+ }
+ if (commonUtils.isEmpty(sProductClassifyId)) {
+ return;
+ }
+ const sBackProcessClassify = masterConfig.gdsconfigformslave.filter(item => (item.sName.toLowerCase() === 'sbackprocessclassify'))[0];
+
+ const values = { sKeyUpFilterName: '', sSqlCondition: { sProductClassifyId } };
+ const dataReturn = (await commonServices.postValueService(token, values, `${commonConfig.server_host}business/getSelectDataBysControlId/${sBackProcessClassify.sId}?sModelsId=${sModelsId}`)).data;
+ /* 接收返回值 */
+ /* 成功的话刷新页面(同步主表和从表数据),不成功就弹出错误提示 */
+ if (dataReturn.code === 1) { /* 成功 */
+ const { rows } = dataReturn.dataset;
+
+ allPartsName = [];
+ if (sAllPartsName !== undefined) {
+ allPartsName = sAllPartsName.split(',');
+ }
+
+ sBackProcessClassifyData = rows;
+ if (allPartsName.length > 0 && masterConfig.gdsconfigformslave.filter(item => item.sName === `sMaterialsName${allPartsName[0]}`).length <= 0 &&
+ sBackProcessClassifyData !== undefined && sBackProcessClassifyData !== '' && sBackProcessClassifyData.length > 0 &&
+ masterConfig.gdsconfigformslave.filter(item => item.sName === `${sBackProcessClassifyData[0].sId}${allPartsName[0]}`).length <= 0) {
+ const sumPQtyConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === 'dSumPQty').length > 0 ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'dSumPQty')[0] : [];
+ const materialsNameConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === 'sMaterialsName').length > 0 ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'sMaterialsName')[0] : [];
+ const printModePoConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === 'iPrintModePo').length > 0 ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'iPrintModePo')[0] : [];
+ const positiveColorConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === 'iPositiveColor').length > 0 ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'iPositiveColor')[0] : [];
+ const processNameConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === 'sProcessName').length > 0 ? masterConfig.gdsconfigformslave.filter(item => item.sName === 'sProcessName')[0] : [];
+
+ let ConfigNew;
+ allPartsName.forEach((item) => {
+ ConfigNew = { ...sumPQtyConfig };
+ ConfigNew.sName = `dSumPQty${item}`;
+ ConfigNew.sAssignField = commonUtils.isEmpty(ConfigNew.sAssignField) ? '' : ConfigNew.sAssignField.replace(/:/g, `${item}:`);
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+
+ ConfigNew = { ...materialsNameConfig };
+ ConfigNew.sName = `sMaterialsName${item}`;
+ ConfigNew.sAssignField = commonUtils.isEmpty(ConfigNew.sAssignField) ? '' : ConfigNew.sAssignField.replace(/:/g, `${item}:`);
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+
+ ConfigNew = { ...printModePoConfig };
+ ConfigNew.sName = `iPrintModePo${item}`;
+ ConfigNew.sAssignField = commonUtils.isEmpty(ConfigNew.sAssignField) ? '' : ConfigNew.sAssignField.replace(/:/g, `${item}:`);
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+
+ ConfigNew = { ...positiveColorConfig };
+ ConfigNew.sName = `iPositiveColor${item}`;
+ ConfigNew.sAssignField = commonUtils.isEmpty(ConfigNew.sAssignField) ? '' : ConfigNew.sAssignField.replace(/:/g, `${item}:`);
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+ if (sBackProcessClassifyData !== '') {
+ sBackProcessClassifyData.filter(processClassify => processClassify.sType !== '3').forEach((processClassify) => {
+ ConfigNew = { ...processNameConfig };
+ ConfigNew.sName = processClassify.sId + item;
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+ });
+ }
+ });
+ if (sBackProcessClassifyData !== '') {
+ sBackProcessClassifyData.filter(processClassify => processClassify.sType === '3').forEach((processClassify) => {
+ ConfigNew = { ...processNameConfig };
+ ConfigNew.sName = processClassify.sId;
+ masterConfig.gdsconfigformslave.push(ConfigNew);
+ });
+ }
+ }
+ const returnChange = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ this.props.onSaveState({ ...returnChange, sBackProcessClassifyData, masterConfig });
+ } else { /* 失败 */
+ this.props.getServiceError(dataReturn);
+ }
+ } else if (sFieldName === 'sTeamName') { /* 主表选择的班组,循环复制到从表班组 */
+ const { slaveData, slaveSelectedRowKeys, employeeDelData: employeeDelDataOld } = this.props;
+ let { employeeData } = this.props;
+ const employeeDelData = commonUtils.isEmptyArr(employeeDelDataOld) ? [] : employeeDelDataOld;
+ const iIndex = dropDownData.findIndex(item => item.sId === changeValue.sTeamName);/* 拿到主表下拉选中的班组的名称 */
+ const addStata = {};
+ addStata.sTeamName = dropDownData[iIndex].sTeamName;
+ addStata.sTeamId = dropDownData[iIndex].sId;
+ masterData = { ...masterData, ...addStata };
+ if (iIndex > -1) {
+ if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) {
+ const sTeamId = dropDownData[iIndex].sId;
+ const sSlaveId = slaveData[0].sId;
+ const sParentId = slaveData[0].sParentId;
+ if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { /* 第一个从表数据默认选中 */
+ slaveSelectedRowKeys.push(sSlaveId);
+ }
+ const url = `${commonConfig.server_host}eleteamemployee/getEleteamemployee?sModelsId=${sModelsId}&sTeamId=${sTeamId}&sSlaveId=${sSlaveId}&sParentId=${sParentId}`;
+ const dataReturn = (await commonServices.getService(token, url)).data;
+ slaveData.forEach(async (slaveItem, index) => { /* 根据选中的班组 ,获取班组人员及比例 */
+ let handleType = slaveItem.handleType;/* 获取操作类型 */
+ handleType = commonUtils.isEmpty(handleType) ? 'update' : handleType;
+ addStata.handleType = handleType;
+ slaveData[index] = { ...slaveItem, ...addStata };
+ const employeeSlaveData = [];
+ let employeeDataNew = [];
+ if (dataReturn.code === 1) {
+ const returnData = dataReturn.dataset.rows;
+ if (commonUtils.isNotEmptyObject(returnData) && returnData.length > 0) {
+ employeeDataNew = employeeData.filter(item => item.sSlaveId !== slaveItem.sId);
+
+ const employeeDelDataNew = employeeData.filter(item => item.sSlaveId === slaveItem.sId);
+ employeeDelDataNew.forEach((item) => {
+ item.handleType = 'del';
+ employeeDelData.push(item);
+ });
+ if (commonUtils.isEmptyArr(employeeSlaveData)) { /* 当班组人员无数据时 */
+ returnData.forEach((child) => {
+ employeeSlaveData.push({
+ sId: commonUtils.createSid(),
+ sParentId: slaveItem.sParentId,
+ sSlaveId: slaveItem.sId,
+ sEmployeeId: child.sEmployeeId,
+ sEmployeeName: child.sEmployeeName,
+ dProportion: child.dProportion !== 0 ? child.dProportion : commonUtils.convertFixNum(1 / returnData.length, 6),
+ handleType: 'add',
+ });
+ });
+ }
+ }
+ const dWageMoneyTotal = commonUtils.isNotEmptyNumber(slaveItem.dWageMoney) ? slaveItem.dWageMoney : 0;
+ if (commonUtils.isNotEmptyNumber(dWageMoneyTotal)) {
+ let dProportionTotal = 0;
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion) && item.dProportion !== 0) {
+ dProportionTotal += commonUtils.convertFixNum(item.dProportion, 6);
+ dProportionTotal = commonUtils.convertFixNum(dProportionTotal, 6);
+ }
+ });
+ employeeSlaveData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dProportion)) {
+ const index1 = employeeSlaveData.findIndex(item1 => item1.sId === item.sId);
+ employeeSlaveData[index1] = {
+ ...item,
+ dWageMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveItem.dWageMoney, 0), 6),
+ dTimeMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveItem.dTimeMoney, 0), 6),
+ dLossMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveItem.dLossMoney, 0), 6),
+ dOtherMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveItem.dOtherMoney, 0), 6),
+ dJobMoney: commonUtils.convertFixNum((item.dProportion / dProportionTotal) * commonUtils.isNull(slaveItem.dJobMoney, 0), 6),
+ handleType: commonUtils.isEmpty(item.handleType) ? 'update' : item.handleType,
+ };
+ }
+ });
+ }
+ employeeData = employeeDataNew.concat(employeeSlaveData);
+ }
+ });
+ }
+ }
+ this.props.onSaveState({
+ masterData, slaveData, employeeData, employeeDelData,
+ });
+ } else {
+ this.props.onChange(name, sFieldName, changeValue, sId, dropDownData);
+ }
+ };
+ handleDel = (obj) => {
+ const props = { ...this.props, ...this.state };
+ const onOkDel = this.handleOkDel;
+ confirm({
+ title: obj.title,
+ onOk() {
+ onOkDel(props);
+ },
+ onCancel() {
+ },
+ });
+ };
+ handleOkDel = async (props) => {
+ /* 数据参数 */
+ const {
+ token, sModelsId, masterConfig, masterData, slaveConfig, checkConfig, employeeConfig,
+ } = props;
+ const value = {
+ sClientType: '1',
+ data: {
+ sMasterTable: masterConfig.sTbName,
+ sId: [masterData.sId],
+ sSlaveTable: [
+ {
+ tableName: slaveConfig.sTbName,
+ relationName: 'sParentId',
+ }, {
+ tableName: checkConfig.sTbName,
+ relationName: 'sBillId',
+ }, {
+ tableName: employeeConfig.sTbName,
+ relationName: 'sParentId',
+ }],
+ },
+ };
+ const { sBillNo, sId } = masterData || {};
+ const url = `${commonConfig.server_host}business/delMasSlaBusinessData?sModelsId=${sModelsId}&sBillNo=${sBillNo}&sSysLogSrcId=${sId}`;
+ /* 接收返回值 */
+ const { data } = await commonServices.postValueService(token, value, url);
+ if (data.code === 1) {
+ /* 数据删除成功 */
+ if (this.props.app.currentPane.refresh !== undefined) {
+ this.props.app.currentPane.refresh();
+ }
+ this.handleDelDataSuccess(props);
+ } else { /* 失败 */
+ this.props.getServiceError(data);
+ }
+ };
+ /* 数据删除成功跳转到新路由即pane */
+ handleDelDataSuccess = (props) => {
+ const { app } = props;
+ let { panes, currentPane } = app;
+ /* 删除单据后退出当前路由后,标签panes变化后的集合 */
+ panes = panes.filter(pane => pane.key !== currentPane.key);
+ /* 跳转到panes集合的最后一个路由,因为panes集合一定含有主页路由所以panes的集合大于等于1 */
+ currentPane = panes[panes.length - 1];
+ this.props.onRemovePane(panes, currentPane);
+ };
+
+ handleCancelModal = () => {
+ this.props.onSaveState({
+ visible: false,
+ });
+ };
+
+ handleOk = async (flag, tmpCheck, isWait) => {
+ const {
+ sModelsId, masterData, app, checkConditions, sCheckModelId, checkPersonData, currentId, masterConfig, slaveConfig, checkConfig,
+ } = this.props;
+ const { currentPane } = app;
+ const bCkxTmpCheck = app.systemData.filter(item => item.sName === 'CkxTmpCheck')[0].sValue;
+ if (bCkxTmpCheck === '1') {
+ const returnData = await this.props.onDataAudit(flag, tmpCheck, isWait);
+ if (returnData.code === 1) {
+ if (returnData.dataset.rows[0].dataSet.outData[0].sCode === 1) {
+ this.props.onGetData(masterConfig, slaveConfig, checkConfig);
+ message.success(returnData.msg);
+ } else {
+ message.error(returnData.dataset.rows[0].dataSet.outData[0].sReturn);
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(returnData);
+ }
+ } else {
+ const dataPersonArray = commonUtils.isEmptyObject(this.props.dataPersonArray) ? [] : this.props.dataPersonArray;
+ if (commonUtils.isEmptyObject(dataPersonArray)) {
+ checkPersonData.forEach((item) => {
+ dataPersonArray.push(item.sUserId);
+ });
+ }
+ const dataPersonString = dataPersonArray.join(',');
+ const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`;
+ const value = {
+ sProName: 'Sp_System_AutoSendCheckMsg',
+ paramsMap: {
+ sFormGuid: sModelsId,
+ sBillKey: currentPane.sProcName,
+ sTbName: masterConfig.sTbName,
+ sGuid: masterData.sId,
+ sBillNo: masterData.sBillNo,
+ sCheckCondition: checkConditions,
+ sMemo: '',
+ sCheckModelGuid: sCheckModelId,
+ sCheckPerson: dataPersonString,
+ },
+ };
+
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ const noCheckMsg = commonFunc.showMessage(app.commonConst, 'NoCheckMsg'); /* 您有消息待审核 */
+ if (returnData.dataset.rows[0].dataSet.outData[0].sCode === 1) {
+ this.props.handleSendSocketMessage('examine', 'showImg', currentId, dataPersonString, noCheckMsg, null);
+ const urlCanCheckBill = `${commonConfig.server_host}checkModel/getCanCheckBill?sModelsId=${sModelsId}`;
+ const valueCanCheckBill = { sCheckModelId, checkPersonData, sBillId: masterData.sId };
+ const returnCanCheckBill = (await commonServices.postValueService(app.token, valueCanCheckBill, urlCanCheckBill)).data;
+ if (returnCanCheckBill.code === 1) {
+ if (returnCanCheckBill.dataset.rows[0].iCount === 1) {
+ this.props.onDataAudit(1, 1);
+ this.props.onSaveState({
+ visible: false,
+ });
+ return;
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(returnCanCheckBill);
+ }
+ this.props.handleSendSocketMessage('reflush', 'showImg', currentId, dataPersonString, noCheckMsg, null);
+ message.success(returnData.msg);
+ } else {
+ message.error(returnData.dataset.rows[0].dataSet.outData[0].sReturn);
+ }
+ } else { /* 失败 */
+ this.props.getServiceError(returnData);
+ }
+ }
+ this.props.onSaveState({
+ visible: false,
+ });
+ };
+
+ render() {
+ const {
+ pageLoading, masterData, visible, checkConditions, checkPersonData, app,
+ } = this.props;
+ const checkCondition = commonFunc.showMessage(app.commonConst, 'checkCondition');/* 审核条件 */
+ const checkSmemo = commonFunc.showMessage(app.commonConst, 'checkSmemo');/* 备注 */
+ const columns = [{
+ title: checkCondition,
+ dataIndex: 'condition',
+ key: 'condition',
+ }, {
+ title: checkSmemo,
+ dataIndex: 'sMemo',
+ key: 'sMemo',
+ }];
+ const imgSrc = commonBusiness.handleAddIcon(masterData);
+ const btnSure = commonFunc.showMessage(app.commonConst, 'btnSure');/* 确认 */
+ const check = commonFunc.showMessage(app.commonConst, 'check');/* 审核 */
+ const BtnClose = commonFunc.showMessage(app.commonConst, 'BtnClose');/* 关闭 */
+ const checkPerson = commonFunc.showMessage(app.commonConst, 'checkPerson');/* 审核人 */
+ return (
+
+
+ {
+ visible ?
+ {BtnClose},
+ ,
+ ]}
+ >
+
+ {checkPerson}
+
+
+
+ { commonUtils.isNotEmptyObject(checkPersonData) ?
+ checkPersonData.map((item) => {
+ return (
+
+ {item.sUserName}
+
+ );
+ })
+ : ''
+ }
+
+
+
+
+ : ''
+ }
+
+ );
+ }
+}
+
+const WorkOrderComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, slavePagination, isSmall, sModelsType, app, checkConfig,
+ } = props;
+ if (commonUtils.isNotEmptyObject(slavePagination)) {
+ if (isSmall) {
+ slavePagination.showTotal = null;
+ }
+ }
+ /* 回带表单 */
+ onReturnForm(form);
+ const pagination = {
+ pageSize: commonConfig.pageSize,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ ...slavePagination,
+ hideOnSinglePage: true,
+ size: isSmall ? 'small' : 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ showSizeChanger: !isSmall,
+ showQuickJumper: !isSmall,
+ };
+ const propsType = {
+ ...props,
+ onChange: props.onMasterChange,
+ };
+ let topTableHeight = 0;
+ if (document.getElementsByClassName('product_table' + props.sTabId)[0]) {
+ topTableHeight = document.getElementsByClassName('product_table' + props.sTabId)[0].offsetHeight
+ }
+ const employeePropsType = {
+ ...commonBusiness.getTableTypes('employee', props),
+ filteredValue: props.slaveSelectedRowKeys,
+ onFilterData: props.onFilterData,
+ tableProps: {
+ AutoTableHeight: (window.innerHeight - 178 - 89 - topTableHeight) > 250 ? (window.innerHeight - 178 - 89 - topTableHeight) : 250
+ }
+ };
+
+ const slaveTableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: {
+ AutoTableHeight: 250,
+ pagination,
+ onChange: props.onTitleChange,
+ },
+ };
+
+ const checkTableProps = {
+ ...commonBusiness.getTableTypes('check', props),
+ tableProps: {
+ AutoTableHeight: 250,
+ },
+ };
+ const sReportParams = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sReportParams')) ?
+ commonFunc.showMessage(app.commonConst, 'sReportParams') : '上报参数标准';
+ /* 新方式的上报参数 */
+ const sParamProps = {
+ ...commonBusiness.getTableTypes('sParam', props),
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ onChange: props.onTitleChange,
+ sModelsType,
+ AutoTableHeight: 350,
+ rowSelection: null,
+ },
+ bRowClick: true,
+ // enabled: true,
+ };
+
+ const slaveTablePropsList = {};
+ if (commonUtils.isNotEmptyArr(props.slaveInfoList)) {
+ props.slaveInfoList.forEach((item, index) => {
+ // const slaveTablePagination = {
+ // pageSize: commonUtils.isNotEmptyNumber(props.iPageSize) && props.iPageSize !== 0 ? props.iPageSize : commonConfig.pageSize,
+ // ...slavePagination,
+ // size: isSmall ? 'small' : 'large',
+ // pageSizeOptions: commonConfig.pageSizeOptions,
+ // showSizeChanger: !isSmall,
+ // showQuickJumper: !isSmall,
+ // hideOnSinglePage: true,
+ // };
+ slaveTablePropsList[`slaveTable${index}Props`] = {
+ ...commonBusiness.getTableTypes(`slave${index}`, props),
+ // tableBelone: 'list',
+ tableProps: {
+ // pagination: slaveTablePagination, onChange: props.onTitleChange1.bind(this, `slave${index}`),
+ AutoTableHeight: (window.innerHeight - 178 - 89 - topTableHeight) > 250 ? (window.innerHeight - 178 - 89 - topTableHeight) : 250
+ },
+ };
+ });
+ }
+ return (
+
+ );
+});
+
+export default CommonBase(CommonSales(ProductionReport));
diff --git a/src/components/productionMainPlan/index.less b/src/components/productionMainPlan/index.less
new file mode 100644
index 0000000..646953a
--- /dev/null
+++ b/src/components/productionMainPlan/index.less
@@ -0,0 +1,246 @@
+:global {
+ .xly-productionPlan-list {
+ .ant-layout-sider {
+ width: 38px !important;
+ flex: 0 0 38px !important;
+ width: 38px !important;
+ max-width: 38px !important;
+ min-width: 38px !important;
+ background-color: #f5f5f5 !important;
+ writing-mode: tb-rl;
+ text-align: left;
+ letter-spacing: 0px;
+ line-height: 38px;
+ font-size: 12px;
+ font-weight: bold;
+ border: 1px solid #cfcece;
+ padding-top: 30px;
+ }
+ /* 设置选中行背景色 */
+ .processList .selected-record-row td div{
+ background: #e6f7ff!important;
+ }
+ .productPlan{ /* 生产主计划汇总表 */
+ overflow: hidden!important;
+ .ant-table-expanded-row-fixed {
+ width: 100%!important;
+ }
+ //height: ~"calc((100vh - 10px) - 11px)"!important;
+ .topTable .ant-table-content .ant-table-scroll {
+ padding-bottom: 30px !important;
+ }
+ //.topTable{
+ // height: ~'calc(100% - 150px)';
+ //}
+ .ant-table-row{
+ .anticon-right{
+ margin: 0!important;
+ }
+ }
+ }
+ /* 生产主计划展开从表 */
+ .productPlan .ant-table-expanded-row{
+ .topTable .ant-table-content .ant-table-scroll {
+ height: auto!important;
+ //max-height: 200px;
+ overflow:auto!important;
+ overflow-x: auto!important;/* 嵌套子表不要X轴滚动条 */
+ }
+ .ant-table-placeholder{
+ margin-top: 18px!important;
+ }
+ }
+
+ /* 设置侧边栏与table距离 */
+ .subForm___2sIdI{
+ margin-left: 0px!important;
+ }
+ .processList{
+ margin: 0 0 0 10px;
+ overflow: unset;
+ }
+ .mainPlan{
+ width: 100%;
+ }
+ .process{
+ a{ margin-bottom: 7px;}
+ img{margin-left: -5px}
+ }
+ .productionCard{
+ color: rgba(0, 0, 0, 0.65) !important;
+ color: #666;
+ padding: 0;
+ margin: 5px 10px;
+ }
+ /* 生产主计划 排程详情 */
+ .productionCardInfo{
+ margin: 0px 10px;
+ }
+ .card_title{
+ font-weight: bold;
+ }
+ .ant-card-head{
+ display: none;
+ }
+ .ant-tabs-content .ant-card-head{
+ display: block!important;
+ }
+ .ant-card-body{
+ width: 100%;
+ padding: 0px!important;
+ padding-right: 1px!important;
+ overflow: hidden!important;
+ }
+ .ant-card-grid{
+ padding: 5px 10px;
+ }
+ .card_left{
+ width: 100%; /* 80% */
+ float: left;
+ font-size:12px;
+ font-weight: bold;
+ }
+ .card_left1{
+ float:left;
+ width: 60%;
+ }
+ .card_left2{
+ float:right;
+ width: 40%;
+ text-align: right;
+ }
+ .card_top{
+ width: 100%;
+ }
+ .card_mid{
+ font-size: 14px;
+ float:left;
+ width: 100%;
+ }
+ .card_bottom{
+ width: 100%;
+ color:#198ef8 ;
+ }
+ .card_right{
+ width: 10%;
+ height:100%;
+ line-height: 50px;
+ color: #ff0000;
+ float: left;
+ font-weight: bold;
+ }
+ /* 排程详情 */
+ .card_data{
+ width: 50%;
+ float: left;
+ }
+ .card_data_title{
+ font-weight: bold;
+ padding: 5px 0;
+ }
+ .card_data_detail{
+ font-size: 12px;
+ }
+ .card_data_char{
+ font-size: 12px;
+ width: 48%;
+ max-height: 60px!important;
+ float: right;
+ }
+ .card_char{
+ height: 49px;
+ position: relative;
+ }
+ .card_data_hour{
+ position: absolute!important;
+ top:43%;
+ width: 75%;
+ z-index: 1;
+ text-align: center;
+ }
+ .card_char #commonChar{
+ margin-bottom: 0px!important;
+ margin-top: -3px!important;
+ max-height: 49px;
+ }
+ .card_char_bottom{
+ overflow:hidden;
+ text-overflow:ellipsis;
+ white-space:nowrap;
+ .limitDateWeight{
+ color:#e60012!important;
+ font-weight: bold!important;
+ }
+ }
+ /* 不同排程状态样式 */
+ .allCard{
+ background: #FFF1F0;
+ }
+ .unCard{
+ background: #E6F7FF;
+ }
+ .defaultCard{
+ background:#fff
+ }
+ .cardSelectedColor{
+ background:#fff7e6;
+ }
+
+ /* 排程样式调整 */
+ .productionCard .ant-card-body{
+ max-height: 93px!important;
+ overflow: auto!important;
+ }
+ .card_flex{
+ display: flex;
+ flex-direction: row;
+ font-size:12px;
+ font-weight: bold;
+ align-items: center;
+ height: 36px;
+ flex-flow: row wrap;
+ justify-content: center;
+ }
+ .left_card{
+ text-align: left;
+ width: 70%;
+ font-size: 13px;
+ height: 100%;
+ line-height: 36px;
+ }
+ .right_card{
+ width: 30%;
+ text-align: center;
+ color: #ff0000;
+ }
+ .sMaterialsStatusStyle{
+ width: 100%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ /* 主计划材料状态 */
+ .sMaterialsStatusStyle:hover{
+ text-decoration: underline!important;
+ text-decoration-color:#1E90FF!important;/* 设置下划线颜色 */
+ }
+ .planCheckModel[aria-disabled=true]{
+ cursor: wait;
+ }
+ }
+ #productionPlanningMaster button{
+ width: 60px;
+ height: 30px;
+ text-align: center;
+ }
+}
+.commonModal{
+ button[disabled]{
+ cursor: wait;
+ }
+}
+.charContainer{
+ background-color: '#fff';
+ margin: 0 10px;
+ overflow: hidden;
+}
diff --git a/src/components/productionMainPlan/productionHeader.js b/src/components/productionMainPlan/productionHeader.js
new file mode 100644
index 0000000..ac21115
--- /dev/null
+++ b/src/components/productionMainPlan/productionHeader.js
@@ -0,0 +1,211 @@
+/**
+ * Created by mar105 on 2019-02-27.
+ */
+/* eslint-disable object-curly-newline,prefer-destructuring */
+import React, { Component } from 'react';
+import { ExportOutlined, PrinterOutlined, SaveOutlined } from '@ant-design/icons';
+import { Row, Col } from 'antd';
+import styles from '../Common/ToolBar/index.less';
+import ShowType from '../Common/CommonComponent';
+import * as commonUtils from '../../utils/utils';/* 通用方法 */
+import AffixMenu from '../../routes/common/AffixMenu';
+import ProductionPlan1 from '../../assets/ProductionPlan-1.svg';
+import ProductionPlan2 from '../../assets/ProductionPlan-2.svg';
+import ProductionPlan7 from '../../assets/ProductionPlan-7.svg';
+import ProductionPlan8 from '../../assets/ProductionPlan-8.svg';
+import ProductionPlan11 from '../../assets/ProductionPlan-11.svg';
+
+export default class productionHeader extends Component {
+ /** 构造函数 */
+ constructor(props) {
+ super(props);
+ this.state = {
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ stateValue: props.stateValue,
+ masterData: props.masterData,
+ };
+ }
+
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(this.props);
+ }
+
+ /** props改变的时候触发 */
+ componentWillReceiveProps(nextProps) {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(nextProps);
+ }
+
+ /** 返回true执行渲染,返回false不渲染 */
+ shouldComponentUpdate(nextProps, nextState) {
+ const {
+ masterConfig, stateValue, enabled, masterData,
+ } = this.state;
+ const ret = enabled !== nextState.enabled || JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
+ JSON.stringify(masterData) !== JSON.stringify(nextState.masterData) ||
+ JSON.stringify(stateValue) !== JSON.stringify(nextState.stateValue);
+ return ret;
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ masterData: props.masterData,
+ stateValue: props.stateValue,
+ });
+ }
+ // 获取header按钮状态 stateValue
+ HandlerHeaderButtonShowState = (props) => {
+ const { masterData, searchSolution } = props;
+ let filterCondition = [];
+ let stateValue = 99;
+ if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSearchSolutionId)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1) {
+ filterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ let state = '';
+ let frozen = '';
+ filterCondition.forEach((item) => {
+ if (item.bFilterName === 'sState') {
+ state = item.bFilterValue;
+ }
+ if (item.bFilterName === 'bFrozen') {
+ frozen = item.bFilterValue;
+ }
+ });
+
+ if (commonUtils.isEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ if (state === '未排程') {
+ stateValue = 0;
+ } else if (state === '未下达' || state === '已排程') {
+ stateValue = 1;
+ } else if (state === '已下达') {
+ stateValue = 2;
+ } else if (state === '已暂停') {
+ stateValue = 3;
+ } else if (state === '已完成') {
+ stateValue = 5;
+ }
+ } else if (commonUtils.isNotEmptyObject(frozen)) {
+ stateValue = 4;
+ } else if (commonUtils.isNotEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ stateValue = 99;
+ }
+ }
+ }
+ return { stateValue };
+ }
+ handleClick = (iTag) => {
+ this.props.onButtonClick(iTag);
+ }
+
+ handleSwitchChange = (value) => {
+ this.props.onSwitchChange(value);
+ }
+ rowReturnType = (child, i) => {
+ const { enabled, stateValue } = this.state;
+ const sMemo = child.sName.toLowerCase().endsWith('memo');
+ const iColValue = sMemo ? 21 : child.iColValue * 2;
+ const iOrder = sMemo ? 100 : child.iOrder > 100 ? 100 : child.iOrder;
+ const enabledNew = (enabled && !child.bReadonly && !child.specialControl);
+ const type = commonUtils.isNotEmptyObject(child.sControlName) && child.sControlName.toLowerCase().startsWith('btn');
+
+ let showTypeProps = {};
+ if (!type) {
+ const switchBtn = child.sControlName.toLowerCase().startsWith('switch');
+ if (!switchBtn) {
+ showTypeProps = {
+ name: 'master',
+ form: this.props.form,
+ formId: this.props.sModelsId,
+ getSqlDropDownData: this.props.getSqlDropDownData,
+ getSqlCondition: this.props.getSqlCondition,
+ handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
+ getFloatNum: this.props.getFloatNum,
+ getDateFormat: this.props.getDateFormat,
+ onChange: this.props.onChange,
+ showConfig: child,
+ textArea: sMemo,
+ enabled: enabledNew,
+ dataValue: commonUtils.isNotEmptyObject(this.props.masterData) ? this.props.masterData[child.sName] : '',
+ bTable: false,
+ };
+ return (
+
+
+
+ );
+ } else {
+ return '';
+ }
+ } else {
+ let displayFlag = false;
+ let disabledFlag = true;
+ if ((stateValue === '0' && child.iTag === 3) || (stateValue === '1' && child.iTag === 5)
+ || (stateValue === '0' && child.iTag === 5) || (stateValue === '2' && child.iTag === 4)
+ || (stateValue === '2' && child.iTag === 5)
+ || (stateValue === '2' && child.iTag === 17)
+ || (stateValue === '3' && child.iTag === 6)
+ || (child.iTag === 1) || (child.iTag === 2)
+ || (child.iTag === 7) || (child.iTag === 8) || (child.iTag === 11)
+ || (child.iTag === 12) || (child.iTag === 13) || (child.iTag === 14) || (child.iTag === 15) || (child.iTag === 16)
+ ) {
+ displayFlag = true;
+ }
+ if ((child.iTag === 1 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 2 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ (child.iTag === 3 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 4 && stateValue === '2') ||
+ (child.iTag === 5 && stateValue === '2') ||
+ (child.iTag === 6 && stateValue === '3') ||
+ (child.iTag === 7 && stateValue === '2') ||
+ (child.iTag === 8 && stateValue === '2') ||
+ (child.iTag === 11 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ ((child.iTag === 12 || child.iTag === 13 || child.iTag === 14) && stateValue !== '99')
+ ) {
+ disabledFlag = false;
+ }
+ // console.log(child.showName, ' disabledFlag:', disabledFlag, 'displayFlag:', displayFlag);
+ return displayFlag ? (
+
+ {(() => {
+ switch (child.iTag) {
+ case 1: return
;
+ case 2: return
;
+ case 7: return
;
+ case 8: return
;
+ case 11: return
;
+ case 12: return ;
+ case 13: return ;
+ case 14: return ;
+ default: return null;
+ }
+ }
+ )()}
+ {child.showName}
+
+ ) : '';
+ }
+ }
+
+ render() {
+ const { masterConfig } = this.state;
+ const teamMachineProps = masterConfig === undefined ? undefined : masterConfig.gdsconfigformslave;
+ return (
+
+ );
+ }
+}
diff --git a/src/components/productionMainPlan/productionMainPlan.js b/src/components/productionMainPlan/productionMainPlan.js
new file mode 100644
index 0000000..d856cf5
--- /dev/null
+++ b/src/components/productionMainPlan/productionMainPlan.js
@@ -0,0 +1,666 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Avatar, Tabs, Card, Row, Col, message } from 'antd'; // Switch, Modal, Card, Row, Col
+import styles from '@/index.less';
+import * as commonFunc from '@/components/Common/commonFunc';
+import CommonBase from '@/components/Common/CommonBase';
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import SearchComponent from '@/components/Common/SearchComponent';/* 搜索组件 */
+import CommonProductionMainPlanEvent from '@/components/Common/CommonProductionmMainPlanEvent';
+import CommonListSelect from '@/components/Common/CommonListSelect';/* 选择界面 */
+import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
+import * as commonUtils from '@/utils/utils';/* 通用方法 */
+import Gantt from '@/components/Charts/Gantt';
+import ProductionUnifiedPlanning from '@/components/productionMainPlan/productionUnifiedPlanning';
+import CustomizedChar from '@/components/Common/ShowChar/CustomizedChar';
+import MoveUp from '@/assets/processUp.svg';
+import MoveDown from '@/assets/processDown.svg';
+import DisableMoveUp from '@/assets/disableprocessUp.svg';
+import DisableMoveDown from '@/assets/disableprocessDown.svg';
+import MoveTop from '@/assets/processTop.svg';
+import DisableMoveTop from '@/assets/disableprocessTop.svg';
+import MoveBottom from '@/assets/processBottom.svg';
+import DisableMoveBottom from '@/assets/disableprocessBottom.svg';
+import ShowList from '@/assets/list.svg';
+import DisableShowList from '@/assets/disablelist.svg';
+import ShowGantt from '@/assets/gantt.svg';
+import DisableShowGantt from '@/assets/disablegantt.svg';
+import commonConfig from '@/utils/config';
+import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
+import ShowCheckModel from '@/assets/checkModel.svg';
+import DisableShowCheckModel from '@/assets/disablecheckModel.svg';
+import selfstyles from './index.less';
+import GanttStyles from '../productionScheduleTree/index.less';
+
+const { TabPane } = Tabs;
+const { Header, Content, Sider } = Layout;
+
+class ProductionMainPlanComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ this.form = {}; /* 表单对象 */
+ }
+ // onRowMouseEnter = (name, record) => {
+ // // if (this.props.enabled && name === 'control') {
+ // // this.props.onTableSelectRowChange(name, [record.sId]);
+ // // }
+ // }
+ onDoubleClick = (name, record) => {
+ if (this.props.onDoubleClick !== undefined) {
+ this.props.onDoubleClick(record);
+ }
+ };
+ onRowClick1 = (name, record, bRowClick) => {
+ let selectedRowKeys = [...this.props.slaveSelectedRowKeys];
+ if (commonUtils.isEmptyArr(selectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sId);
+ selectedRowKeys = keys;
+ } else {
+ const indexKey = selectedRowKeys.indexOf(record.sId);
+ if (indexKey === -1) {
+ selectedRowKeys.push(record.sId);
+ } else if (indexKey !== -1) {
+ if (!bRowClick) { /* 可输入行,行内点击时 不去除selectedRowKeys */
+ selectedRowKeys.splice(indexKey, 1);
+ }
+ }
+ }
+ this.props.onTableSelectRowChange(name, selectedRowKeys);
+ };
+
+ // eslint-disable-next-line no-unused-vars
+ onRowClick = (name, record, bRowClick) => {
+ // let selectedRowKeys = [...this.props.slaveSelectedRowKeys];
+ // if (commonUtils.isEmptyArr(selectedRowKeys)) {
+ // const keys = [];
+ // keys.push(record.sId);
+ // selectedRowKeys = keys;
+ // } else {
+ // const indexKey = selectedRowKeys.indexOf(record.sId);
+ // if (indexKey === -1) {
+ // selectedRowKeys.push(record.sId);
+ // } else if (indexKey !== -1) {
+ // if (!bRowClick) { /* 可输入行,行内点击时 不去除selectedRowKeys */
+ // selectedRowKeys.splice(indexKey, 1);
+ // }
+ // }
+ // }
+ // this.props.onTableSelectRowChange(name, selectedRowKeys);
+
+ /* 子表选中 */
+ if (name === 'slaveInfo') {
+ const { slaveInfoSelectedRowKeys } = this.props;
+ let selectedRowKeys = slaveInfoSelectedRowKeys;
+ if (commonUtils.isEmptyArr(selectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sId);
+ selectedRowKeys = keys;
+ } else {
+ const indexKey = selectedRowKeys.indexOf(record.sId);
+ if (indexKey === -1) {
+ selectedRowKeys.push(record.sId);
+ } else if (indexKey !== -1) {
+ if (!bRowClick) { /* 可输入行,行内点击时 不去除selectedRowKeys */
+ selectedRowKeys.splice(indexKey, 1);
+ }
+ }
+ }
+ this.props.onTableSelectRowChange(name, selectedRowKeys);
+ }
+ };
+
+ /** 处理选择行发生改变 */
+ handleTableFilterData = (name, data, record) => {
+ /* 外置处理业务 */
+ if (name === 'slave') {
+ let slaveInfoDataNew = [];
+ if (commonUtils.isNotEmptyArr(data)) {
+ slaveInfoDataNew = data.filter(item => item.sProductionPlanId === record.sId);
+ }
+ return slaveInfoDataNew;
+ }
+ };
+ handleCancelUnifiedPlanningChooseModal = () => {
+ this.props.onGetProdData('workCenter', 'Sp_Productionplan_Pie_Char', {});
+ const { workCenterSelectedRowKeys, workCenterData } = this.props;
+ if (commonUtils.isNotEmptyArr(workCenterData)) {
+ const addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = commonUtils.isEmpty(workCenterSelectedRowKeys) ? workCenterData[0].sWorkCenterId : workCenterSelectedRowKeys;
+ const filterArr = [addFilter];
+ this.props.onGetProdData('machine', 'Sp_Productionplan_sColumnarStack_Char', { bFilter: JSON.stringify(filterArr) });
+ }
+ this.props.onSaveState({ unifiedPlanningChooseVisible: false });
+ this.props.onRefresh();
+ };
+ handlePieCard = async (sWorkCenterId) => {
+ const addFilter = {};
+ addFilter.bFilterName = 'sWorkCenterId';
+ addFilter.bFilterCondition = '=';
+ addFilter.bFilterValue = sWorkCenterId;
+ let bProductionPlanOutside = false;
+ if (sWorkCenterId === '0000000000') {
+ bProductionPlanOutside = true; /* 跳转到发外排程 */
+ }
+ const filterArr = [addFilter];
+ this.props.onGetProdData('machine', 'Sp_Productionplan_sColumnarStack_Char', { bFilter: JSON.stringify(filterArr) });
+ this.props.onSaveState({ workCenterSelectedRowKeys: [sWorkCenterId], bProductionPlanOutside });
+ };
+
+ handleWorkCenterData = () => {
+ const { workCenterData, workCenterCharData } = this.props;
+ return commonUtils.isNotEmptyArr(workCenterData) && commonUtils.isNotEmptyObject(workCenterCharData) && commonUtils.isNotEmptyArr(workCenterCharData.data) ? workCenterData.map((child) => {
+ const charConfigArr = [];
+ const charConfigAndDataArr = [];
+ const charConfig = commonBusiness.getCharConfig('', 'sPieGroup', child.sWorkCenterId, 1, 20, 65);
+ charConfigArr.push({ ...charConfig });
+ // charConfigAndData.percent = 3;
+ const charConfigAndData = workCenterCharData.data.filter(item => item.sWorkCenterId === child.sWorkCenterId)[0];
+ charConfigAndDataArr.push({ ...charConfig, child: { data: [{ ...charConfigAndData }], height: 90 } });
+ const charProps = commonBusiness.getCharTypes(child.sWorkCenterName, charConfigArr, charConfigAndDataArr, this.props, { bordered: false });
+ const gridStyle = {
+ width: '99%',
+ padding: '5px 10px',
+ height: '80px',
+ };
+ return (
+
+
+
+
{child.sWorkCenterName}
+
工时:{child.dHourSum}{commonUtils.isNotEmptyNumber(child.dHourSum) ? 'h' : ''}
+
数量:{child.iPlanSum}
+
+
+
{child.dStdWorkCenterHour}h
+
最晚:{child.sLimitDate}
+
+
+ );
+ }) : '';
+ }
+
+ sortData = (tempData) => {
+ tempData.sort((g1, g2) => {
+ return g1.iOrder - g2.iOrder;
+ });
+ return tempData;
+ };
+
+ /* 控制排序 */
+ orderData = (e, name, type) => {
+ // 埋入数据修监听点
+ this.props.onSaveState({
+ dataChanged: true,
+ });
+ const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
+ let { [`${name}Data`]: currentData } = this.props;
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
+ return;
+ }
+ if (commonUtils.isEmptyArr(currentData)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
+ return;
+ }
+ const tempNew = currentData.filter((item) => { /* 获取勾选数据集 */
+ return tableselectedRowKeys.indexOf(item.sId) > -1;
+ });
+ if (commonUtils.isEmptyArr(tempNew)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
+ return;
+ }
+ const len = currentData.length;
+ const newLen = tempNew.length;
+ let num = 0.01;/* 循环增加体 */
+ let targetiOrder = -1;
+ if (type === 1) { /* 上移 */
+ const iIndex = currentData.findIndex(item => item.sId === tempNew[0].sId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = 0;
+ }
+ } else {
+ targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
+ }
+ } else if (type === 2) { /* 下移 */
+ const iIndex = currentData.findIndex(item => item.sId === tempNew[newLen - 1].sId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[iIndex + 1].iOrder;
+ }
+ } else if (type === 0) { /* 置顶 */
+ const iIndex = currentData.findIndex(item => item.sId === tempNew[0].sId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[0].iOrder - 1;
+ }
+ } else if (type === 3) { /* 置底 */
+ const iIndex = currentData.findIndex(item => item.sId === tempNew[newLen - 1].sId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[len - 1].iOrder + 1;
+ }
+ }
+ tempNew.forEach((item) => {
+ const index1 = currentData.findIndex(item1 => item1.sId === item.sId);
+ currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
+ num += 0.01;
+ });
+ currentData = this.sortData(currentData);
+ currentData = this.orderNum(currentData);
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
+ const slavePagination = { ...slavePaginationOld };
+ slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
+ this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
+ }
+ };
+
+ /* 自定义排序号 */
+ orderNum = (tableData) => {
+ tableData.forEach((item, index) => {
+ item.iOrder = index + 1;
+ item.handleType = 'update';
+ });
+ return tableData;
+ };
+ /* 切换稽查列表 */
+ changeCheckModel= (e, type) => {
+ if (type === 'checkModel') {
+ const { slaveFilterCondition } = this.props;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Manufacture_GetPlanAPSstate';
+ chart.paramsMap = {
+ };
+ this.props.onCheckModel(chart, slaveFilterCondition).catch(() => {
+ this.props.onSaveState({ pageLoading: false });
+ });
+ }
+ };
+
+ /* 切换甘特图/列表视图 */
+ changeGantt = (e, type) => {
+ let bGantt = false;
+ if (type === 'gantt') {
+ const { slaveFilterCondition } = this.props;
+ bGantt = true;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_WorkOrder_GtCharAll';
+ chart.paramsMap = {
+ };
+ this.props.onGanttChar(chart, slaveFilterCondition).finally(() => {
+ this.props.onSaveState({ pageLoading: false });
+ });
+ } else if (type === 'list') {
+ bGantt = false;
+ }
+ this.props.onSaveState({ bGantt });
+ };
+
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const ProductionPlanComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, app, onGetChartClick, slavePagination, planLoadingSate, iPageSize, bGantt, charGanttData,
+ } = props;
+
+ /* 回带表单 */
+ onReturnForm(form);
+ const pagination = {
+ pageSize: commonUtils.isNotEmptyNumber(iPageSize) && iPageSize !== 0 ? iPageSize : commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ // size: 'large',
+
+ };
+ const width = '18px';
+ const height = '18px';
+ const moveUp = {
+ title: '上移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveDown = {
+ title: '下移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveTop = {
+ title: '置顶',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveBottom = {
+ title: '置底',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showGantt = {
+ title: '查看Gantt',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showList = {
+ title: '查看列表',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showCheckModel = {
+ title: '齐套稽查',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ let zoom = {};
+ zoom.scale = 'Minutes';
+ zoom.step = '10'; /* 间隔 */
+ if (commonUtils.isNotEmptyObject(charGanttData)) {
+ // eslint-disable-next-line prefer-destructuring
+ zoom = charGanttData.zoom;
+ }
+ const ganttProps = {
+ // ...commonBusiness.getGanttTypes('slave', props),
+ tasks: commonUtils.isNotEmptyObject(charGanttData) ? charGanttData : {}, /* 甘特图数据源 */
+ zoom: commonUtils.isNotEmptyObject(zoom) ? zoom : {},
+ onDataUpdated: props.onDataUpdated,
+ };
+
+ // onChange: props.onTitleChange.bind(this, 'slave'),, 表头没有点击排序事件可以不添加onChange事件
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ // tableBelone: 'list',
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ clearArray: props.clearArray,
+ };
+
+ const tableInfoProps = {
+ ...commonBusiness.getTableTypes('slaveInfo', props),
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ // rowSelection: null,
+ planLoadingSate,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slaveInfo', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slaveInfo'),
+ },
+ // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
+ };
+ let unifiedPlanningType = {};
+ if (commonUtils.isNotEmptyObject(props.unifiedPlanningChooseData)) {
+ unifiedPlanningType = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'unifiedPlanning',
+ config: props.unifiedPlanningConfig,
+ conditonValues: props.getSqlCondition(props.unifiedPlanningConfig),
+ title: props.unifiedPlanningChooseData.sMenuName,
+ route: props.unifiedPlanningChooseData.sName,
+ formId: props.unifiedPlanningChooseData.sId,
+ key: props.sModelsId + props.unifiedPlanningChooseData.sId,
+ sModelsType: props.unifiedPlanningChooseData.sModelType,
+ select: props.onSelect,
+ selectCancel: props.onCancelUnifiedPlanningChooseModal,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ };
+ }
+ const addProps = {};
+
+ const charConfigArr = [];
+ const charConfigAndDataArr = [];
+ const charConfig = commonBusiness.getCharConfig('机台排程', 'sEqualColumnarStack', '1324324', 1, 24, 280);
+ charConfigArr.push({ ...charConfig });
+ if (commonUtils.isNotEmptyArr(props.machineCharData)) {
+ charConfigAndDataArr.push({
+ ...charConfig,
+ child: {
+ ...props.machineCharData, height: 300, chartName: 'chartMachine', onChartClick: onGetChartClick,
+ },
+ });
+ }
+
+ /* 生产进度详情 */
+ let searchWorkSchedule = {};
+ let workScheduleConfig = {};
+ let searchWorkTitle = '';
+ if (commonUtils.isNotEmptyObject(props.workScheduleConfig)) {
+ // eslint-disable-next-line prefer-destructuring
+ workScheduleConfig = props.workScheduleConfig;
+ searchWorkTitle = workScheduleConfig.sActiveName;
+ const sWorkOrderId = commonUtils.isNotEmptyObject(props.workScheduleRecord) ? props.workScheduleRecord.sWorkOrderId : '';
+ searchWorkSchedule = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workScheduleConfig,
+ conditonValues: props.getSqlCondition(workScheduleConfig),
+ title: workScheduleConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: workScheduleConfig.sActiveId,
+ key: props.sModelsId + workScheduleConfig.sId,
+ sModelsType: 'search/workSchedule',
+ bFilterProName: 'p_sWorkOrderId_pro',
+ bFilterProValue: sWorkOrderId,
+ // select: props.onSelect,
+ // selectCancel: props.onSelectCancel,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度 */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+ const machineCharProps = commonBusiness.getCharTypes('machineChar', charConfigArr, charConfigAndDataArr, props);
+ const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
+ const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
+ const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
+ const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
+ const bSetList = true; /* 显示列表 */
+ const bSetGantt = true; /* 显示甘特图 */
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionMainPlanEvent(ProductionMainPlanComponent));
diff --git a/src/components/productionMainPlan/productionUnifiedPlanning.js b/src/components/productionMainPlan/productionUnifiedPlanning.js
new file mode 100644
index 0000000..3f5e1d2
--- /dev/null
+++ b/src/components/productionMainPlan/productionUnifiedPlanning.js
@@ -0,0 +1,241 @@
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, message } from 'antd'; // Button
+import CommonListEvent from '@/components/Common/CommonListEvent';/* 继承销售模块业务功能 */
+import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+// import SearchComponent from '@/components/Common/SearchComponent'; /* 搜索组件 */
+import commonConfig from '@/utils/config';
+import CommonView from '@/components/Common/CommonViewNew';
+import * as commonServices from '@/services/services';/* 服务类 */
+import * as commonUtils from '@/utils/utils';/* 通用方法 */
+import styles from '@/index.less';
+
+const { Content } = Layout;
+
+class UnifiedPlanning extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const { masterData: OldmasterData, slaveData } = nextProps;
+ const masterData = { ...OldmasterData };
+ if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isEmpty(masterData.tCurrTime) && commonUtils.isNotEmptyArr(slaveData)) {
+ const currDate = new Date();
+ const time = `${currDate.getFullYear()}-${currDate.getMonth() + 1}-${currDate.getDate()} ${currDate.getHours()}:${currDate.getMinutes()}`;
+ masterData.tCurrTime = time;
+ slaveData.forEach((item, index) => {
+ slaveData[index] = { ...item, tCStartTime: time };
+ });
+ this.props.onSaveState({ masterData, slaveData });
+ }
+ }
+ /** 确认下单 */
+ handleSelect = () => {
+ const { slaveSelectedData, app } = this.props;
+ this.props.app.currentPane.select(app.currentPane.name, app.currentPane.config, slaveSelectedData);
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+ /** 关闭 */
+ handleCancelModal = () => {
+ const { app } = this.props;
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+
+ handleMasterChange = (name, sFieldName, changeValue, sId, dropDownData) => {
+ const { slaveData } = this.props;
+ const returnData = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ if (sFieldName === 'tCurrTime') {
+ slaveData.forEach((item, i) => {
+ slaveData[i] = {
+ ...item, tCStartTime: changeValue[sFieldName], bIsCalculation: false, handleType: 'update',
+ };
+ });
+ this.props.onSaveState({ ...returnData, slaveData });
+ }
+ }
+
+ handleTableChange = (name, sFieldName, changeValue, sId, dropDownData) => {
+ const {
+ [`${name}Data`]: tableData,
+ } = this.props;
+ const iIndex = tableData.findIndex(item => item.sId === sId);
+ tableData[iIndex] = this.props.onDataChange(name, sFieldName, changeValue, sId, dropDownData, true);
+ if (sFieldName === 'sCurrStatus') {
+ // {"1":"正常运行","2":"正常","3":"返回重排"}
+ if (changeValue[sFieldName] === '3') {
+ tableData[iIndex] = { ...tableData[iIndex], tCStartTime: undefined };
+ }
+ }
+ if (tableData[iIndex].bIsCalculation) {
+ tableData.forEach((item, i) => {
+ tableData[i] = { ...item, bIsCalculation: false };
+ });
+ }
+ this.setState({ [`${name}Data`]: tableData });
+ }
+ // 按钮操作
+ handleButtonClick = (itag, btnName) => {
+ if (btnName === 'BtnCalculation') {
+ this.handleCalculation();
+ }
+ };
+ handleCalculation = async () => {
+ // 获得滚动条div
+ const dom = document.getElementById('productionPlanning').getElementsByClassName('ant-table-body')[0];
+ const { slaveData } = this.props;
+ if (commonUtils.isNotEmptyArr(slaveData)) {
+ let calculation = true;
+ const slaveWarning = slaveData.filter(item => item.sCurrStatus === '1' || item.sCurrStatus === '2' || item.sCurrStatus === '3');
+ if (commonUtils.isEmptyArr(slaveWarning)) {
+ message.error('必须选择机器运行状态!');
+ return;
+ }
+ for (const item of slaveData) {
+ if (commonUtils.isNotEmptyObject(item.sCurrStatus) && item.sCurrStatus === '2' && (item.dWeek === undefined || item.dWeek <= 0)) {
+ calculation = false;
+ message.error('暂停状态下周期不能小于0');
+ break;
+ }
+ }
+ if (calculation) {
+ this.props.onSaveState({ pageLoading: true });
+ let iCount = 0;
+ if (commonUtils.isNotEmptyArr(slaveData)) {
+ const slaveDataError = slaveData.filter(item => commonUtils.isNotEmptyObject(item.sCurrStatus) && (item.sCurrStatus === '2' || item.sCurrStatus === '3'));
+ const slaveDataFilter = slaveData.filter(item => commonUtils.isNotEmptyObject(item.sCurrStatus) && item.sCurrStatus === '1');
+ if (commonUtils.isNotEmptyArr(slaveDataError)) { /* 先执行故障机器,返回重拍机器 */
+ for (const item of slaveDataError) {
+ const iIndex = slaveData.findIndex(data => data.sId === item.sId);
+ if (iIndex > -1) {
+ const isCalculation = await (this.handleCalculationProcedureCall('Sp_unifiedPlanning_BtnCalculation', JSON.stringify({ params: [{ ...item, isClear: iCount, iCount: slaveData.length }] })));
+ if (isCalculation) {
+ slaveData[iIndex] = { ...slaveData[iIndex], bIsCalculation: isCalculation };
+ this.props.onSaveState({ slaveData });
+ iCount += 1;
+ if (iCount > 5) {
+ // 设置滚动条的高度
+ dom.scrollTop = (iCount - 5) * 27.5;
+ }
+ }
+ }
+ }
+ }
+ if (commonUtils.isNotEmptyArr(slaveDataFilter)) {
+ for (const item of slaveDataFilter) {
+ const iIndex = slaveData.findIndex(data => data.sId === item.sId);
+ if (iIndex > -1) {
+ const isCalculation = await (this.handleCalculationProcedureCall('Sp_unifiedPlanning_BtnCalculation', JSON.stringify({ params: [{ ...item, isClear: iCount, iCount: slaveData.length }] })));
+ if (isCalculation) {
+ slaveData[iIndex] = { ...slaveData[iIndex], bIsCalculation: isCalculation };
+ this.props.onSaveState({ slaveData });
+ iCount += 1;
+ if (iCount > 5) {
+ // 设置滚动条的高度
+ dom.scrollTop = (iCount - 5) * 27.5;
+ }
+ }
+ }
+ }
+ }
+ }
+ this.props.onSaveState({ pageLoading: false });
+ this.props.app.currentPane.selectCancel();
+ }
+ }
+ }
+ // 计算
+ handleCalculationProcedureCall = async (proName, proInParam, other) => {
+ const { app, sModelsId } = this.props;
+ const value = { sProName: proName, sProInParam: proInParam };
+ if (other?.iFlag === 1) {
+ value.iFlag = 1;
+ }
+ const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
+ const returnData = (await commonServices.postValueService(app.token, value, url)).data;
+ if (returnData.code === 1) {
+ return true;
+ } else {
+ this.props.getServiceError({ ...returnData, fn: () => this.handleCalculationProcedureCall(proName, proInParam, { iFlag: 1 }) });
+ return false;
+ }
+ }
+ // ----------------------------数据修改回带end ---------------------------- //
+
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+
+const UnifiedPlanningComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const { form, onReturnForm, slavePagination } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ const pagination = {
+ ...slavePagination,
+ size: 'large',
+ pageSize: 1000,
+ showQuickJumper: true,
+ hideOnSinglePage: true,
+ };
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: {
+ rowSelection: null, rowKey: 'sSlaveId', pagination, onChange: props.onTitleChange,
+ },
+ };
+ /*
+
+
+
+
+ */
+ return (
+
+ );
+});
+
+export default CommonBase(CommonListEvent(UnifiedPlanning));
diff --git a/src/components/productionSchedule/index.less b/src/components/productionSchedule/index.less
new file mode 100644
index 0000000..8b22cc6
--- /dev/null
+++ b/src/components/productionSchedule/index.less
@@ -0,0 +1,66 @@
+.ganttList{
+ width: 100vm;
+ padding: 0rem 0.5rem 0 0.5rem;
+}
+:global{
+ .gantt_add, .gantt_grid_head_add{
+ display: none;
+ }
+ .gantt_grid_head_cell.gantt_grid_head_add{
+ display: none;
+ }
+ .commonListSelectBtn{
+ display: none;
+ }
+ .workScheduleModal{
+ overflow: hidden;
+ padding-bottom: 0;
+ .ant-modal-body #modalChooseProcess{
+ overflow: hidden;
+ height: 100%!important;
+ .ant-table-body{
+ height:calc(60vh)!important; /* 调整工单进度详情进度高度 */
+ overflow: auto;
+ }
+ }
+ }
+ .productionSchedule{
+ .topTable{
+ height: ~"calc(100% - 50px)";
+ }
+
+ .split-record-row td { /* 生产排程Tree分割行样式 */
+ border: none!important;
+ span.linksActiveIdStyle{text-decoration:none!important; color:#000!important;}
+ .ant-table-row-expand-icon-collapsed{
+ display: none!important;
+ }
+ .ant-checkbox{
+ display: none!important;
+ }
+ }
+ .split-record-row td:nth-of-type(3) {
+ color: #CDCDCD;
+ span{
+ color: #CDCDCD;
+ }
+ span.linksActiveIdStyle{color:#CDCDCD!important; }
+ }
+ //.noInput{
+ // padding: 0!important;
+ //}
+ //.sActiveIdStyle{
+ // padding: 0!important;
+ //}
+ //.ant-form-item-children{
+ // input{
+ // padding: 0 0px!important;
+ // border: none!important;
+ // }
+ // .sActiveIdStyle{
+ // left: 0!important;
+ // }
+ //}
+ }
+}
+
diff --git a/src/components/productionSchedule/productionHeader.js b/src/components/productionSchedule/productionHeader.js
new file mode 100644
index 0000000..3586f7f
--- /dev/null
+++ b/src/components/productionSchedule/productionHeader.js
@@ -0,0 +1,211 @@
+/**
+ * Created by mar105 on 2019-02-27.
+ */
+/* eslint-disable object-curly-newline,prefer-destructuring */
+import React, { Component } from 'react';
+import { ExportOutlined, PrinterOutlined, SaveOutlined } from '@ant-design/icons';
+import { Row, Col } from 'antd';
+import styles from '../Common/ToolBar/index.less';
+import ShowType from '../Common/CommonComponent';
+import * as commonUtils from '../../utils/utils';/* 通用方法 */
+import AffixMenu from '../../routes/common/AffixMenu';
+import ProductionPlan1 from '../../assets/ProductionPlan-1.svg';
+import ProductionPlan2 from '../../assets/ProductionPlan-2.svg';
+import ProductionPlan7 from '../../assets/ProductionPlan-7.svg';
+import ProductionPlan8 from '../../assets/ProductionPlan-8.svg';
+import ProductionPlan11 from '../../assets/ProductionPlan-11.svg';
+
+export default class productionHeader extends Component {
+ /** 构造函数 */
+ constructor(props) {
+ super(props);
+ this.state = {
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ stateValue: props.stateValue,
+ masterData: props.masterData,
+ };
+ }
+
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(this.props);
+ }
+
+ /** props改变的时候触发 */
+ componentWillReceiveProps(nextProps) {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(nextProps);
+ }
+
+ /** 返回true执行渲染,返回false不渲染 */
+ shouldComponentUpdate(nextProps, nextState) {
+ const {
+ masterConfig, stateValue, enabled, masterData,
+ } = this.state;
+ const ret = enabled !== nextState.enabled || JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
+ JSON.stringify(masterData) !== JSON.stringify(nextState.masterData) ||
+ JSON.stringify(stateValue) !== JSON.stringify(nextState.stateValue);
+ return ret;
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ masterData: props.masterData,
+ stateValue: props.stateValue,
+ });
+ }
+ // 获取header按钮状态 stateValue
+ HandlerHeaderButtonShowState = (props) => {
+ const { masterData, searchSolution } = props;
+ let filterCondition = [];
+ let stateValue = 99;
+ if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSearchSolutionId)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1) {
+ filterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ let state = '';
+ let frozen = '';
+ filterCondition.forEach((item) => {
+ if (item.bFilterName === 'sState') {
+ state = item.bFilterValue;
+ }
+ if (item.bFilterName === 'bFrozen') {
+ frozen = item.bFilterValue;
+ }
+ });
+
+ if (commonUtils.isEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ if (state === '未排程') {
+ stateValue = 0;
+ } else if (state === '未下达' || state === '已排程') {
+ stateValue = 1;
+ } else if (state === '已下达') {
+ stateValue = 2;
+ } else if (state === '已暂停') {
+ stateValue = 3;
+ } else if (state === '已完成') {
+ stateValue = 5;
+ }
+ } else if (commonUtils.isNotEmptyObject(frozen)) {
+ stateValue = 4;
+ } else if (commonUtils.isNotEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ stateValue = 99;
+ }
+ }
+ }
+ return { stateValue };
+ }
+ handleClick = (iTag) => {
+ this.props.onButtonClick(iTag);
+ }
+
+ handleSwitchChange = (value) => {
+ this.props.onSwitchChange(value);
+ }
+ rowReturnType = (child, i) => {
+ const { enabled, stateValue } = this.state;
+ const sMemo = child.sName.toLowerCase().endsWith('memo');
+ const iColValue = sMemo ? 21 : child.iColValue * 2;
+ const iOrder = sMemo ? 100 : child.iOrder > 100 ? 100 : child.iOrder;
+ const enabledNew = (enabled && !child.bReadonly && !child.specialControl);
+ const type = commonUtils.isNotEmptyObject(child.sControlName) && child.sControlName.toLowerCase().startsWith('btn');
+
+ let showTypeProps = {};
+ if (!type) {
+ const switchBtn = child.sControlName.toLowerCase().startsWith('switch');
+ if (!switchBtn) {
+ showTypeProps = {
+ name: 'master',
+ form: this.props.form,
+ formId: this.props.sModelsId,
+ getSqlDropDownData: this.props.getSqlDropDownData,
+ getSqlCondition: this.props.getSqlCondition,
+ handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
+ getFloatNum: this.props.getFloatNum,
+ getDateFormat: this.props.getDateFormat,
+ onChange: this.props.onChange,
+ showConfig: child,
+ textArea: sMemo,
+ enabled: enabledNew,
+ dataValue: commonUtils.isNotEmptyObject(this.props.masterData) ? this.props.masterData[child.sName] : '',
+ bTable: false,
+ };
+ return (
+
+
+
+ );
+ } else {
+ return '';
+ }
+ } else {
+ let displayFlag = false;
+ let disabledFlag = true;
+ if ((stateValue === '0' && child.iTag === 3) || (stateValue === '1' && child.iTag === 5)
+ || (stateValue === '0' && child.iTag === 5) || (stateValue === '2' && child.iTag === 4)
+ || (stateValue === '2' && child.iTag === 5)
+ || (stateValue === '2' && child.iTag === 17)
+ || (stateValue === '3' && child.iTag === 6)
+ || (child.iTag === 1) || (child.iTag === 2)
+ || (child.iTag === 7) || (child.iTag === 8) || (child.iTag === 11)
+ || (child.iTag === 12) || (child.iTag === 13) || (child.iTag === 14) || (child.iTag === 15) || (child.iTag === 16)
+ ) {
+ displayFlag = true;
+ }
+ if ((child.iTag === 1 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 2 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ (child.iTag === 3 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 4 && stateValue === '2') ||
+ (child.iTag === 5 && stateValue === '2') ||
+ (child.iTag === 6 && stateValue === '3') ||
+ (child.iTag === 7 && stateValue === '2') ||
+ (child.iTag === 8 && stateValue === '2') ||
+ (child.iTag === 11 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ ((child.iTag === 12 || child.iTag === 13 || child.iTag === 14) && stateValue !== '99')
+ ) {
+ disabledFlag = false;
+ }
+ // console.log(child.showName, ' disabledFlag:', disabledFlag, 'displayFlag:', displayFlag);
+ return displayFlag ? (
+
+ {(() => {
+ switch (child.iTag) {
+ case 1: return
;
+ case 2: return
;
+ case 7: return
;
+ case 8: return
;
+ case 11: return
;
+ case 12: return ;
+ case 13: return ;
+ case 14: return ;
+ default: return null;
+ }
+ }
+ )()}
+ {child.showName}
+
+ ) : '';
+ }
+ }
+
+ render() {
+ const { masterConfig } = this.state;
+ const teamMachineProps = masterConfig === undefined ? undefined : masterConfig.gdsconfigformslave;
+ return (
+
+ );
+ }
+}
diff --git a/src/components/productionSchedule/productionPlanChangeMacheInfo.js b/src/components/productionSchedule/productionPlanChangeMacheInfo.js
new file mode 100644
index 0000000..467cecf
--- /dev/null
+++ b/src/components/productionSchedule/productionPlanChangeMacheInfo.js
@@ -0,0 +1,109 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Button, Row, Col } from 'antd';
+import CommonListEvent from './CommonListEvent';/* 继承销售模块业务功能 */
+import * as commonFunc from './commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
+import StaticEditTable from './CommonTable';/* 可编辑表格 */
+import CommonBase from './CommonBase';/* 获取配置及数据 */
+import * as commonBusiness from './commonBusiness';/* 单据业务功能 */
+import SearchComponent from './SearchComponent';/* 搜索组件 */
+import * as commonConfig from '../../utils/config';
+
+const { Content } = Layout;
+
+class ProductionPlanChangeMachineInfoComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+ /** 确认下单 */
+ handleSelect = () => {
+ const { slaveSelectedData, app } = this.props;
+ this.props.app.currentPane.select(app.currentPane.name, app.currentPane.config, slaveSelectedData);
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+ /** 关闭 */
+ handleCancelModal = () => {
+ const { app } = this.props;
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+ // ----------------------------数据修改回带end ---------------------------- //
+
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+
+const CommonListComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const { form, onReturnForm, slavePagination } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ const pagination = {
+ ...slavePagination,
+ size: 'large',
+ pageSize: commonConfig.pageSize,
+ showQuickJumper: true,
+ hideOnSinglePage: true,
+ };
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
+ };
+ const teamProps = {
+ ...commonBusiness.getTableTypes('team', props),
+ tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
+ };
+ return (
+
+ );
+});
+
+export default CommonBase(CommonListEvent(ProductionPlanChangeMachineInfoComponent));
diff --git a/src/components/productionSchedule/productionPlanInfo2.js b/src/components/productionSchedule/productionPlanInfo2.js
new file mode 100644
index 0000000..d79ea71
--- /dev/null
+++ b/src/components/productionSchedule/productionPlanInfo2.js
@@ -0,0 +1,136 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Select } from 'antd'; // Switch
+import styles from '../../index.less';
+import * as commonFunc from '../Common/commonFunc';
+import CommonBase from '../Common/CommonBase';
+import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
+import SearchComponent from '../Common/SearchComponent';/* 搜索组件 */
+import CommonProductionPlanEvent from '../Common/CommonProductionPlanEvent';
+import * as config from '../../utils/config';
+import ProductionHeader from './productionHeader';/* 可编辑表格 */
+
+const { Option } = Select;
+const { Header, Content, Sider } = Layout;
+
+class ProductionPlanInfoComponentInfo2 extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ this.form = {}; /* 表单对象 */
+ }
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const ProductionPlanComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, onSelectChange, sStateSelect, isDragAndDrop, stateOption,
+ } = props;
+
+ /* 回带表单 */
+ onReturnForm(form);
+ const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
+ const workTeamProps = {
+ ...commonBusiness.getTableTypes('workCenter', props),
+ tableProps: { rowKey: 'sWorkCenterId' },
+ isKeyUsesId: false,
+ enabled: false,
+ };
+
+ const machineProps = {
+ ...commonBusiness.getTableTypes(sStateSelect === '0' ? 'unMachine' : 'machine', props),
+ tableProps: { rowKey: 'sMachineId' },
+ isKeyUsesId: false,
+ enabled: false,
+ };
+
+ const pagination = {
+ onChange: props.onPaginationChange,
+ size: 'large',
+ pageSize: config.pageSize,
+ pageNum: config.pageNum,
+ showQuickJumper: true,
+ };
+
+ const processProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: { pagination: pageFlag ? false : pagination },
+ scrollX: 3,
+ isDragAndDrop,
+ };
+
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionPlanEvent(ProductionPlanInfoComponentInfo2));
diff --git a/src/components/productionSchedule/productionSchedule.js b/src/components/productionSchedule/productionSchedule.js
new file mode 100644
index 0000000..46e797f
--- /dev/null
+++ b/src/components/productionSchedule/productionSchedule.js
@@ -0,0 +1,1059 @@
+/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { LoadingOutlined } from '@ant-design/icons';
+import { Modal, Layout, Spin, Card, Row, Col, message } from 'antd'; // Switch Select, Tabs,
+import styles from '@/index.less';
+import selfstyles from '@/components/productionMainPlan/index.less';
+import * as commonFunc from '@/components/Common/commonFunc';
+import CommonBase from '@/components/Common/CommonBase';
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import CommonProductionPlanEvent from '@/components/Common/CommonProductionPlanEvent';
+import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
+import MoveUp from '@/assets/processUp.svg';
+import MoveDown from '@/assets/processDown.svg';
+import DisableMoveUp from '@/assets/disableprocessUp.svg';
+import DisableMoveDown from '@/assets/disableprocessDown.svg';
+import MoveTop from '@/assets/processTop.svg';
+import DisableMoveTop from '@/assets/disableprocessTop.svg';
+import MoveBottom from '@/assets/processBottom.svg';
+import DisableMoveBottom from '@/assets/disableprocessBottom.svg';
+import ChangeMachine from '@/assets/changeMachine.svg';
+import DisableChangeMachine from '@/assets/disablechangeMachine.svg';
+import ShowGantt from '@/assets/gantt.svg';
+import DisableShowGantt from '@/assets/disablegantt.svg';
+import ShowCheckModel from '@/assets/checkModel.svg';
+import DisableShowCheckModel from '@/assets/disablecheckModel.svg';
+import ShowTimer from '@/assets/timer.svg';
+import DisableShowTimer from '@/assets/disabletimer.svg';
+import ShowList from '@/assets/list.svg';
+import DisableShowList from '@/assets/disablelist.svg';
+import Reset from '@/assets/reset.svg';
+import DisableReset from '@/assets/disablereset.svg';
+import * as commonUtils from '@/utils/utils';
+import ShowType from '@/components/Common/CommonComponent';
+import commonConfig from '@/utils/config';
+import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
+import * as commonServices from '@/services/services';
+import Gantt from '@/components/Charts/Gantt';
+import MessageArea from '@/components/Charts/Gantt/MessageArea/Message';
+import CommonListSelect from '@/components/Common/CommonListSelect';
+import GanttStyles from './index.less';
+
+const { Header, Content, Sider } = Layout;
+
+class ProductionSchedule extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ isRender: 0,
+ checkModelStatus: false,
+ };
+ this.form = {}; /* 表单对象 */
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const { slaveColumn, masterConfig } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
+ }
+ // onRowMouseEnter = (name, record) => {
+ // console.log('record:', record);
+ // }
+ onDoubleClick = (name, record) => {
+ if (this.props.onDoubleClick !== undefined) {
+ this.props.onDoubleClick(record);
+ }
+ };
+ onRowClick = (name, record, bRowClick) => {
+ const { slaveData } = this.props;
+ let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
+ slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sSlaveId);
+ slaveSelectedRowKeys = keys;
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ } else {
+ const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
+ if (indexKey === -1) {
+ slaveSelectedRowKeys.push(record.sSlaveId);
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ sIds.forEach((item) => {
+ const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (iIndex === -1) {
+ slaveInfoSelectedRowKeys.push(item);
+ }
+ });
+ } else if (indexKey !== -1) {
+ if (!bRowClick) {
+ slaveSelectedRowKeys.splice(indexKey, 1);
+ }
+ const sIds = record.sSlaveId.split('-');
+ sIds.forEach((item) => {
+ const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (!bRowClick) {
+ slaveInfoSelectedRowKeys.splice(index, 1);
+ }
+ });
+ }
+ }
+ } else if (name === 'slaveInfo') {
+ if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sId);
+ slaveInfoSelectedRowKeys = keys;
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
+ }
+ } else {
+ const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
+ if (indexKey === -1) {
+ slaveInfoSelectedRowKeys.push(record.sId);
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
+ if (iIndex === -1) {
+ slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
+ }
+ }
+ } else if (indexKey !== -1) {
+ /* 可输入行,行内点击时 不去除selectedRowKeys */
+ if (!bRowClick) {
+ slaveInfoSelectedRowKeys.splice(indexKey, 1);
+ }
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
+ if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ if (!bRowClick) {
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ }
+ } else {
+ let bdel = true;
+ for (const sId of sSlaveIds) {
+ if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
+ bdel = false;
+ break;
+ }
+ }
+ if (bdel) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ if (!bRowClick) {
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ let machineEnabled = false;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
+ const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
+ if (processSlave.length === slaveSelectedRowKeys.length) {
+ machineEnabled = true;
+ }
+ }
+ const { sModelsId } = this.props;
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
+ this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
+ };
+ onCloseChangeMachine = () => {
+ const { masterData } = this.props;
+ delete masterData.tStartDate;
+ delete masterData.iSplitNum;
+ delete masterData.bSplit;
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
+ }
+ onTableSelectRowChange = (name, selectedRowKeys) => {
+ if (name === 'slave') {
+ const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
+ const slaveInfoSelectedRowKeys = [];
+ if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
+ selectedRowKeys.forEach((selectedRow) => {
+ const sIds = selectedRow.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ });
+ }
+ addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
+ this.props.onSaveState({ ...addState });
+ } else {
+ this.props.onTableSelectRowChange(name, selectedRowKeys);
+ }
+ // let record = {};
+ // let key;
+ // if (name === 'slave') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveSelectedRowKeys.length === 1) {
+ // key = slaveSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length > slaveSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length < slaveSelectedRowKeys.length) {
+ // key = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sSlaveId)[0];
+ // this.onRowClick(name, record);
+ // } else if (name === 'slaveInfo') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveInfoSelectedRowKeys.length === 1) {
+ // key = slaveInfoSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length > slaveInfoSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveInfoSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length < slaveInfoSelectedRowKeys.length) {
+ // key = slaveInfoSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sId)[0];
+ // this.onRowClick(name, record);
+ // } else {
+ // this.props.onTableSelectRowChange(name, selectedRowKeys);
+ // }
+ };
+ /** 处理选择行发生改变 */
+ handleTableFilterData = (name, data, record) => {
+ /* 外置处理业务 */
+ if (name === 'slave') {
+ let slaveInfoDataNew = [];
+ if (commonUtils.isNotEmptyArr(data)) {
+ slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
+ }
+ return slaveInfoDataNew;
+ }
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+
+ /* 甘特图数据改变出发事件 */
+ logDataUpdate = (type, action, item, id) => {
+ const { charGanttData } = this.props;
+ /* 记录更新的数据 */
+ if (action === 'update') {
+ if (commonUtils.isNotEmptyArr(charGanttData)) {
+ const { data } = charGanttData;
+ if (Array.isArray(data) && data.length > 0) {
+ const iIndex = data.findIndex(child => child.id === id);
+ if (iIndex > -1) {
+ if (commonUtils.isNotEmptyObject(item.start_date)) {
+ data[iIndex].start_date = new Date(item.start_date);
+ }
+ if (commonUtils.isNotEmptyObject(item.end_date)) {
+ data[iIndex].end_date = new Date(item.end_date);
+ }
+ charGanttData.tasks.data = data;
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ }
+ }
+ const text = item && item.text ? ` (${item.text})` : '';
+ let message = `${type} ${action}: ${id} ${text}`;
+ if (type === 'link' && action !== 'delete') {
+ message += ` ( source: ${item.source}, target: ${item.target} )`;
+ }
+ this.addMessage(message);
+ }
+ logTaskUpdate = (id, mode, task) => {
+ const text = task && task.text ? ` (${task.text})` : '';
+ const message = `Task ${mode}: ${id} ${text}`;
+ this.addMessage(message);
+ }
+
+ logLinkUpdate = (id, mode, link) => {
+ let message = `Link ${mode}: ${id}`;
+ if (link) {
+ message += ` ( source: ${link.source}, target: ${link.target} )`;
+ this.addMessage(message);
+ }
+ }
+ addMessage = (message) => {
+ const maxLogLength = 5;
+ const newMessate = { message };
+ const messages = [
+ ];
+ messages.push(newMessate);
+ if (messages.length > maxLogLength) {
+ messages.length = maxLogLength;
+ }
+ this.props.onSaveState({ messages });
+ }
+ sortData = (tempData) => {
+ tempData.sort((g1, g2) => {
+ return g1.iOrder - g2.iOrder;
+ });
+ return tempData;
+ };
+
+ /* 控制排序 */
+ orderData = (e, name, type) => {
+ const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
+ let { [`${name}Data`]: currentData } = this.props;
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
+ return;
+ }
+ if (commonUtils.isEmptyArr(currentData)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
+ return;
+ }
+ const tempNew = currentData.filter((item) => { /* 获取勾选数据集 */
+ return tableselectedRowKeys.indexOf(item.sSlaveId) > -1;
+ });
+ if (commonUtils.isEmptyArr(tempNew)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
+ return;
+ }
+ const len = currentData.length;
+ currentData = this.orderNum(currentData);
+ const newLen = tempNew.length;
+ let num = 0.01;/* 循环增加体 */
+ let targetiOrder = -1;
+ if (type === 1) { /* 上移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = 0;
+ }
+ } else if (iIndex === 1 && currentData[0].sDivRowNew) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
+ }
+ } else if (type === 2) { /* 下移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[iIndex + 1].iOrder;
+ }
+ } else if (type === 0) { /* 置顶 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else if (iIndex === 1 && currentData[0].sDivRowNew) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop'));/* 无需置顶 */
+ return;
+ } else if (currentData[0].sDivRowNew) { /* 如果顶层有分割 */
+ targetiOrder = currentData[1].iOrder - 1;
+ } else {
+ targetiOrder = currentData[0].iOrder - 1;
+ }
+ } else if (type === 3) { /* 置底 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[len - 1].iOrder + 1;
+ }
+ }
+ tempNew.forEach((item) => {
+ const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
+ currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
+ num += 0.01;
+ });
+ currentData = this.sortData(currentData);
+ currentData = this.orderNum(currentData);
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
+ const slavePagination = { ...slavePaginationOld };
+ slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
+ this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
+ } else if (name === 'slaveInfo') {
+ this.props.onSaveState({ isChangeMachine: true });
+ }
+ };
+
+ /* 自定义排序号 */
+ orderNum = (tableData) => {
+ const { slaveColumn } = this.props;
+ tableData.forEach((item, index) => {
+ item.iOrder = index + 1;
+ item.handleType = 'update';
+ });
+ /* 移动后 重新计算分割间隔条数及用时逻辑 */
+ const returnFilterData = tableData.filter(item => commonUtils.isNotEmptyObject(item.sDivRowNew) && item.sDivRowNew !== '');
+ if (commonUtils.isNotEmptyArr(returnFilterData)) {
+ returnFilterData.forEach((tableDataRow, index) => {
+ /* 找到白班与晚班区间的汇总条数与工时 */
+ let startIndex = 0; /* 找到开始下标 */
+ let endindex = 0; /* 找到结束下标 */
+ let sliceData = [];
+ startIndex = tableData.findIndex(item => item.sId === returnFilterData[index].sId);
+ if (index + 1 < returnFilterData.length) {
+ endindex = tableData.findIndex(item => item.sId === returnFilterData[index + 1].sId);
+ }
+ if (index === returnFilterData.length - 1) {
+ endindex = tableData.length;
+ }
+ if (startIndex < endindex) {
+ sliceData = tableData.slice(startIndex + 1, endindex);
+ }
+ let num = 0;
+ let dTime = 0;
+ let dPlateQty = 0; /* 付版 */
+ let dProcessQty = 0;
+ /* 找到第二个字段 */
+ if (commonUtils.isNotEmptyArr(sliceData)) {
+ num = sliceData.length;
+ sliceData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item.dHour)) {
+ dTime += item.dHour1;
+ dPlateQty += item.dPlateQty;
+ dProcessQty += item.dProcessQty;
+ }
+ });
+ let sCount = '';
+ if (num > 0) {
+ sCount += `F${num}单`;
+ }
+ if (dProcessQty > 0) {
+ sCount += ` - ${dProcessQty}`;
+ }
+ if (sliceData[0].sType === '1') {
+ sCount += ` - ${dPlateQty}付版`;
+ }
+ if (dTime > 0) {
+ // sCount += ' - ' + Math.floor(dTime/60) + ":" + (dTime%60) + '小时';
+ sCount += ` - ${(dTime / 60).toFixed(2)}h`;
+ }
+ const sFileName = commonUtils.isNotEmptyArr(slaveColumn) && slaveColumn.length > 2 ? slaveColumn[1].dataIndex : '';
+ if (sCount && sFileName) {
+ const addState = {};
+ addState[sFileName] = tableDataRow.sDivRowNew + sCount;
+ tableData[startIndex] = { ...tableData[startIndex], ...addState };
+ }
+ }
+ });
+ }
+ return tableData;
+ };
+
+ /* 切换甘特图/列表视图 */
+ changeGantt = (e, type) => {
+ let bGantt = false;
+ if (type === 'gantt') {
+ const { slaveFilterCondition } = this.props;
+ bGantt = true;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Process_CommonGtChar';
+ chart.paramsMap = {
+ };
+ this.props.onGanttChar(chart, slaveFilterCondition);
+ } else if (type === 'list') {
+ bGantt = false;
+ }
+ this.props.onSaveState({ bGantt });
+ };
+
+ /* 切换稽查列表 */
+ changeCheckModel= async (e, type) => {
+ if (type === 'checkModel') {
+ if (this.state.checkModelStatus) {
+ return;
+ }
+ this.setState({
+ checkModelStatus: true,
+ });
+ const { slaveFilterCondition } = this.props;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Manufacture_GetAPSstate';
+ chart.paramsMap = {
+ };
+ await this.props.onCheckModel(chart, slaveFilterCondition);
+ this.setState({
+ checkModelStatus: false,
+ });
+ }
+ };
+ /* 弹出重算时间弹窗 */
+ showTimerModal= (e, type) => {
+ if (type === 'changeTimer') {
+ this.props.onSaveState({ changeTimerVisible: true });
+ }
+ };
+ /** 处理选择行发生改变 */
+ // handleTableFilterData = (name, data, record) => {
+ // /* 外置处理业务 */
+ // if (name === 'slave') {
+ // let slaveInfoDataNew = '';
+ // slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
+ // return slaveInfoDataNew;
+ // }
+ // };
+ /** 处理card点击事件 */
+ handleTabsCallback = (child) => {
+ if (commonUtils.isNotEmptyArr(this.props.teamData)) {
+ child.cardSelectedColor = '#fff7e6';
+ const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
+ const teamDataNew = this.props.teamData;
+ teamDataNew.forEach((item, index) => {
+ if (index !== iIndex) { item.cardSelectedColor = ''; }
+ });
+ }
+ this.props.onSaveState({ Loading: true });
+ this.props.onTabsCallback(child);
+ };
+
+ // handleGanttChar = async (ganttChart) => {
+ // const { token, sModelsId, formRoute, slaveFilterCondition } = this.props;
+ // let charGanttData = {};
+ // const value = {
+ // sProName: ganttChart.sProcedureName,
+ // paramsMap: ganttChart.prodParamsMap,
+ // bFilter: slaveFilterCondition,
+ // };
+ // const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ // const { data: returnData } = await commonServices.postValueService(token, value, url);
+ // console.log('returnData', returnData);
+ // if (returnData.code === 1) {
+ // const { dataset } = returnData;
+ // if (commonUtils.isNotEmptyObject(dataset)) {
+ // const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ // if (outData.sCode === -1) {
+ // message.error(outData.sReturn);
+ // } else {
+ // charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ // }
+ // }
+ // } else {
+ // message.error(returnData.msg);
+ // }
+ // console.log('charGanttData', charGanttData);
+ // this.props.onSaveState({ charGanttData });
+ // };
+ // renderCards = (data) => {
+ // let showInfo = '';
+ // data.map((item) => {
+ // showInfo += (
+ //
+ //
+ // {item.sTeamName} {item.dHour} {'30%'}
+ //
+ //
+ // );
+ // });
+ // return showInfo;
+ // }
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+
+const ProductionScheduleComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, app, masterData, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate, bGantt, charGanttData, messages,
+ Loading } = props;
+ // console.log('props:===', props);
+ /* 回带表单 */
+ onReturnForm(form);
+ // const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
+ const pagination = {
+ pageSize: commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+ const width = '18px';
+ const height = '18px';
+ const moveUp = {
+ title: '上移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveDown = {
+ title: '下移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveTop = {
+ title: '置顶',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveBottom = {
+ title: '置底',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const changeMachine = {
+ title: '更换机台',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showGantt = {
+ title: '查看Gantt',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showCheckModel = {
+ title: '齐套稽查',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showTimer = {
+ title: '重算时间',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showList = {
+ title: '查看列表',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const resetSearch = {
+ title: '重置搜索',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const addProps = {};
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ clearArray: props.clearArray,
+ };
+
+ const tableInfoProps = {
+ ...commonBusiness.getTableTypes('slaveInfo', props),
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ planLoadingSate,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slaveInfo', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slaveInfo'),
+ },
+ // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
+ };
+ let zoom = {};
+ zoom.scale = 'Minutes';
+ zoom.step = '10'; /* 间隔 */
+ if (commonUtils.isNotEmptyObject(charGanttData)) {
+ zoom = charGanttData.zoom;
+ }
+ const ganttProps = {
+ // ...commonBusiness.getGanttTypes('slave', props),
+ tasks: commonUtils.isNotEmptyObject(charGanttData) ? charGanttData : {}, /* 甘特图数据源 */
+ zoom: commonUtils.isNotEmptyObject(zoom) ? zoom : {},
+ onDataUpdated: props.onDataUpdated,
+ };
+ const gridStyle = {
+ width: '100%',
+ textAlign: 'left',
+ };
+ const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
+ const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
+ const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
+ const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
+ const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
+ const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
+ const resetSearchEnabled = clearArray.length > 0;
+
+ const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
+ const machineShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineId,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
+ const teamShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
+ const startShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ showTime: true,
+ };
+
+ const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
+ const splitShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
+ const splitNumShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ let searchWorkSchedule = {};
+ let workScheduleConfig = {};
+ let searchWorkTitle = '';
+ if (commonUtils.isNotEmptyObject(props.workScheduleConfig)) {
+ workScheduleConfig = props.workScheduleConfig;
+ searchWorkTitle = workScheduleConfig.sActiveName;
+ const sWorkOrderId = commonUtils.isNotEmptyObject(props.workScheduleRecord) ? props.workScheduleRecord.sWorkOrderId : '';
+ searchWorkSchedule = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workScheduleConfig,
+ conditonValues: props.getSqlCondition(workScheduleConfig),
+ title: workScheduleConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: workScheduleConfig.sActiveId,
+ key: sModelsId + workScheduleConfig.sId,
+ sModelsType: 'search/workSchedule',
+ bFilterProName: 'p_sWorkOrderId_pro',
+ bFilterProValue: sWorkOrderId,
+ // select: props.onSelect,
+ // selectCancel: props.onSelectCancel,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度 */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+
+ let selectedRowKey = {};
+ if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
+ selectedRowKey = teamSelectedRowKeys[0];
+ }
+
+ let teamDataNum = 0;
+ if (commonUtils.isNotEmptyArr(props.teamData)) {
+ // 取得导航按钮的行数
+ if (props.teamData.length % 8 === 0) {
+ teamDataNum = (props.teamData.length / 8);
+ } else {
+ teamDataNum = Math.ceil(props.teamData.length / 8);
+ }
+ }
+
+ /* 增加Modal按钮样式 */
+ const okProps = {};
+ if (props.bChangeTimerEnable !== undefined) {
+ okProps.disabled = !props.bChangeTimerEnable;
+ // okProps.loading = !props.bChangeTimerEnable;
+ }
+
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionPlanEvent(ProductionSchedule));
diff --git a/src/components/productionScheduleTree/index.less b/src/components/productionScheduleTree/index.less
new file mode 100644
index 0000000..49ca0ab
--- /dev/null
+++ b/src/components/productionScheduleTree/index.less
@@ -0,0 +1,304 @@
+.ganttList{
+ width: 100vm;
+ padding: 0rem 0.5rem 0 0.5rem;
+}
+:global{
+ .gantt_add, .gantt_grid_head_add{
+ display: none;
+ }
+ .gantt_grid_head_cell.gantt_grid_head_add{
+ display: none;
+ }
+ .commonListSelectBtn{
+ display: none;
+ }
+ .workScheduleModal{
+ overflow: hidden;
+ padding-bottom: 0;
+ }
+ .productionScheduleTree{
+ // background: #fff!important;
+ :global{
+ .ant-tree li{
+ padding: 1px;
+ }
+ }
+ .processListTable .ant-table-content .ant-table-body{
+ max-height: 100%;
+ }
+ .topTable .ant-table-content .ant-table-scroll{
+ padding-bottom: 0!important;
+ }
+ .topTable{
+ border-top: 1px solid transparent;
+ height: 100%;
+ .ant-table-content{
+ border-top: 1px solid #dbdbdb;
+ }
+ }
+ .productPlan{
+ .ant-row{
+ margin-left: 0!important;
+ margin-right: 0!important;
+ }
+ }
+ .ant-table-thead > tr > th {
+ background-color: #F2F2F2!important;
+ }
+ .process{
+ max-width: 48px!important;
+ width: 48px!important;
+ flex: 0 0 48px !important;
+ line-height: 48px;
+ background-color: #F2F2F2!important;
+ border: 1px solid #dbdbdb!important;
+ .ant-layout-sider-children{
+ a{
+ margin-bottom: 12px;
+ img{
+ //width: 20px;
+ }
+ }
+ }
+ }
+ .search-container{
+ width: 100%;
+ position: relative;
+ z-index: 50;
+ }
+ //.ant-layout{
+ // background: #ffffff!important;
+ //}
+ #staticEditTable{
+ border-right: 1px solid #dbdbdb;
+ td{
+ height: 28px;
+ white-space: nowrap;
+ word-break: break-all;
+ }
+ }
+ .ant-tree li .ant-tree-node-content-wrapper{
+ height: 20px;
+ line-height: 20px;
+ }
+ .ant-tree-treenode{
+ .process{
+ max-width: 48px!important;
+ }
+ .ant-tree-indent-unit{
+ &:before{
+ display: none;
+ }
+ }
+ .ant-tree-switcher-noop{
+ display: none;
+ }
+ }
+ .productionScheduleTree-container{
+ padding: 10px;
+ padding-top: 3px;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ display: flex;
+ }
+ .productionScheduleTree-sider{
+ box-sizing: border-box;
+ width: 180px;
+ height: 100%;
+ border: 1px solid #d9d9d9;
+ float: left;
+ position: relative;
+ .resize-controller{
+ width: 6px;
+ height: 100%;
+ position: absolute;
+ z-index: 10;
+ right: -3px;
+ top: 0;
+ cursor: col-resize;
+ }
+ .productionScheduleTree-sider-title{
+ width: 100%;
+ height: 30px;
+ padding-left: 6px;
+ line-height: 30px;
+ background: #f2f2f2;
+ box-sizing: border-box;
+ border-bottom: 1px solid #dbdbdb;
+ color: #101010;
+ font-size: 14px;
+ font-weight: bold;
+ .control-icon{
+ cursor: pointer;
+ }
+ span{
+ margin-left: 16px;
+ }
+ }
+ .productionScheduleTree-sider-content{
+ width: 100%;
+ height: ~"calc(100% - 30px)";
+ overflow: auto;
+ }
+ }
+ .productionScheduleTree-content{
+ width: ~"calc(100% - 224px)";
+ float: left;
+ height: 100%;
+ #expandTable{
+ .ant-table-scroll{
+ padding-bottom: 30px!important;
+ }
+ }
+ .topTable .ant-table-content .ant-table-scroll{
+ padding-bottom: 0!important;
+ }
+ .ant-table-content .ant-table-body{
+ max-height: 100%!important;
+ }
+ }
+ .noInput{
+ padding: 0!important;
+ display: flex;
+ width: 100%;
+ height: 100%;
+ align-items: center;
+ }
+ //.sActiveIdStyle{
+ // padding: 0!important;
+ //}
+ #staticEditTable{
+ .ant-form-item-children{
+ input{
+ padding: 0 0px!important;
+ border: none!important;
+ }
+ .sActiveIdStyle{
+ left: 0!important;
+ }
+ }
+ }
+ .split-record-row td, .split-record-row-skip td { /* 生产排程Tree分割行样式2222 */
+ border: none!important;
+ span.linksActiveIdStyle{text-decoration:none!important; color:#000!important;}
+ }
+ .split-record-row td{
+ .ant-table-row-expand-icon-collapsed{
+ display: none!important;
+ }
+ .ant-checkbox{
+ display: none!important;
+ }
+ }
+ //.split-record-row-skip td span.ant-checkbox{
+ // background-color: unset!important;
+ //}
+ .split-record-row td:nth-of-type(3) {
+ color: #CDCDCD;
+ span{
+ color:#CDCDCD;
+ }
+ }
+ .split-record-row td:not(:nth-of-type(4)){ /* 处理分隔行显示不全,不能以某列宽度为基准来设计,至少5列合并*/
+ //z-index: 1!important;
+ }
+ //.split-record-row-skip td:nth-of-type(2) {
+ // color: #CDCDCD;
+ // span{
+ // color:#CDCDCD;
+ // }
+ //}
+ .split-record-row-skip td:not(:nth-of-type(3)){ /* 处理分隔行显示不全,不能以某列宽度为基准来设计,至少5列合并*/
+ //z-index: 1!important;
+ }
+ /* 设置单元格样式 */
+ .selected-record-row td .SetCell_green div{
+ background-color: green!important;
+ }
+ .selected-record-row td .SetCell_red div{
+ background-color:#ff9393!important;
+ }
+ .selected-record-row td .SetCell_yellow div{
+ background-color: yellow!important;
+ }
+ .selected-record-row td .SetCell_blue div{
+ background-color: blue!important;
+ }
+ .selected-record-row td .SetCell_orange div{
+ background-color: orange!important;
+ }
+ .selected-record-row td .SetCell_pink div{
+ background-color: pink!important;
+ }
+
+ .workoutsid-node{
+ color: rgba(24, 144, 255, 100);
+ font-size: 12px;
+ font-weight: bold;
+ }
+ .workoutconfirm-node{
+ color: rgba(24, 144, 255, 100);
+ font-size: 12px;
+ font-weight: bold;
+ }
+ .process-node{
+ color: rgba(24, 144, 255, 100);
+ font-size: 12px;
+ font-weight: bold;
+ }
+ .machine-node{
+ color: #101010;
+ font-size: 12px;
+ font-weight: bold;
+ }
+ .hour-info{
+ color: #ff4d4f;
+ margin-left: 4px;
+ }
+ .workcenter-node{
+ color: #101010;
+ font-size: 12px;
+ font-weight: bold;
+ }
+ .productPlan{
+ height: 100%;
+ .tree-pagination-container{
+ width: 100%;
+ height: 100%;
+ position: relative;
+ .pagination-item{
+ position: absolute;
+ bottom: 0;
+ left: 8px;
+ }
+ .ant-row{
+ height: ~"calc(100% - 32px)"!important;
+ }
+ .topTable .ant-table-content .ant-table-scroll{
+ padding-bottom: 30px!important;
+ }
+ }
+ .tree-pagination-container-nopage{
+ .pagination-item{
+ display: none;
+ }
+ .ant-row{
+ height: ~"calc(100%)"!important;
+ }
+ }
+ .ant-row{
+ #staticEditTable{
+ td{
+ white-space: unset;
+ overflow: unset;
+ }
+ }
+ }
+ .colorInfo {
+ line-height: 33px!important;
+ }
+ }
+ }
+}
+
diff --git a/src/components/productionScheduleTree/productionHeader.js b/src/components/productionScheduleTree/productionHeader.js
new file mode 100644
index 0000000..3586f7f
--- /dev/null
+++ b/src/components/productionScheduleTree/productionHeader.js
@@ -0,0 +1,211 @@
+/**
+ * Created by mar105 on 2019-02-27.
+ */
+/* eslint-disable object-curly-newline,prefer-destructuring */
+import React, { Component } from 'react';
+import { ExportOutlined, PrinterOutlined, SaveOutlined } from '@ant-design/icons';
+import { Row, Col } from 'antd';
+import styles from '../Common/ToolBar/index.less';
+import ShowType from '../Common/CommonComponent';
+import * as commonUtils from '../../utils/utils';/* 通用方法 */
+import AffixMenu from '../../routes/common/AffixMenu';
+import ProductionPlan1 from '../../assets/ProductionPlan-1.svg';
+import ProductionPlan2 from '../../assets/ProductionPlan-2.svg';
+import ProductionPlan7 from '../../assets/ProductionPlan-7.svg';
+import ProductionPlan8 from '../../assets/ProductionPlan-8.svg';
+import ProductionPlan11 from '../../assets/ProductionPlan-11.svg';
+
+export default class productionHeader extends Component {
+ /** 构造函数 */
+ constructor(props) {
+ super(props);
+ this.state = {
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ stateValue: props.stateValue,
+ masterData: props.masterData,
+ };
+ }
+
+ /** 渲染前只执行一次 */
+ componentWillMount() {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(this.props);
+ }
+
+ /** props改变的时候触发 */
+ componentWillReceiveProps(nextProps) {
+ /* state和this属性赋值 */
+ this.assignmentWillProps(nextProps);
+ }
+
+ /** 返回true执行渲染,返回false不渲染 */
+ shouldComponentUpdate(nextProps, nextState) {
+ const {
+ masterConfig, stateValue, enabled, masterData,
+ } = this.state;
+ const ret = enabled !== nextState.enabled || JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
+ JSON.stringify(masterData) !== JSON.stringify(nextState.masterData) ||
+ JSON.stringify(stateValue) !== JSON.stringify(nextState.stateValue);
+ return ret;
+ }
+
+ assignmentWillProps = (props) => {
+ this.setState({
+ enabled: props.enabled,
+ masterConfig: props.masterConfig,
+ masterData: props.masterData,
+ stateValue: props.stateValue,
+ });
+ }
+ // 获取header按钮状态 stateValue
+ HandlerHeaderButtonShowState = (props) => {
+ const { masterData, searchSolution } = props;
+ let filterCondition = [];
+ let stateValue = 99;
+ if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSearchSolutionId)) {
+ const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
+ if (iIndex > -1) {
+ filterCondition = JSON.parse(searchSolution[iIndex].sCondition);
+ let state = '';
+ let frozen = '';
+ filterCondition.forEach((item) => {
+ if (item.bFilterName === 'sState') {
+ state = item.bFilterValue;
+ }
+ if (item.bFilterName === 'bFrozen') {
+ frozen = item.bFilterValue;
+ }
+ });
+
+ if (commonUtils.isEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ if (state === '未排程') {
+ stateValue = 0;
+ } else if (state === '未下达' || state === '已排程') {
+ stateValue = 1;
+ } else if (state === '已下达') {
+ stateValue = 2;
+ } else if (state === '已暂停') {
+ stateValue = 3;
+ } else if (state === '已完成') {
+ stateValue = 5;
+ }
+ } else if (commonUtils.isNotEmptyObject(frozen)) {
+ stateValue = 4;
+ } else if (commonUtils.isNotEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
+ stateValue = 99;
+ }
+ }
+ }
+ return { stateValue };
+ }
+ handleClick = (iTag) => {
+ this.props.onButtonClick(iTag);
+ }
+
+ handleSwitchChange = (value) => {
+ this.props.onSwitchChange(value);
+ }
+ rowReturnType = (child, i) => {
+ const { enabled, stateValue } = this.state;
+ const sMemo = child.sName.toLowerCase().endsWith('memo');
+ const iColValue = sMemo ? 21 : child.iColValue * 2;
+ const iOrder = sMemo ? 100 : child.iOrder > 100 ? 100 : child.iOrder;
+ const enabledNew = (enabled && !child.bReadonly && !child.specialControl);
+ const type = commonUtils.isNotEmptyObject(child.sControlName) && child.sControlName.toLowerCase().startsWith('btn');
+
+ let showTypeProps = {};
+ if (!type) {
+ const switchBtn = child.sControlName.toLowerCase().startsWith('switch');
+ if (!switchBtn) {
+ showTypeProps = {
+ name: 'master',
+ form: this.props.form,
+ formId: this.props.sModelsId,
+ getSqlDropDownData: this.props.getSqlDropDownData,
+ getSqlCondition: this.props.getSqlCondition,
+ handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
+ getFloatNum: this.props.getFloatNum,
+ getDateFormat: this.props.getDateFormat,
+ onChange: this.props.onChange,
+ showConfig: child,
+ textArea: sMemo,
+ enabled: enabledNew,
+ dataValue: commonUtils.isNotEmptyObject(this.props.masterData) ? this.props.masterData[child.sName] : '',
+ bTable: false,
+ };
+ return (
+
+
+
+ );
+ } else {
+ return '';
+ }
+ } else {
+ let displayFlag = false;
+ let disabledFlag = true;
+ if ((stateValue === '0' && child.iTag === 3) || (stateValue === '1' && child.iTag === 5)
+ || (stateValue === '0' && child.iTag === 5) || (stateValue === '2' && child.iTag === 4)
+ || (stateValue === '2' && child.iTag === 5)
+ || (stateValue === '2' && child.iTag === 17)
+ || (stateValue === '3' && child.iTag === 6)
+ || (child.iTag === 1) || (child.iTag === 2)
+ || (child.iTag === 7) || (child.iTag === 8) || (child.iTag === 11)
+ || (child.iTag === 12) || (child.iTag === 13) || (child.iTag === 14) || (child.iTag === 15) || (child.iTag === 16)
+ ) {
+ displayFlag = true;
+ }
+ if ((child.iTag === 1 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 2 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ (child.iTag === 3 && (stateValue === '0' || stateValue === '1')) ||
+ (child.iTag === 4 && stateValue === '2') ||
+ (child.iTag === 5 && stateValue === '2') ||
+ (child.iTag === 6 && stateValue === '3') ||
+ (child.iTag === 7 && stateValue === '2') ||
+ (child.iTag === 8 && stateValue === '2') ||
+ (child.iTag === 11 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
+ ((child.iTag === 12 || child.iTag === 13 || child.iTag === 14) && stateValue !== '99')
+ ) {
+ disabledFlag = false;
+ }
+ // console.log(child.showName, ' disabledFlag:', disabledFlag, 'displayFlag:', displayFlag);
+ return displayFlag ? (
+
+ {(() => {
+ switch (child.iTag) {
+ case 1: return
;
+ case 2: return
;
+ case 7: return
;
+ case 8: return
;
+ case 11: return
;
+ case 12: return ;
+ case 13: return ;
+ case 14: return ;
+ default: return null;
+ }
+ }
+ )()}
+ {child.showName}
+
+ ) : '';
+ }
+ }
+
+ render() {
+ const { masterConfig } = this.state;
+ const teamMachineProps = masterConfig === undefined ? undefined : masterConfig.gdsconfigformslave;
+ return (
+
+ );
+ }
+}
diff --git a/src/components/productionScheduleTree/productionPlanChangeMacheInfo.js b/src/components/productionScheduleTree/productionPlanChangeMacheInfo.js
new file mode 100644
index 0000000..467cecf
--- /dev/null
+++ b/src/components/productionScheduleTree/productionPlanChangeMacheInfo.js
@@ -0,0 +1,109 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Button, Row, Col } from 'antd';
+import CommonListEvent from './CommonListEvent';/* 继承销售模块业务功能 */
+import * as commonFunc from './commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
+import StaticEditTable from './CommonTable';/* 可编辑表格 */
+import CommonBase from './CommonBase';/* 获取配置及数据 */
+import * as commonBusiness from './commonBusiness';/* 单据业务功能 */
+import SearchComponent from './SearchComponent';/* 搜索组件 */
+import * as commonConfig from '../../utils/config';
+
+const { Content } = Layout;
+
+class ProductionPlanChangeMachineInfoComponent extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+ /** 确认下单 */
+ handleSelect = () => {
+ const { slaveSelectedData, app } = this.props;
+ this.props.app.currentPane.select(app.currentPane.name, app.currentPane.config, slaveSelectedData);
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+ /** 关闭 */
+ handleCancelModal = () => {
+ const { app } = this.props;
+ this.props.app.currentPane.selectCancel(app.currentPane.name);
+ };
+ // ----------------------------数据修改回带end ---------------------------- //
+
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+
+const CommonListComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const { form, onReturnForm, slavePagination } = props;
+ /* 回带表单 */
+ onReturnForm(form);
+ const pagination = {
+ ...slavePagination,
+ size: 'large',
+ pageSize: commonConfig.pageSize,
+ showQuickJumper: true,
+ hideOnSinglePage: true,
+ };
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
+ };
+ const teamProps = {
+ ...commonBusiness.getTableTypes('team', props),
+ tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
+ };
+ return (
+
+ );
+});
+
+export default CommonBase(CommonListEvent(ProductionPlanChangeMachineInfoComponent));
diff --git a/src/components/productionScheduleTree/productionPlanInfo2.js b/src/components/productionScheduleTree/productionPlanInfo2.js
new file mode 100644
index 0000000..d79ea71
--- /dev/null
+++ b/src/components/productionScheduleTree/productionPlanInfo2.js
@@ -0,0 +1,136 @@
+/* eslint-disable array-callback-return,no-undef */
+import React, { Component } from 'react';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Layout, Spin, Select } from 'antd'; // Switch
+import styles from '../../index.less';
+import * as commonFunc from '../Common/commonFunc';
+import CommonBase from '../Common/CommonBase';
+import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
+import SearchComponent from '../Common/SearchComponent';/* 搜索组件 */
+import CommonProductionPlanEvent from '../Common/CommonProductionPlanEvent';
+import * as config from '../../utils/config';
+import ProductionHeader from './productionHeader';/* 可编辑表格 */
+
+const { Option } = Select;
+const { Header, Content, Sider } = Layout;
+
+class ProductionPlanInfoComponentInfo2 extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ this.form = {}; /* 表单对象 */
+ }
+ render() {
+ const { pageLoading } = this.props;
+ return (
+
+ );
+ }
+}
+const ProductionPlanComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, onSelectChange, sStateSelect, isDragAndDrop, stateOption,
+ } = props;
+
+ /* 回带表单 */
+ onReturnForm(form);
+ const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
+ const workTeamProps = {
+ ...commonBusiness.getTableTypes('workCenter', props),
+ tableProps: { rowKey: 'sWorkCenterId' },
+ isKeyUsesId: false,
+ enabled: false,
+ };
+
+ const machineProps = {
+ ...commonBusiness.getTableTypes(sStateSelect === '0' ? 'unMachine' : 'machine', props),
+ tableProps: { rowKey: 'sMachineId' },
+ isKeyUsesId: false,
+ enabled: false,
+ };
+
+ const pagination = {
+ onChange: props.onPaginationChange,
+ size: 'large',
+ pageSize: config.pageSize,
+ pageNum: config.pageNum,
+ showQuickJumper: true,
+ };
+
+ const processProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ tableProps: { pagination: pageFlag ? false : pagination },
+ scrollX: 3,
+ isDragAndDrop,
+ };
+
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionPlanEvent(ProductionPlanInfoComponentInfo2));
diff --git a/src/components/productionScheduleTree/productionScheduleTree.js b/src/components/productionScheduleTree/productionScheduleTree.js
new file mode 100644
index 0000000..ceae61c
--- /dev/null
+++ b/src/components/productionScheduleTree/productionScheduleTree.js
@@ -0,0 +1,1706 @@
+/* eslint-disable */
+/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
+import React, { Component } from 'react';
+import { DownOutlined, LoadingOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
+import { Form, Icon } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Modal, Layout, Spin, Card, Row, Col, message, Tree, Switch, Pagination } from 'antd'; // Switch Select, Tabs,
+import styles from '@/index.less';
+import selfstyles from '@/components/productionMainPlan/index.less';
+import * as commonFunc from '@/components/Common/commonFunc';
+import CommonBase from '@/components/Common/CommonBase';
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import CommonProductionPlanTreeEvent from '@/components/Common/CommonProductionPlanTreeEvent';
+import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
+import MoveUp from '@/assets/processUp.svg';
+import MoveDown from '@/assets/processDown.svg';
+import DisableMoveUp from '@/assets/disableprocessUp.svg';
+import DisableMoveDown from '@/assets/disableprocessDown.svg';
+import MoveTop from '@/assets/processTop.svg';
+import DisableMoveTop from '@/assets/disableprocessTop.svg';
+import MoveBottom from '@/assets/processBottom.svg';
+import DisableMoveBottom from '@/assets/disableprocessBottom.svg';
+import ChangeMachine from '@/assets/plan/change.png';
+import DisableChangeMachine from '@/assets/plan/change_1.png';
+
+import SetSave from '@/assets/plan/save.png';
+import DisableSetSave from '@/assets/plan/save_1.png';
+
+import SetLock from '@/assets/plan/lock.png';
+import DisableSetLock from '@/assets/plan/lock_1.png';
+
+import SetOverExec from '@/assets/plan/over.png';
+import DisableSetOverExec from '@/assets/plan/over_1.png';
+
+import ShowGantt from '@/assets/gantt.svg';
+import DisableShowGantt from '@/assets/disablegantt.svg';
+import ShowCheckModel from '@/assets/plan/check.png';
+import DisableShowCheckModel from '@/assets/plan/check_1.png';
+import ShowTimer from '@/assets/plan/cal.png';
+import DisableShowTimer from '@/assets/plan/cal_1.png';
+import ShowList from '@/assets/list.svg';
+import DisableShowList from '@/assets/disablelist.svg';
+import Reset from '@/assets/reset.svg';
+import DisableReset from '@/assets/disablereset.svg';
+import * as commonUtils from '@/utils/utils';
+import ShowType from '@/components/Common/CommonComponent';
+import commonConfig from '@/utils/config';
+import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
+import Gantt from '@/components/Charts/Gantt';
+import * as commonServices from '@/services/services';
+import CommonListSelect from '@/components/Common/CommonListSelect';
+import SearchComponent from '@/components/Common/SearchComponent';
+import tab from '@/routes/tab/tab';
+import GanttStyles from './index.less';
+import moment from 'moment';
+
+const { TreeNode } = Tree;
+
+const { Header, Content, Sider } = Layout;
+
+class ProductionSchedule extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ isRender: 0,
+ treeData: [],
+ pageSize: 20,
+ pageNum: 1,
+ expandAll: true,
+ expandedTreeKeys: [],
+ checkModelStatus: false,
+ defaultKey: 'unset',
+ slideFlag: localStorage.getItem('treeSlide_' + this.props.sModelsId) ? +localStorage.getItem('treeSlide_' + this.props.sModelsId) : 0,
+ };
+ this.treeDiv = null;
+ this.requested = false
+ this.bMachine = false;
+ if (props && props.app && props.app.currentPane && props.app.currentPane.copyTo && props.app.currentPane.copyTo.sWorkCenterName) {
+ this.bMachine = true
+ }
+ this.showSetMachine = false;
+ this.form = {};
+ }
+ componentWillReceiveProps(props) {
+ if (props.slaveInfoSelectedRowKeys && props.slaveSelectedData && (props.slaveInfoSelectedRowKeys.length || props.slaveSelectedData.length)) {
+ this.showSetMachine = true;
+ } else {
+ this.showSetMachine = false;
+ }
+ if (props.app && props.app.currentPane && props.app.currentPane.copyTo && props.app.currentPane.copyTo.treeKey) {
+ if (this.state.defaultKey === 'unset') {
+ this.setState({
+ defaultKey: [props.app.currentPane.copyTo.treeKey]
+ });
+ }
+ }
+ if (Array.isArray(this.state.defaultKey) && props.treeData.length && props.app.currentPane.copyTo.treeKey && !this.requested) {
+ let selectedItem = '';
+ props.treeData.forEach(item => {
+ if (item.children) {
+ item.children.forEach(item2 => {
+ if (item2.sId + item2.sWorkCenterId == props.app.currentPane.copyTo.treeKey) {
+ selectedItem = item2;
+ }
+ })
+ }
+ })
+ this.handleTabsCallback(selectedItem);
+ this.requested = true;
+ }
+ if (this.state.expandedTreeKeys.length === 0 && this.state.expandAll) {
+ const arr = [];
+ props.treeData.forEach((item) => {
+ arr.push(item.sId + item.sWorkCenterId);
+ });
+ this.setState({
+ expandedTreeKeys: arr,
+ });
+ }
+ }
+ shouldComponentUpdate(nextProps) {
+ const { slaveColumn, masterConfig } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
+ }
+ onDoubleClick = (name, record) => {
+ if (this.props.onDoubleClick !== undefined) {
+ this.props.onDoubleClick(record);
+ }
+ };
+ onRowClick = (name, record, bRowClick) => {
+ const { slaveData } = this.props;
+ let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
+ slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sSlaveId);
+ slaveSelectedRowKeys = keys;
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ } else {
+ const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
+ if (indexKey === -1) {
+ slaveSelectedRowKeys.push(record.sSlaveId);
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ sIds.forEach((item) => {
+ const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (iIndex === -1) {
+ slaveInfoSelectedRowKeys.push(item);
+ }
+ });
+ } else if (indexKey !== -1) {
+ if (!bRowClick) {
+ slaveSelectedRowKeys.splice(indexKey, 1);
+ }
+ const sIds = record.sSlaveId.split('-');
+ sIds.forEach((item) => {
+ const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (!bRowClick) {
+ slaveInfoSelectedRowKeys.splice(index, 1);
+ }
+ });
+ }
+ }
+ } else if (name === 'slaveInfo') {
+ if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sId);
+ slaveInfoSelectedRowKeys = keys;
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
+ }
+ } else {
+ const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
+ if (indexKey === -1) {
+ slaveInfoSelectedRowKeys.push(record.sId);
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
+ if (iIndex === -1) {
+ slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
+ }
+ }
+ } else if (indexKey !== -1) {
+ slaveInfoSelectedRowKeys.splice(indexKey, 1);
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
+ if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ } else {
+ let bdel = true;
+ for (const sId of sSlaveIds) {
+ if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
+ bdel = false;
+ break;
+ }
+ }
+ if (bdel) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ let machineEnabled = false;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
+ const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
+ if (processSlave.length === slaveSelectedRowKeys.length) {
+ machineEnabled = true;
+ }
+ }
+ const { sModelsId } = this.props;
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sWorkCenterId', []);
+ this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
+ };
+
+ onRowMouseEnter= (name, record) => { // recor
+
+ if (this.timerSelectRowChange) {
+ clearTimeout(this.timerSelectRowChange);
+ }
+ this.timerSelectRowChange = setTimeout(() => {
+ this.props.onSaveState({
+ rowHoverSid: record.sSlaveId,
+ });
+ // console.log('=====record', record);
+ // this.handleSelectRowChange(this.props.name, [record[this.rowKey]]);
+ }, 150);
+ }
+
+ onRowMouseLeave= () => {
+ if (this.timerSelectRowChange) {
+ this.props.onSaveState({
+ rowHoverSid: '',
+ });
+ clearTimeout(this.timerSelectRowChange);
+ }
+ }
+
+ onCloseChangeMachine = () => {
+ const { masterData } = this.props;
+ delete masterData.tStartDate;
+ delete masterData.iSplitNum;
+ delete masterData.bSplit;
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sWorkCenterId: '', sMachineId: '', sTeamId: '' } });
+ }
+ onPageChange = (pageNum) => {
+ this.setState({
+ pageNum,
+ });
+ }
+ onTableSelectRowChange = (name, selectedRowKeys) => {
+ const { slaveData, slaveSelectedRowKeys, slaveInfoConfig } = this.props;
+ if (name === 'slave') {
+ const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
+ const slaveInfoSelectedRowKeys = [];
+ /* 找到勾选掉的Id */
+ let oldSelectRowkeys = []; /* 取消勾选行 */
+ if(commonUtils.isEmptyObject(slaveInfoConfig) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ oldSelectRowkeys = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item)); // 历史数据中删除的数据
+ if(commonUtils.isNotEmptyArr(oldSelectRowkeys) ) { /* 单层表格时 */
+ oldSelectRowkeys.forEach((oldSelectRowkey) => {
+ if(commonUtils.isNotEmptyObject(oldSelectRowkey) && oldSelectRowkey.includes('sDivRow')) { /* 找到勾选掉的sDivRow汇总行 */
+ const slaveRemoveData = slaveData.filter(item => item.sDivRowParentId === oldSelectRowkey);
+ if(commonUtils.isNotEmptyArr(slaveRemoveData)) {
+ slaveRemoveData.forEach((itemChild) => {
+ const indexKey = selectedRowKeys.indexOf(itemChild.sSlaveId);
+ if(indexKey > -1) {
+ selectedRowKeys.splice(indexKey, 1);
+ }
+ });
+ }
+ } else {
+ const indexKey = selectedRowKeys.indexOf(oldSelectRowkey);
+ if(indexKey > -1) {
+ selectedRowKeys.splice(indexKey, 1);
+ }
+ }
+ });
+ }
+ }
+ if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
+ selectedRowKeys.forEach((selectedRow) => {
+ const sIds = selectedRow.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ if (commonUtils.isEmptyObject(slaveInfoConfig) && commonUtils.isEmptyArr(oldSelectRowkeys)) { /* 单层结构 sDivRow控制 */
+ if (commonUtils.isNotEmptyObject(selectedRow) && selectedRow.includes('sDivRow')) {
+ const slaveChildData = slaveData.filter(item => item.sDivRowParentId === selectedRow);
+ if (commonUtils.isNotEmptyArr(slaveChildData)) {
+ slaveChildData.forEach((itemChild) => {
+ const indexKey = selectedRowKeys.indexOf(itemChild.sSlaveId);
+ if (indexKey === -1) {
+ selectedRowKeys.push(itemChild.sSlaveId);
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+ addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
+ addState.slaveSelectedRowKeys = selectedRowKeys;
+ this.props.onSaveState({ ...addState });
+ } else {
+ this.props.onTableSelectRowChange(name, selectedRowKeys);
+ }
+ // let record = {};
+ // let key;
+ // if (name === 'slave') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveSelectedRowKeys.length === 1) {
+ // key = slaveSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length > slaveSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length < slaveSelectedRowKeys.length) {
+ // key = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sSlaveId)[0];
+ // this.onRowClick(name, record);
+ // } else if (name === 'slaveInfo') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveInfoSelectedRowKeys.length === 1) {
+ // key = slaveInfoSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length > slaveInfoSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveInfoSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length < slaveInfoSelectedRowKeys.length) {
+ // key = slaveInfoSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sId)[0];
+ // this.onRowClick(name, record);
+ // } else {
+ // this.props.onTableSelectRowChange(name, selectedRowKeys);
+ // }
+ };
+ onTreeExpandChange = () => {
+ const oldState = this.state.expandAll;
+ const arr = [];
+ if (!oldState) {
+ this.props.treeData.forEach((item) => {
+ arr.push(item.sId + item.sProcessId + item.iOrder);
+ });
+ }
+ this.setState({
+ expandAll: !oldState,
+ expandedTreeKeys: arr,
+ });
+ }
+ onTreeExpand = (e) => {
+ this.setState({
+ expandedTreeKeys: e,
+ });
+ }
+ /** 处理选择行发生改变s */
+ handleTableFilterData = (name, data, record) => {
+ /* 外置处理业务 */
+ if (name === 'slave') {
+ let slaveInfoDataNew = [];
+ if (commonUtils.isNotEmptyArr(data)) {
+ slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
+ }
+ return slaveInfoDataNew;
+ }
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+ /* 甘特图数据改变出发事件 */
+ logDataUpdate = (type, action, item, id) => {
+ const { charGanttData } = this.props;
+ /* 记录更新的数据 */
+ if (action === 'update') {
+ if (commonUtils.isNotEmptyArr(charGanttData)) {
+ const { data } = charGanttData;
+ if (commonUtils.isNotEmptyArr(data) && data.length > 0) {
+ const iIndex = data.findIndex(child => child.id === id);
+ if (iIndex > -1) {
+ if (commonUtils.isNotEmptyObject(item.start_date)) {
+ data[iIndex].start_date = item.start_date;
+ }
+ if (commonUtils.isNotEmptyObject(item.end_date)) {
+ data[iIndex].end_date = item.end_date;
+ }
+ charGanttData.tasks.data = data;
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ }
+ }
+ const text = item && item.text ? ` (${item.text})` : '';
+ let message = `${type} ${action}: ${id} ${text}`;
+ if (type === 'link' && action !== 'delete') {
+ message += ` ( source: ${item.source}, target: ${item.target} )`;
+ }
+ this.addMessage(message);
+ }
+ logTaskUpdate = (id, mode, task) => {
+ const text = task && task.text ? ` (${task.text})` : '';
+ const message = `Task ${mode}: ${id} ${text}`;
+ this.addMessage(message);
+ }
+ logLinkUpdate = (id, mode, link) => {
+ let message = `Link ${mode}: ${id}`;
+ if (link) {
+ message += ` ( source: ${link.source}, target: ${link.target} )`;
+ this.addMessage(message);
+ }
+ }
+ addMessage = (message) => {
+ const maxLogLength = 5;
+ const newMessate = { message };
+ const messages = [
+ ];
+ messages.push(newMessate);
+ if (messages.length > maxLogLength) {
+ messages.length = maxLogLength;
+ }
+ this.props.onSaveState({ messages });
+ }
+ sortData = (tempData) => {
+ tempData.sort((g1, g2) => {
+ return g1.iOrder - g2.iOrder;
+ });
+ return tempData;
+ };
+ /* 控制排序 */
+ orderData = (e, name, type) => {
+ const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
+ let { [`${name}Data`]: currentData } = this.props;
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
+ return;
+ }
+ if (commonUtils.isEmptyArr(currentData)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
+ return;
+ }
+ const tempData = [];
+
+ for (const sId of tableselectedRowKeys) {
+ let index = 0;
+ const tableDataIndex = currentData.findIndex(item => item.sId === sId);
+ if (tableDataIndex > -1) {
+ const tableDataRow = JSON.parse(JSON.stringify(currentData[tableDataIndex]));
+ if(commonUtils.isNotEmptyObject(tableDataRow)) {
+ const iSelectedOrder = tableDataRow.iOrder + index + 100;
+ const row = {...tableDataRow, iSelectedOrder : iSelectedOrder }
+ tempData.push(row);
+ }
+ }
+ index +=1;
+ }
+
+ const tempNew = commonUtils.isNotEmptyArr(tempData) ? JSON.parse(JSON.stringify(tempData)) : [];
+ if (commonUtils.isEmptyArr(tempNew)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
+ return;
+ }
+ const len = currentData.length;
+ currentData = this.orderNum(currentData);
+ const newLen = tempNew.length;
+ let num = 0.01;/* 循环增加体 */
+ let targetiOrder = -1;
+ if (type === 1) { /* 上移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = 0;
+ }
+ } else if (iIndex === 1 && currentData[0].sDivRowNew) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
+ }
+ } else if (type === 2) { /* 下移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[iIndex + 1].iOrder;
+ }
+ } else if (type === 0) { /* 置顶 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else if (iIndex === 1 && currentData[0].sDivRowNew) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop'));/* 无需置顶 */
+ return;
+ } else if (currentData[0].sDivRowNew) { /* 如果顶层有分割 */
+ targetiOrder = currentData[1].iOrder - 1;
+ } else {
+ targetiOrder = currentData[0].iOrder - 1;
+ }
+ } else if (type === 3) { /* 置底 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[len - 1].iOrder + 1;
+ }
+ }
+ tempNew.forEach((item) => {
+ const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
+ currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
+ num += 0.01;
+ });
+ currentData = this.sortData(currentData);
+ currentData = this.orderNum(currentData);
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
+ const slavePagination = { ...slavePaginationOld };
+ slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
+ this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
+ } else if (name === 'slaveInfo') {
+ const { slaveData, slaveSelectedRowKeys, masterData }= this.props;
+ if(commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
+ message.error('请选择一行数据!');
+ return;
+ }
+ if(commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(masterData)) {
+ const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId) && commonUtils.isEmptyObject(item.sDivRowNew)); /* 找不是sDivRow的选中行第一条 */
+ if (iIndex > -1) {
+ masterData.sMachineId = slaveData[iIndex].sMachineId;
+ masterData.sMachineName = slaveData[iIndex].sMachineName;
+ masterData.sWorkCenterId = slaveData[iIndex].sWorkCenterId;
+ masterData.sWorkCenterName = slaveData[iIndex].sWorkCenterName;
+ }
+ }
+ this.props.onSaveState({ isChangeMachine: true, masterData });
+ }
+ };
+ /* 自定义排序号 */
+ orderNum = (tableData) => {
+ const {slaveColumn} = this.props;
+ tableData.forEach((item, index) => {
+ item.iOrder = index + 1;
+ item.handleType = 'update';
+ });
+ /* 移动后 重新计算分割间隔条数及用时逻辑 */
+ const returnFilterData = tableData.filter(item => commonUtils.isNotEmptyObject(item.sDivRowNew) && item.sDivRowNew !=='');
+ if (commonUtils.isNotEmptyArr(returnFilterData)) {
+ returnFilterData.forEach((tableDataRow, index) => {
+ /* 找到白班与晚班区间的汇总条数与工时 */
+ let startIndex = 0; /* 找到开始下标 */
+ let endindex = 0; /* 找到结束下标 */
+ let sliceData =[];
+ startIndex = tableData.findIndex(item => item.sId === returnFilterData[index].sId);
+ if(index +1 < returnFilterData.length) {
+ endindex = tableData.findIndex(item => item.sId === returnFilterData[index + 1].sId);
+ }
+ if(index === returnFilterData.length -1) {
+ endindex = tableData.length;
+ }
+ if(startIndex < endindex) {
+ sliceData= tableData.slice(startIndex + 1, endindex);
+ }
+ let num = 0;
+ let dTime = 0;
+ let dPlateQty = 0; /* 付版 */
+ let dProcessQty = 0;
+ let endTime;
+ /* 找到第二个字段 */
+ const scheduleShow = ['16508090850002295893127095467000'].includes(this.props?.sModelsId);
+ let timeSName = 'dHour1';
+ if (scheduleShow) timeSName = 'dSumHour';
+ if(commonUtils.isNotEmptyArr(sliceData)) {
+ num = sliceData.length;
+ sliceData.forEach((item) => {
+ if (commonUtils.isNotEmptyNumber(item[timeSName])) {
+ dTime += item[timeSName];
+ dPlateQty += item.dPlateQty;
+ dProcessQty += item.dProcessQty;
+ if (item?.tEndDate) {
+ let value = item.tEndDate;
+ if (endTime) {
+ value = moment.max(moment(endTime), moment(item.tEndDate));
+ }
+ endTime = value;
+ }
+ const iSrcIndex = tableData.findIndex(itemReturn => itemReturn.sSlaveId === item.sSlaveId); /* 汇总的每行上都加newRow的sSlaveId作为父级Id */
+ if(iSrcIndex > -1) {
+ tableData[iSrcIndex] = {...tableData[iSrcIndex], sDivRowParentId : tableDataRow.sSlaveId, sDivRowTmp : tableDataRow.sDivRowNew}
+ }
+ }
+ });
+ let sCount = '';
+ if(num > 0) {
+ sCount += 'F'+ num + '单';
+ }
+ if(dProcessQty > 0) {
+ sCount += ' - '+ dProcessQty;
+ }
+ if(sliceData[0].sType === "1" && !scheduleShow) {
+ sCount += ' - ' + dPlateQty +'付版';
+ }
+ if(dTime > 0) {
+ if (scheduleShow) {
+ sCount += ' - ' + Math.floor(dTime / 24) + "d" + (dTime % 24).toFixed(2) + 'h';
+ } else {
+ sCount += ' - ' + (dTime/60).toFixed(2) + 'h';
+ };
+
+ }
+ if (endTime) {
+ sCount += ' - ' + moment(endTime).format('MM月DD日');
+ }
+ const sFileName = commonUtils.isNotEmptyArr(slaveColumn) && slaveColumn.length > 2 ? slaveColumn[1].dataIndex : '';
+ if(sCount && sFileName) {
+ const addState ={};
+ addState[sFileName] = tableDataRow.sDivRowNew + sCount;
+ tableData[startIndex] = {...tableData[startIndex] , ...addState}
+ }
+ }
+ });
+ }
+ return tableData;
+ };
+ /* 切换甘特图/列表视图 */
+ changeGantt = (e, type) => {
+ let bGantt = false;
+ if (type === 'gantt') {
+ const { slaveFilterCondition } = this.props;
+ bGantt = true;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Process_CommonGtChar';
+ chart.paramsMap = {
+ };
+ this.props.onGanttChar(chart, slaveFilterCondition).finally(() => {
+ this.props.onSaveState({ pageLoading: false });
+ });
+ } else if (type === 'list') {
+ bGantt = false;
+ }
+ this.props.onSaveState({ bGantt });
+ };
+ /* 切换稽查列表 */
+ changeCheckModel= async (e, type) => {
+ if (type === 'checkModel') {
+ if (this.state.checkModelStatus) {
+ return;
+ }
+ this.setState({
+ checkModelStatus: true
+ })
+ const { slaveFilterCondition } = this.props;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Manufacture_GetAPSstate';
+ chart.paramsMap = {
+ };
+ await this.props.onCheckModel(chart, slaveFilterCondition);
+ this.setState({
+ checkModelStatus: false
+ })
+ }
+ };
+ /* 弹出重算时间弹窗 */
+ showTimerModal= (e, type) => {
+ if (type === 'changeTimer') {
+ this.props.onChangeTimerPro();
+ }
+ };
+ /* 侧边保存 */
+ showSave= (e, type) => {
+ if (type === 'save') {
+ this.props.onSaveState({
+ pageLoading: true,
+ });
+ setTimeout(async() => {
+ this.props.onSubmit(); /* 调用保存 */
+ }, 500);
+ }
+ };
+ /* 侧边保存 */
+ showLock= (e, type) => {
+ if (type === 'lock') {
+ this.props.onShowLockPro();
+ }
+ };
+
+ showLock= (e, type) => {
+ if (type === 'lock') {
+ this.props.onShowLockPro();
+ }
+ };
+ showOverExec= (e, type) => {
+ if (this.props.onShowOverExecPro) {
+ this.props.onShowOverExecPro();
+ }
+ };
+ /** 处理选择行发生改变 */
+ // handleTableFilterData = (name, data, record) => {
+ // /* 外置处理业务 */
+ // if (name === 'slave') {
+ // let slaveInfoDataNew = '';
+ // slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
+ // return slaveInfoDataNew;
+ // }
+ // };
+ /** 处理card点击事件 */
+ handleTabsCallback = (child) => {
+ // if (commonUtils.isNotEmptyArr(this.props.teamData)) {
+ // child.cardSelectedColor = '#fff7e6';
+ // const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
+ // const teamDataNew = this.props.teamData;
+ // teamDataNew.forEach((item, index) => {
+ // if (index !== iIndex) { item.cardSelectedColor = ''; }
+ // });
+ // }
+ // this.props.onSaveState({ Loading: true });
+ this.props.onTabsCallback(child);
+ };
+
+ toggleSlide = () => {
+ let flag = this.state.slideFlag ? 0 : 1;
+ localStorage.setItem('treeSlide_' + this.props.sModelsId, flag);
+ this.setState({
+ slideFlag: flag
+ })
+ }
+
+ handleSlideToggle = () => {
+ if (this.state.slideFlag) {
+ this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'block';
+ const originWidth = this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
+ this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + 10}px)`;
+ this.toggleSlide();
+ } else {
+ this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'none';
+ this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100%)`;
+ this.toggleSlide();
+ }
+ }
+
+ resetTreeKey = () => {
+ this.setState({
+ defaultKey: 'selected'
+ })
+ }
+
+ setBMachine = (flag) => {
+ this.bMachine = flag
+ }
+
+ componentDidMount() {
+ if (!this.state.slideFlag) {
+ this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'block';
+ const originWidth = this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
+ this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + 10}px)`;
+ } else {
+ this.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.display = 'none';
+ this.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100%)`;
+ }
+ }
+ // handleGanttChar = async (ganttChart) => {
+ // const { token, sModelsId, formRoute, slaveFilterCondition } = this.props;
+ // let charGanttData = {};
+ // const value = {
+ // sProName: ganttChart.sProcedureName,
+ // paramsMap: ganttChart.prodParamsMap,
+ // bFilter: slaveFilterCondition,
+ // };
+ // const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ // const { data: returnData } = await commonServices.postValueService(token, value, url);
+ // console.log('returnData', returnData);
+ // if (returnData.code === 1) {
+ // const { dataset } = returnData;
+ // if (commonUtils.isNotEmptyObject(dataset)) {
+ // const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ // if (outData.sCode === -1) {
+ // message.error(outData.sReturn);
+ // } else {
+ // charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ // }
+ // }
+ // } else {
+ // message.error(returnData.msg);
+ // }
+ // console.log('charGanttData', charGanttData);
+ // this.props.onSaveState({ charGanttData });
+ // };
+ // renderCards = (data) => {
+ // let showInfo = '';
+ // data.map((item) => {
+ // showInfo += (
+ //
+ //
+ // {item.sTeamName} {item.dHour} {'30%'}
+ //
+ //
+ // );
+ // });
+ // return showInfo;
+ // }
+ render() {
+ const { pageLoading, treeLoading } = this.props;
+ return (
+
+
+ this.treeDiv = ref} style={{ height: '100%' }}>
+
+
+
+
+ );
+ }
+}
+
+const ProductionScheduleComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, app, masterData, slaveData, slaveSelectedRowKeys, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate, bGantt, charGanttData, messages, slavePageSize, workOutsideSize, workOutConfirmSize,
+ Loading, treeData, defaultSid, treeChild, pageSize, pageNum, onPageChange, sortEnabled, workOutsideColumn, workOutConfirmColumn, onTreeExpandChange, expandAll, onTreeExpand, expandedTreeKeys, gdsjurisdiction,
+ } = props;
+ const moveEnabled = commonUtils.isNotEmptyArr(slaveSelectedRowKeys);
+ /* 回带表单s */
+ onReturnForm(form);
+ // const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
+ const pagination = {
+ pageSize: commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+
+ const paginationSlave = {
+ pageSize: commonUtils.isNotEmptyNumber(slavePageSize) && slavePageSize !== 0 ? slavePageSize : commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+ const paginationWorkOutside = {
+ pageSize: commonUtils.isNotEmptyNumber(workOutsideSize) && workOutsideSize !== 0 ? workOutsideSize : commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+ const paginationWorkOutConfirm = {
+ pageSize: commonUtils.isNotEmptyNumber(workOutConfirmSize) && workOutConfirmSize !== 0 ? workOutConfirmSize : commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+ const width = '18px';
+ const height = '18px';
+ const moveUp = {
+ title: '上移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveDown = {
+ title: '下移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveTop = {
+ title: '置顶',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveBottom = {
+ title: '置底',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const changeMachine = {
+ title: '更换机台',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const slideSave = {
+ title: '侧边保存',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const slideLock = {
+ title: '侧边锁定',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const slideOverExec = {
+ title: '侧边超能力',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showGantt = {
+ title: '查看Gantt',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showCheckModel = {
+ title: '齐套稽查',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showTimer = {
+ title: '重算时间',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showList = {
+ title: '查看列表',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const resetSearch = {
+ title: '重置搜索',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const addProps = {};
+ //
+ // 前端假分页数据
+ // let tablePageData = commonBusiness.getTableTypes('slave', props).data;
+ // if (tablePageData) {
+ // tablePageData = commonBusiness.getTableTypes('slave', props).data.slice(pageSize * (pageNum - 1), pageSize * pageNum);
+ // }
+
+ // 从表原始数据
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ // onTableFilterData: props.onTableFilterData,
+ bMutiSelect1: true,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination: paginationSlave,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ // onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ // onMouseLeave: () => { props.onRowMouseLeave('slave',record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ rowHoverSid : props.rowHoverSid,
+ clearArray: props.clearArray,
+ };
+
+ const workOutsideProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ bMutiSelect1: true,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination: paginationWorkOutside,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ headerColumn: workOutsideColumn,
+ clearArray: props.clearArray,
+ };
+
+ const workOutConfirmProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ bMutiSelect1: true,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination: paginationWorkOutConfirm,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ headerColumn: workOutConfirmColumn,
+ clearArray: props.clearArray,
+ };
+ const tableInfoProps = {
+ ...commonBusiness.getTableTypes('slaveInfo', props),
+ bMutiSelect1: true,
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ planLoadingSate,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slaveInfo', record); },
+ onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slaveInfo'),
+ },
+ // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
+ };
+ let zoom = {};
+ zoom.scale = 'Minutes';
+ zoom.step = '10'; /* 间隔 */
+ if (commonUtils.isNotEmptyObject(charGanttData)) {
+ zoom = charGanttData.zoom;
+ }
+ const ganttProps = {
+ // ...commonBusiness.getGanttTypes('slave', props),
+ tasks: commonUtils.isNotEmptyObject(charGanttData) ? charGanttData : {}, /* 甘特图数据源 */
+ zoom: commonUtils.isNotEmptyObject(zoom) ? zoom : {},
+ onDataUpdated: props.onDataUpdated,
+ };
+ const gridStyle = {
+ width: '100%',
+ textAlign: 'left',
+ };
+ const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
+ const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
+ const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
+ const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
+ const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
+ const setSave = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'setSave')) ? commonFunc.showMessage(app.commonConst, 'setSave') : '保存';/* 保存 */
+ const setLock = commonFunc.showMessage(app.commonConst, 'setLock') ? commonFunc.showMessage(app.commonConst, 'setLock') : '锁定';/* 锁定 */
+ const setOverExec = commonFunc.showMessage(app.commonConst, 'setOverExec') ? commonFunc.showMessage(app.commonConst, 'setOverExec') :'超能力';/* 超 */
+ // const resetSearchEnabled = clearArray.length > 0;
+
+ const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
+ const resetSearchEnabled = true;
+ // const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
+ const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineName'); /* 以sMachineName */
+
+
+ /* 根据权限控制 */
+ let bSetTop = true; /* 置顶 */
+ let bSetDown = true; /* 置底 */
+ let bSetUp = true; /* 上移 */
+ let bSetBottom = true; /* 下移 */
+ let bSetMachine = true; /* 更换机台
+ // let bResetSearch = true; */
+ let bSetList = true; /* 显示列表 */
+ let bSetGantt = true; /* 显示甘特图 */
+ let bSetCheckModel = true; /* 齐套稽查 */
+ let bSetTimer = true; /* 改变时间 */
+ let bSetOverExec = true; /* 超能力 */
+ let bSetSave = true; /* 保存 */
+ let bSetLock = true; /* 锁定 */
+ if (commonUtils.isNotEmptyArr(gdsjurisdiction)){
+ bSetTop = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetTop') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetDown = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetDown') === -1 ? true : false;
+ bSetUp = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetUp') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetBottom = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetBottom') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetMachine = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetMachine') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetList = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetList') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetGantt = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetGantt') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetCheckModel = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetCheckModel') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetTimer = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetTimer') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetSave = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetSave') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetOverExec = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetOverExec') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ bSetLock = gdsjurisdiction.findIndex(item => item.sAction === 'BtnSlideSetLock') === -1 ? true : false; /* 没显示 代表有权限 否则没有权限 */
+ }
+
+ const machineShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineName,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
+ const teamShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iWorkCenterIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sWorkCenterName');
+ // if(commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(masterData) && commonUtils.isEmptyObject(masterData.sMachineId)) {
+ // const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId) && commonUtils.isEmptyObject(item.sDivRowNew)); /* 找不是sDivRow的选中行第一条 */
+ // if (iIndex > -1) {
+ // if (slaveData[iIndex] && slaveData[iIndex].sMachineId) {
+ // masterData.sMachineId = slaveData[iIndex].sMachineId;
+ // masterData.sMachineName = slaveData[iIndex].sMachineName;
+ // masterData.sWorkCenterId = slaveData[iIndex].sWorkCenterId;
+ // masterData.sWorkCenterName = slaveData[iIndex].sWorkCenterName;
+ // }
+ // }
+ // }
+ const workCenterProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iWorkCenterIndex > -1 ? masterConfig.gdsconfigformslave[iWorkCenterIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sWorkCenterName,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
+ const startShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
+ const splitShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
+ const splitNumShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const iProcessSyQtyIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'dProcessSyQty');
+ /* 剩余数量 */
+ const iProcessSyQtyProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iProcessSyQtyIndex > -1 ? masterConfig.gdsconfigformslave[iProcessSyQtyIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? 0 : masterData.dProcessSyQty,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+
+
+ let searchWorkSchedule = {};
+ let workScheduleConfig = {};
+ let searchWorkTitle = '';
+ if (commonUtils.isNotEmptyObject(props.workScheduleConfig)) {
+ workScheduleConfig = props.workScheduleConfig;
+ searchWorkTitle = workScheduleConfig.sActiveName;
+ const sWorkOrderId = commonUtils.isNotEmptyObject(props.workScheduleRecord) ? props.workScheduleRecord.sWorkOrderId : '';
+ searchWorkSchedule = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workScheduleConfig,
+ conditonValues: props.getSqlCondition(workScheduleConfig),
+ title: workScheduleConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: workScheduleConfig.sActiveId,
+ key: sModelsId + workScheduleConfig.sId,
+ sModelsType: 'search/workSchedule',
+ bFilterProName: 'p_sWorkOrderId_pro',
+ bFilterProValue: sWorkOrderId,
+ // select: props.onSelect,
+ // selectCancel: props.onSelectCancel,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+ let searchWorkMaterialsStatus = {};
+ let workMaterialsStatusConfig = {};
+ let searchMaterialsStatusTitle = '';
+ if (commonUtils.isNotEmptyObject(props.workMaterialsStatusConfig)) {
+ workMaterialsStatusConfig = props.workMaterialsStatusConfig;
+ searchMaterialsStatusTitle = workScheduleConfig.sActiveName;
+ // const sWorkOrderId = commonUtils.isNotEmptyObject(props.workMaterialsStatusRecord) ? props.workMaterialsStatusRecord.sWorkOrderId : '';
+ searchWorkMaterialsStatus = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workMaterialsStatusConfig,
+ conditonValues: props.getSqlCondition(workMaterialsStatusConfig),
+ title: workScheduleConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: workMaterialsStatusConfig.sActiveId,
+ key: sModelsId + workMaterialsStatusConfig.sId,
+ sModelsType: 'search/workSchedule',
+ bFilterProName: 'p_sWorkOrderId_pro',
+ // bFilterProValue: sWorkOrderId,
+ // select: props.onSelect,
+ // selectCancel: props.onSelectCancel,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+
+ /* 历史日产量 */
+ let sHistoryQtyProps = {};
+ let sHistoryQtyConfig = {};
+ let sHistoryQtyTitle = '';
+ if (commonUtils.isNotEmptyObject(props.sHistoryQtyConfig)) {
+ sHistoryQtyConfig = props.sHistoryQtyConfig;
+ sHistoryQtyTitle = sHistoryQtyConfig.sActiveName;
+ const sHistoryQtyRecord = props.sHistoryQtyRecord;
+ sHistoryQtyProps = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workScheduleConfig,
+ conditonValues: props.getSqlCondition(sHistoryQtyConfig, 'slave', sHistoryQtyRecord),
+ title: sHistoryQtyConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: sHistoryQtyConfig.sActiveId,
+ key: sModelsId + sHistoryQtyConfig.sId,
+ sModelsType: 'search/sHistoryQty',
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+ let selectedRowKey = {};
+ if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
+ selectedRowKey = teamSelectedRowKeys[0];
+ }
+
+ let teamDataNum = 0;
+ if (commonUtils.isNotEmptyArr(props.teamData)) {
+ // 取得导航按钮的行数
+ if (props.teamData.length % 8 === 0) {
+ teamDataNum = (props.teamData.length / 8);
+ } else {
+ teamDataNum = Math.ceil(props.teamData.length / 8);
+ }
+ }
+
+ const handleTreeOnSelect = (keys, e) => {
+ window.vlistNewSearh = true;
+ props.resetTreeKey();
+ props.setBMachine(e.node.sType == "machine")
+ const child = e.selectedNodes.length ? e.node.props.dataRef : false;
+ if (child) {
+ props.onTabsCallback(child);
+ onPageChange(1);
+ }
+ };
+
+ const renderTreeNodes = (data, pid) =>
+ data.map((item, index) => {
+ if (item.children) {
+ return (
+
+ {item.sShowName}
+ {item.dHour ? {item.dHour} : ''}
+ {(item.dSumProductionReportQty && item.dHour) ? / : ''}
+ {item.dSumProductionReportQty ? {item.dSumProductionReportQty} : ''}
+
+ }
+ key={item.sId + item.sWorkCenterId}
+ dataRef={{ ...item, pid: pid || 0 }}
+ >
+ {renderTreeNodes(item.children, item.sId)}
+
+ );
+ }
+ return
+ {item.sShowName}
+ {item.dHour ? {item.dHour} : ''}
+ {(item.dSumProductionReportQty && item.dHour) ? / : ''}
+ {item.dSumProductionReportQty ? {item.dSumProductionReportQty} : ''}
+
+ } dataRef={{ ...item, pid: pid || 0 }} {...item} key={item.sId + item.sWorkCenterId} />;
+ });
+
+ const handleResizeLayout = (e) => {
+ const originX = e.pageX;
+ const originWidth = props.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].offsetWidth;
+ let offset = 0;
+ window.onmousemove = function (e2) {
+ offset = e2.pageX - originX;
+ props.treeDiv.getElementsByClassName('productionScheduleTree-sider')[0].style.width = `${originWidth + offset}px`;
+ props.treeDiv.getElementsByClassName('productionScheduleTree-content')[0].style.width = `calc(100% - ${originWidth + offset + 10}px)`;
+ };
+ window.onmouseup = function () {
+ window.onmousemove = null;
+ window.onmousemove = null;
+ localStorage.setItem('customProductionScheduleTreeWidth_' + props.sModelsId, originWidth + offset + 10);
+ };
+ };
+
+ let customWidth = 224;
+ if (localStorage.getItem('customProductionScheduleTreeWidth_' + props.sModelsId) !== '') {
+ customWidth = localStorage.getItem('customProductionScheduleTreeWidth_' + props.sModelsId);
+ }
+
+ const renderTable = () => {
+ let res = '';
+ if (treeChild.sType === 'workoutsid') {
+ res = ();
+ } else if (treeChild.sType === 'workoutconfirm') {
+ res = ();
+ } else {
+ res = ();
+ }
+ return res;
+ };
+ /* 增加Modal按钮样式 */
+ const okProps = {};
+ if (props.loadingTimer !== undefined) {
+ // okProps.disabled = !props.bChangeTimerEnable;
+ okProps.loading = props.loadingTimer;
+ }
+
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionPlanTreeEvent(ProductionSchedule));
diff --git a/src/components/productionScheduleTree/productionScheduleTreeBack.js b/src/components/productionScheduleTree/productionScheduleTreeBack.js
new file mode 100644
index 0000000..8d486b8
--- /dev/null
+++ b/src/components/productionScheduleTree/productionScheduleTreeBack.js
@@ -0,0 +1,1042 @@
+/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
+import React, { Component } from 'react';
+import { DownOutlined } from '@ant-design/icons';
+import { Form } from '@ant-design/compatible';
+import '@ant-design/compatible/assets/index.css';
+import { Modal, Layout, Spin, Card, Row, Col, message, Tree, Switch, Pagination } from 'antd'; // Switch Select, Tabs,
+import styles from '@/index.less';
+import selfstyles from '@/components/productionMainPlan/index.less';
+import * as commonFunc from '@/components/Common/commonFunc';
+import CommonBase from '@/components/Common/CommonBase';
+import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */
+import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */
+import CommonProductionPlanTreeEvent from '@/components/Common/CommonProductionPlanTreeEvent';
+import Toolbar from '@/components/Common/ToolBar/ToolBarNew';
+import MoveUp from '@/assets/processUp.svg';
+import MoveDown from '@/assets/processDown.svg';
+import DisableMoveUp from '@/assets/disableprocessUp.svg';
+import DisableMoveDown from '@/assets/disableprocessDown.svg';
+import MoveTop from '@/assets/processTop.svg';
+import DisableMoveTop from '@/assets/disableprocessTop.svg';
+import MoveBottom from '@/assets/processBottom.svg';
+import DisableMoveBottom from '@/assets/disableprocessBottom.svg';
+import ChangeMachine from '@/assets/changeMachine.svg';
+import DisableChangeMachine from '@/assets/disablechangeMachine.svg';
+import ShowGantt from '@/assets/gantt.svg';
+import DisableShowGantt from '@/assets/disablegantt.svg';
+import ShowCheckModel from '@/assets/checkModel.svg';
+import DisableShowCheckModel from '@/assets/disablecheckModel.svg';
+import ShowTimer from '@/assets/timer.svg';
+import DisableShowTimer from '@/assets/disabletimer.svg';
+import ShowList from '@/assets/list.svg';
+import DisableShowList from '@/assets/disablelist.svg';
+import Reset from '@/assets/reset.svg';
+import DisableReset from '@/assets/disablereset.svg';
+import * as commonUtils from '@/utils/utils';
+import ShowType from '@/components/Common/CommonComponent';
+import * as commonConfig from '@/utils/config';
+import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
+import Gantt from '@/components/Charts/Gantt';
+import * as commonServices from '@/services/services';
+import MessageArea from '@/components/Charts/Gantt/MessageArea/Message';
+import CommonListSelect from '@/components/Common/CommonListSelect';
+import SearchComponent from '@/components/Common/SearchComponent';
+import tab from '@/routes/tab/tab';
+import GanttStyles from './index.less';
+
+const { TreeNode } = Tree;
+
+const { Header, Content, Sider } = Layout;
+
+class ProductionSchedule extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ isRender: 0,
+ treeData: [],
+ pageSize: 20,
+ pageNum: 1,
+ };
+ this.form = {}; /* 表单对象 */
+ }
+
+ shouldComponentUpdate(nextProps) {
+ const { slaveColumn, masterConfig } = nextProps;
+ return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
+ }
+
+ onDoubleClick = (name, record) => {
+ if (this.props.onDoubleClick !== undefined) {
+ this.props.onDoubleClick(record);
+ }
+ };
+
+ onRowClick = (name, record, bRowClick) => {
+ const { slaveData } = this.props;
+ let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
+ slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sSlaveId);
+ slaveSelectedRowKeys = keys;
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ } else {
+ const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
+ if (indexKey === -1) {
+ slaveSelectedRowKeys.push(record.sSlaveId);
+ const sIds = record.sSlaveId.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ sIds.forEach((item) => {
+ const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (iIndex === -1) {
+ slaveInfoSelectedRowKeys.push(item);
+ }
+ });
+ } else if (indexKey !== -1) {
+ if (!bRowClick) {
+ slaveSelectedRowKeys.splice(indexKey, 1);
+ }
+ const sIds = record.sSlaveId.split('-');
+ sIds.forEach((item) => {
+ const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
+ if (!bRowClick) {
+ slaveInfoSelectedRowKeys.splice(index, 1);
+ }
+ });
+ }
+ }
+ } else if (name === 'slaveInfo') {
+ if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
+ const keys = [];
+ keys.push(record.sId);
+ slaveInfoSelectedRowKeys = keys;
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
+ }
+ } else {
+ const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
+ if (indexKey === -1) {
+ slaveInfoSelectedRowKeys.push(record.sId);
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
+ if (iIndex === -1) {
+ slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
+ }
+ }
+ } else if (indexKey !== -1) {
+ slaveInfoSelectedRowKeys.splice(indexKey, 1);
+ const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
+ if (commonUtils.isNotEmptyArr(slaveDataNews)) {
+ const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
+ if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ } else {
+ let bdel = true;
+ for (const sId of sSlaveIds) {
+ if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
+ bdel = false;
+ break;
+ }
+ }
+ if (bdel) {
+ const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
+ slaveSelectedRowKeys.splice(iIndex, 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ let machineEnabled = false;
+ if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
+ const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
+ const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
+ if (processSlave.length === slaveSelectedRowKeys.length) {
+ machineEnabled = true;
+ }
+ }
+ const { sModelsId } = this.props;
+ commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
+ this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
+ };
+ onCloseChangeMachine = () => {
+ const { masterData } = this.props;
+ delete masterData.tStartDate;
+ delete masterData.iSplitNum;
+ delete masterData.bSplit;
+ this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
+ }
+
+ onPageChange = (pageNum) => {
+ this.setState({
+ pageNum,
+ });
+ }
+
+ onTableSelectRowChange = (name, selectedRowKeys) => {
+ if (name === 'slave') {
+ const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
+ const slaveInfoSelectedRowKeys = [];
+ if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
+ selectedRowKeys.forEach((selectedRow) => {
+ const sIds = selectedRow.split('-');
+ slaveInfoSelectedRowKeys.push(...sIds);
+ });
+ }
+ addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
+ this.props.onSaveState({ ...addState });
+ } else {
+ this.props.onTableSelectRowChange(name, selectedRowKeys);
+ }
+ // let record = {};
+ // let key;
+ // if (name === 'slave') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveSelectedRowKeys.length === 1) {
+ // key = slaveSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length > slaveSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length < slaveSelectedRowKeys.length) {
+ // key = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sSlaveId)[0];
+ // this.onRowClick(name, record);
+ // } else if (name === 'slaveInfo') {
+ // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length === 1) {
+ // key = selectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveInfoSelectedRowKeys.length === 1) {
+ // key = slaveInfoSelectedRowKeys[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length > slaveInfoSelectedRowKeys.length) {
+ // key = selectedRowKeys.filter(item => !slaveInfoSelectedRowKeys.includes(item))[0];
+ // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length < slaveInfoSelectedRowKeys.length) {
+ // key = slaveInfoSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
+ // }
+ // record = tableData.filter(item => key === item.sId)[0];
+ // this.onRowClick(name, record);
+ // } else {
+ // this.props.onTableSelectRowChange(name, selectedRowKeys);
+ // }
+ };
+
+ /** 处理选择行发生改变s */
+ handleTableFilterData = (name, data, record) => {
+ /* 外置处理业务 */
+ if (name === 'slave') {
+ let slaveInfoDataNew = [];
+ if (commonUtils.isNotEmptyArr(data)) {
+ slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
+ }
+ return slaveInfoDataNew;
+ }
+ };
+ // 根据配置解析拼接具体参数
+ handleProParams = (sKey, arr) => {
+ const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
+ const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
+ if (commonUtils.isNotEmptyArr(keyData)) {
+ const addState = {};
+ addState.key = sKey;
+ const val = [];
+ keyData.forEach((currData) => {
+ const currVal = {};
+ arr.forEach((filed) => {
+ currVal[`${filed}`] = currData[`${filed}`];
+ });
+ val.push(currVal);
+ });
+ addState.value = val;
+ return addState;
+ } else {
+ return undefined;
+ }
+ };
+
+ /* 甘特图数据改变出发事件 */
+ logDataUpdate = (type, action, item, id) => {
+ const { charGanttData } = this.props;
+ /* 记录更新的数据 */
+ if (action === 'update') {
+ if (commonUtils.isNotEmptyArr(charGanttData)) {
+ const { data } = charGanttData;
+ if (commonUtils.isNotEmptyArr(data) && data.length > 0) {
+ const iIndex = data.findIndex(child => child.id === id);
+ if (iIndex > -1) {
+ if (commonUtils.isNotEmptyObject(item.start_date)) {
+ data[iIndex].start_date = item.start_date;
+ }
+ if (commonUtils.isNotEmptyObject(item.end_date)) {
+ data[iIndex].end_date = item.end_date;
+ }
+ charGanttData.tasks.data = data;
+ this.props.onSaveState({ charGanttData });
+ }
+ }
+ }
+ }
+ const text = item && item.text ? ` (${item.text})` : '';
+ let message = `${type} ${action}: ${id} ${text}`;
+ if (type === 'link' && action !== 'delete') {
+ message += ` ( source: ${item.source}, target: ${item.target} )`;
+ }
+ this.addMessage(message);
+ }
+ logTaskUpdate = (id, mode, task) => {
+ const text = task && task.text ? ` (${task.text})` : '';
+ const message = `Task ${mode}: ${id} ${text}`;
+ this.addMessage(message);
+ }
+
+ logLinkUpdate = (id, mode, link) => {
+ let message = `Link ${mode}: ${id}`;
+ if (link) {
+ message += ` ( source: ${link.source}, target: ${link.target} )`;
+ this.addMessage(message);
+ }
+ }
+ addMessage = (message) => {
+ const maxLogLength = 5;
+ const newMessate = { message };
+ const messages = [
+ ];
+ messages.push(newMessate);
+ if (messages.length > maxLogLength) {
+ messages.length = maxLogLength;
+ }
+ this.props.onSaveState({ messages });
+ }
+ sortData = (tempData) => {
+ tempData.sort((g1, g2) => {
+ return g1.iOrder - g2.iOrder;
+ });
+ return tempData;
+ };
+
+ /* 控制排序 */
+ orderData = (e, name, type) => {
+ const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
+ let { [`${name}Data`]: currentData } = this.props;
+ if (name === 'slave') {
+ if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
+ return;
+ }
+ if (commonUtils.isEmptyArr(currentData)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
+ return;
+ }
+ const tempNew = currentData.filter((item) => { /* 获取勾选数据集 */
+ return tableselectedRowKeys.indexOf(item.sSlaveId) > -1;
+ });
+ if (commonUtils.isEmptyArr(tempNew)) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
+ return;
+ }
+ const len = currentData.length;
+ const newLen = tempNew.length;
+ let num = 0.01;/* 循环增加体 */
+ let targetiOrder = -1;
+ if (type === 1) { /* 上移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
+ return;
+ } else {
+ targetiOrder = 0;
+ }
+ } else {
+ targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
+ }
+ } else if (type === 2) { /* 下移 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[iIndex + 1].iOrder;
+ }
+ } else if (type === 0) { /* 置顶 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
+ if (iIndex === 0) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[0].iOrder - 1;
+ }
+ } else if (type === 3) { /* 置底 */
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
+ if (iIndex === len - 1) {
+ if (newLen === 1) {
+ message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
+ return;
+ } else {
+ targetiOrder = currentData[iIndex].iOrder;
+ }
+ } else {
+ targetiOrder = currentData[len - 1].iOrder + 1;
+ }
+ }
+ tempNew.forEach((item) => {
+ const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
+ currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
+ num += 0.01;
+ });
+ currentData = this.sortData(currentData);
+ currentData = this.orderNum(currentData);
+ const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
+ const slavePagination = { ...slavePaginationOld };
+ slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
+ this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
+ } else if (name === 'slaveInfo') {
+ this.props.onSaveState({ isChangeMachine: true });
+ }
+ };
+
+ /* 自定义排序号 */
+ orderNum = (tableData) => {
+ tableData.forEach((item, index) => {
+ item.iOrder = index + 1;
+ item.handleType = 'update';
+ });
+ return tableData;
+ };
+
+ /* 切换甘特图/列表视图 */
+ changeGantt = (e, type) => {
+ let bGantt = false;
+ if (type === 'gantt') {
+ const { slaveFilterCondition } = this.props;
+ bGantt = true;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Process_CommonGtChar';
+ chart.paramsMap = {
+ };
+ this.props.onGanttChar(chart, slaveFilterCondition);
+ } else if (type === 'list') {
+ bGantt = false;
+ }
+ this.props.onSaveState({ bGantt });
+ };
+
+ /* 切换稽查列表 */
+ changeCheckModel= (e, type) => {
+ if (type === 'checkModel') {
+ const { slaveFilterCondition } = this.props;
+ /* 调用获取甘特图数据 */
+ const chart = {};
+ chart.sProcedureName = 'Sp_Manufacture_GetAPSstate';
+ chart.paramsMap = {
+ };
+ this.props.onCheckModel(chart, slaveFilterCondition);
+ }
+ };
+ /* 弹出重算时间弹窗 */
+ showTimerModal= (e, type) => {
+ if (type === 'changeTimer') {
+ this.props.onSaveState({ changeTimerVisible: true });
+ }
+ };
+ /** 处理选择行发生改变 */
+ // handleTableFilterData = (name, data, record) => {
+ // /* 外置处理业务 */
+ // if (name === 'slave') {
+ // let slaveInfoDataNew = '';
+ // slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
+ // return slaveInfoDataNew;
+ // }
+ // };
+ /** 处理card点击事件 */
+ handleTabsCallback = (child) => {
+ // if (commonUtils.isNotEmptyArr(this.props.teamData)) {
+ // child.cardSelectedColor = '#fff7e6';
+ // const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
+ // const teamDataNew = this.props.teamData;
+ // teamDataNew.forEach((item, index) => {
+ // if (index !== iIndex) { item.cardSelectedColor = ''; }
+ // });
+ // }
+ // this.props.onSaveState({ Loading: true });
+ this.props.onTabsCallback(child);
+ };
+
+
+ // handleGanttChar = async (ganttChart) => {
+ // const { token, sModelsId, formRoute, slaveFilterCondition } = this.props;
+ // let charGanttData = {};
+ // const value = {
+ // sProName: ganttChart.sProcedureName,
+ // paramsMap: ganttChart.prodParamsMap,
+ // bFilter: slaveFilterCondition,
+ // };
+ // const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}&sName=${formRoute}`;
+ // const { data: returnData } = await commonServices.postValueService(token, value, url);
+ // console.log('returnData', returnData);
+ // if (returnData.code === 1) {
+ // const { dataset } = returnData;
+ // if (commonUtils.isNotEmptyObject(dataset)) {
+ // const outData = returnData.dataset.rows[0].dataSet.outData[0];
+ // if (outData.sCode === -1) {
+ // message.error(outData.sReturn);
+ // } else {
+ // charGanttData = commonUtils.isEmpty(outData.sReturn) ? [] : JSON.parse(outData.sReturn);
+ // }
+ // }
+ // } else {
+ // message.error(returnData.msg);
+ // }
+ // console.log('charGanttData', charGanttData);
+ // this.props.onSaveState({ charGanttData });
+ // };
+ // renderCards = (data) => {
+ // let showInfo = '';
+ // data.map((item) => {
+ // showInfo += (
+ //
+ //
+ // {item.sTeamName} {item.dHour} {'30%'}
+ //
+ //
+ // );
+ // });
+ // return showInfo;
+ // }
+ render() {
+ const { pageLoading, treeLoading } = this.props;
+ return (
+
+ );
+ }
+}
+
+const ProductionScheduleComponent = Form.create({
+ mapPropsToFields(props) {
+ const { masterData } = props;
+ const obj = commonFunc.mapPropsToFields(masterData, Form);
+ return obj;
+ },
+})((props) => {
+ const {
+ form, onReturnForm, app, masterData, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate, bGantt, charGanttData, messages,
+ Loading, treeData, defaultSid, moveEnabled, treeChild, pageSize, pageNum, onPageChange, sortEnabled, workOutsideColumn } = props;
+ /* 回带表单s */
+ onReturnForm(form);
+ // const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
+ const pagination = {
+ pageSize: commonConfig.pageSize,
+ ...slavePagination,
+ size: 'large',
+ pageSizeOptions: commonConfig.pageSizeOptions,
+ // showQuickJumper: true,
+ hideOnSinglePage: false,
+ showSizeChanger: true,
+ current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
+ };
+ const width = '18px';
+ const height = '18px';
+ const moveUp = {
+ title: '上移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveDown = {
+ title: '下移',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveTop = {
+ title: '置顶',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const moveBottom = {
+ title: '置底',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const changeMachine = {
+ title: '更换机台',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showGantt = {
+ title: '查看Gantt',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showCheckModel = {
+ title: '齐套稽查',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+
+ const showTimer = {
+ title: '重算时间',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const showList = {
+ title: '查看列表',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const resetSearch = {
+ title: '重置搜索',
+ width: { width },
+ height: { height },
+ img:
,
+ disableimg:
,
+ };
+ const addProps = {};
+ //
+ // 前端假分页数据
+ let tablePageData = commonBusiness.getTableTypes('slave', props).data;
+ if (tablePageData) {
+ tablePageData = commonBusiness.getTableTypes('slave', props).data.slice(pageSize * (pageNum - 1), pageSize * pageNum);
+ }
+
+ // 从表原始数据
+ const tableProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ clearArray: props.clearArray,
+ };
+
+ const workOutsideProps = {
+ ...commonBusiness.getTableTypes('slave', props),
+ onTableFilterData: props.onTableFilterData,
+ tableProps: {
+ rowKey: 'sSlaveId',
+ pagination,
+ sortSelf: true,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slave', record, true); },
+ onDoubleClick: () => { props.onDoubleClick('slave', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slave'),
+ },
+ headerColumn: workOutsideColumn,
+ clearArray: props.clearArray,
+ };
+ const tableInfoProps = {
+ ...commonBusiness.getTableTypes('slaveInfo', props),
+ tableProps: {
+ rowKey: 'sId',
+ pagination,
+ planLoadingSate,
+ onRow: (record) => {
+ return {
+ onClick: () => { props.onRowClick('slaveInfo', record); },
+ onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
+ // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
+ };
+ },
+ onChange: props.onTitleChange.bind(this, 'slaveInfo'),
+ },
+ // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
+ };
+ let zoom = {};
+ zoom.scale = 'Minutes';
+ zoom.step = '10'; /* 间隔 */
+ if (commonUtils.isNotEmptyObject(charGanttData)) {
+ zoom = charGanttData.zoom;
+ }
+ const ganttProps = {
+ // ...commonBusiness.getGanttTypes('slave', props),
+ tasks: commonUtils.isNotEmptyObject(charGanttData) ? charGanttData : {}, /* 甘特图数据源 */
+ zoom: commonUtils.isNotEmptyObject(zoom) ? zoom : {},
+ onDataUpdated: props.onDataUpdated,
+ };
+ const gridStyle = {
+ width: '100%',
+ textAlign: 'left',
+ };
+ const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
+ const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
+ const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
+ const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
+ const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
+ const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
+ // const resetSearchEnabled = clearArray.length > 0;
+ const resetSearchEnabled = true;
+
+ const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
+ const machineShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineId,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
+ const teamShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+ const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
+ const startShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
+ const splitShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
+ const splitNumShowTypeProps = {
+ app,
+ record: masterData,
+ name: 'master',
+ form: props.form,
+ formId: sModelsId,
+ getSqlDropDownData: props.getSqlDropDownData,
+ getSqlCondition: props.getSqlCondition,
+ handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
+ getFloatNum: props.getFloatNum,
+ getDateFormat: props.getDateFormat,
+ onChange: props.onChange,
+ showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
+ formItemLayout: {},
+ enabled: true,
+ dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
+ bTable: false,
+ onFilterDropDownData: props.onFilterDropDownData,
+ };
+
+ let searchWorkSchedule = {};
+ let workScheduleConfig = {};
+ let searchWorkTitle = '';
+ if (commonUtils.isNotEmptyObject(props.workScheduleConfig)) {
+ workScheduleConfig = props.workScheduleConfig;
+ searchWorkTitle = workScheduleConfig.sActiveName;
+ const sWorkOrderId = commonUtils.isNotEmptyObject(props.workScheduleRecord) ? props.workScheduleRecord.sWorkOrderId : '';
+ searchWorkSchedule = {
+ app: {
+ ...props.app,
+ currentPane: {
+ name: 'workSchedule',
+ config: workScheduleConfig,
+ conditonValues: props.getSqlCondition(workScheduleConfig),
+ title: workScheduleConfig.sActiveName,
+ route: '/indexPage/commonList',
+ formRoute: '/indexPage/commonList',
+ formId: workScheduleConfig.sActiveId,
+ key: sModelsId + workScheduleConfig.sId,
+ sModelsType: 'search/workSchedule',
+ bFilterProName: 'p_sWorkOrderId_pro',
+ bFilterProValue: sWorkOrderId,
+ // select: props.onSelect,
+ // selectCancel: props.onSelectCancel,
+ },
+ },
+ dispatch: props.dispatch,
+ content: props.content,
+ id: new Date().getTime().toString(),
+ realizeHeight: props.realizeHeight, /* 拖动偏移高度s */
+ bNotShowBtn: true,
+ rowSelection: null,
+ };
+ }
+
+
+ let selectedRowKey = {};
+ if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
+ selectedRowKey = teamSelectedRowKeys[0];
+ }
+
+ let teamDataNum = 0;
+ if (commonUtils.isNotEmptyArr(props.teamData)) {
+ // 取得导航按钮的行数
+ if (props.teamData.length % 8 === 0) {
+ teamDataNum = (props.teamData.length / 8);
+ } else {
+ teamDataNum = Math.ceil(props.teamData.length / 8);
+ }
+ }
+
+ const handleTreeOnSelect = (keys, e) => {
+ const child = e.selectedNodes.length ? e.node.props.dataRef : false;
+ if (child) {
+ props.onTabsCallback(child);
+ onPageChange(1);
+ }
+ };
+
+ const parentNode = [];
+ const renderTreeNodes = (data, pid) =>
+ data.map((item, index) => {
+ if (item.children) {
+ parentNode.push(item.sId + item.sProcessId);
+ // const key = `0-${index}`;
+ return (
+ {item.sShowName}{item.dHour ? {item.dHour}h : ''}} key={item.sId + item.sProcessId} dataRef={{ ...item, pid: pid || 0 }}>
+ {renderTreeNodes(item.children, item.sId)}
+
+ );
+ }
+ return {item.sShowName}{item.dHour ? {item.dHour}h : ''}} key={item.sId + item.sProcessId} dataRef={{ ...item, pid: pid || 0 }} {...item} />;
+ });
+ return (
+
+ );
+});
+
+export default CommonBase(CommonProductionPlanTreeEvent(ProductionSchedule));
diff --git a/src/routes/basicInfoSetting/auditInformation/auditInformation.js b/src/routes/basicInfoSetting/auditInformation/auditInformation.js
new file mode 100644
index 0000000..2c4f0b1
--- /dev/null
+++ b/src/routes/basicInfoSetting/auditInformation/auditInformation.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import AuditInformationComponent from '../../../components/AuditInformation/AuditInformation';
+
+function ProductReport({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const auditInformationProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductReport);
diff --git a/src/routes/basicInfoSetting/machineInfo/eleMachineInfo.js b/src/routes/basicInfoSetting/machineInfo/eleMachineInfo.js
new file mode 100644
index 0000000..b33445d
--- /dev/null
+++ b/src/routes/basicInfoSetting/machineInfo/eleMachineInfo.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import EleMachineInfoComponent from '../../../components/CommonElementEvent/ElemachineInfo';
+
+function EleMachineInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const machineProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(EleMachineInfo);
diff --git a/src/routes/basicInfoSetting/machineInfo/machineInfo.js b/src/routes/basicInfoSetting/machineInfo/machineInfo.js
new file mode 100644
index 0000000..f43d5ef
--- /dev/null
+++ b/src/routes/basicInfoSetting/machineInfo/machineInfo.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'dva';
+import MachineInfoComponent from '../../../components/BasicInfoSetting/MachineInfo/MachineInfo';
+
+function MachineInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const machineProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(MachineInfo);
diff --git a/src/routes/basicInfoSetting/mailMsg/sysMsgInfo.js b/src/routes/basicInfoSetting/mailMsg/sysMsgInfo.js
new file mode 100644
index 0000000..86eeadc
--- /dev/null
+++ b/src/routes/basicInfoSetting/mailMsg/sysMsgInfo.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import SysMsgInfoComponent from '../../../components/CommonElementEvent/SysMsgInfo';
+
+function sysMsgInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const machineProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(sysMsgInfo);
diff --git a/src/routes/basicInfoSetting/paymentInfo/paymentInfo.js b/src/routes/basicInfoSetting/paymentInfo/paymentInfo.js
new file mode 100644
index 0000000..536ccd2
--- /dev/null
+++ b/src/routes/basicInfoSetting/paymentInfo/paymentInfo.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import PaymentInfoComponent from '../../../components/BasicInfoSetting/PaymentInfo/PaymentInfo';
+
+function PaymentInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const paymentInfoProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(PaymentInfo);
diff --git a/src/routes/basicInfoSetting/paymentInfo/paymentInfoTerms.js b/src/routes/basicInfoSetting/paymentInfo/paymentInfoTerms.js
new file mode 100644
index 0000000..ad9a321
--- /dev/null
+++ b/src/routes/basicInfoSetting/paymentInfo/paymentInfoTerms.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import PaymentTermsInfoComponent from '../../../components/CommonElementEvent/PaymentTermsInfo';
+
+function PaymentTermsInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const paymentInfoProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(PaymentTermsInfo);
diff --git a/src/routes/basicInfoSetting/printLabel/printLabel.js b/src/routes/basicInfoSetting/printLabel/printLabel.js
new file mode 100644
index 0000000..5aaba0a
--- /dev/null
+++ b/src/routes/basicInfoSetting/printLabel/printLabel.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import { connect } from 'umi';
+import PrintLabelComponent from '../../../components/PrintLabel/PrintLabel';
+
+function PrintLabel({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const printLabelProps = {
+ dispatch,
+ app,
+ content,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(PrintLabel);
diff --git a/src/routes/basicInfoSetting/productReport/productReport.js b/src/routes/basicInfoSetting/productReport/productReport.js
new file mode 100644
index 0000000..ead473a
--- /dev/null
+++ b/src/routes/basicInfoSetting/productReport/productReport.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductReportComponent from '../../../components/ProductionReport/ProductionReport';
+
+function ProductReport({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const productReportProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductReport);
diff --git a/src/routes/basicInfoSetting/sisFormula/sisFormula.js b/src/routes/basicInfoSetting/sisFormula/sisFormula.js
new file mode 100644
index 0000000..8399db7
--- /dev/null
+++ b/src/routes/basicInfoSetting/sisFormula/sisFormula.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'umi';
+import SisformulaComponent from '../../../components/BasicInfoSetting/Sisformula/Sisformula';
+
+function Sisformula({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const sisFormulaProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(Sisformula);
diff --git a/src/routes/basicInfoSetting/sisFormula/sisFormulaInfo.js b/src/routes/basicInfoSetting/sisFormula/sisFormulaInfo.js
new file mode 100644
index 0000000..b6e767e
--- /dev/null
+++ b/src/routes/basicInfoSetting/sisFormula/sisFormulaInfo.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import { connect } from 'dva';
+import SisFormulaComponent from '../../../components/CommonElementEvent/SisformulaInfo';
+
+function SisFormulaInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+
+ const sisFormulaProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(SisFormulaInfo);
diff --git a/src/routes/basicInfoSetting/systemPermission/systemPermissionInfo.js b/src/routes/basicInfoSetting/systemPermission/systemPermissionInfo.js
new file mode 100644
index 0000000..7f3bc17
--- /dev/null
+++ b/src/routes/basicInfoSetting/systemPermission/systemPermissionInfo.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import { connect } from 'umi';
+import SystemPermissionInfoComponent from '../../../components/JurisdictionAllotEvent/SystemPermissionInfo';
+
+function SystemPermissionInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ function removeModalPan(changePanes) {
+ dispatch({ type: 'app/removeModalPane', payload: { changePanes } });
+ }
+
+ function addPane(pane) {
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+ const systemPermissionInfoProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: addPane,
+ onRemovePane: removePane,
+ onRemoveModalPane: removeModalPan,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(SystemPermissionInfo);
diff --git a/src/routes/common/eleteamInfo.js b/src/routes/common/eleteamInfo.js
new file mode 100644
index 0000000..ae984ef
--- /dev/null
+++ b/src/routes/common/eleteamInfo.js
@@ -0,0 +1,29 @@
+/**
+ * Created by mar105 on 2019-03-05.
+ */
+
+import React from 'react';
+import { connect } from 'umi';
+import EleteamInfoComponent from '../../components/CommonElementEvent/EleteamInfo';
+
+
+function EleteamInfoRouter({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const customerInfoProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(EleteamInfoRouter);
+
diff --git a/src/routes/commonAuto/commonAuto.js b/src/routes/commonAuto/commonAuto.js
new file mode 100644
index 0000000..8ffde12
--- /dev/null
+++ b/src/routes/commonAuto/commonAuto.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import { connect } from 'umi';
+import CommonAutoComponent from '../../components/CommonAuto/CommonAuto';
+
+function CommonAuto({
+ dispatch, app, content, location,
+}) {
+ const commonAuto = {
+ app,
+ content,
+ dispatch,
+ location,
+ formRoute: '/commonAuto',
+ // routing: location,
+ // sModelsId: '16023076160002851926300441337000', /* 通用自定义界面sId */
+ // sModelsId: '16073932850005572635673985499000', /* 通用自定义模板1-sId */
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(CommonAuto);
+
diff --git a/src/routes/importData/importData.js b/src/routes/importData/importData.js
new file mode 100644
index 0000000..ecc4cc8
--- /dev/null
+++ b/src/routes/importData/importData.js
@@ -0,0 +1,22 @@
+import React from 'react';
+import { connect } from 'umi';
+import ImportDataInfo from '../../components/CommonImportDataEvent/importDataInfo';
+
+function importData({ dispatch, app, content }) {
+ const importDataProps = {
+ app,
+ content,
+ dispatch,
+ onAddPane: getAddPane, /* 增加标签 */
+ };
+ function getAddPane(pane) {
+ /* 增加标签 */
+ dispatch({ type: 'app/addPane', payload: { pane } });
+ }
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(importData);
diff --git a/src/routes/productionMainPlan/productionMainPlan.js b/src/routes/productionMainPlan/productionMainPlan.js
new file mode 100644
index 0000000..19f0f0b
--- /dev/null
+++ b/src/routes/productionMainPlan/productionMainPlan.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionMainPlanComponentInfo from '../../components/productionMainPlan/productionMainPlan';
+
+function ProductionMainPlan({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const productionPlanProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionMainPlan);
diff --git a/src/routes/productionMainPlan/productionUnifiedPlanning.js b/src/routes/productionMainPlan/productionUnifiedPlanning.js
new file mode 100644
index 0000000..7d886ae
--- /dev/null
+++ b/src/routes/productionMainPlan/productionUnifiedPlanning.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionUnifiedPlanningComponentInfo from '../../components/productionMainPlan/productionUnifiedPlanning';
+
+function ProductionUnifiedPlanning({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const productionUnifiedPlanningProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionUnifiedPlanning);
diff --git a/src/routes/productionSchedule/productionPlan.js b/src/routes/productionSchedule/productionPlan.js
new file mode 100644
index 0000000..75b16da
--- /dev/null
+++ b/src/routes/productionSchedule/productionPlan.js
@@ -0,0 +1,18 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionPlanComponent from '../../components/ProductionPlan/ProductionPlan';
+
+function ProductionPlan({ dispatch, app, content }) {
+ const ProductionPlanBillProps = {
+ app,
+ content,
+ dispatch,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionPlan);
diff --git a/src/routes/productionSchedule/productionPlanChangeMachineInfo.js b/src/routes/productionSchedule/productionPlanChangeMachineInfo.js
new file mode 100644
index 0000000..4f2db59
--- /dev/null
+++ b/src/routes/productionSchedule/productionPlanChangeMachineInfo.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionPlanChangeMachineInfo from '../../components/productionPlanInfo/productionPlanInfo';
+
+function ProductionPlanChangeMachine({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const productionPlanChangeMachineProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionPlanChangeMachine);
diff --git a/src/routes/productionSchedule/productionScheduleInfo.js b/src/routes/productionSchedule/productionScheduleInfo.js
new file mode 100644
index 0000000..75c1210
--- /dev/null
+++ b/src/routes/productionSchedule/productionScheduleInfo.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionScheduleComponentInfo from '../../components/productionSchedule/productionSchedule';
+
+function ProductionScheduleInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const productionPlanProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionScheduleInfo);
diff --git a/src/routes/productionScheduleTree/productionScheduleTree.js b/src/routes/productionScheduleTree/productionScheduleTree.js
new file mode 100644
index 0000000..c77c5e8
--- /dev/null
+++ b/src/routes/productionScheduleTree/productionScheduleTree.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { connect } from 'umi';
+import ProductionScheduleTree from '../../components/productionScheduleTree/productionScheduleTree';
+
+function ProductionScheduleInfo({ dispatch, app, content }) {
+ function removePane(changePanes, currentPane) {
+ dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ }
+
+ const productionPlanProps = {
+ app,
+ content,
+ dispatch,
+ onRemovePane: removePane,
+ };
+
+ return (
+
+ );
+}
+
+export default connect(({ app, content }) =>
+ ({ app, content }))(ProductionScheduleInfo);
diff --git a/src/routes/tab/tab.js b/src/routes/tab/tab.js
index 37d4c07..780221e 100644
--- a/src/routes/tab/tab.js
+++ b/src/routes/tab/tab.js
@@ -1,112 +1,149 @@
-import { connect } from 'umi';
-import { Icon as LegacyIcon } from '@ant-design/compatible';
-import { ExclamationCircleOutlined } from '@ant-design/icons';
-import { Tabs, Modal } from 'antd';
-import IndexCenter from '@/routes/indexCenter/indexCenter';/* 首页 */
-import TabComponent from '@/components/Tab/TabComponent';
-import CommonListEdit from '@/routes/commonList/commonListEdit'; /* 可编辑公共列表 */
-import CommonList from '@/routes/commonList/commonList';/* 公共列表 */
-import CommonListA from '@/routes/commonList/commonListA'; /* 无需注册模块验证的公共列表 */
-import CommonListTab from '@/routes/commonList/commonListTab'; /* 多个列表 */
-import CommonBill from '@/routes/commonList/commonBill';/* 通用单据页 */
-import CommonNewBill from '@/routes/commonList/commonNewBill';/* 通用单据页 */
-import CommonClassify from '@/routes/commonClassify/commonClassify';/* 公共分类 */
-import CustomerInfo from '@/routes/basicInfoSetting/customerInfo/customerInfo';/* 客户信息 */
-import CommonColumnList from '@/routes/commonColumnList/commonColumnList';/* 公共自定义标题列表 */
-import CommonListTree from '@/routes/commonListTree/commonListTree';/* 两层通用结构commonListTree,功能如物料需求计划 */
-import CommonListLeft from '@/routes/commonList/commonListLeft';/* 左侧树形 */
-import CommonGatte from '@/routes/commonGatte/commonGatte';/* 甘特图列表 */
-import MaterialRequirementsPlanning from '@/routes/materialRequirementsPlanning/materialRequirementsPlanning';/* 物料需求计划 */
-import TestStandInfo from '@/routes/basicInfoSetting/teststandInfo/teststandInfo';/* 刀模信息 */
-import Employee from '@/routes/basicInfoSetting/employee/employee';/* 职员信息 */
-import Materiel from '@/routes/basicInfoSetting/materiel/materiel';/* 物料信息 */
-import PrintInfo from '@/routes/basicInfoSetting/printInfo/printInfo';/* 印件信息 */
-import SystemSetting from '@/routes/basicInfoSetting/systemSetting/systemSetting';/* 印件信息 */
-import SupplyInfo from '@/routes/basicInfoSetting/supplyInfo/supplyInfo';/* 权限分配 */
-import ProcessInfo from '@/routes/basicInfoSetting/processInfo/processInfo';/* 工序信息 */
-import CheckModel from '@/routes/basicInfoSetting/checkModel/checkModel';/* 审核模板 */
-import CheckPhase from '@/routes/basicInfoSetting/checkPhase/checkPhase';/* 审核阶段 */
-import SftLoginInfo from '@/routes/basicInfoSetting/sftLoginInfo/sftLoginInfo';/* 用户管理 */
-import Commonstyle from '@/routes/basicInfoSetting/commonStyle/commonStyle';/* 常用规格 */
-import ProductClassify from '@/routes/basicInfoSetting/productClassify/productClassify';/* 印件分类信息 */
-import CommonCheckBill from '@/routes/common/commonCheckBill';/* 通用预览单据页 */
-import WorkOrderNew from '@/routes/manufacture/workOrder/workOrder';/* 生产施工单 */
-import WorkOrderPack from '@/routes/manufacture/workOrderPack/workOrderPack';/* 包装施工单 */
-import WorkOrderPackTableTree from '@/routes/manufacture/workOrderPackTableTree/workOrderPackTableTree';/* 包装施工单 */
-import WorkOrderResearchTableTree from '@/routes/manufacture/workOrderResearchTableTree/workOrderResearchTableTree';/* 研发工单 */
-import ProcessCardInfo from '@/routes/manufacture/processCard/processCardInfo';
-import ProcessCardInfoPack from '@/routes/manufacture/processCardPack/processCardInfoPack';
-import ProcessCardPackTableTree from '@/routes/manufacture/processCardPackTableTree/processCardPackTableTree';
-import ProcessCardPackTableTreeNew from '@/routes/manufacture/processCardPackTableTreeNew/processCardPackTableTreeNew';
-import WorkOrderPackTableTreeNew from '@/routes/manufacture/workOrderPackTableTreeNew/workOrderPackTableTreeNew';
-import ProductionPlan from '@/routes/productionPlan/productionPlan';/* 生产排程 */
-import styles from '@/index.less';
-import { sendWebSocketMessage } from '@/components/Common/commonFunc';
-import { isNotEmptyObject, isNotEmptyArr } from '@/utils/utils'; /* 通用方法 */
-import KnifemouldInfo from '@/routes/basicInfoSetting/knifemouldInfo/knifemouldInfo';/* 刀模信息 */
-import CommonChar from '@/routes/commonChar/commonChar';/* 通用图表页 */
-import QuotationPackTableTree from '@/routes/quoQuotation/quotationPackTableTree/quotationPackTableTree';
+import { connect } from "umi";
+import { Icon as LegacyIcon } from "@ant-design/compatible";
+import { ExclamationCircleOutlined } from "@ant-design/icons";
+import { Tabs, Modal } from "antd";
+import IndexCenter from "@/routes/indexCenter/indexCenter"; /* 首页 */
+import TabComponent from "@/components/Tab/TabComponent";
+import CommonListEdit from "@/routes/commonList/commonListEdit"; /* 可编辑公共列表 */
+import CommonList from "@/routes/commonList/commonList"; /* 公共列表 */
+import CommonListA from "@/routes/commonList/commonListA"; /* 无需注册模块验证的公共列表 */
+import CommonListTab from "@/routes/commonList/commonListTab"; /* 多个列表 */
+import CommonBill from "@/routes/commonList/commonBill"; /* 通用单据页 */
+import CommonNewBill from "@/routes/commonList/commonNewBill"; /* 通用单据页 */
+import CommonClassify from "@/routes/commonClassify/commonClassify"; /* 公共分类 */
+import CustomerInfo from "@/routes/basicInfoSetting/customerInfo/customerInfo"; /* 客户信息 */
+import CommonColumnList from "@/routes/commonColumnList/commonColumnList"; /* 公共自定义标题列表 */
+import CommonListTree from "@/routes/commonListTree/commonListTree"; /* 两层通用结构commonListTree,功能如物料需求计划 */
+import CommonListLeft from "@/routes/commonList/commonListLeft"; /* 左侧树形 */
+import CommonGatte from "@/routes/commonGatte/commonGatte"; /* 甘特图列表 */
+import MaterialRequirementsPlanning from "@/routes/materialRequirementsPlanning/materialRequirementsPlanning"; /* 物料需求计划 */
+import TestStandInfo from "@/routes/basicInfoSetting/teststandInfo/teststandInfo"; /* 刀模信息 */
+import Employee from "@/routes/basicInfoSetting/employee/employee"; /* 职员信息 */
+import Materiel from "@/routes/basicInfoSetting/materiel/materiel"; /* 物料信息 */
+import PrintInfo from "@/routes/basicInfoSetting/printInfo/printInfo"; /* 印件信息 */
+import SystemSetting from "@/routes/basicInfoSetting/systemSetting/systemSetting"; /* 印件信息 */
+import SupplyInfo from "@/routes/basicInfoSetting/supplyInfo/supplyInfo"; /* 权限分配 */
+import ProcessInfo from "@/routes/basicInfoSetting/processInfo/processInfo"; /* 工序信息 */
+import CheckModel from "@/routes/basicInfoSetting/checkModel/checkModel"; /* 审核模板 */
+import CheckPhase from "@/routes/basicInfoSetting/checkPhase/checkPhase"; /* 审核阶段 */
+import SftLoginInfo from "@/routes/basicInfoSetting/sftLoginInfo/sftLoginInfo"; /* 用户管理 */
+import Commonstyle from "@/routes/basicInfoSetting/commonStyle/commonStyle"; /* 常用规格 */
+import ProductClassify from "@/routes/basicInfoSetting/productClassify/productClassify"; /* 印件分类信息 */
+import CommonCheckBill from "@/routes/common/commonCheckBill"; /* 通用预览单据页 */
+import WorkOrderNew from "@/routes/manufacture/workOrder/workOrder"; /* 生产施工单 */
+import WorkOrderPack from "@/routes/manufacture/workOrderPack/workOrderPack"; /* 包装施工单 */
+import WorkOrderPackTableTree from "@/routes/manufacture/workOrderPackTableTree/workOrderPackTableTree"; /* 包装施工单 */
+import WorkOrderResearchTableTree from "@/routes/manufacture/workOrderResearchTableTree/workOrderResearchTableTree"; /* 研发工单 */
+import ProcessCardInfo from "@/routes/manufacture/processCard/processCardInfo";
+import ProcessCardInfoPack from "@/routes/manufacture/processCardPack/processCardInfoPack";
+import ProcessCardPackTableTree from "@/routes/manufacture/processCardPackTableTree/processCardPackTableTree";
+import ProcessCardPackTableTreeNew from "@/routes/manufacture/processCardPackTableTreeNew/processCardPackTableTreeNew";
+import WorkOrderPackTableTreeNew from "@/routes/manufacture/workOrderPackTableTreeNew/workOrderPackTableTreeNew";
+import ProductionPlan from "@/routes/productionPlan/productionPlan"; /* 生产排程 */
+import styles from "@/index.less";
+import { sendWebSocketMessage } from "@/components/Common/commonFunc";
+import { isNotEmptyObject, isNotEmptyArr } from "@/utils/utils"; /* 通用方法 */
+import KnifemouldInfo from "@/routes/basicInfoSetting/knifemouldInfo/knifemouldInfo"; /* 刀模信息 */
+import CommonChar from "@/routes/commonChar/commonChar"; /* 通用图表页 */
+import CommonAuto from "@/routes/commonAuto/commonAuto"; /* 通用自定义界面 */
+import EleteamInfo from "@/routes/common/eleteamInfo"; /* 班组信息页 新 */
+import SisFormulaInfo from "@/routes/basicInfoSetting/sisFormula/sisFormulaInfo";
+import EleMachineInfo from "@/routes/basicInfoSetting/machineInfo/eleMachineInfo"; /* 设备信息 */
+import SystemPermissionInfo from "@/routes/basicInfoSetting/systemPermission/systemPermissionInfo"; /* 设备信息 */
+import QuotationPackTableTree from "@/routes/quoQuotation/quotationPackTableTree/quotationPackTableTree";
+import ImportDataInfo from "@/routes/importData/importData"; /* 设备信息 */
+import PaymentTermsInfo from '@/routes/basicInfoSetting/paymentInfo/paymentInfoTerms';
+import ProductionReport from '@/routes/basicInfoSetting/productReport/productReport';/* 产量上报 */
+import ProductionMainPlan from '@/routes/productionMainPlan/productionMainPlan';/* 新生产主计划 */
+import ProductionPlanInfo from '@/routes/productionPlan/productionPlanInfo';/* 新生产排程 */
+import ProductionPlanOutside from '@/routes/productionPlan/productionPlanOutside';/* 发外排程 */
+import ProductionSchedule from '@/routes/productionSchedule/productionScheduleInfo';/* 生产排程甘特图 */
+import ProductionScheduleTree from '@/routes/productionScheduleTree/productionScheduleTree';/* 生产排程tree(金宣发) */
+import AuditInformation from '@/routes/basicInfoSetting/auditInformation/auditInformation';/* 审核信息 */
+import SysMsgInfo from '@/routes/basicInfoSetting/mailMsg/sysMsgInfo';
+import PrintLabel from '@/routes/basicInfoSetting/printLabel/printLabel';
/* 计算方案s */
const { confirm } = Modal;
const { TabPane } = Tabs;
function Tab({ dispatch, app }) {
const { panes } = app;
- let paneType = '';
+ let paneType = "";
const tagArr = panes.filter(item => item.newRecordFlag !== undefined);
- const tagLastKey = tagArr !== undefined && tagArr.length > 0 ? tagArr[tagArr.length - 1].key : '';
- const tabpanes = panes.map((pane) => {
- const bRecordFlagDisabled = (tagArr.length > 0 && pane.key !== tagLastKey);
+ const tagLastKey = tagArr !== undefined && tagArr.length > 0 ? tagArr[tagArr.length - 1].key : "";
+ const tabpanes = panes.map(pane => {
+ const bRecordFlagDisabled = tagArr.length > 0 && pane.key !== tagLastKey;
const routeList = {
- '/indexPage/commonList': ,
- '/indexPage/commonListA': ,
- '/indexPage/commonNewBill': ,
- '/indexPage/commonBill' : ,
- '/indexPage/commonListEdit' : ,
- '/indexPage/commonClassify' : ,
- '/indexPage/eleknifemould' : ,
- '/indexPage/elecustomer' : ,
- '/indexPage/commonListTab' : ,
- '/indexPage/commonColumnList' : ,
- '/indexPage/commonListTree' : ,
- '/indexPage/commonListLeft' : ,
- '/indexPage/commonGatte': ,
- '/indexPage/materialRequirementsPlanning' : ,
- '/indexPage/eleteststand' : ,
- '/indexPage/eleemployee' : ,
- '/indexPage/elematerials' : ,
- '/indexPage/eleproduct' : ,
- '/indexPage/syssystemsettings' : ,
- '/indexPage/elesupply' : ,
- '/indexPage/eleprocess' : ,
- '/indexPage/elecheckmodel' : ,
- '/indexPage/sischeckphase' : ,
- '/indexPage/sftlogininfo' : ,
- '/indexPage/siscommonstyle' : ,
- '/indexPage/sisproductclassify' : ,
- '/indexPage/commonCheckBill' : ,
- '/indexPage/workOrderNew' : ,
- '/indexPage/workOrderPack' : ,
- '/indexPage/workOrderPackTableTree' : ,
- '/indexPage/workOrderResearchTableTree' : ,
- '/indexPage/processCard' : ,
- '/indexPage/processCardPack' : ,
- '/indexPage/processCardPackTableTree' : ,
- '/indexPage/processCardPackTableTreeNew' : ,
- '/indexPage/workOrderPackTableTreeNew' : ,
- '/indexPage/productionPlan' : ,
- '/indexPage/commonChar' : ,
- '/indexPage/quotationPackTableTree' : ,
- }
+ "/indexPage/commonList": ,
+ "/indexPage/commonListA": ,
+ "/indexPage/commonNewBill": ,
+ "/indexPage/commonBill": ,
+ "/indexPage/commonListEdit": ,
+ "/indexPage/commonClassify": ,
+ "/indexPage/eleknifemould": ,
+ "/indexPage/elecustomer": ,
+ "/indexPage/commonListTab": ,
+ "/indexPage/commonColumnList": ,
+ "/indexPage/commonListTree": ,
+ "/indexPage/commonListLeft": ,
+ "/indexPage/commonGatte": ,
+ "/indexPage/materialRequirementsPlanning": ,
+ "/indexPage/eleteststand": ,
+ "/indexPage/eleemployee": ,
+ "/indexPage/elematerials": ,
+ "/indexPage/eleproduct": ,
+ "/indexPage/syssystemsettings": ,
+ "/indexPage/elesupply": ,
+ "/indexPage/eleprocess": ,
+ "/indexPage/elecheckmodel": ,
+ "/indexPage/sischeckphase": ,
+ "/indexPage/sftlogininfo": ,
+ "/indexPage/siscommonstyle": ,
+ "/indexPage/sisproductclassify": ,
+ "/indexPage/commonCheckBill": ,
+ "/indexPage/workOrderNew": ,
+ "/indexPage/workOrderPack": ,
+ "/indexPage/workOrderPackTableTree": ,
+ "/indexPage/workOrderResearchTableTree": ,
+ "/indexPage/processCard": ,
+ "/indexPage/processCardPack": ,
+ "/indexPage/processCardPackTableTree": ,
+ "/indexPage/processCardPackTableTreeNew": ,
+ "/indexPage/workOrderPackTableTreeNew": ,
+ "/indexPage/productionPlan": ,
+ "/indexPage/commonChar": ,
+ "/indexPage/quotationPackTableTree": ,
+ "/indexPage/commonAuto": ,
+ "/indexPage/eleteamInfo": ,
+ "/indexPage/sisformulaInfo": ,
+ "/indexPage/elemachineInfo": ,
+ "/indexPage/systemPermission": ,
+ "/indexPage/importData": ,
+ '/indexPage/sispaymentTerms': ,
+ '/indexPage/productionReport': ,
+ '/indexPage/productionMainPlan': ,
+ '/indexPage/productionPlanInfo': ,
+ '/indexPage/productionPlanOutside': ,
+ '/indexPage/productionSchedule': ,
+ '/indexPage/productionScheduleTree': ,
+ '/indexPage/auditInformation':,
+ '/indexPage/mailMsg':,
+ '/indexPage/printlabel':,
+ };
const content = routeList[pane.route] || ;
if (pane.paneType) {
- paneType = {pane.title};
+ paneType = (
+
+
+ {pane.title}
+
+ );
} else {
paneType = {pane.title};
}
return (
-
+
{content}
);
@@ -125,7 +162,7 @@ function Tab({ dispatch, app }) {
if (app.webSocket !== null && app.webSocket.readyState === WebSocket.OPEN) {
sendws(flag, showType, msgInfo, sId, sendTo, param);
} else {
- dispatch({ type: 'app/createWebSocket', payload: { reStart: true, dispatch } });
+ dispatch({ type: "app/createWebSocket", payload: { reStart: true, dispatch } });
setTimeout(() => {
sendws(flag, showType, msgInfo, sId, sendTo, param);
}, 30000);
@@ -140,28 +177,28 @@ function Tab({ dispatch, app }) {
};
function saveCurrentPane(currentPane) {
- dispatch({ type: 'app/saveCurrentPane', payload: { currentPane } });
+ dispatch({ type: "app/saveCurrentPane", payload: { currentPane } });
}
- const clearWebSocketMsg = (i) => {
+ const clearWebSocketMsg = i => {
const { userinfo } = app;
const { copyTo } = i;
if (isNotEmptyObject(copyTo)) {
- const {
- slaveData, srcFormRoute, copyOtherData, masterData, copyToDataSid,
- } = copyTo;
- const sIdArray = [...copyToDataSid || []];
+ const { slaveData, srcFormRoute, copyOtherData, masterData, copyToDataSid } = copyTo;
+ const sIdArray = [...(copyToDataSid || [])];
if (!i?.checkedId) {
- if (isNotEmptyObject(srcFormRoute) && srcFormRoute.includes('materialRequirementsPlanning')) { /* 物料需求计划用sWorkOrderMaterialId作为唯一键 */
- if (isNotEmptyArr(copyOtherData) && copyOtherData[0]?.name === 'detail' && isNotEmptyArr(copyOtherData[0]?.data)) {
+ if (isNotEmptyObject(srcFormRoute) && srcFormRoute.includes("materialRequirementsPlanning")) {
+ /* 物料需求计划用sWorkOrderMaterialId作为唯一键 */
+ if (isNotEmptyArr(copyOtherData) && copyOtherData[0]?.name === "detail" && isNotEmptyArr(copyOtherData[0]?.data)) {
const slaveDetailData = copyOtherData[0].data;
- slaveDetailData.forEach((item) => {
+ slaveDetailData.forEach(item => {
const redisKey = item.sWorkOrderMaterialId;
sIdArray.push(redisKey);
});
- } else { /* 变更单、采购申请单 */
- slaveData.forEach((item) => {
+ } else {
+ /* 变更单、采购申请单 */
+ slaveData.forEach(item => {
const redisKey = item.sWorkOrderMaterialId;
sIdArray.push(redisKey);
});
@@ -169,23 +206,22 @@ function Tab({ dispatch, app }) {
}
}
- if (isNotEmptyObject(masterData) &&
- isNotEmptyObject(masterData.sSrcSlaveId)) {
+ if (isNotEmptyObject(masterData) && isNotEmptyObject(masterData.sSrcSlaveId)) {
sIdArray.push(masterData.sSrcSlaveId);
}
if (Array.isArray(slaveData)) {
- slaveData.forEach((item) => {
+ slaveData.forEach(item => {
const redisKey = item.sSlaveId;
sIdArray.push(redisKey);
});
}
const sId = [...new Set(sIdArray)].filter(Boolean).toString();
- handleSendSocketMessage('copyfinish', 'noAction', sId, userinfo.sId, null, null);
+ handleSendSocketMessage("copyfinish", "noAction", sId, userinfo.sId, null, null);
}
- handleSendSocketMessage('release', 'noAction', i?.checkedId || '', userinfo.sId, null, null);
- handleSendSocketMessage('release', 'noAction', i?.formId || '', userinfo.sId, null, null);
+ handleSendSocketMessage("release", "noAction", i?.checkedId || "", userinfo.sId, null, null);
+ handleSendSocketMessage("release", "noAction", i?.formId || "", userinfo.sId, null, null);
};
function removePane(changePanes, currentPane, removePane) {
@@ -197,39 +233,38 @@ function Tab({ dispatch, app }) {
}
}
if (removePane && removePane[0]) {
- const isProductionScheduleTree = removePane[0].route.indexOf('systemPermission') > -1 ||
- (removePane[0].route.indexOf('production') > -1);
+ const isProductionScheduleTree = removePane[0].route.indexOf("systemPermission") > -1 || removePane[0].route.indexOf("production") > -1;
if (isProductionScheduleTree) {
- removeData.forEach((i) => {
+ removeData.forEach(i => {
clearWebSocketMsg(i);
});
- dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ dispatch({ type: "app/removePane", payload: { changePanes, currentPane } });
return;
}
}
if (app.diffMap && removePane[0] && app.diffMap.get(removePane[0].key)) {
confirm({
icon: ,
- content: '内容未保存,是否离开?',
+ content: "内容未保存,是否离开?",
onOk() {
- removeData.forEach((i) => {
+ removeData.forEach(i => {
clearWebSocketMsg(i);
});
- dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ dispatch({ type: "app/removePane", payload: { changePanes, currentPane } });
},
onCancel() {
- console.log('取消关闭');
+ console.log("取消关闭");
},
});
} else {
- removeData.forEach((i) => {
+ removeData.forEach(i => {
clearWebSocketMsg(i);
});
- dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
+ dispatch({ type: "app/removePane", payload: { changePanes, currentPane } });
}
}
return (
-