From 7bc4b753ec25150e5e70f74023fa73bcc65a48c1 Mon Sep 17 00:00:00 2001 From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com> Date: Wed, 17 Dec 2025 16:35:18 +0800 Subject: [PATCH] 放大镜弹窗 --- src/components/Common/CommonBillEvent.js | 1257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/components/Common/CommonComponent/index.js | 10 +++------- src/components/Common/CommonHooks/useCommonBase.js | 313 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------ src/components/Common/CommonSubBillEvent.js | 2 +- src/components/Common/CommonTable/index.js | 1660 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/components/Common/commonBusiness.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- src/mes/common/commonModalComponent/index.js | 2 +- src/mes/indexMes/index.js | 4 ++-- 8 files changed, 2223 insertions(+), 1080 deletions(-) diff --git a/src/components/Common/CommonBillEvent.js b/src/components/Common/CommonBillEvent.js index 1e8d9cc..af313df 100644 --- a/src/components/Common/CommonBillEvent.js +++ b/src/components/Common/CommonBillEvent.js @@ -76,7 +76,7 @@ export default (ChildComponent) => { const masterConfig = formData.filter(item => !item.bGrd)[0]; const BtnDesignFunctionConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnBsOperation.BtnDesignFunction') : {}; const reportDesign = commonFunc.showMessage(app.commonConst, 'reportDesign');/* 报表设计 */ - const sReasonTitle = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sReason'))? + const sReasonTitle = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sReason')) ? commonFunc.showMessage(app.commonConst, 'sReason') : '报错原因';/* 导入报错原因 */ if (commonUtils.isEmptyObject(BtnDesignFunctionConfig)) { masterConfig.gdsconfigformslave.push({ @@ -148,11 +148,11 @@ export default (ChildComponent) => { /* 导入错误配置 */ let importConfig = {}; - let importFilterData = formData.filter(item => item.bReportData && item.sGrd === 'importTemplate'); - if(commonUtils.isNotEmptyArr(importFilterData)) { + let importFilterData = formData.filter(item => item.bReportData && item.sGrd === 'importTemplate'); + if (commonUtils.isNotEmptyArr(importFilterData)) { importConfig = formData.filter(item => item.bReportData && item.sGrd === 'importTemplate')[0]; const iIndex = importConfig.gdsconfigformslave.findIndex(item => item.sName === 'sReason'); - if(iIndex === -1) { + if (iIndex === -1) { importConfig.gdsconfigformslave.push({ bCanInput: false, bEntireLine: false, @@ -282,9 +282,9 @@ export default (ChildComponent) => { packColumn, }; } else if (sModelsType === 'purchase/purchaseOrder') { - let orderDetailConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.sTbName.toUpperCase() === 'purpurchaseorderDetail'.toUpperCase())) ? + let orderDetailConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.sTbName.toUpperCase() === 'purpurchaseorderDetail'.toUpperCase())) ? formData.filter(item => item.sTbName.toUpperCase() === 'purpurchaseorderDetail'.toUpperCase())[0] : {}; - if(commonUtils.isNotEmptyObject(orderDetailConfig)) { + if (commonUtils.isNotEmptyObject(orderDetailConfig)) { const orderDetailColumn = commonFunc.getHeaderConfig(orderDetailConfig); config.orderDetailConfig = orderDetailConfig; this.handleGetOneMemoData('orderDetail', orderDetailConfig); @@ -293,14 +293,14 @@ export default (ChildComponent) => { orderDetailColumn, }; } - }else if (sModelsType === 'purchase/purchasecheck') { + } else if (sModelsType === 'purchase/purchasecheck') { let orderDetailConfig = {}; - let orderDetailColumn = []; + let orderDetailColumn = []; const filterData = formData.filter(item => item.sTbName.toUpperCase() === 'purpurchasecheckingDetail'.toUpperCase()); - if(commonUtils.isNotEmptyArr(filterData)) { - orderDetailConfig = filterData[0]; + if (commonUtils.isNotEmptyArr(filterData)) { + orderDetailConfig = filterData[0]; } - if(commonUtils.isNotEmptyObject(orderDetailConfig)) { + if (commonUtils.isNotEmptyObject(orderDetailConfig)) { orderDetailColumn = commonFunc.getHeaderConfig(orderDetailConfig); config.orderDetailConfig = orderDetailConfig; this.handleGetOneMemoData('orderDetail', orderDetailConfig); @@ -311,12 +311,12 @@ export default (ChildComponent) => { } } else if (sModelsType === 'purchase/purchaseApply') { let orderDetailConfig = {}; - let orderDetailColumn = []; + let orderDetailColumn = []; const filterData = formData.filter(item => item.sTbName.toUpperCase().indexOf('DETAIL') !== -1); - if(commonUtils.isNotEmptyArr(filterData)) { - orderDetailConfig = filterData[0]; + if (commonUtils.isNotEmptyArr(filterData)) { + orderDetailConfig = filterData[0]; } - if(commonUtils.isNotEmptyObject(orderDetailConfig)) { + if (commonUtils.isNotEmptyObject(orderDetailConfig)) { orderDetailColumn = commonFunc.getHeaderConfig(orderDetailConfig); config.orderDetailConfig = orderDetailConfig; this.handleGetOneMemoData('orderDetail', orderDetailConfig); @@ -389,14 +389,14 @@ export default (ChildComponent) => { orderDetailConfig, orderDetailColumn, }); - }else if (sModelsType === 'purchase/purchasecheck') { + } else if (sModelsType === 'purchase/purchasecheck') { let orderDetailConfig = {}; - let orderDetailColumn = []; + let orderDetailColumn = []; const filterData = formData.filter(item => item.sTbName.toUpperCase() === 'purpurchasecheckingDetail'.toUpperCase()); - if(commonUtils.isNotEmptyArr(filterData)) { - orderDetailConfig = filterData[0]; + if (commonUtils.isNotEmptyArr(filterData)) { + orderDetailConfig = filterData[0]; } - if(commonUtils.isNotEmptyObject(orderDetailConfig)) { + if (commonUtils.isNotEmptyObject(orderDetailConfig)) { const orderDetailColumn = commonFunc.getHeaderConfig(orderDetailConfig); this.handleGetOneMemoData('orderDetail', orderDetailConfig); this.props.onSaveState({ @@ -493,7 +493,7 @@ export default (ChildComponent) => { slaveInfoList.push(item.showName); }); if (slaveInfoList.length) { - addState = {...addState, ...await this.handleGetDataOne('slave0', addState.slave0Config, null, null, null, null, nextProps, true)}; + addState = { ...addState, ...await this.handleGetDataOne('slave0', addState.slave0Config, null, null, null, null, nextProps, true) }; } this.props.onSaveState({ slaveInfoList, @@ -620,7 +620,7 @@ export default (ChildComponent) => { } } }; - handlePackDataAdd= (item, index, sControlId) => { + handlePackDataAdd = (item, index, sControlId) => { const tableDataRow = {}; tableDataRow.sId = commonUtils.createSid(); tableDataRow.handleType = 'add'; @@ -756,7 +756,7 @@ export default (ChildComponent) => { } }; /** 获取部件树 */ - handleGetControlTreeDataBak= (controlDataOld, isWait, sSlaveId) => { + handleGetControlTreeDataBak = (controlDataOld, isWait, sSlaveId) => { /* 生成部件树结构 */ let treeData = []; const expandedKeys = []; @@ -863,7 +863,7 @@ export default (ChildComponent) => { }; /** 获取子节点数据 */ - handleGetControlTreeChildData= (sParentId, controlData) => { + handleGetControlTreeChildData = (sParentId, controlData) => { if (commonUtils.isNotEmptyObject(sParentId) && commonUtils.isNotEmptyArr(controlData)) { const childTree = commonUtils.isNotEmptyArr(controlData) ? controlData.filter(item => item.sControlParentId === sParentId) : []; const children = []; @@ -896,17 +896,17 @@ export default (ChildComponent) => { }; handleGetTableConfig = async (name, sModelsId, oldConfig, configName) => { - if(commonUtils.isNotEmptyObject(sModelsId)) { + if (commonUtils.isNotEmptyObject(sModelsId)) { const newConfig = await this.props.onGetTableConfig(name, sModelsId, oldConfig); - if(commonUtils.isNotEmptyObject(newConfig)) { + if (commonUtils.isNotEmptyObject(newConfig)) { const newColumn = commonFunc.getHeaderConfig(newConfig); - this.props.onSaveState({[`${[configName || name]}Config`]: newConfig, [`${[configName || name]}Column`]: newColumn }) + this.props.onSaveState({ [`${[configName || name]}Config`]: newConfig, [`${[configName || name]}Column`]: newColumn }) } } } /** 根据key查找树节点并改变属性 */ - handleSearchNodes= (key, data, showNameNew) => { + handleSearchNodes = (key, data, showNameNew) => { if (commonUtils.isNotEmptyObject(showNameNew)) { data.forEach((item) => { if (item.key === key) { @@ -1114,7 +1114,7 @@ export default (ChildComponent) => { } if (sModelsType === 'purchase/purchaseInstore') { let iIndex = app.systemData.findIndex(item => item.sName === 'CbxMaterialsDefine'); - if(commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed) ){ + if (commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed)) { console.log('红冲', masterData); iIndex = -1; } @@ -1138,7 +1138,7 @@ export default (ChildComponent) => { } } else if (sModelsType === 'productStock/productInStore' || sModelsType === 'outside/outsideinstoreAll') { /* 成品入库、整单发外入库 */ let iIndex = app.systemData.findIndex(item => item.sName === 'CbxProductDefine'); - if(commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed) ){ + if (commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed)) { console.log('红111冲', masterData); iIndex = -1; } @@ -1187,8 +1187,8 @@ export default (ChildComponent) => { } /* 通用报价单:101251240115016244276286330 */ const dataUrl = slaveItem.sFormId === '19211681019715780306452560' || slaveItem.sFormId === '101251240115016076506222050' - || slaveItem.sFormId === '101251240115016036175782700' || slaveItem.sFormId === '101251240115016002356125200' || slaveItem.sFormId === '101251240115016244276286330' || - slaveItem.sFormId === '101251240115016197744514350' ? + || slaveItem.sFormId === '101251240115016036175782700' || slaveItem.sFormId === '101251240115016002356125200' || slaveItem.sFormId === '101251240115016244276286330' || + slaveItem.sFormId === '101251240115016197744514350' ? `${commonConfig.server_host}salesorder/getQuotationPartsInfo?sModelsId=${sModelsId}` : `${commonConfig.server_host}salesorder/getPartsInfo?sModelsId=${sModelsId}`; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; @@ -1385,7 +1385,7 @@ export default (ChildComponent) => { const copyToPackConfig = copyTo.config.filter(item => item.sControlName.toLowerCase() === `${copyTo.name}.pack`.toLowerCase()); const packAssignField = commonUtils.isNotEmptyArr(copyToPackConfig) ? copyToPackConfig[0].sAssignField : ''; if (commonUtils.isNotEmptyObject(packAssignField)) { - /* 复制到时增加合版表 */ + /* 复制到时增加合版表 */ if (commonUtils.isNotEmptyArr(copyTo.packData)) { await copyTo.packData.filter(item => item.sControlId === controlItem.sId).forEach(async (packItem) => { newCopyTo.pack = packItem; @@ -1632,10 +1632,10 @@ export default (ChildComponent) => { } } } - if(location.pathname && location.pathname.includes('commonOeeBill')) { - if(commonUtils.isNotEmptyObject(app) && app.currentPane && app.currentPane.copyTo){ - const masterCopyToData = app.currentPane.copyTo.masterData; - if(commonUtils.isNotEmptyObject(masterCopyToData)) { + if (location.pathname && location.pathname.includes('commonOeeBill')) { + if (commonUtils.isNotEmptyObject(app) && app.currentPane && app.currentPane.copyTo) { + const masterCopyToData = app.currentPane.copyTo.masterData; + if (commonUtils.isNotEmptyObject(masterCopyToData)) { tableDataRow.sReportPanel = masterCopyToData.sReportPanel; tableDataRow.sReportParam = masterCopyToData.sReportParam; tableDataRow.sProcessParam = masterCopyToData.sProcessParam; @@ -1645,7 +1645,7 @@ export default (ChildComponent) => { } } - slaveData.push(tableDataRow); + slaveData.push(tableDataRow); }); } } @@ -1656,7 +1656,7 @@ export default (ChildComponent) => { if (detailAssignField !== '') { const copyDetail = copyTo.copyOtherData.filter(item => item.name === 'detail')[0]; const detail = copyDetail.data; - if(commonUtils.isNotEmptyArr(detail)) { + if (commonUtils.isNotEmptyArr(detail)) { detail.forEach((detailItem) => { const newCopyTo = {}; newCopyTo.master = copyTo.masterData; @@ -1691,7 +1691,7 @@ export default (ChildComponent) => { /* 新增时生成采购批号 */ if (sModelsType === 'purchase/purchaseInstore') { let iIndex = app.systemData.findIndex(item => item.sName === 'CbxMaterialsDefine'); - if(commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed) ){ + if (commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed)) { console.log('红冲', masterData); iIndex = -1; } @@ -1715,7 +1715,7 @@ export default (ChildComponent) => { } } else if (sModelsType === 'productStock/productInStore' || sModelsType === 'outside/outsideinstoreAll') { /* 成品入库、整单发外入库 */ let iIndex = app.systemData.findIndex(item => item.sName === 'CbxProductDefine'); - if(commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed) ){ + if (commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed)) { console.log('红冲', masterData); iIndex = -1; } @@ -1884,7 +1884,7 @@ export default (ChildComponent) => { dispatch({ type: 'app/throwError', payload: { code: -2, msg: rtmsg.msg } }); } } else if (rtmsg.action === 'update') { - await this.handleGetData(masterConfig, slaveConfig, checkConfig,'update'); + await this.handleGetData(masterConfig, slaveConfig, checkConfig, 'update'); if (cb && typeof cb === 'function') { this.props.onSaveState({ enabled: false, calculated: false }, () => { cb(); }); } else { @@ -2169,7 +2169,7 @@ export default (ChildComponent) => { if (iIndex > -1) { bCheck = true; } - if(bCheck) { + if (bCheck) { message.error(commonFunc.showMessage(app.commonConst, 'slaveNotNull')); // 从表不能为空! this.props.onSaveState({ loading: false, @@ -2677,7 +2677,7 @@ export default (ChildComponent) => { } const sId = sIdArray.toString(); onSendSocketMessage('copyfinish', 'noAction', sId, userinfo.sId, null, null); - } else if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSrcSlaveId)) { + } else if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSrcSlaveId)) { const sIdArray = []; /* 处理只有单主表解锁问题 */ sIdArray.push(masterData.sSrcSlaveId); @@ -3746,8 +3746,8 @@ export default (ChildComponent) => { tableDataRow.dProductTaxMoney = dProductTaxMoney; /* 税额 */ tableDataRow.dProductTaxForeignMoney = dProductTaxForeignMoney; /* 外币税额 */ /* 报损金额改变后 反算单价 */ - tableDataRow.dProductForeignPrice = tableDataRow.dProductQty !==0 ? commonUtils.convertFixNum( dProductForeignMoney/tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ - tableDataRow.dProductPrice = tableDataRow.dProductQty !==0 ? commonUtils.convertFixNum( dProductMoney/tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ + tableDataRow.dProductForeignPrice = tableDataRow.dProductQty !== 0 ? commonUtils.convertFixNum(dProductForeignMoney / tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ + tableDataRow.dProductPrice = tableDataRow.dProductQty !== 0 ? commonUtils.convertFixNum(dProductMoney / tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ } else if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isEmptyNumber(tableDataRow.dLossMoney)) { const dProductForeignMoney = commonUtils.isNull(tableDataRow.dSrcNoCheckMoney, 0); const dProductMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dProductForeignMoney * dCurrencyRate : 0, dPmoney); /* 本位币金额 */ @@ -3763,7 +3763,7 @@ export default (ChildComponent) => { tableDataRow.dProductTaxMoney = dProductTaxMoney; /* 税额 */ tableDataRow.dProductTaxForeignMoney = dProductTaxForeignMoney; /* 外币税额 */ } - } else if (sModelsType && (sModelsType === 'purchase/purchasecheck' || sModelsType.includes('outside/outsideChecking') ) && sFieldName === 'dLossMoney' && name === 'slave') { + } else if (sModelsType && (sModelsType === 'purchase/purchasecheck' || sModelsType.includes('outside/outsideChecking')) && sFieldName === 'dLossMoney' && name === 'slave') { const dPmoney = this.props.getFloatNum('dMaterialsMoney'); const { dNetPrice } = app.decimals; const dTaxRate = commonUtils.convertToNum(tableDataRow.dTaxRate); /* 税率 */ @@ -3779,7 +3779,7 @@ export default (ChildComponent) => { tableDataRow[`d${type}NoTaxPrice`] = dProductNoTaxPrice; /* 不含税价 */ tableDataRow[`d${type}TaxMoney`] = dProductTaxMoney; /* 税额 */ /* 报损金额改变后 反算单价 */ - tableDataRow[`d${type}Price`] = dProductQty !==0 ? commonUtils.convertFixNum( dMoney/dProductQty, dNetPrice) : 0; /* 外币税额 */ + tableDataRow[`d${type}Price`] = dProductQty !== 0 ? commonUtils.convertFixNum(dMoney / dProductQty, dNetPrice) : 0; /* 外币税额 */ } else if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isEmptyNumber(tableDataRow.dLossMoney)) { tableDataRow.dMaterialsMoney = commonUtils.isNull(tableDataRow.dSrcNoCheckMoney, 0); tableDataRow.dLossMoney = 0; @@ -3900,11 +3900,11 @@ export default (ChildComponent) => { if (this.inputChange) { clearTimeout(this.inputChange); } - this.inputChange = setTimeout(async() => { + this.inputChange = setTimeout(async () => { // /* 调用父组件的回带函数 */ tableDataRow = await this.handleMaterialsChangeWait(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models); }, 10); - return tableDataRow; + return tableDataRow; } handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => { @@ -3968,15 +3968,15 @@ export default (ChildComponent) => { }); } } else if (sFieldName === 'dAuxiliaryLossQty') { - const tableDataRowNew ={ ...tableDataRow ,dAuxiliaryQty:tableDataRow.dAuxiliaryLossQty }; + const tableDataRowNew = { ...tableDataRow, dAuxiliaryQty: tableDataRow.dAuxiliaryLossQty }; if (commonUtils.isEmpty(sComputeId)) { // tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, sFieldName, 'dLossQty'); tableDataRow.dLossQty = await commonBusiness.getFormulaValue({ - token, sModelsId, masterData, tableDataRow:tableDataRowNew, sComputeId, sFormulaIdType, + token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId, sFormulaIdType, }); } else { tableDataRow.dLossQty = await commonBusiness.getFormulaValue({ - token, sModelsId, masterData, tableDataRow:tableDataRowNew, sComputeId, + token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId, }); } if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) { @@ -3985,15 +3985,15 @@ export default (ChildComponent) => { } } else if (sFieldName === 'dLossQty') { const { sReComputeId } = tableDataRow; - const tableDataRowNew ={ ...tableDataRow ,dMaterialsQty:tableDataRow.dLossQty }; + const tableDataRowNew = { ...tableDataRow, dMaterialsQty: tableDataRow.dLossQty }; if (commonUtils.isEmpty(sReComputeId) && tableDataRow.bInverse) { // tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, 'dAuxiliaryLossQty'); tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({ - token, sModelsId, masterData, tableDataRow:tableDataRowNew, sReComputeId, sFormulaIdType, + token, sModelsId, masterData, tableDataRow: tableDataRowNew, sReComputeId, sFormulaIdType, }); } else { tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({ - token, sModelsId, masterData, tableDataRow:tableDataRowNew, sComputeId: sReComputeId, + token, sModelsId, masterData, tableDataRow: tableDataRowNew, sComputeId: sReComputeId, }); } if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) { @@ -4275,7 +4275,7 @@ export default (ChildComponent) => { const slaveDelData = commonUtils.isEmptyArr(slaveDelDataOld) ? [] : slaveDelDataOld; if (dataReturn.code === 1) { const returnSlaveData = dataReturn.dataset.rows; - if(commonUtils.isNotEmptyArr(slaveData)) { + if (commonUtils.isNotEmptyArr(slaveData)) { slaveData.forEach((item) => { item.handleType = 'del'; slaveDelData.push(item); @@ -4342,7 +4342,7 @@ export default (ChildComponent) => { } const dataReturn = (await commonServices.postValueService(app.token, body, url)).data; if (dataReturn.code === 1) { - /* 获取数据集 */ + /* 获取数据集 */ const { rows } = dataReturn.dataset; const slaveDataNew = []; rows.forEach((row) => { @@ -4401,7 +4401,7 @@ export default (ChildComponent) => { }; const dataReturn = (await commonServices.postValueService(app.token, body, url)).data; if (dataReturn.code === 1) { - /* 获取数据集 */ + /* 获取数据集 */ const { rows } = dataReturn.dataset; const slaveDataNew = []; rows.forEach((row) => { @@ -4450,7 +4450,7 @@ export default (ChildComponent) => { return returnData; } } - handleBtnPrint =async (sActiveId, checked, eKey) => { + handleBtnPrint = async (sActiveId, checked, eKey) => { const { app, sModelsId, masterConfig, masterData, slaveConfig, sModelsType, reportData, menuChildData, formRoute, controlConfig, } = this.props; @@ -4529,7 +4529,7 @@ export default (ChildComponent) => { window.open(`${encodeURI(`${urlPrint}&queryFilter=${queryFilterJson}`)}&token=${encodeURIComponent(token)}`); } }; - handleOpenPost= (url, params) => { + handleOpenPost = (url, params) => { const newWin = window.open(); let formStr = ''; formStr = `
` + @@ -4565,7 +4565,7 @@ export default (ChildComponent) => { handleTitleChange1 = (name, slavePagination, filters, sorter) => { this.props.onSaveState({ [`${name}Pagination`]: slavePagination }); const { - slaveConfig, slaveFilterCondition, sGroupByList,[`${name}Config`] : tableConfig, [`${name}FilterCondition`]: tableFilterCondition, + slaveConfig, slaveFilterCondition, sGroupByList, [`${name}Config`]: tableConfig, [`${name}FilterCondition`]: tableFilterCondition, } = this.props; let bGetData = true; if (commonUtils.isNotEmptyObject(filters)) { @@ -4591,7 +4591,7 @@ export default (ChildComponent) => { }; /* 工单、工艺卡、报价单控制表回带图片地址 */ - handleFilfileManageOk= async (controlFilfileData, controlFilfileDelData, sSrcSlaveId) => { + handleFilfileManageOk = async (controlFilfileData, controlFilfileDelData, sSrcSlaveId) => { const { controlData: tableData, app, sModelsId, token, controlConfig, } = this.props; @@ -4742,7 +4742,7 @@ export default (ChildComponent) => { child.dTotalMoney = 0; child.handleType = commonUtils.isEmpty(child.handleType) ? 'update' : child.handleType; child.dRoundingMoney = commonUtils.isNum(child.dRoundingMoney) ? child.dRoundingMoney : 0; - child.dBalanceMoney = commonUtils.convertFixNum(child.dBalanceMoney, dNetMoney); /* 根据系统设定位数格式未付款金额*/ + child.dBalanceMoney = commonUtils.convertFixNum(child.dBalanceMoney, dNetMoney); /* 根据系统设定位数格式未付款金额*/ if (child.dBalanceMoney < 0) { minusSum -= Math.abs(child.dBalanceMoney); minusRoundingSum -= Math.abs(child.dRoundingMoney); @@ -5018,40 +5018,40 @@ export default (ChildComponent) => { this.handleOutTemplate(); } else if (name === 'BtnOutTemplateData') { /* 导出模版数据 */ this.handleOutTemplateData(); - }else if (name === 'BtnShowAll') { /* 显示全部部件 */ + } else if (name === 'BtnShowAll') { /* 显示全部部件 */ this.handleTableCancelSelect('slave'); } else if (name === 'BtnShowControl') { /* 显示部件层级 */ - const { controlData } = this.props; - const expandedRowKeys =[]; - if(commonUtils.isNotEmptyArr(controlData)) { /* 当显示全部时 展开所有部件层级 */ + const { controlData } = this.props; + const expandedRowKeys = []; + if (commonUtils.isNotEmptyArr(controlData)) { /* 当显示全部时 展开所有部件层级 */ controlData.forEach((item) => { const { sId } = item; expandedRowKeys.push(sId); }); } - this.props.onSaveState({ showAllTreeVisible: true, controlShowExpandedRowKeys: { expandedRowKeys: expandedRowKeys } }); + this.props.onSaveState({ showAllTreeVisible: true, controlShowExpandedRowKeys: { expandedRowKeys: expandedRowKeys } }); } else if (name === 'BtnRefresh') { if (this.props.app.currentPane.refresh !== undefined) { this.props.app.currentPane.refresh(); } const { masterConfig, slaveConfig, checkConfig } = this.props; this.handleGetData(masterConfig, slaveConfig, checkConfig); - } else if(name && name.includes('BtnTempSql')) { /* 通过BtnTempSql按钮 自定义调用Sql 并将数据回填到界面上 */ + } else if (name && name.includes('BtnTempSql')) { /* 通过BtnTempSql按钮 自定义调用Sql 并将数据回填到界面上 */ const { masterConfig, slaveConfig, sModelsId, token } = this.props; - let { masterData,slaveData } = this.props; + let { masterData, slaveData } = this.props; const slave0Data = []; const slave1Data = []; const slave2Data = []; const slave3Data = []; const slave4Data = []; - const copyTo ={}; + const copyTo = {}; copyTo.name = name; copyTo.slaveData = slaveData; - const buttonConfigArr = masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName && item.sControlName.includes('BtnTempSql')); + const buttonConfigArr = masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName && item.sControlName.includes('BtnTempSql')); const allConfig = { slaveConfig, masterConfig, }; - if(commonUtils.isNotEmptyArr(buttonConfigArr)) { + if (commonUtils.isNotEmptyArr(buttonConfigArr)) { copyTo.config = buttonConfigArr; const sTmpInfoConfig = buttonConfigArr.filter(item => item.sControlName && item.sControlName.includes('BtnTempSql'))[0]; const sControlName = sTmpInfoConfig.sControlName; @@ -5162,7 +5162,7 @@ export default (ChildComponent) => { slave4Data.push(slave4Row); }); } - this.props.onSaveState({ slaveData, slave1Data, slave2Data, slave3Data, slave4Data}); + this.props.onSaveState({ slaveData, slave1Data, slave2Data, slave3Data, slave4Data }); } else { this.props.getServiceError(dataReturn); } @@ -5170,20 +5170,20 @@ export default (ChildComponent) => { } else { message.error('请正确配置自定义按钮!'); } - }else if (name && name.includes('BtnCalc')) { /* 实现通用计算功能 */ + } else if (name && name.includes('BtnCalc')) { /* 实现通用计算功能 */ const { masterConfig, masterData, sModelsId, } = this.props; const btnConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => (item.sControlName === name))) ? masterConfig.gdsconfigformslave.filter(item => (item.sControlName === name))[0] : {};// sButtonEnabled sButtonParam - if(commonUtils.isNotEmptyObject(btnConfig)) { + if (commonUtils.isNotEmptyObject(btnConfig)) { /* 组装allTableData */ - const allTableMap ={}; - const allReturnMap ={}; - const slaveNameList = []; + const allTableMap = {}; + const allReturnMap = {}; + const slaveNameList = []; /* 从props找到 所有的Config */ - if(commonUtils.isNotEmptyArr(this.props)) { + if (commonUtils.isNotEmptyArr(this.props)) { for (const key of Object.keys(this.props)) { - if(key.includes('Config') && !key.includes('onGet') && !key.includes('report')) { - const tablename = key.replace('Config', '').trim(); + if (key.includes('Config') && !key.includes('onGet') && !key.includes('report')) { + const tablename = key.replace('Config', '').trim(); slaveNameList.push(tablename); } } @@ -5191,13 +5191,13 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyArr(slaveNameList)) { slaveNameList.forEach((name, index) => { - const tableConfig = this.props[name +'Config']; /* 动态配置 */ - const tableData = this.props[name +'Data']; /* 动态配置 */ - const tableSelectedRowKeys = this.props[name + 'SelectedRowKeys']; /* 选中Key */ - allTableMap[name +'.'+ tableConfig.sTbName] = tableData + const tableConfig = this.props[name + 'Config']; /* 动态配置 */ + const tableData = this.props[name + 'Data']; /* 动态配置 */ + const tableSelectedRowKeys = this.props[name + 'SelectedRowKeys']; /* 选中Key */ + allTableMap[name + '.' + tableConfig.sTbName] = tableData }) const masterTbName = masterConfig.sTbName; - allTableMap['master.'+ masterTbName] = masterData; + allTableMap['master.' + masterTbName] = masterData; } const sButtonParam = btnConfig.sButtonParam; const btn = JSON.parse(sButtonParam); @@ -5215,16 +5215,16 @@ export default (ChildComponent) => { const returnData = dataReturn.dataset.rows[0]; if (commonUtils.isNotEmptyArr(slaveNameList) && commonUtils.isNotEmptyObject(returnData)) { slaveNameList.forEach((name, index) => { - const tableConfig = this.props[name +'Config']; /* 动态配置 */ + const tableConfig = this.props[name + 'Config']; /* 动态配置 */ let tableData = []; - if(commonUtils.isNotEmptyObject(tableConfig)) { - console.log('666', name +'.'+ tableConfig.sTbName); - tableData = returnData[name +'.'+ tableConfig.sTbName]; /* 动态配置 */ + if (commonUtils.isNotEmptyObject(tableConfig)) { + console.log('666', name + '.' + tableConfig.sTbName); + tableData = returnData[name + '.' + tableConfig.sTbName]; /* 动态配置 */ } - allReturnMap[name +'Data'] = tableData; + allReturnMap[name + 'Data'] = tableData; }); const masterTbName = masterConfig.sTbName; - allReturnMap.master = returnData['master.'+ masterTbName]; + allReturnMap.master = returnData['master.' + masterTbName]; } this.props.onSaveState({ ...allReturnMap }); } else { /* 失败 */ @@ -5466,11 +5466,11 @@ export default (ChildComponent) => { } /* 取消表格行选中 */ - handleTableCancelSelect= (name) => { + handleTableCancelSelect = (name) => { const { [`${name}SelectedRowKeys`]: tableSelectedRowKeys } = this.props; if (name === 'slave' && commonUtils.isNotEmptyArr(tableSelectedRowKeys)) { this.props.onSaveState({ - [`${name}SelectedRowKeys`]: [], controlSelectedRowKeys :[], + [`${name}SelectedRowKeys`]: [], controlSelectedRowKeys: [], }); } } @@ -5556,7 +5556,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyObject(slaveSelectOneData)) { paramType = slaveSelectOneData.sProcessParam; } - if(commonUtils.isEmpty(paramType)) { + if (commonUtils.isEmpty(paramType)) { message.warn('无报价参数!'); return; } @@ -5619,29 +5619,29 @@ export default (ChildComponent) => { } } /* 将sParam1中的数据 还原到sParamData数据中 */ - if(commonUtils.isNotEmptyObject(record.sQuoParams)) { + if (commonUtils.isNotEmptyObject(record.sQuoParams)) { const selectedData = JSON.parse(record.sQuoParams); - if(commonUtils.isNotEmptyArr(selectedData)) { + if (commonUtils.isNotEmptyArr(selectedData)) { selectedData.forEach((itemS) => { const iIndex = sParamData.findIndex(item => item.sParamName === itemS.sParamName); - if(iIndex > -1) { - const addState ={}; + if (iIndex > -1) { + const addState = {}; addState.sParamValue = itemS.sParamValue; addState.bSelfCbx = itemS.bSelfCbx; - sParamData[iIndex] ={...sParamData[iIndex], ...addState}; + sParamData[iIndex] = { ...sParamData[iIndex], ...addState }; } }); } /* 如果数据集有一个是非选中的则非选中状态 否则全选 */ - if(commonUtils.isNotEmptyArr(sParamColumn)) { - const iIndex = sParamColumn.findIndex(item => item.dataIndex ==='bSelfCbx'); - if(iIndex > -1) { + if (commonUtils.isNotEmptyArr(sParamColumn)) { + const iIndex = sParamColumn.findIndex(item => item.dataIndex === 'bSelfCbx'); + if (iIndex > -1) { const filterData = sParamData.filter(item => !item.bSelfCbx); - if(commonUtils.isNotEmptyArr(filterData)) { - sParamColumn[iIndex] ={ ...sParamColumn[iIndex], bCheckAll:false}; - }else { - sParamColumn[iIndex] ={ ...sParamColumn[iIndex], bCheckAll:true}; + if (commonUtils.isNotEmptyArr(filterData)) { + sParamColumn[iIndex] = { ...sParamColumn[iIndex], bCheckAll: false }; + } else { + sParamColumn[iIndex] = { ...sParamColumn[iIndex], bCheckAll: true }; } } } @@ -5654,7 +5654,7 @@ export default (ChildComponent) => { sParamConfig, sParamColumn, sParamData, - sParamModalType:'sQuo' + sParamModalType: 'sQuo' }); } else if (name === 'process' && sName === 'sParams') { // process sProcessParam const { processConfig, enabled, sModelsType } = this.props; @@ -5666,7 +5666,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyObject(slaveSelectOneData)) { paramType = slaveSelectOneData.sWorkOrderParam; } - if(commonUtils.isEmpty(paramType)) { + if (commonUtils.isEmpty(paramType)) { message.warn('无工艺参数!'); return; } @@ -5729,29 +5729,29 @@ export default (ChildComponent) => { } } /* 将sParam1中的数据 还原到sParamData数据中 */ - if(commonUtils.isNotEmptyObject(record.sParams)) { + if (commonUtils.isNotEmptyObject(record.sParams)) { const selectedData = JSON.parse(record.sParams); - if(commonUtils.isNotEmptyArr(selectedData)) { + if (commonUtils.isNotEmptyArr(selectedData)) { selectedData.forEach((itemS) => { const iIndex = sParamData.findIndex(item => item.sParamName === itemS.sParamName); - if(iIndex > -1) { - const addState ={}; + if (iIndex > -1) { + const addState = {}; addState.sParamValue = itemS.sParamValue; addState.bSelfCbx = itemS.bSelfCbx; - sParamData[iIndex] ={...sParamData[iIndex], ...addState}; + sParamData[iIndex] = { ...sParamData[iIndex], ...addState }; } }); } /* 如果数据集有一个是非选中的则非选中状态 否则全选 */ - if(commonUtils.isNotEmptyArr(sParamColumn)) { - const iIndex = sParamColumn.findIndex(item => item.dataIndex ==='bSelfCbx'); - if(iIndex > -1) { + if (commonUtils.isNotEmptyArr(sParamColumn)) { + const iIndex = sParamColumn.findIndex(item => item.dataIndex === 'bSelfCbx'); + if (iIndex > -1) { const filterData = sParamData.filter(item => !item.bSelfCbx); - if(commonUtils.isNotEmptyArr(filterData)) { - sParamColumn[iIndex] ={ ...sParamColumn[iIndex], bCheckAll:false}; - }else { - sParamColumn[iIndex] ={ ...sParamColumn[iIndex], bCheckAll:true}; + if (commonUtils.isNotEmptyArr(filterData)) { + sParamColumn[iIndex] = { ...sParamColumn[iIndex], bCheckAll: false }; + } else { + sParamColumn[iIndex] = { ...sParamColumn[iIndex], bCheckAll: true }; } } } @@ -5764,23 +5764,23 @@ export default (ChildComponent) => { sParamConfig, sParamColumn, sParamData, - sParamModalType:'sWork', + sParamModalType: 'sWork', enabled, }); - }else if ( name === 'control' && sName === 'dSinglePQty') { /* 控制表 查看开版图 */ + } else if (name === 'control' && sName === 'dSinglePQty') { /* 控制表 查看开版图 */ this.props.onSaveState({ showSinglePQtyPictureVisible: true, /* 弹出查看开版图Modal*/ }); } else { - if(sName === 'myTableConfig') { + if (sName === 'myTableConfig') { this.handleQuickViewClick(name, sName, record, index, myConfig, configName); } else { - this.props.onViewClick(name, sName, record, index, myConfig ); + this.props.onViewClick(name, sName, record, index, myConfig); } } }; - handleQuickViewClick = async (name, sName, record, index , myConfigArr, configName) => { + handleQuickViewClick = async (name, sName, record, index, myConfigArr, configName) => { const { slaveConfig, slaveData, @@ -5800,7 +5800,7 @@ export default (ChildComponent) => { } = this.props; let picArr = []; - if(commonUtils.isNotEmptyArr(myConfigArr)) { + if (commonUtils.isNotEmptyArr(myConfigArr)) { picArr = myConfigArr; } @@ -5881,7 +5881,7 @@ export default (ChildComponent) => { /* 选择基础颜色 */ handleSelectSisColor = async (name, selectConfig, selectData) => { const { - enabled, processData, processSelectedRowId, controlSelectedRowId, controlData, sisColorField, masterData, slaveSelectedRowKeys, slaveData,packData, + enabled, processData, processSelectedRowId, controlSelectedRowId, controlData, sisColorField, masterData, slaveSelectedRowKeys, slaveData, packData, } = this.props; if (enabled && commonUtils.isNotEmptyObject(processSelectedRowId)) { let sColorSerialMemoStr = ''; @@ -5962,11 +5962,11 @@ export default (ChildComponent) => { if (sFieldName === 'sPositiveColor') { addState.iPositiveColor = trueColor; addState.iPositiveSpecialColor = trueSpecialColor; - addState.sOppositeColor= controlData[iIndex].sOppositeColor; + addState.sOppositeColor = controlData[iIndex].sOppositeColor; } else if (sFieldName === 'sOppositeColor') { addState.iOppositeColor = falseColor; addState.iOppositeSpecialColor = falseSpecialColor; - addState.sPositiveColor= controlData[iIndex].sPositiveColor; + addState.sPositiveColor = controlData[iIndex].sPositiveColor; } controlData[iIndex] = { ...controlData[iIndex], ...addState }; } @@ -5976,7 +5976,7 @@ export default (ChildComponent) => { }); } - handleViewChoose= (name, sName, record) => { + handleViewChoose = (name, sName, record) => { const { sId } = record; /* 控制表主键 */ const { enabled } = this.props; const sisColorSelectedRowKeys = []; @@ -6005,7 +6005,7 @@ export default (ChildComponent) => { sisColorSelectedRowKeys, sisColorSelectedData: jsonData, }); - }else if (sName === 'sParams' && location.pathname.includes('productionReport')) { // 产量上报 工艺参数 + } else if (sName === 'sParams' && location.pathname.includes('productionReport')) { // 产量上报 工艺参数 const { enabled } = this.props; const slaveSelectOneData = record; const sProcessParamsSelects = []; @@ -6124,7 +6124,7 @@ export default (ChildComponent) => { sParamModalType: 'sReport', enabled, }); - }else if (enabled && name === 'control' && (sName === 'sPositiveColor' || sName === 'sOppositeColor')) { /* 控制表 选择正面颜色、反面颜色 */ + } else if (enabled && name === 'control' && (sName === 'sPositiveColor' || sName === 'sOppositeColor')) { /* 控制表 选择正面颜色、反面颜色 */ const { [`${name}Data`]: tableData } = this.props; const iIndex = tableData.findIndex(item => item.sId === sId); if (iIndex > -1) { @@ -6183,15 +6183,15 @@ export default (ChildComponent) => { } /* 根据不同条件 计算排版数 */ //竖排(上机高、上机宽、部件高、部件宽、出血咬口) dPartsLength --》dMachineLength,dPartsWidth--》dMachineWidth - getSp = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth)=>{ + getSp = (dMachineLength, dMachineWidth, dPartsLength, dPartsWidth) => { var dMachineWidth = dMachineWidth; var dMachineLength = dMachineLength; //计算合版数量 - var iTemp = Math.floor(dMachineWidth / dPartsWidth) * Math.floor(dMachineLength /dPartsLength ); + var iTemp = Math.floor(dMachineWidth / dPartsWidth) * Math.floor(dMachineLength / dPartsLength); return iTemp; } //横排(上机高、上机宽、部件高、部件宽、出血咬口) dPartsLength --》dMachineWidth,dPartsWidth--》dMachineLength - getHp = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth) =>{ + getHp = (dMachineLength, dMachineWidth, dPartsLength, dPartsWidth) => { var dMachineWidth = dMachineWidth; var dMachineLength = dMachineLength; //计算合版数量 @@ -6199,10 +6199,10 @@ export default (ChildComponent) => { return iTemp; } //横竖取大 - getHSQD = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth) =>{ - var iTemp =this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); - var iTemp2 =this.getSp(dMachineLength,dMachineWidth,dPartsLength,dPartsWidth); - if(iTemp2>iTemp){ + getHSQD = (dMachineLength, dMachineWidth, dPartsLength, dPartsWidth) => { + var iTemp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + var iTemp2 = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + if (iTemp2 > iTemp) { iTemp = iTemp2; // tag= 2;//竖排 } @@ -6227,97 +6227,97 @@ export default (ChildComponent) => { var xxfx = 3;//虚线方向 1:横虚线 2:树虚线;3:无需虚线 var wlfx = 1;//竖纹 //机器长宽转换 - if(dMachineWidth > dMachineLength){ + if (dMachineWidth > dMachineLength) { dMachineTmp = dMachineWidth;//上级高 dMachineWidth = dMachineLength;//上级宽 dMachineLength = dMachineTmp; wlfx = 2; } //长宽转换(dLength 高度、dWidth 表示宽度,高度永远大于宽度) - if(dPartsWidth > dPartsLength){ + if (dPartsWidth > dPartsLength) { dPartsTmp = dPartsWidth;//上级高 dPartsWidth = dPartsLength;//上级宽 dPartsLength = dPartsTmp; } - dMachineWidth = dMachineWidth-dBite; + dMachineWidth = dMachineWidth - dBite; const sCutMethod = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sCutMethod, 0)); /* 裁切方式 */ const sSpineDirection = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sSpineDirection, 0)); /* 书脊方向 */ - const sPrintingPlate = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sPrintingPlate, 0)); /* 排版方式 */ + const sPrintingPlate = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sPrintingPlate, 0)); /* 排版方式 */ // console.log('sPrintingPlate', sPrintingPlate); // console.log('sCutMethod', sCutMethod); // console.log('sSpineDirection', sSpineDirection); let tmpBl = 1;//排版数乘的数字,如果书类为2 默认是1 let tmp = 0; //三边裁切 - if( sCutMethod === 1){ + if (sCutMethod === 1) { //长书(1,3,4) - if(sSpineDirection=== 1){ + if (sSpineDirection === 1) { dPartsLength = dPartsLength; - dPartsWidth = dPartsWidth*2; - }else{ + dPartsWidth = dPartsWidth * 2; + } else { dPartsWidth = dPartsWidth - dPartsLength = dPartsLength*2; + dPartsLength = dPartsLength * 2; } tmpBl = 2; - dPartsWidth = dPartsWidth + 2*dBoold; - dPartsLength = dPartsLength + 2*dBoold; - if(sPrintingPlate === 1){ /* 横竖取大 */ - tmp = this.getHSQD(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); - dSingleQty = tmp*2; + dPartsWidth = dPartsWidth + 2 * dBoold; + dPartsLength = dPartsLength + 2 * dBoold; + if (sPrintingPlate === 1) { /* 横竖取大 */ + tmp = this.getHSQD(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + dSingleQty = tmp * 2; console.log('横竖取大排版数:', dSingleQty); - }else if(sPrintingPlate ===3){ /* 横排 */ - if(wlfx===1 && sSpineDirection===1){ + } else if (sPrintingPlate === 3) { /* 横排 */ + if (wlfx === 1 && sSpineDirection === 1) { //长书脊 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); - dSingleQty = tmp*2; - }else if(wlfx===2 && sSpineDirection===1){ + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + dSingleQty = tmp * 2; + } else if (wlfx === 2 && sSpineDirection === 1) { //长书脊 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1); - dSingleQty = tmp*2; - }else if(wlfx===1 && sSpineDirection===2){ + dSingleQty = tmp * 2; + } else if (wlfx === 1 && sSpineDirection === 2) { //长书脊 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1); - dSingleQty = tmp*2; - }else if(wlfx==2 && sSpineDirection==2){ + dSingleQty = tmp * 2; + } else if (wlfx == 2 && sSpineDirection == 2) { //长书脊 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2); - dSingleQty = tmp*2; + dSingleQty = tmp * 2; } - }else if(sPrintingPlate===4) { /* 竖排 */ + } else if (sPrintingPlate === 4) { /* 竖排 */ //竖排 - if(wlfx===1 && sSpineDirection===1){ + if (wlfx === 1 && sSpineDirection === 1) { //长书脊 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1); - dSingleQty = tmp*2; - }else if(wlfx===2 && sSpineDirection===1){ + dSingleQty = tmp * 2; + } else if (wlfx === 2 && sSpineDirection === 1) { //长书脊 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2); - dSingleQty = tmp*2; - }else if(wlfx===1 && sSpineDirection===2){ + dSingleQty = tmp * 2; + } else if (wlfx === 1 && sSpineDirection === 2) { //长书脊 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2); - dSingleQty = tmp*2; - }else if(wlfx===2 && sSpineDirection===2){ + dSingleQty = tmp * 2; + } else if (wlfx === 2 && sSpineDirection === 2) { //长书脊 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1); - dSingleQty = tmp*2; + dSingleQty = tmp * 2; } - }else if(sPrintingPlate===2){ /* 混排 */ + } else if (sPrintingPlate === 2) { /* 混排 */ //混排 横排 多余部分 看看是否能够竖着排 如果竖排 看看能否再横着排(折页没有混排) } - }else{ /* 四边裁 */ - dPartsWidth = dPartsWidth+2*dBoold; - dPartsLength = dPartsLength+2*dBoold; - if(sPrintingPlate===1){ - tmp = this.getHSQD(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + } else { /* 四边裁 */ + dPartsWidth = dPartsWidth + 2 * dBoold; + dPartsLength = dPartsLength + 2 * dBoold; + if (sPrintingPlate === 1) { + tmp = this.getHSQD(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); //1:横虚线 2:树虚线;3:无需虚线 // if(tag==2){ // //alert("横竖取大==版数:"+tmp); @@ -6326,17 +6326,17 @@ export default (ChildComponent) => { // //alert("横竖取大==版数:"+tmp); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3); // } - console.log("四边裁-横竖取大:"+tmp); + console.log("四边裁-横竖取大:" + tmp); dSingleQty = tmp; - }else if(sPrintingPlate===3){ - if(wlfx===1){ + } else if (sPrintingPlate === 3) { + if (wlfx === 1) { //长书级 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); dSingleQty = tmp; // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3); - }else{ + } else { //长书级 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); dSingleQty = tmp; // $("#dPlateQty").val(tmp); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,3); @@ -6344,60 +6344,60 @@ export default (ChildComponent) => { // var tmp = getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); // alert("横排版数:"+tmp); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2); - }else if(sPrintingPlate===4) { + } else if (sPrintingPlate === 4) { //竖排 - if(wlfx===1){ + if (wlfx === 1) { //长书级 - tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); - console.log("竖排版数:"+tmp); + tmp = this.getSp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + console.log("竖排版数:" + tmp); dSingleQty = tmp; // $("#dPlateQty").val(tmp); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,3); - }else{ + } else { //长书级 - tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth); - console.log("竖排版数:"+tmp); + tmp = this.getHp(dMachineLength, dMachineWidth, dPartsLength, dPartsWidth); + console.log("竖排版数:" + tmp); dSingleQty = tmp; // $("#dPlateQty").val(tmp); // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3); } - }else if(sPrintingPlate===2){ + } else if (sPrintingPlate === 2) { //混排 横排 多余部分 看看是否能够竖着排 如果竖排 看看能否再横着排(折页没有混排) - if( sCutMethod===1){ + if (sCutMethod === 1) { message.warning("书没有混排"); return; } //竖排+横排 let htTmpTag = 0; let tmp3 = 0; - tmp = this.getHHP(dMachineWidth,dMachineLength ,dPartsLength ,dPartsWidth); - tmp3 = this.getHHP(dMachineWidth,dMachineLength ,dPartsWidth,dPartsLength); - if(tmp { + /* 查询单表数据 */ + handleGetDataOne = async (name, slaveInfoConfig, slaveFilterCondition, page, pageSize, slaveOrderBy, props, isWait) => { const { slaveData, slaveSelectedRowKeys } = props || this.props; if (commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(slaveInfoConfig)) { - let record = slaveData[0]; /* 从表选中行 没有选中行时 取第一行 */ - if(commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { + let record = slaveData[0]; /* 从表选中行 没有选中行时 取第一行 */ + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { const iIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); if (iIndex > -1) { record = slaveData[iIndex]; @@ -6408,7 +6408,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyObject(sSqlCondition0)) { conditonValues = this.props.getSqlCondition(slaveInfoConfig, 'slave', record); } - conditonValues = { sParentId: record.sId, ...conditonValues}; + conditonValues = { sParentId: record.sId, ...conditonValues }; const pageNum = commonUtils.isEmpty(page) ? 1 : page; const pageTableSize = commonUtils.isNotEmptyNumber(pageSize) ? pageSize : commonConfig.pageSize; let addState = await this.props.handleGetDataSet({ @@ -6419,10 +6419,10 @@ export default (ChildComponent) => { }, flag: true, clearSelectData: true, - isWait:true, + isWait: true, }); - if(isWait) { - if(commonUtils.isEmptyObject(addState)) { + if (isWait) { + if (commonUtils.isEmptyObject(addState)) { addState = {}; } addState.pageLoading = false; @@ -6648,7 +6648,7 @@ export default (ChildComponent) => { }; /* 单据字段单击右键全部更新,弹出窗选择后,更新此列所有数据。(只更新非只读字段) */ - handleContextMenuOk=(contextMenuValue) => { + handleContextMenuOk = (contextMenuValue) => { const { contextMenuConfig, contextMenuTbName, [`${contextMenuTbName}Data`]: tableData, [`${contextMenuTbName}SelectedRowKeys`]: selectedRowKeys, } = this.props; @@ -6691,19 +6691,19 @@ export default (ChildComponent) => { enabled, sParamModalType } = this.props; - if(enabled) { + if (enabled) { if (commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyObject(processRecord)) { const processSelectDataIndex = processData.findIndex(item => item.sId === processRecord.sId); if (processSelectDataIndex > -1) { if (commonUtils.isNotEmptyArr(sParamData)) { let sParamJsonData = ''; const sParamSeletedData = sParamData.filter(item => item.bSelfCbx); - if(commonUtils.isNotEmptyObject(sParamSeletedData)) { + if (commonUtils.isNotEmptyObject(sParamSeletedData)) { sParamJsonData = JSON.stringify(sParamSeletedData); } let { handleType } = processData[processSelectDataIndex]; handleType = commonUtils.isEmpty(handleType) ? 'update' : handleType; - if(sParamModalType === 'sQuo') { /* 报价参数点击确定 */ + if (sParamModalType === 'sQuo') { /* 报价参数点击确定 */ processData[processSelectDataIndex].sQuoParams = sParamJsonData; } else { /* 工单参数点击确定 */ processData[processSelectDataIndex].sParams = sParamJsonData; @@ -6763,7 +6763,7 @@ export default (ChildComponent) => { } } - /* 动态参数标题选择框 全选/取消全选 */ + /* 动态参数标题选择框 全选/取消全选 */ handleCheckParamChange = (name) => { const { processData, @@ -6774,17 +6774,17 @@ export default (ChildComponent) => { enabled, } = this.props; /* 全选 取消全选功能 */ - if(commonUtils.isNotEmptyArr(sParamData)) { + if (commonUtils.isNotEmptyArr(sParamData)) { /* 标题bSelfCbx加标识 */ - const iIndex = sParamColumn.findIndex(item=>item.dataIndex ==='bSelfCbx'); - if(iIndex > -1) { + const iIndex = sParamColumn.findIndex(item => item.dataIndex === 'bSelfCbx'); + if (iIndex > -1) { let bSelfCbx = false; - if(sParamColumn[iIndex].bCheckAll) { + if (sParamColumn[iIndex].bCheckAll) { bSelfCbx = false; } else { bSelfCbx = true; } - sParamColumn[iIndex] = {...sParamColumn[iIndex],bCheckAll:bSelfCbx} + sParamColumn[iIndex] = { ...sParamColumn[iIndex], bCheckAll: bSelfCbx } sParamData.forEach((item, index) => { sParamData[index] = { ...sParamData[index], bSelfCbx: bSelfCbx }; }) @@ -7360,34 +7360,820 @@ export default (ChildComponent) => { let tableDataRow = {}; if (sFieldName === 'sMaterialsNo' || sFieldName === 'sMaterialsName' || sFieldName === 'dAuxiliaryQty' || sFieldName === 'dReelAuxiliaryQty' || sFieldName === 'dConversionQty' || sFieldName === 'sMaterialsStyle') { let iIndex = -1; - if(commonUtils.isEmptyArr(tableSelectedRowKeys)) { + if (commonUtils.isEmptyArr(tableSelectedRowKeys)) { iIndex = 0; } else { tableData.findIndex(item => item.sId === tableSelectedRowKeys.toString()) } tableDataRow = await this.handleMaterialsChange(record, sModelsId, masterData, {}, sFieldName, app, token, models); - if(iIndex > -1) { + if (iIndex > -1) { tableData[iIndex] = tableDataRow; } - this.props.onSaveState({ [`${name}Data`]: tableData}) + this.props.onSaveState({ [`${name}Data`]: tableData }) } else { this.props.onDropDownBlur(name, sFieldName, record, tableConfig); } }; - handleShowParam = (name, record, tableSelectedRowKeys) => { + handleShowParam = (name, record, tableSelectedRowKeys) => { let processSelectedData = []; - if(commonUtils.isNotEmptyObject(record)) { + if (commonUtils.isNotEmptyObject(record)) { processSelectedData = [record]; } this.props.onSaveState({ commonParamVisible: true, processSelectedData, - processSelectedRowKeys:tableSelectedRowKeys, + processSelectedRowKeys: tableSelectedRowKeys, }); } + handleSelectCommonPopup = (currentPaneName, selectConfig, selectData, tbName, commonPopupShowConfig, other) => { + const { + [`${tbName}Data`]: tableData, [`${tbName}SelectedRowKeys`]: tableSelectedRowKeys, masterData, processConfig, + } = this.props; + + /* 工单,工艺卡 放大镜选择材料 直接插入全部材料中 */ + if (selectConfig.sControlName && selectConfig.sControlName === 'BtnPopupMaterialsWorkOrder') { + + let { materials0Data, materials1Data, materials1Config, materials2Data, materials2Config, } = this.props; + + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + if (commonUtils.isEmptyArr(materials1Data)) { + materials1Data = []; + } + if (commonUtils.isEmptyArr(materials2Data)) { + materials2Data = []; + } + /* 找到放大镜复制到配置 */ + + /* 材料大类 */ + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials0`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 材料大类 */ + + const addState = {}; + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + if (commonUtils.isNotEmptyArr(selectData)) { + const selectFilterDataAll = selectData; /* 除了油墨,专色墨,电化铝之外的物料大类 */ + + /* 全部材料 */ + if (commonUtils.isNotEmptyArr(selectFilterDataAll)) { + selectFilterDataAll.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iIndex > -1) { + newCopyTo.materials0 = item; + } + let tableDataRowAdd = this.handleTableAdd('materials0', true); + item.handleType = 'add'; + // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + materials0Data.push(tableDataRowAdd); + }); + } + console.log('222', materials0Data, copyToAssignField); + + if (commonUtils.isNotEmptyArr(materials0Data) && location.pathname.includes('processCardPackTableTree')) { + /* 根据配置过滤数据 */ + const sSqlCondition1 = materials1Config ? materials1Config.sSqlCondition : 'materials0.sBclassifyName.油墨'; + if (commonUtils.isNotEmptyObject(sSqlCondition1)) { + let targetTbName = sSqlCondition1.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition1.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition1.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => sParentKey && sParentKey.includes(item[filteredValue])); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials1Data.push(item); + }) + } + } + + + const sSqlCondition2 = materials2Config ? materials2Config.sSqlCondition : 'materials0.sBclassifyName.电化铝'; + if (commonUtils.isNotEmptyObject(sSqlCondition2)) { + let targetTbName = sSqlCondition2.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition2.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition2.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => item[filteredValue] === sParentKey); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials2Data.push(item); + }) + } + } + + addState.materials1Data = materials1Data; + addState.materials2Data = materials2Data; + } else if (commonUtils.isNotEmptyArr(materials0Data) && location.pathname.includes('workOrderResearchTableTree')) { + /* 根据配置过滤数据 */ + const sSqlCondition1 = materials1Config ? materials1Config.sSqlCondition : 'materials0.sBclassifyName.纸张'; + if (commonUtils.isNotEmptyObject(sSqlCondition1)) { + let targetTbName = sSqlCondition1.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition1.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition1.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => sParentKey && sParentKey.includes(item[filteredValue])); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials1Data.push(item); + }) + } + } + + + const sSqlCondition2 = materials2Config ? materials2Config.sSqlCondition : 'materials0.sBclassifyName.油墨'; + if (commonUtils.isNotEmptyObject(sSqlCondition2)) { + let targetTbName = sSqlCondition2.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition2.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition2.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => item[filteredValue] === sParentKey); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials2Data.push(item); + }) + } + } + + addState.materials1Data = materials1Data; + addState.materials2Data = materials2Data; + } + this.props.onSaveState({ materials0Data, ...addState }); + } + } else if (selectConfig.sControlName && selectConfig.sControlName === 'BtnPopupMaterialsQuo') { + + let { materialsData, materials0Data, materials1Data, materials0Config, materials1Config, materials2Data, materials2Config, } = this.props; + + if (commonUtils.isEmptyArr(materialsData)) { + materialsData = []; + } + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + + if (commonUtils.isEmptyArr(materials1Data)) { + materials1Data = []; + } + if (commonUtils.isEmptyArr(materials2Data)) { + materials2Data = []; + } + /* 找到放大镜复制到配置 */ + + /* 材料大类 */ + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials0`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 材料大类 */ + + const addState = {}; + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + if (commonUtils.isNotEmptyArr(selectData)) { + const selectFilterDataAll = selectData; /* 除了油墨,专色墨,电化铝之外的物料大类 */ + /* 全部材料 */ + if (commonUtils.isNotEmptyArr(selectFilterDataAll)) { + selectFilterDataAll.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iIndex > -1) { + newCopyTo.materials0 = item; + } + let tableDataRowAdd = this.handleTableAdd('materials0', true); + item.handleType = 'add'; + // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + materialsData.push(tableDataRowAdd); + }); + } + if (false && commonUtils.isNotEmptyArr(materialsData)) { + /* 根据配置过滤数据 */ + const sSqlCondition1 = materials0Config ? materials0Config.sSqlCondition : 'materials0.sBclassifyName.油墨'; + if (commonUtils.isNotEmptyObject(sSqlCondition1)) { + let targetTbName = sSqlCondition1.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition1.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition1.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => sParentKey && sParentKey.includes(item[filteredValue])); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials0Data.push(item); + }) + } + } + + + const sSqlCondition2 = materials1Config ? materials1Config.sSqlCondition : 'materials0.sBclassifyName.电化铝'; + if (commonUtils.isNotEmptyObject(sSqlCondition2)) { + let targetTbName = sSqlCondition2.split('.')[0]; /* 1.表名 control */ + let filteredValue = sSqlCondition2.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ + let sParentKey = sSqlCondition2.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ + if (targetTbName === 'materials0') { + const filterData = materials0Data.filter(item => item[filteredValue] === sParentKey); + if (commonUtils.isNotEmptyArr(filterData)) + filterData.forEach((item, index) => { + materials1Data.push(item); + }) + } + } + addState.materialsData = materialsData; + addState.materials0Data = materials0Data; + addState.materials1Data = materials1Data; + addState.materials2Data = materials2Data; + } + this.props.onSaveState({ ...addState }); + } + } else if (selectConfig.sControlName && (selectConfig.sControlName === 'BtnPopupMaterials1Child' || selectConfig.sControlName.includes('BtnHeadPopup'))) { + const { materials0SelectedRowKeys, materials1SelectedRowKeys, materials2SelectedRowKeys } = this.props; /* 油墨数据选中行 */ + let { materials0Data } = this.props; + let fatherRow = {}; + if (tbName === 'materials1Child') { + const iIndex = commonUtils.isNotEmptyArr(materials1SelectedRowKeys) ? materials0Data.findIndex(item => item.sId === materials1SelectedRowKeys[0]) : -1; + if (iIndex === -1) { + message.error('请选择左侧选择行!'); + return; + } + fatherRow = materials1Data[iIndex]; + } else if (tbName === 'materials2Child') { + const iIndex = commonUtils.isNotEmptyArr(materials2SelectedRowKeys) ? materials0Data.findIndex(item => item.sId === materials2SelectedRowKeys[0]) : -1; + if (iIndex === -1) { + message.error('请选择左侧选择行!'); + return; + } + fatherRow = materials2Data[iIndex]; + } else if (tbName === 'materials0Child') { + const iIndex = commonUtils.isNotEmptyArr(materials0SelectedRowKeys) ? materials0Data.findIndex(item => item.sId === materials0SelectedRowKeys[0]) : -1; + if (iIndex === -1) { + message.error('请选择左侧选择行!'); + return; + } + fatherRow = materials0Data[iIndex]; + } + + let { [`${tbName}Data`]: tableData } = this.props; + if (commonUtils.isEmptyArr(tableData)) { + tableData = []; + } + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + + if (commonUtils.isNotEmptyArr(selectData)) { + // eslint-disable-next-line no-unused-vars + selectData.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + let tableDataRowAdd = this.handleTableAdd(tbName, true); + item.handleType = 'add'; + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item) }; // 取赋值字段 + tableDataRowAdd.handleType = 'add'; + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + tableDataRowAdd.sParentMaterialsId = fatherRow.sId; /* 选中从表的sId */ + tableDataRowAdd.sProcessId = fatherRow.sProcessId; /* 工序ID */ + tableDataRowAdd.sProcessTbId = fatherRow.sProcessTbId; /* 工序表格ID */ + if (tbName === 'materials0Child') { /* 替代料 */ + tableDataRowAdd.sMaterialsNo1 = fatherRow.sMaterialsNo; /* 原材料编号 */ + tableDataRowAdd.sMaterialsName1 = fatherRow.sMaterialsName; /* 原材料名称 */ + tableDataRowAdd.bAlternative = true; + } + + // const newTableDataRowAdd = JSON.parse(JSON.stringify(tableDataRowAdd)); + // newTableDataRowAdd.sId = commonUtils.createSid(); + materials0Data.push(tableDataRowAdd); + + + }); + console.log('放大镜确认数据:', tbName, tableData, materials0Data) + this.props.onSaveState({ materials0Data }); + } + } else if (selectConfig.sControlName && selectConfig.sControlName.includes('BtnPopupMaterials')) { /* 报价单工序表放大镜 选择材料 */ + /* materials1ChildData:油墨, materials2ChildData:电化铝 */ + let { materials1Data, materials1ChildData, materials2Data, materials2ChildData, materials0Data, processData, processSelectedRowKeys } = this.props; + let materialsOtherData = []; + + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + + if (commonUtils.isEmptyArr(materials1Data)) { + materials1Data = []; + } + + if (commonUtils.isEmptyArr(materials1ChildData)) { + materials1ChildData = []; + } + + if (commonUtils.isEmptyArr(materials2ChildData)) { + materials2ChildData = []; + } + + if (commonUtils.isEmptyArr(materials2Data)) { + materials2Data = []; + } + + /* 找到放大镜复制到配置 */ + /* 材料大类 */ + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials0`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 材料大类 */ + + /* 自调专色墨 */ + const copyToConfig1Left = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials1`.toLowerCase()); + const copyToAssignField1Left = commonUtils.isNotEmptyArr(copyToConfig1Left) ? copyToConfig1Left[0].sAssignField : ''; /* 专色墨 */ + + /* 油墨 */ + const copyToConfig1 = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials1Child`.toLowerCase()); + const copyToAssignField1 = commonUtils.isNotEmptyArr(copyToConfig1) ? copyToConfig1[0].sAssignField : ''; /* 油墨 */ + + /* 油墨 */ + const copyToConfig2 = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials2Child`.toLowerCase()); + const copyToAssignField2 = commonUtils.isNotEmptyArr(copyToConfig2) ? copyToConfig2[0].sAssignField : ''; /* 电化铝 */ + + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + if (commonUtils.isNotEmptyArr(selectData)) { + if (commonUtils.isEmpty(materials1ChildData)) { + materials1ChildData = []; + } + if (commonUtils.isEmpty(materials2ChildData)) { + materials2ChildData = []; + } + // const selectFilterData1 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.youmo); + // const selectFilterData1Left = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.zsm); + // // const selectFilterData1 = selectData.filter(item => item.sZmldlName === '纸张'); + // const selectFilterData2 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.dhl ); + // + // const selectFilterDataOther = selectData.filter(item => item.sZmldlName !== sMaterialsClassfiy.youmo && + // item.sZmldlName !== sMaterialsClassfiy.zsm && item.sZmldlName !== sMaterialsClassfiy.dhl ); /* 除了油墨,专色墨,电化铝之外的物料大类 */ + // + // /* 自动专色墨 */ + // if(commonUtils.isNotEmptyArr(selectFilterData1Left)) { + // selectFilterData1Left.forEach((item, index) => { + // const newCopyTo = {}; + // newCopyTo.master = masterData; + // if (iIndex > -1) { + // newCopyTo.materials1Child = item; + // } + // let tableDataRowAdd = this.handleTableAdd('materials1', true); + // item.handleType = 'add'; + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1Left, item) }; // 取赋值字段 + // tableDataRowAdd.sId = commonUtils.createSid(); + // tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + // materials1Data.push(tableDataRowAdd); + // }); + // } + // + // /* 油墨 */ + // if(commonUtils.isNotEmptyArr(selectFilterData1)) { + // selectFilterData1.forEach((item, index) => { + // const newCopyTo = {}; + // newCopyTo.master = masterData; + // if (iIndex > -1) { + // newCopyTo.materials1Child = item; + // } + // let tableDataRowAdd = this.handleTableAdd('materials1Child', true); + // item.handleType = 'add'; + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + // tableDataRowAdd = {...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1, item)}; // 取赋值字段 + // tableDataRowAdd.sId = commonUtils.createSid(); + // tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + // materials1ChildData.push(tableDataRowAdd); + // }); + // } + // + // /* 电化铝 */ + // if(commonUtils.isNotEmptyArr(selectFilterData2)) { + // selectFilterData2.forEach((item, index) => { + // const newCopyTo = {}; + // newCopyTo.master = masterData; + // if (iIndex > -1) { + // newCopyTo.materials2Child = item; + // } + // let tableDataRowAdd = this.handleTableAdd('materials2Child', true); + // item.handleType = 'add'; + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField2, item) }; // 取赋值字段 + // tableDataRowAdd.sId = commonUtils.createSid(); + // tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + // materials2ChildData.push(tableDataRowAdd); + // }); + // } + // + // if(commonUtils.isNotEmptyArr(materials2ChildData)) { + // materials2ChildData.forEach((val) => { + // const iIndex = materials2Data.findIndex(item => item.sMaterialsId === val.sMaterialsId && item.sControlId === val.sControlId && item.sMaterialsStyle === val.sMaterialsStyle); + // if(iIndex === -1){ + // materials2Data.push(val); + // } + // }); + // } + // + + // /* 其他材料 */ + // if(commonUtils.isNotEmptyArr(selectFilterDataOther)) { + // selectFilterDataOther.forEach((item, index) => { + // const newCopyTo = {}; + // newCopyTo.master = masterData; + // if (iIndex > -1) { + // newCopyTo.materials0 = item; + // } + // let tableDataRowAdd = this.handleTableAdd('materials0', true); + // item.handleType = 'add'; + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 + // tableDataRowAdd.sId = commonUtils.createSid(); + // tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + // if(commonUtils.isNotEmptyObject(processRow)) { + // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessId) ) { + // tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ + // } + // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId) ) { + // tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ + // } + // if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { + // tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ + // } + // } + // + // materialsOtherData.push(tableDataRowAdd); + // }); + // } + // const temp1Data = materials1Data.concat(materials1ChildData); + // const temp2Data = temp1Data.concat(materials2Data); + // + // materials0Data = temp2Data.concat(materialsOtherData); + let processRow = {}; + if (commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)) { + const iPIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); + if (iPIndex > -1) { + processRow = processData[iPIndex]; + } + } + const selectFilterDataAll = selectData; /* 除了油墨,专色墨,电化铝之外的物料大类 */ + /* 全部材料 */ + if (commonUtils.isNotEmptyArr(selectFilterDataAll)) { + selectFilterDataAll.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iIndex > -1) { + newCopyTo.materials0 = item; + } + let tableDataRowAdd = this.handleTableAdd('materials0', true); + item.handleType = 'add'; + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + if (commonUtils.isNotEmptyObject(processRow)) { + if (commonUtils.isEmptyObject(tableDataRowAdd.sProcessId)) { + tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ + } + if (commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId)) { + tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ + } + if (commonUtils.isEmptyObject(tableDataRowAdd.sControlId)) { + tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ + } + } + materials0Data.push(tableDataRowAdd); + }); + } + + console.log('materials1Data1:', materials0Data, materials1Data, materials1ChildData, materials2ChildData, materialsOtherData); + + this.props.onSaveState({ materials1Data, materials1ChildData, materials2ChildData, materialsOtherData, materials0Data }); + } + } else if (location.pathname && location.pathname.includes('quotationPackTableTree') && selectConfig.sName && selectConfig.sName === 'sAlumiteBomBillNo') { /* 报价单电化铝Bom选择数据后,数据带入到电化铝 */ + let { materialsData, materials1Data, materials2Data, materials2ChildData, materials0Data } = this.props; + const addState = {}; + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + if (commonUtils.isEmptyArr(materials1Data)) { + materials1Data = []; + } + if (commonUtils.isEmptyArr(materials2Data)) { + materials2Data = []; + } + if (commonUtils.isEmptyArr(materials2ChildData)) { + materials2ChildData = []; + } + const sControlName = 'sPopupsAlumiteBomBillNo'; + /* 电化铝父级赋值配置 */ + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${sControlName}.materials2Data`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 电化铝 */ + + /* 电化铝子级赋值配置 */ + const copyToChildConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${sControlName}.materials2ChildData`.toLowerCase()); + const copyToChildAssignField = commonUtils.isNotEmptyArr(copyToChildConfig) ? copyToChildConfig[0].sAssignField : ''; /* 电化铝子级 */ + + if (commonUtils.isNotEmptyArr(selectData)) { + // eslint-disable-next-line no-unused-vars + selectData.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + let tableDataRowAdd = this.handleTableAdd('materials1Data', true); + item.handleType = 'add'; + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentMaterialsId = fatherRow.sId; /* 选中从表的sId */ + materials1Data.push(tableDataRowAdd); + const newTableDataRowAdd = JSON.parse(JSON.stringify(tableDataRowAdd)); + // newTableDataRowAdd.sId = commonUtils.createSid(); + materialsData.push(newTableDataRowAdd); + }); + addState.materials1Data = materials1Data; + addState.materialsData = materialsData; + this.props.onSaveState({ materials1Data, materials2Data, materials0Data }); + } + } else if ((selectConfig.sName && selectConfig.sName === 'sAlumiteBomBillNo') || selectConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo') { /* 电化铝Bom选择数据后,数据带入到电化铝 */ + let { materials2Data, materials2ChildData, materialsData, materials0Data, processData, processSelectedRowKeys, materialsDelData, materials0DelData } = this.props; + const addState = {}; + if (commonUtils.isEmptyArr(materialsData)) { + materialsData = []; + } + if (commonUtils.isEmptyArr(materials0Data)) { + materials0Data = []; + } + if (commonUtils.isEmptyArr(materials2Data)) { + materials2Data = []; + } + if (commonUtils.isEmptyArr(materials2ChildData)) { + materials2ChildData = []; + } + if (commonUtils.isEmptyArr(materials0DelData)) { + materials0DelData = []; + } + if (commonUtils.isEmptyArr(materialsDelData)) { + materialsDelData = []; + } + const sControlName = 'sPopupsAlumiteBomBillNo'; + /* 电化铝父级赋值配置 */ + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${sControlName}.materials2Data`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 电化铝 */ + + /* 电化铝子级赋值配置 */ + const copyToChildConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${sControlName}.materials2ChildData`.toLowerCase()); + const copyToChildAssignField = commonUtils.isNotEmptyArr(copyToChildConfig) ? copyToChildConfig[0].sAssignField : ''; /* 电化铝子级 */ + + if (commonUtils.isNotEmptyArr(selectData)) { + if (commonUtils.isNotEmptyArr(processSelectedRowKeys) && commonUtils.isNotEmptyArr(processData)) { + const iProcessIndex = processData.findIndex(item => item.sId === processSelectedRowKeys[0]); + processData[iProcessIndex].handleType = commonUtils.isEmpty(processData[iProcessIndex].handleType) ? 'update' : processData[iProcessIndex].handleType; + processData[iProcessIndex].sAlumiteBomBillNo = selectData[0].sVersionNum; + addState.processData = processData; + /* 移除该工序下的所有电化铝 */ + const filterDelData = materials0Data.filter(row => row.sProcessId === processData[iProcessIndex].sProcessId && + row.sProcessTbId === processData[iProcessIndex].sId && row.sBclassifyName === '电化铝' && commonUtils.isEmptyObject(row.sParentMaterialsId)); + console.log('移除该工序下的所有电化铝', filterDelData); + if (commonUtils.isNotEmptyArr(filterDelData)) { + filterDelData.forEach((item, index) => { + const iIndex = materials0Data.findIndex(row => row.sId === item.sId); + if (iIndex > -1) { + const delRow = materials0Data[iIndex]; + delRow.handleType = 'del'; + if (selectConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo') { + materialsData.splice(iIndex, 1); + materialsDelData.push(delRow); + } else { + materials0Data.splice(iIndex, 1); + materials0DelData.push(delRow); + } + } + }) + } + } + // eslint-disable-next-line no-unused-vars + selectData.forEach((item, index) => { + // const iIndex = materials0Data.findIndex(row => row.sAluminumBomId === item.sId && row.sAluminumBomSlaveId === item.sSlaveId); + // console.log('iIndex', iIndex); + // if(iIndex > -1) { + // const delRow = materials0Data[iIndex]; + // delRow.handleType = 'del'; + // if(selectConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo') { + // materialsData.splice(iIndex, 1); + // materialsDelData.push(delRow); + // } else { + // materials0Data.splice(iIndex, 1); + // materials0DelData.push(delRow); + // } + // } + const newCopyTo = {}; + newCopyTo.master = masterData; + let tableDataRowAdd = this.handleTableAdd('materials2Data', true); + item.handleType = 'add'; + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + // tableDataRowAdd.sParentMaterialsId = fatherRow.sId; /* 选中从表的sId */ + materials2Data.push(tableDataRowAdd); + + /* 替代料对应的材料id重新刷一遍 */ + const tdlFilterData = materials0Data.filter(item => commonUtils.isNotEmptyObject(item.sParentMaterialsId) && + item.sMaterialsNo1 === tableDataRowAdd.sMaterialsNo); + if (commonUtils.isNotEmptyObject(tdlFilterData)) { + tdlFilterData.forEach((item, index) => { + const iFIndex = materials0Data.findIndex(child => child.sId === item.sId); + if (iFIndex > -1) { + const addState = {}; + addState.sParentMaterialsId = tableDataRowAdd.sId; + addState.handleType = commonUtils.isEmpty(materials0Data[iFIndex].handleType) ? 'update' : materials0Data[iFIndex].handleType; + materials0Data[iFIndex] = { ...materials0Data[iFIndex], ...addState }; + } + }); + } + + const newTableDataRowAdd = JSON.parse(JSON.stringify(tableDataRowAdd)); + // newTableDataRowAdd.sId = commonUtils.createSid(); + materials0Data.push(newTableDataRowAdd); + if (selectConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo') { + materialsData.push(newTableDataRowAdd); + } + }); + if (selectConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo') { + addState.materialsData = materialsData; + addState.materialsDelData = materialsDelData; + } else { + addState.materials0Data = materials0Data; + addState.materials0DelData = materials0DelData; + } + + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + if (commonUtils.isJSON(selectData[0].sParams)) { + const paramsNewData = JSON.parse(selectData[0].sParams); + if (commonUtils.isJSON(tableData[iIndex].sParams)) { + const paramsOldData = JSON.parse(tableData[iIndex].sParams); + const iNewIndex = paramsNewData.findIndex(item => item.sParamType === 'sWorkOrder'); + if (iNewIndex > -1) { + const iOldIndex = paramsOldData.findIndex(item => item.sParamType === 'sWorkOrder'); + if (iOldIndex > -1) { + paramsOldData[iOldIndex].data = { ...paramsOldData[iOldIndex].data, ...paramsNewData[iNewIndex].data }; + } else { + paramsOldData.push(paramsNewData[iNewIndex]); + } + tableData[iIndex].sParams = JSON.stringify(paramsOldData); + } + } else { + tableData[iIndex].sParams = selectData[0].sParams; + } + } + console.log('materials0DelData', materials0DelData); + + this.props.onSaveState({ ...addState }); + } + } else if (selectConfig.sControlName?.startsWith('BtnPopupEdit')) { + if (!Array.isArray(selectData)) return; + if (other?.index >= 0 && tableData[other.index]) { + tableData[other.index][selectConfig.sActiveKey] = JSON.stringify(selectData || []); + if (!tableData[other.index].handleType) { + tableData[other.index].handleType = 'update'; + } + } + this.props.onSaveState({ [`${tbName}Data`]: [...tableData] }); + } else if (selectConfig.sControlName && selectConfig.sControlName === 'BtnPopup.dPreMatProductQty') { /* 消耗备料 */ + let { slaveData, slaveSelectedRowKeys } = this.props; + const addState = {}; + if (commonUtils.isEmptyArr(slaveData)) { + slaveData = []; + } + const iIndex = this.handleGetSelectedIndex(this.props, 'slave'); + let dModifyProductQty = 0; + const jsonData = []; + let jsonStr = ''; + if (commonUtils.isNotEmptyArr(selectData)) { + // eslint-disable-next-line no-unused-vars + selectData.forEach((item, index) => { + dModifyProductQty += commonUtils.isNull(item.dModifyProductQty, 0); + const obj = {}; + obj.sSlaveId = commonUtils.isNotEmptyObject(item.sSlaveId) ? item.sSlaveId : item.sId; + obj.sId = item.sId; + obj.dModifyProductQty = commonUtils.isNotEmptyNumber(item.dModifyProductQty) ? item.dModifyProductQty : 0; + jsonData.push(obj); + }); + addState.dPreMatProductQty = dModifyProductQty; + addState.handleType = commonUtils.isEmpty(tableData[iIndex].handleType) ? 'update' : tableData[iIndex].handleType; + if (commonUtils.isNotEmptyArr(jsonData)) { + jsonStr = commonUtils.isNotEmptyArr(jsonData) ? JSON.stringify(jsonData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ + addState.sPreMatProduct = jsonStr; + } + if (iIndex > -1) { + slaveData[iIndex] = { ...slaveData[iIndex], ...addState }; + } + addState.slaveData = slaveData; + this.props.onSaveState({ ...addState }); + } else { + addState.dPreMatProductQty = 0; + addState.handleType = commonUtils.isEmpty(tableData[iIndex].handleType) ? 'update' : tableData[iIndex].handleType; + addState.sPreMatProduct = ''; + if (iIndex > -1) { + slaveData[iIndex] = { ...slaveData[iIndex], ...addState }; + } + addState.slaveData = slaveData; + this.props.onSaveState({ ...addState }); + } + } else if (selectConfig.sName === 'sOrderNo') { /* 选择试制订单号 */ + const { controlData: controlDataNew, packData } = this.props; + const addReturn = this.props.onSelectCommonPopup(currentPaneName, selectConfig, selectData, tbName, true); + const addState = {}; + const tableData = commonUtils.isNotEmptyObject(addReturn) && commonUtils.isNotEmptyArr(addReturn[tbName + 'Data']) ? addReturn[tbName + 'Data'] : []; + if (commonUtils.isNotEmptyArr(tableData)) { + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) && commonUtils.isNotEmptyObject(tableSelectedRowKeys[0]) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + const tableDataRow = iIndex > -1 ? tableData[iIndex] : {}; + /* 如果packData只有一条数据 则同步合版数据 及增加控制表合版备注 */ + if (commonUtils.isNotEmptyArr(packData) && packData.length === 1 && packData[0].sSlaveId === tableDataRow.sId) { + let packDataRow = packData[0]; + const sControlId = packDataRow.sControlId; + packDataRow = this.handlePackDataAdd(tableDataRow, 0, sControlId); + packDataRow.dCombineQty = 1; + packData[0] = { ...packData[0], ...packDataRow } + + if (commonUtils.isNotEmptyObject(packData[0])) { + const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty, sCombinePartsName } = packData[0]; + const tableCombineSelectedData = []; + const jsonObj = {}; + jsonObj.sId = sId; + jsonObj.sProductNo = sProductNo; /* 产品编号 */ + jsonObj.dCombineQty = commonUtils.isNotEmptyNumber(dCombineQty) ? dCombineQty : 0; /* 排版数 */ + jsonObj.dProductQty = commonUtils.isNotEmptyNumber(dProductQty) ? dProductQty : 0; /* 生产数 */ + jsonObj.dFactProductQty = commonUtils.isNotEmptyNumber(dFactProductQty) ? dFactProductQty : 0; /* 实际生产数 */ + jsonObj.sCombinePartsName = sCombinePartsName; /* 合版部件名称 */ + tableCombineSelectedData.push(jsonObj); + const sCombinedMemo = commonUtils.isNotEmptyArr(tableCombineSelectedData) ? JSON.stringify(tableCombineSelectedData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ + // const controlDataNew =commonUtils.isNotEmptyArr(addState.controlData)? addState.controlData: controlDataOld; + if (commonUtils.isNotEmptyArr(controlDataNew)) { + const iControlIndex = controlDataNew.findIndex(item => item.sId === sControlId); + if (iControlIndex > -1) { + controlDataNew[iControlIndex].sCombinedMemo = sCombinedMemo; + controlDataNew[iControlIndex].sPartsName = tableDataRow.sProductName; + } + addState.controlData = controlDataNew; + } + } + } else if (packData.length > 1) { + const packFilterData = packData.filter(item => item.sSlaveId === tableDataRow.sId); + if (commonUtils.isNotEmptyArr(packFilterData)) { + packFilterData.forEach((itemPack, index) => { + let packDataRow = itemPack; + const sControlId = packDataRow.sControlId; + packDataRow = this.handlePackDataAdd(tableDataRow, 0, sControlId); + // packDataRow.dCombineQty = 1; + const pIndex = packData.findIndex(item => item.sId === itemPack.sId); + if (pIndex > -1) { + packData[pIndex] = { ...packData[pIndex], ...packDataRow }; /* 根据选中的从表 找到所有的合版数据,将合版数据中的产品换成切换后的产品 */ + let sCombinedMemoStr = ''; /* 将控制表合版信息中的产品换成新选择的产品 */ + if (commonUtils.isNotEmptyArr(controlDataNew)) { + const iControlIndex = controlDataNew.findIndex(item => item.sId === sControlId); + if (iControlIndex > -1) { + sCombinedMemoStr = controlDataNew[iControlIndex].sCombinedMemo; + if (sCombinedMemoStr) { + const sCombinedMemoArr = commonUtils.isNotEmptyObject(sCombinedMemoStr) ? JSON.parse(sCombinedMemoStr) : {}; + if (commonUtils.isNotEmptyArr(sCombinedMemoArr)) { + const iIndex = sCombinedMemoArr.findIndex(item => item.sId === itemPack.sId); + if (iIndex > -1) { + const addState = {}; + addState.sProductId = tableDataRow.sProductId; /* 产品id */ + addState.sCustomerId = tableDataRow.sCustomerId; /* 客户id */ + addState.sCustomerName = tableDataRow.sCustomerName; /* 客户名称 */ + addState.sProductName = tableDataRow.sProductName; /* 产品名称 */ + addState.sProductNo = tableDataRow.sProductNo; /* 产品编号 */ + sCombinedMemoArr[iIndex] = { ...sCombinedMemoArr[iIndex], ...addState }; + const sCombinedMemo = commonUtils.isNotEmptyArr(sCombinedMemoArr) ? JSON.stringify(sCombinedMemoArr) : ''; /* JSON对象转换为字符串存放到合版信息中 */ + controlDataNew[iControlIndex].sCombinedMemo = sCombinedMemo; + controlDataNew[iControlIndex].sPartsName = tableDataRow.sProductName; + } + } + } + } + } + } + }); + addState.controlData = controlDataNew; + } + + } + addState.packData = packData; + this.props.onSaveState({ [`${tbName}Data`]: tableData, ...addState }); + } + + } + else { + this.props.onSelectCommonPopup(currentPaneName, selectConfig, selectData, tbName); + } + }; render() { const { masterData } = this.props; const imgSrc = commonBusiness.handleAddIcon(masterData); @@ -7451,12 +8237,13 @@ export default (ChildComponent) => { onBtnPreview={this.handleBtnPreview} onSelectCommonPopupProduct={this.handleSelectCommonPopupProduct} onResolveSinglePQty={this.handleResolveSinglePQty} - onGetDataOne ={this.handleGetDataOne} + onGetDataOne={this.handleGetDataOne} onParamsOk={this.handleParamsOk} onReportParamsOk={this.handleReportParamsOk} - onCheckParamChange ={this.handleCheckParamChange} + onCheckParamChange={this.handleCheckParamChange} onDropDownBlur={this.handleTableBlur} onDataRowShowParam={this.handleShowParam} + onSelectCommonPopup={this.handleSelectCommonPopup} /* 送货单个性化放大镜弹窗 */ /> ); } diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js index b7c378c..a7a3fa5 100644 --- a/src/components/Common/CommonComponent/index.js +++ b/src/components/Common/CommonComponent/index.js @@ -605,15 +605,11 @@ export default class CommonComponent extends Component { /* 主表时才赋值value */ if (this.props.bTable) { if (this.props.showConfig.bMultipleChoice) { - if (this.state.dataValue) { - obj.value = this.state.dataValue.split(','); - } else { - obj.value = []; - } + obj.value = !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(",") : []; /* 数据值 */ } else { - obj.value = this.state.dataValue; + obj.value = this.state.dataValue; /* 数据值 */ } - !this.props.bNewForm && (obj.className = styles.editSelect); + obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; } if (this.props.showConfig.iDropWidth > 0) { obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js index d9c4196..a788e96 100644 --- a/src/components/Common/CommonHooks/useCommonBase.js +++ b/src/components/Common/CommonHooks/useCommonBase.js @@ -56,7 +56,7 @@ const useCommonBase = props => { } const { sModelsId, app } = state; const formData = await handleGetModelConfig({ sModelsId }); - + const addState = {}; let pageRoute = props.sModelType; // 如果是弹窗且没有pageLayout,则认为是commonBill @@ -70,7 +70,7 @@ const useCommonBase = props => { formData[0].gdsconfigformslave.push({ sId: commonUtils.createSid(), sControlName: 'pageLayout', - sDefault: JSON.stringify([["slave"],[{"configList":[{"sName":"slave","sTabName":"","sEnglishTabName":"","sBig5TabName":"","showType":"table","bHideTitle":true,"tableBtnsConfig":[]}],"mode":"advanced","height":"100%","width":"100%"}]]) + sDefault: JSON.stringify([["slave"], [{ "configList": [{ "sName": "slave", "sTabName": "", "sEnglishTabName": "", "sBig5TabName": "", "showType": "table", "bHideTitle": true, "tableBtnsConfig": [] }], "mode": "advanced", "height": "100%", "width": "100%" }]]) }) } else if (pageRoute === '/indexPage/commonBill') { const { sLanguage } = app.userinfo; @@ -79,15 +79,15 @@ const useCommonBase = props => { if (index === 0) { item.sGrd = 'master'; tableList.push('master'); - tabConfig.push({"configList":[{"sName":"master","showType":"form","bHideTitle":true,"defaultEnabled":true}],"mode":"advanced","height":"auto","width":"100%"}); + tabConfig.push({ "configList": [{ "sName": "master", "showType": "form", "bHideTitle": true, "defaultEnabled": true }], "mode": "advanced", "height": "auto", "width": "100%" }); } else { const tablename = `slave${index - 2 < 0 ? '' : index - 2}`; item.sGrd = tablename; tableList.push(tablename); if (!tabConfig[1]) { - tabConfig.push({"configList":[],"mode":"advanced"}); + tabConfig.push({ "configList": [], "mode": "advanced" }); } - tabConfig[1].configList.push({"sName":tablename,"sTabName":item[sLanguage],"showType":"table","defaultEnabled":true,"bHideTitle":true}); + tabConfig[1].configList.push({ "sName": tablename, "sTabName": item[sLanguage], "showType": "table", "defaultEnabled": true, "bHideTitle": true }); } }); formData[0].gdsconfigformslave.push({ @@ -115,14 +115,107 @@ const useCommonBase = props => { * @param {Function} callback - 回调函数 */ const handleSaveState = (values, callback) => { + if (commonUtils.isNotEmptyObject(values.masterConfig) && values.masterConfig.bMerged) { + delete values.masterConfig; + } + Object.keys(values).forEach(key => { + // 如果将要保存的slaveConfig是合并过的,则删除掉 + if (key.startsWith('slave') && key.endsWith('Config') && commonUtils.isNotEmptyObject(values[key]) && values[key].bMerged) { + delete values[key]; + } + }); + // 如果改变了主表数据,遍历下所有配置sButtonEnabled的字段,生成配置 + const addState = {}; + const sRulesJsonTotal = handleGetRulesJsonTotal(values); + if (sRulesJsonTotal) { + addState.sRulesJsonTotal = sRulesJsonTotal; + } const cbState = {}; if (typeof callback === "function") { cbState.callbackRefresh = callbackRefresh + 1; cbState.callback = callback; } + console.log(values, 'values'); + dispatch(["saveState", { ...values, ...cbState }]); }; + // 遍历下所有配置sButtonEnabled的字段,生成配置 + + const handleGetRulesJsonTotal = (values) => { + const { masterConfig: masterConfig1, masterData: masterData1 } = values; + const { masterConfig: masterConfig2, masterData: masterData2, sRulesJsonTotal } = state; + + const masterConfig = masterConfig1 || masterConfig2; + const masterData = masterData1 || masterData2; + + const condition0 = commonUtils.isEmptyObject(masterConfig1) && commonUtils.isEmptyObject(masterData1); + const condition1 = commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData1); + const condition2 = commonUtils.isNotEmptyObject(masterConfig) && sRulesJsonTotal === undefined && commonUtils.isNotEmptyObject(masterData); + const condition3 = commonUtils.convertObjToStr(masterData1) === commonUtils.convertObjToStr(masterData2) && sRulesJsonTotal !== undefined; + + const { sRulesTableList = [] } = state; + let condition4 = false; + if (sRulesTableList.length) { + sRulesTableList.forEach(tableName => { + const { [`${tableName}Data`]: tableData1 } = values; + const { [`${tableName}Data`]: tableData2 = [] } = state; + if (tableData1 !== undefined && commonUtils.convertObjToStr(tableData1) !== commonUtils.convertObjToStr(tableData2)) { + condition4 = true; + } + }) + } + + if (condition0 || !(condition1 || condition2) || condition3) { + if (!condition4) { + return ''; + } + } + + const { gdsconfigformslave = [] } = masterConfig; + return gdsconfigformslave.reduce((result, config) => { + const { sButtonEnabled } = config; + const sRulesJson = commonUtils.convertStrToObj(sButtonEnabled, []); + if (commonUtils.isNotEmptyArr(sRulesJson)) { + for (let i = 0; i < sRulesJson.length; i += 1) { + const rule = sRulesJson[i] || {}; + const { condition = [] } = rule; + let flag = false; // 是否满足条件 + for (let j = 0; j < condition.length; j += 1) { + const item = condition[j]; + const { bFilterName, bFilterCondition, bFilterValue, jsCondition } = item; + if (jsCondition) { + flag = commonFunc.getEvalResult({ + props: { ...props, ...state, ...values }, + str: jsCondition, + defaultValue: false, + reocrdRules: true, + onSaveState: handleSaveState, + }) + } else if (bFilterName !== undefined && bFilterCondition !== undefined && bFilterValue !== undefined) { + const currentValue = masterData[bFilterName]; + flag = handleCompareValues(currentValue, bFilterValue, bFilterCondition); + } + if (!flag) { + break; + } + } + if (flag) { + // console.log('=====匹配的规则', config, rule); + const columnList = Object.keys(rule).filter(columnName => columnName && columnName.indexOf('Column') !== -1); + columnList.forEach((columnName) => { + if (commonUtils.isEmptyArr(result[columnName])) { + result[columnName] = []; + } + result[columnName] = Array.from(new Set([...result[columnName], ...rule[columnName]])); + }); + // return result; + } + } + } + return result; + }, {}); + } /** * 获取模型配置 * @param {Object} params - 参数对象 @@ -132,9 +225,8 @@ const useCommonBase = props => { const handleGetModelConfig = async params => { const { sModelsId } = params; const { token, formSrcRoute } = state; - const configUrl = `${ - commonConfig.server_host - }business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; + const configUrl = `${commonConfig.server_host + }business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; const configReturn = (await commonServices.getService(token, configUrl)) .data; let formData = []; @@ -238,9 +330,8 @@ const useCommonBase = props => { } const configDataId = configData.sId; - const dataUrl = `${ - commonConfig.server_host - }business/getBusinessDataByFormcustomId/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; + const dataUrl = `${commonConfig.server_host + }business/getBusinessDataByFormcustomId/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; const dataReturn = (await commonServices.postValueService( token, condition, @@ -325,9 +416,8 @@ const useCommonBase = props => { let treeData = []; const expandedKeys = []; const configDataId = configData.sParentId; - const dataUrl = `${ - commonConfig.server_host - }filterTree/getFilterTree/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; + const dataUrl = `${commonConfig.server_host + }filterTree/getFilterTree/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; const dataReturn = (await commonServices.postValueService( token, condition, @@ -535,8 +625,8 @@ const useCommonBase = props => { iIndex > -1 ? iIndex : data.findIndex( - itemData => itemData.sSlaveId === selectedRowKeys[0] - ); + itemData => itemData.sSlaveId === selectedRowKeys[0] + ); if (iIndex > -1) { conditonValues[fieldNameFilter] = data[iIndex][fieldName]; } @@ -590,9 +680,8 @@ const useCommonBase = props => { conditonValues: {} }; } - const url = `${commonConfig.server_host}business/getSelectLimit/${ - showConfig.sId - }?sModelsId=${state.sModelsId}&sName=${formSrcRoute}`; + const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId + }?sModelsId=${state.sModelsId}&sName=${formSrcRoute}`; /* 参数 */ let conditonValues = getSqlCondition(showConfig, name, record); if (record?.conditonValues) { @@ -705,8 +794,8 @@ const useCommonBase = props => { iIndex > -1 ? iIndex : dataCondition.findIndex( - itemData => itemData.sSlaveId === selectedRowKeys[0] - ); + itemData => itemData.sSlaveId === selectedRowKeys[0] + ); if (iIndex > -1) { data = data.filter( item => @@ -804,8 +893,8 @@ const useCommonBase = props => { slaveSelectedData = commonUtils.isEmpty(slaveSelectedData) ? [] : slaveSelectedData.filter(item => - selectedRowKeys.toString().includes(item.sSlaveId) - ); + selectedRowKeys.toString().includes(item.sSlaveId) + ); selectedRowKeys.forEach(item => { const iIndex = slaveSelectedData.findIndex( selectItem => selectItem.sSlaveId === item @@ -829,7 +918,7 @@ const useCommonBase = props => { !commonUtils.isEmpty(sFieldName) && (commonUtils.isEmptyArr(state[`${name}SelectedRowKeys`]) || selectedRowKeys.toString() !== - state[`${name}SelectedRowKeys`].toString()) + state[`${name}SelectedRowKeys`].toString()) ) { tableConfig.gdsconfigformslave .filter( @@ -871,8 +960,8 @@ const useCommonBase = props => { if (name === "slave0") { const viewRow = slave0SelectedRowKeys.length ? slave0Data?.filter(item => - slave0SelectedRowKeys.includes(item.sId) - )[0] + slave0SelectedRowKeys.includes(item.sId) + )[0] : {}; if (viewRow?.sAbnormalEventId) { handleSaveState({ @@ -1140,7 +1229,7 @@ const useCommonBase = props => { (sFieldName === "sWareHouseId" || sFieldName === "sWareHouseNo" || sFieldName === "sWareHouseName") && - sModelsType.includes("materialsStock/productionmaterialsadjust") + sModelsType.includes("materialsStock/productionmaterialsadjust") ? { ...item } : { ...item, [sFieldName]: changeValue[sFieldName] }; if ( @@ -1162,8 +1251,8 @@ const useCommonBase = props => { : tableDataRow.handleType; const models = sModelsType.includes("sales/") || - sModelsType.includes("manufacture/") || - sModelsType.includes("productStock/") + sModelsType.includes("manufacture/") || + sModelsType.includes("productStock/") ? "Product" : "Materials"; @@ -1258,9 +1347,8 @@ const useCommonBase = props => { /* 待用数据声明 */ const sTabId = props.app.currentPane.key; /* 当前标签页TabId */ /* 接口地址 */ - const sNameUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${ - showConfig.sActiveId - }?sModelsId=${showConfig.sActiveId}&sName=${formSrcRoute}`; + const sNameUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${showConfig.sActiveId + }?sModelsId=${showConfig.sActiveId}&sName=${formSrcRoute}`; const CallBackRecord = handleCallBackRecord; /* 字段名,主从表,字段名 */ /* newRecord时,如果是新增产品,则要带客户过去 */ const addStata = {}; @@ -2128,9 +2216,8 @@ const useCommonBase = props => { changeValue: sValue, sButtonParam: btn }); - const url = `${ - commonConfig.server_host - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; + const url = `${commonConfig.server_host + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; const returnData = (await commonServices.postValueService( token, value, @@ -2657,7 +2744,160 @@ const useCommonBase = props => { } return tableConfigNew; }; + /* 通用弹窗 选择数据带回窗体 */ + const handleSelectCommonPopup = (currentPaneName, selectConfig, selectData, tbName, isWait) => { + // 如果配置了sAfterClickInstruct,先走指令集再走原逻辑,否值直接走原逻辑 + const { sAfterClickInstruct, showName } = selectConfig; + if (sAfterClickInstruct) { + instructSet({ + ...props, + ...state, + slavepupData: selectData, + btnConfig: { sInstruct: sAfterClickInstruct, showName }, + onSaveState: handleSaveState, + callback: () => { + handleSelectCommonPopupNew(currentPaneName, selectConfig, selectData, tbName, isWait); + } + }) + } else { + if (typeof isWait === 'boolean' && isWait) { + return handleSelectCommonPopupNew(currentPaneName, selectConfig, selectData, tbName, isWait); + } else { + handleSelectCommonPopupNew(currentPaneName, selectConfig, selectData, tbName); + } + } + }; + const handleSelectCommonPopupNew = (currentPaneName, selectConfig, selectData, tbName, isWait) => { + const { + [`${tbName}SelectedRowKeys`]: tableSelectedRowKeys, masterData, + controlData, controlSelectedRowKeys, sModelsId, + } = state; + const { sOnChangeInstruct, showName } = selectConfig; + const type = 'change'; + const onChangeNew = commonUtils.convertStrToObj(sOnChangeInstruct, {}); + const instructType = onChangeNew[type]; + // 回弹字段直接设置单价 + async function setProductPrice(tableDataRowAdd, item, props) { + if (selectConfig.sName === 'sProductId' || selectConfig.sName === 'sProductName' || selectConfig.sName === 'sProductNo') { + const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`; + const { sCustomerId } = masterData; /* 增加客户id参数 */ + const value = { + sProName: 'Sp_Cashier_GetProductPrice', + paramsMap: { + sProductGuid: item.sId, + sCustomerId, + }, + }; + const returnData = (await commonServices.postValueService(props.app.token, value, url)).data; + if (returnData.code === 1) { + tableDataRowAdd.dNProductPrice = returnData.dataset.rows[0].dataSet.outData[0].dPrice; /* 产品单价 */ + const dProofingMoney = commonUtils.convertToNum(tableDataRowAdd.dProofingMoney); /* 打样金额 */ + const dPlateMoney = commonUtils.convertToNum(tableDataRowAdd.dPlateMoney); /* 制版金额 */ + const dKnifeMouldMoney = commonUtils.convertToNum(tableDataRowAdd.dKnifeMouldMoney); /* 刀模金额 */ + const dProductQty = commonUtils.convertToNum(tableDataRowAdd.dProductQty); /* 数量 */ + const dCurrencyRate = commonUtils.convertIsNotNumToNumber1(masterData.dCurrencyRate); /* 汇率 */ + const { dNetPrice } = props.app.decimals; + if (dProductQty === 0 || (dProofingMoney === 0 && dPlateMoney === 0 && dKnifeMouldMoney === 0)) { + const dProductForeignPrice = returnData.dataset.rows[0].dataSet.outData[0].dPrice; + tableDataRowAdd.dProductForeignPrice = dProductForeignPrice; + tableDataRowAdd.dProductPrice = commonUtils.convertFixNum(dProductForeignPrice * dCurrencyRate, dNetPrice); + } + } + return tableDataRowAdd; + } else { + return tableDataRowAdd; + } + } + let { [`${tbName}Data`]: tableData, [`${tbName}Pagination`]: pagination = {} } = state; + let addReturn = {}; + if (commonUtils.isNotEmptyArr(tableData) && commonUtils.isNotEmptyArr(selectData)) { + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) && commonUtils.isNotEmptyObject(tableSelectedRowKeys[0]) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + const iControlIndex = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ? controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]) : -1; /* 控制表 */ + selectData.forEach(async (item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + const sName = selectConfig.sKeyUpFilter; /* 将后台配置筛选字段作为 列字段 */ + let sValue = ''; + if (iIndex > -1) { + newCopyTo.slave = tableData[iIndex]; + sValue = tableData[iIndex][sName]; + } + if (iControlIndex > -1) { + newCopyTo.control = controlData[iControlIndex]; + } + /* 第一条数据若字段值为空或者只有一条数据时 则添加到该行 否则新增一行 */ + if (selectData.length === 1 || (index === 0 && commonUtils.isEmptyObject(sValue))) { + let tableDataRow = {}; // 取默认值 + if (tbName === 'master') { + tableDataRow = { ...tableData, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + tableData = tableDataRow; + tableData.handleType = commonUtils.isEmpty(tableData.handleType) ? 'update' : tableData.handleType; + if (instructType) { + handleExecInstructSet({ + type, + sInstruct: instructType, + showName: `${showName}-${type === 'blur' ? '离焦' : '变化'}`, + }); + } + + } else { + tableDataRow = { ...tableData[iIndex] }; + if (tbName === 'slave') { + tableDataRow.sSqlConditionId = tableDataRow.sId; + } + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + + tableData[iIndex] = tableDataRow; + tableData[iIndex].handleType = commonUtils.isEmpty(tableData[iIndex].handleType) ? 'update' : tableData[iIndex].handleType; + tableData[iIndex] = await setProductPrice(tableData[iIndex], item, props); + if (instructType) { + handleExecInstructSet({ + type, + sInstruct: instructType, + showName: `${showName}-${type === 'blur' ? '离焦' : '变化'}`, + }); + } + } + } else { + let tableDataRowAdd = handleTableAdd(tbName, true); + if (tbName === 'slave') { + tableDataRowAdd.sSqlConditionId = tableDataRowAdd.sId; + } + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + tableDataRowAdd = await setProductPrice(tableDataRowAdd, item, props); + if (instructType) { + handleExecInstructSet({ + type, + sInstruct: instructType, + showName: `${showName}-${type === 'blur' ? '离焦' : '变化'}`, + }); + } + tableData.push(tableDataRowAdd); + } + + pagination = { + ...pagination, + total: tableData.length, + } + if (tbName === 'master') { + const result = handleMasterChange(tbName, selectConfig.sName, {}, null, null, true, tableData); + tableData = result.masterData; + } + + const addState = { [`${tbName}Data`]: tableData, [`${tbName}Pagination`]: pagination }; + + if (typeof isWait !== 'boolean') { + handleSaveState(addState); + } + + }); + if (typeof isWait === 'boolean' && isWait) { + addReturn = { [`${tbName}Data`]: tableData, [`${tbName}Pagination`]: pagination }; + return addReturn; + } + } + }; const returnProps = { ...props, ...state, @@ -2687,7 +2927,8 @@ const useCommonBase = props => { onMesTableLineCopy: handleMesTableLineCopy, // 表格行复制 onCopyTo: handleCopyTo, // 复制到 onMergeTableConfig: handleMergeTableConfig, // 合并config配置和所有sButtonEnabled配置 - awaitPromiseReturn: awaitPromiseReturn + awaitPromiseReturn: awaitPromiseReturn, + onSelectCommonPopup: handleSelectCommonPopup }; // 切换页面时,加载角标数据 diff --git a/src/components/Common/CommonSubBillEvent.js b/src/components/Common/CommonSubBillEvent.js index 0eef840..792bf95 100644 --- a/src/components/Common/CommonSubBillEvent.js +++ b/src/components/Common/CommonSubBillEvent.js @@ -5564,7 +5564,7 @@ export default (ChildComponent) => { onResolveMachineComposing={this.handleResolveMachineComposing} onContextMenuOk={this.handleContextMenuOk} orderNum={this.orderNum} - // onSelectCommonPopup={this.handleSelectCommonPopup} /* 送货单个性化放大镜弹窗 */ + onSelectCommonPopup={this.handleSelectCommonPopup} /* 送货单个性化放大镜弹窗 */ /> ); } diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 0ddd7b1..c7742c9 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -215,7 +215,7 @@ class CommonTableRc extends React.Component { }; this.rowKey = commonUtils.isNotEmptyObject(props.tableProps) && - !commonUtils.isEmpty(props.tableProps.rowKey) + !commonUtils.isEmpty(props.tableProps.rowKey) ? props.tableProps.rowKey : "sId"; /* 表格主键 */ this.config = {}; /* 配置信息(基础)(数据格式:对象) */ @@ -322,15 +322,15 @@ class CommonTableRc extends React.Component { this.props.app.currentPane && (this.props.app.currentPane.route.indexOf("commonList") !== -1 || this.props.app.currentPane.route.indexOf("productionScheduleTree") !== - -1) + -1) ) { if (this.tableHeight !== "100%" && this.tableHeight !== 0) { if (this.props.name !== "report") { this.mydiv.getElementsByClassName( "ant-table-body" )[0].style.height = this.tableHeight - ? this.tableHeight + "px" - : 80 + "px"; + ? this.tableHeight + "px" + : 80 + "px"; } } } @@ -434,7 +434,7 @@ class CommonTableRc extends React.Component { this.props.updateRowNumTime !== nextState.updateRowNumTime || enabled !== nextState.enabled || JSON.stringify(this.props.isDragAndDrop) !== - JSON.stringify(nextProps.isDragAndDrop) || + JSON.stringify(nextProps.isDragAndDrop) || // JSON.stringify(headerColumn) !== JSON.stringify(nextState.headerColumn) || JSON.stringify(this.props.config) !== JSON.stringify(nextProps.config) || JSON.stringify(tableColumn) !== JSON.stringify(nextState.tableColumn) || @@ -442,21 +442,21 @@ class CommonTableRc extends React.Component { JSON.stringify(totalData) !== JSON.stringify(nextState.totalData) || JSON.stringify(totalData1) !== JSON.stringify(nextState.totalData1) || JSON.stringify(selectedRowKeys) !== - JSON.stringify(nextState.selectedRowKeys) || + JSON.stringify(nextState.selectedRowKeys) || JSON.stringify(slaveInfoSelectedRowKeys) !== - JSON.stringify(nextState.slaveInfoSelectedRowKeys) || + JSON.stringify(nextState.slaveInfoSelectedRowKeys) || JSON.stringify(expKeys) !== JSON.stringify(nextState.expKeys) || JSON.stringify(previewVisible) !== - JSON.stringify(nextState.previewVisible) || + JSON.stringify(nextState.previewVisible) || JSON.stringify(commonPopupVisible) !== - JSON.stringify(nextState.commonPopupVisible) || + JSON.stringify(nextState.commonPopupVisible) || JSON.stringify(commonFieldPopupVisible) !== - JSON.stringify(nextState.commonFieldPopupVisible) || + JSON.stringify(nextState.commonFieldPopupVisible) || JSON.stringify(previewImage) !== JSON.stringify(nextState.previewImage) || JSON.stringify(filteredValue) !== - JSON.stringify(nextState.filteredValue) || + JSON.stringify(nextState.filteredValue) || JSON.stringify(this.props.tableProps.pagination) !== - JSON.stringify(nextProps.tableProps.pagination) || + JSON.stringify(nextProps.tableProps.pagination) || // JSON.stringify(this.props.tableProps.AutoTableHeight) !== JSON.stringify(nextProps.tableProps.AutoTableHeight) || JSON.stringify(nextProps.slaveInfo) !== slaveInfo || JSON.stringify(nextProps.realizeHeight) !== realizeHeight || @@ -658,7 +658,7 @@ class CommonTableRc extends React.Component { ? this.handleResize(index, column, isSlaveInfo) : null, bnotresize: bNotResize ? "bNotResize" : null, - onClick: () => {}, + onClick: () => { }, onMouseDown: () => { if (this.lastTdMouseOver) { return; @@ -733,8 +733,7 @@ class CommonTableRc extends React.Component { }); if (isSlaveInfo) { sessionStorage.setItem( - `${this.props.formId}_${ - this.props.config.sId + `${this.props.formId}_${this.props.config.sId }_info_headerColumns`, JSON.stringify(sortArr) ); @@ -866,7 +865,7 @@ class CommonTableRc extends React.Component { ...columns[initColumnIndexArr[0]], children: [ columns[initColumnIndexArr[0]].children[ - initColumnIndexArr[1] + initColumnIndexArr[1] ] ] }; @@ -934,7 +933,7 @@ class CommonTableRc extends React.Component { ...columns[initColumnIndexArr[0]], children: [ columns[initColumnIndexArr[0]].children[ - initColumnIndexArr[1] + initColumnIndexArr[1] ] ] }; @@ -1022,8 +1021,7 @@ class CommonTableRc extends React.Component { if (isSlaveInfo) { this.setState({ tableInfoColumn: columns }, () => { sessionStorage.setItem( - `${this.props.formId}_${ - this.props.config.sId + `${this.props.formId}_${this.props.config.sId }_info_headerColumns`, JSON.stringify(sortArr) ); @@ -1101,12 +1099,12 @@ class CommonTableRc extends React.Component { // let { selectedRowKeys } = this.props; const rowKey = tabType === "slaveInfo" && - commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) + commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ? this.props.slaveInfo.tableProps.rowKey : this.rowKey; let selectedRowKeys = tabType === "slaveInfo" && - commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) + commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ? this.props.slaveInfo.selectedRowKeys === undefined ? undefined : [...this.props.slaveInfo.selectedRowKeys] @@ -1366,12 +1364,12 @@ class CommonTableRc extends React.Component { : this.props.selectedRowKeys; const rowKey = tabType === "slaveInfo" && - commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) + commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ? this.props.slaveInfo.tableProps : this.rowKey; const rowClassName = commonUtils.isNotEmptyArr(selectedRowKeys) && - selectedRowKeys.indexOf(record[rowKey]) > -1 + selectedRowKeys.indexOf(record[rowKey]) > -1 ? `selected-record-row ${styleColor}` : commonUtils.isNotEmptyObject(styleColor) ? styleColor @@ -1607,11 +1605,10 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyArr(sPicturePath)) { sPicturePath[0].render = (value = "") => { const picHref = value.includes("xlyerpfiles") - ? `${ - commonConfig.server_host - }file/download?savePathStr=${encodeURIComponent( - value - )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}` + ? `${commonConfig.server_host + }file/download?savePathStr=${encodeURIComponent( + value + )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}` : value; return ( @@ -1630,11 +1627,10 @@ class CommonTableRc extends React.Component { fileList[0].lastIndexOf("/") + 1 ); fileName = fileName.substring(fileName.indexOf("_") + 1); - const picHref = `${ - commonConfig.server_host - }file/download?savePathStr=${encodeURIComponent( - value - )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`; + const picHref = `${commonConfig.server_host + }file/download?savePathStr=${encodeURIComponent( + value + )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`; const fileType = fileName .split(".") .pop() @@ -1722,12 +1718,11 @@ class CommonTableRc extends React.Component {
{value}
1 @@ -1739,12 +1734,11 @@ class CommonTableRc extends React.Component { "salveWybz3" ].includes(this.props.name) ? (
2 @@ -1759,13 +1753,12 @@ class CommonTableRc extends React.Component { "salveWybz3" ].includes(this.props.name) ? (
3 @@ -1989,9 +1982,8 @@ class CommonTableRc extends React.Component { colorIndex = colorIndex === -1 ? 0 : colorIndex; return ( { const { sModelType } = this.props.parentProps; if (sModelType !== "/indexMes/productionExec") return; @@ -2238,9 +2230,8 @@ class CommonTableRc extends React.Component { if (value === "1" || value === "✓") { return (
{commonUtils.isNotEmptyObject(t.sProcessName) ? t.sProcessName @@ -2492,169 +2480,169 @@ class CommonTableRc extends React.Component { return (
{// eslint-disable-next-line array-callback-return - sPartItem.map((t, i) => { - const sPartItemLength = sPartItem.length; - const ArrItemStr = t.split("#")[0]; /* 工序名称 */ - const ArrItemNum = t.split("#")[1]; /* 状态 */ - const ArrItemName = t.split("#")[2]; /* 机台名称 */ - const ArrItemBanZhu = t.split("#")[3]; /* 班组 */ - const ArrItemTime = t.split("#")[4]; /* 排单时间 */ - const ArrItemPCNum = t.split("#")[5]; /* 排程数 */ - const ArrItemSBNum = t.split("#")[6]; /* 上报数 */ - const ArrItem7Num = - commonUtils.isNotEmptyArr(t.split("#")) && - t.split("#").length > 8 - ? t.split("#")[8] - : ""; /* 包数 */ - const ArrItem8Num = - commonUtils.isNotEmptyArr(t.split("#")) && - t.split("#").length > 9 - ? t.split("#")[9] - : ""; /* 每包数量 */ - const ArrItem9Num = - commonUtils.isNotEmptyArr(t.split("#")) && - t.split("#").length > 10 - ? t.split("#")[10] - : ""; /* 零头数量 */ - let ArrItemNumChange = ""; - let icon; - // eslint-disable-next-line default-case - switch (Number(ArrItemNum)) { - case 0: - ArrItemNumChange = "未排程"; - icon = ( - - ); - break; - case 1: - ArrItemNumChange = "未完成"; - icon = ( - - ); - break; - case 2: - ArrItemNumChange = "生产中"; - icon = ( - - ); - break; - case 3: - ArrItemNumChange = "暂停"; - icon = ( - - ); - break; - case 4: - ArrItemNumChange = "取消"; - icon = ( - - ); - break; - case 5: - ArrItemNumChange = "完成"; - icon = ( - - ); - break; - } - // eslint-disable-next-line no-unused-vars - const content = ( -
-
- 工序名称: - {ArrItemStr} -
-
- 状态: - {ArrItemNumChange} -
-
- 机台名称: - {ArrItemName} -
-
- 班组: - {ArrItemBanZhu} -
-
- 排单时间: - {ArrItemTime} -
-
- 排程数: - {ArrItemPCNum} -
+ sPartItem.map((t, i) => { + const sPartItemLength = sPartItem.length; + const ArrItemStr = t.split("#")[0]; /* 工序名称 */ + const ArrItemNum = t.split("#")[1]; /* 状态 */ + const ArrItemName = t.split("#")[2]; /* 机台名称 */ + const ArrItemBanZhu = t.split("#")[3]; /* 班组 */ + const ArrItemTime = t.split("#")[4]; /* 排单时间 */ + const ArrItemPCNum = t.split("#")[5]; /* 排程数 */ + const ArrItemSBNum = t.split("#")[6]; /* 上报数 */ + const ArrItem7Num = + commonUtils.isNotEmptyArr(t.split("#")) && + t.split("#").length > 8 + ? t.split("#")[8] + : ""; /* 包数 */ + const ArrItem8Num = + commonUtils.isNotEmptyArr(t.split("#")) && + t.split("#").length > 9 + ? t.split("#")[9] + : ""; /* 每包数量 */ + const ArrItem9Num = + commonUtils.isNotEmptyArr(t.split("#")) && + t.split("#").length > 10 + ? t.split("#")[10] + : ""; /* 零头数量 */ + let ArrItemNumChange = ""; + let icon; + // eslint-disable-next-line default-case + switch (Number(ArrItemNum)) { + case 0: + ArrItemNumChange = "未排程"; + icon = ( + + ); + break; + case 1: + ArrItemNumChange = "未完成"; + icon = ( + + ); + break; + case 2: + ArrItemNumChange = "生产中"; + icon = ( + + ); + break; + case 3: + ArrItemNumChange = "暂停"; + icon = ( + + ); + break; + case 4: + ArrItemNumChange = "取消"; + icon = ( + + ); + break; + case 5: + ArrItemNumChange = "完成"; + icon = ( + + ); + break; + } + // eslint-disable-next-line no-unused-vars + const content = (
- 上报数: - {ArrItemSBNum} -
- {ArrItem7Num ? (
- 包数: - {ArrItem7Num} + 工序名称: + {ArrItemStr}
- ) : ( - "" - )} - {ArrItem8Num ? (
- 每包数量: - {ArrItem8Num} + 状态: + {ArrItemNumChange}
- ) : ( - "" - )} - {ArrItem9Num ? (
- 零头数量: - {ArrItem9Num} + 机台名称: + {ArrItemName}
- ) : ( - "" - )} -
- ); - // 数字转换图标 - return ( -
- {icon} - + 班组: + {ArrItemBanZhu} +
+
+ 排单时间: + {ArrItemTime} +
+
+ 排程数: + {ArrItemPCNum} +
+
+ 上报数: + {ArrItemSBNum} +
+ {ArrItem7Num ? ( +
+ 包数: + {ArrItem7Num} +
+ ) : ( + "" + )} + {ArrItem8Num ? ( +
+ 每包数量: + {ArrItem8Num} +
+ ) : ( + "" + )} + {ArrItem9Num ? ( +
+ 零头数量: + {ArrItem9Num} +
+ ) : ( + "" + )} +
+ ); + // 数字转换图标 + return ( +
- {ArrItemStr} - - {/*{ i + 1 === sPartItemLength ? '' : }*/} -
- ); - })} + {icon} + + {ArrItemStr} + + {/*{ i + 1 === sPartItemLength ? '' : }*/} +
+ ); + })}
); } @@ -2669,7 +2657,7 @@ class CommonTableRc extends React.Component { this.useVListNew = true; const sModelsType = commonUtils.isNotEmptyObject(this.props) && - commonUtils.isNotEmptyObject(this.props.app) + commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : ""; if ( @@ -2725,6 +2713,224 @@ class CommonTableRc extends React.Component { return (
{// eslint-disable-next-line array-callback-return; + sPartItem.map((t, i) => { + const sPartItemLength = sPartItem.length; + let colorValue = "#000000"; + if (t?.background) { + colorValue = t.background; + } else { + const sState = commonUtils.isEmpty(t.sState) + ? 4 + : t.sState; + switch ( + Number(sState) // 根据状态显示颜色 + ) { + case 0: + colorValue = "#000000"; /* 0:黑色 */ + break; + case 1: + colorValue = "#ff4d4f"; /* 1:红色 */ + break; + case 2: + colorValue = "#49aa19"; /* 2:绿色 */ + break; + case 3: + colorValue = "#49aa19"; /* 3:绿色 */ + break; + case 4: + colorValue = "#ff4d4f"; /* 4:红色 */ + break; + default: + colorValue = "#000000"; + } + } + return ( +
+ {commonUtils.isNotEmptyObject( + t.sMaterialsName + ) ? ( + + {t.sMaterialsName} + + ) : ( + "" + )} + {i + 1 === sPartItemLength ? ( + "" + ) : ( + + - + + )} +
+ ); + })} +
+ ); + }} + > +
+ {// eslint-disable-next-line array-callback-return; + sPartItem.map((t, i) => { + const sPartItemLength = sPartItem.length; + let colorValue = "#000000"; + if (t?.background) { + colorValue = t.background; + } else { + const sState = commonUtils.isEmpty(t.sState) + ? 4 + : t.sState; + switch ( + Number(sState) // 根据状态显示颜色 + ) { + case 0: + colorValue = "#000000"; /* 0:黑色 */ + break; + case 1: + colorValue = "#ff4d4f"; /* 1:红色 */ + break; + case 2: + colorValue = "#49aa19"; /* 2:绿色 */ + break; + case 3: + colorValue = "#49aa19"; /* 3:绿色 */ + break; + case 4: + colorValue = "#ff4d4f"; /* 4:红色 */ + break; + default: + colorValue = "#000000"; + } + } + return ( +
+ {commonUtils.isNotEmptyObject( + t.sMaterialsName + ) ? ( + + {t.sMaterialsName} + + ) : ( + "" + )} + {i + 1 === sPartItemLength ? ( + "" + ) : ( + + - + + )} +
+ ); + })} +
+ + ); + } else { + return itemStr; + } + }; + } + } else { + /* 无嵌套列头JSON列解析 */ + sMaterialsStatus[index].render = itemStr => { + if (commonUtils.isJSON(itemStr)) { + const sPartItem = JSON.parse(itemStr); + /* 取箭头弹出的窗体配置 */ + let showConfig = {}; + let linkStyle = ""; /* 弹窗 */ + if ( + commonUtils.isNotEmptyArr(this.props.config) && + commonUtils.isNotEmptyArr( + this.props.config.gdsconfigformslave + ) && + commonUtils.isNotEmptyStr("sMaterialsStatus") + ) { + const showConfigArr = this.props.config.gdsconfigformslave.filter( + item => item.sName === "sMaterialsStatus" && item.bVisible + ); + if (commonUtils.isNotEmptyArr(showConfigArr)) { + showConfig = showConfigArr[0]; + if ( + commonUtils.isNotEmptyObject(showConfig) && + showConfig.sDropDownType === "picArr" && + !commonUtils.isEmpty(showConfig.sActiveId) && + commonUtils.isEmptyArr(this.props.sGroupByList) + ) { + linkStyle = "sMaterialsStatusStyle"; + } + } + } + return ( + { + return ( +
+ {// eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { const sPartItemLength = sPartItem.length; let colorValue = "#000000"; @@ -2735,7 +2941,7 @@ class CommonTableRc extends React.Component { ? 4 : t.sState; switch ( - Number(sState) // 根据状态显示颜色 + Number(sState) // 根据状态显示颜色 ) { case 0: colorValue = "#000000"; /* 0:黑色 */ @@ -2771,17 +2977,15 @@ class CommonTableRc extends React.Component { @@ -2805,21 +3009,21 @@ class CommonTableRc extends React.Component {
); })} -
- ); +
+ ); + }} + > +
-
- {// eslint-disable-next-line array-callback-return; + {// eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { const sPartItemLength = sPartItem.length; let colorValue = "#000000"; @@ -2830,7 +3034,7 @@ class CommonTableRc extends React.Component { ? 4 : t.sState; switch ( - Number(sState) // 根据状态显示颜色 + Number(sState) // 根据状态显示颜色 ) { case 0: colorValue = "#000000"; /* 0:黑色 */ @@ -2868,13 +3072,13 @@ class CommonTableRc extends React.Component { onClick={ commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind( - this, - this.props.name, - showConfig.sName, - t, - i, - showConfig - ) + this, + this.props.name, + showConfig.sName, + t, + i, + showConfig + ) : null } > @@ -2887,230 +3091,14 @@ class CommonTableRc extends React.Component { "" ) : ( - )} -
- ); - })} -
- - ); - } else { - return itemStr; - } - }; - } - } else { - /* 无嵌套列头JSON列解析 */ - sMaterialsStatus[index].render = itemStr => { - if (commonUtils.isJSON(itemStr)) { - const sPartItem = JSON.parse(itemStr); - /* 取箭头弹出的窗体配置 */ - let showConfig = {}; - let linkStyle = ""; /* 弹窗 */ - if ( - commonUtils.isNotEmptyArr(this.props.config) && - commonUtils.isNotEmptyArr( - this.props.config.gdsconfigformslave - ) && - commonUtils.isNotEmptyStr("sMaterialsStatus") - ) { - const showConfigArr = this.props.config.gdsconfigformslave.filter( - item => item.sName === "sMaterialsStatus" && item.bVisible - ); - if (commonUtils.isNotEmptyArr(showConfigArr)) { - showConfig = showConfigArr[0]; - if ( - commonUtils.isNotEmptyObject(showConfig) && - showConfig.sDropDownType === "picArr" && - !commonUtils.isEmpty(showConfig.sActiveId) && - commonUtils.isEmptyArr(this.props.sGroupByList) - ) { - linkStyle = "sMaterialsStatusStyle"; - } - } - } - return ( - { - return ( -
- {// eslint-disable-next-line array-callback-return; - sPartItem.map((t, i) => { - const sPartItemLength = sPartItem.length; - let colorValue = "#000000"; - if (t?.background) { - colorValue = t.background; - } else { - const sState = commonUtils.isEmpty(t.sState) - ? 4 - : t.sState; - switch ( - Number(sState) // 根据状态显示颜色 - ) { - case 0: - colorValue = "#000000"; /* 0:黑色 */ - break; - case 1: - colorValue = "#ff4d4f"; /* 1:红色 */ - break; - case 2: - colorValue = "#49aa19"; /* 2:绿色 */ - break; - case 3: - colorValue = "#49aa19"; /* 3:绿色 */ - break; - case 4: - colorValue = "#ff4d4f"; /* 4:红色 */ - break; - default: - colorValue = "#000000"; - } - } - return ( -
- {commonUtils.isNotEmptyObject( - t.sMaterialsName - ) ? ( - - {t.sMaterialsName} - - ) : ( - "" - )} - {i + 1 === sPartItemLength ? ( - "" - ) : ( - - - - - )} -
- ); - })} -
- ); - }} - > -
- {// eslint-disable-next-line array-callback-return; - sPartItem.map((t, i) => { - const sPartItemLength = sPartItem.length; - let colorValue = "#000000"; - if (t?.background) { - colorValue = t.background; - } else { - const sState = commonUtils.isEmpty(t.sState) - ? 4 - : t.sState; - switch ( - Number(sState) // 根据状态显示颜色 - ) { - case 0: - colorValue = "#000000"; /* 0:黑色 */ - break; - case 1: - colorValue = "#ff4d4f"; /* 1:红色 */ - break; - case 2: - colorValue = "#49aa19"; /* 2:绿色 */ - break; - case 3: - colorValue = "#49aa19"; /* 3:绿色 */ - break; - case 4: - colorValue = "#ff4d4f"; /* 4:红色 */ - break; - default: - colorValue = "#000000"; - } - } - return ( -
- {commonUtils.isNotEmptyObject( - t.sMaterialsName - ) ? ( - - {t.sMaterialsName} - - ) : ( - "" - )} - {i + 1 === sPartItemLength ? ( - "" - ) : ( - - - - - )} -
- ); - })} +
+ ); + })}
); @@ -3154,14 +3142,70 @@ class CommonTableRc extends React.Component { }} > {// eslint-disable-next-line array-callback-return; + sPartItem.map((t, i) => { + // const sPartItemLength = sPartItem.length; + let colorValue = "#000000"; + const sState = commonUtils.isEmpty(t.sState) + ? 4 + : t.sState; + switch ( + Number(sState) // 根据状态显示颜色 + ) { + case 1: + colorValue = "#ff0000"; /* 1:红色 */ + break; + case 2: + colorValue = "#49aa19"; /* 2:绿色 */ + break; + case 3: + colorValue = "#ffff00"; /* 3:黄色 */ + break; + case 0: + colorValue = ""; /* 3:不要颜色 */ + break; + default: + colorValue = ""; + } + return ( +
+
{t.dSchedulHours}
+
+ ); + })} + + ); + } + }; + } + } else { + /* 无嵌套列头JSON列解析 */ + dynamicColumn[index].render = itemStr => { + if ( + commonUtils.isNotEmptyObject(itemStr) && + commonUtils.isJSON(itemStr) + ) { + const sPartItem = JSON.parse(itemStr); + return ( +
+ {// eslint-disable-next-line array-callback-return; sPartItem.map((t, i) => { // const sPartItemLength = sPartItem.length; let colorValue = "#000000"; - const sState = commonUtils.isEmpty(t.sState) - ? 4 - : t.sState; + const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState; switch ( - Number(sState) // 根据状态显示颜色 + Number(sState) // 根据状态显示颜色 ) { case 1: colorValue = "#ff0000"; /* 1:红色 */ @@ -3172,75 +3216,19 @@ class CommonTableRc extends React.Component { case 3: colorValue = "#ffff00"; /* 3:黄色 */ break; - case 0: - colorValue = ""; /* 3:不要颜色 */ - break; default: - colorValue = ""; + colorValue = "#666"; } return (
{t.dSchedulHours}
); })} -
- ); - } - }; - } - } else { - /* 无嵌套列头JSON列解析 */ - dynamicColumn[index].render = itemStr => { - if ( - commonUtils.isNotEmptyObject(itemStr) && - commonUtils.isJSON(itemStr) - ) { - const sPartItem = JSON.parse(itemStr); - return ( -
- {// eslint-disable-next-line array-callback-return; - sPartItem.map((t, i) => { - // const sPartItemLength = sPartItem.length; - let colorValue = "#000000"; - const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState; - switch ( - Number(sState) // 根据状态显示颜色 - ) { - case 1: - colorValue = "#ff0000"; /* 1:红色 */ - break; - case 2: - colorValue = "#49aa19"; /* 2:绿色 */ - break; - case 3: - colorValue = "#ffff00"; /* 3:黄色 */ - break; - default: - colorValue = "#666"; - } - return ( -
-
{t.dSchedulHours}
-
- ); - })}
); } else { @@ -3263,44 +3251,44 @@ class CommonTableRc extends React.Component { return (
{// eslint-disable-next-line array-callback-return; - sPartItem.map((t, i) => { - const sPartItemLength = sPartItem.length; - const sColor = t.sColor; - const dWidth = - t.dRate !== undefined && t.dRate !== 0 - ? `${t.dRate * 500}px` - : "100px"; - const content = ( -
-

{`${t.sName} :${t.sValue}`}

-
- ); - - return ( - -
- {t.sValue} + sPartItem.map((t, i) => { + const sPartItemLength = sPartItem.length; + const sColor = t.sColor; + const dWidth = + t.dRate !== undefined && t.dRate !== 0 + ? `${t.dRate * 500}px` + : "100px"; + const content = ( +
+

{`${t.sName} :${t.sValue}`}

- - ); - })} + ); + + return ( + +
+ {t.sValue} +
+
+ ); + })}
); } else { @@ -3673,14 +3661,14 @@ class CommonTableRc extends React.Component { ...this.props.tableProps, pagination: bPagination ? { - ...this.props.tableProps.pagination, - onChange: (current, size) => { - this.curPagination = { - current, - pageSize: size - }; - } + ...this.props.tableProps.pagination, + onChange: (current, size) => { + this.curPagination = { + current, + pageSize: size + }; } + } : false /* 表格是否分页 */, onChange: this.onChange }; @@ -4212,6 +4200,59 @@ class CommonTableRc extends React.Component { styleColorArrTotalM.styleColorArrTotalB = styleColorArrTotalB; return styleColorArrTotalM; }; + // 获取表格行按钮状态 + getTableBtnState = (btnName, record) => { + let result = false; + const { enabled, config, masterData, name, sUseInfo, bLimitOperate } = this.props; + result = enabled; + /* 订单占用,则该行锁定 不能操作 */ + const { sWorkOrderUsed } = record; + if (commonUtils.isNotEmptyObject(sWorkOrderUsed)) { + result = false; + } + /* 若红冲单据 则按钮锁定 不能操作 */ + if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sMinusSrcId) && masterData.sMinusType === '1') { + result = false; + } + if (btnName === 'BtnAdd' && bLimitOperate) { + result = false; + } + + const { sInstruct: sInstructStr } = config; + const sInstruct = commonUtils.convertStrToObj(sInstructStr, {}); + const { data = [] } = sInstruct; + + const btnConfig = data.find(item => item && item.name === btnName && item.enabled !== undefined); + if (btnConfig) { + const { enabled: enabledContent } = btnConfig; + if (typeof enabledContent === 'boolean') { + result = enabledContent; + } else if (enabledContent) { + const tempData = { + props: { + enabled + }, + master: masterData, + [name]: record + }; + + let strNew = enabledContent; + Object.keys(tempData).forEach(key => { + const reg = new RegExp(`${key}\\.`, "g"); + strNew = strNew.replace(reg, `tempData["${key}"].`); + }); + try { + const evalStr = eval("`" + strNew + "`"); + result = !!eval(evalStr); + // console.log('=====表格行按钮状态结果', result, { btnName, enabledContent, tempData, strNew, evalStr }); + } catch (error) { + console.log('=====表格行按钮状态错误', { error, enabledContent, strNew, tempData }); + } + } + } + + return result; + } /** 获取table的表头信息(主要是table中的表头信息合并,[{title:1-1},{title:1-2}]变成[{title:1,children:[{title:1},{title:2}]}]) type:是否过滤 */ getTableColumn = (headerColumn, type, props) => { // this.hasMergeHeader = false; @@ -4385,9 +4426,8 @@ class CommonTableRc extends React.Component { const marginLeft = this.props.bMutiSelect ? "6px" : "2px"; expandedAllIcon = (
); }, @@ -4963,7 +5039,7 @@ class CommonTableRc extends React.Component { } }); }, - onCancel() {} + onCancel() { } }); }} > @@ -4974,9 +5050,9 @@ class CommonTableRc extends React.Component { )} {props.mesAdd ? props.mesAdd({ - tableName: props.name, - tableClassName: this.state.tableClassName - }) + tableName: props.name, + tableClassName: this.state.tableClassName + }) : ""} {props.choosePlate()} @@ -5049,9 +5125,8 @@ class CommonTableRc extends React.Component { const { formId } = props; const { token } = props.app; const divProps = { - action: `${ - commonConfig.server_host - }file/upload?sModelsId=${formId}&token=${token}`, + action: `${commonConfig.server_host + }file/upload?sModelsId=${formId}&token=${token}`, onChange: this.handleUploadChange, accept: "*/*", showUploadList: false, @@ -5387,13 +5462,13 @@ class CommonTableRc extends React.Component { {...addProps} onClick={ props.enabled || - this.findIsUpdByControlName(this.props, "BtnAdd") + this.findIsUpdByControlName(this.props, "BtnAdd") ? this.addTbRow.bind(this, index) : null } > {props.enabled || - this.findIsUpdByControlName(this.props, "BtnAdd") ? ( + this.findIsUpdByControlName(this.props, "BtnAdd") ? ( {" "} {props.enabled || - this.findIsUpdByControlName(this.props, "BtnAdd") ? ( + this.findIsUpdByControlName(this.props, "BtnAdd") ? ( {props.enabled || - this.findIsUpdByControlName(this.props, "BtnCopyAll") ? ( + this.findIsUpdByControlName(this.props, "BtnCopyAll") ? ( {props.enabled || - this.findIsUpdByControlName(this.props, "BtnDel") ? ( + this.findIsUpdByControlName(this.props, "BtnDel") ? ( {props.enabled && rowTag !== 1 ? ( @@ -5746,10 +5821,10 @@ class CommonTableRc extends React.Component { onClick={ props.enabled ? this.chooseProductProcessModalTbRow.bind( - this, - index, - record - ) + this, + index, + record + ) : null } > @@ -5784,10 +5859,10 @@ class CommonTableRc extends React.Component { onClick={ props.enabled ? this.chooseProductMaterialsModalTbRow.bind( - this, - index, - record - ) + this, + index, + record + ) : null } > @@ -5928,7 +6003,7 @@ class CommonTableRc extends React.Component { }, title: () => this.props.setOpterationColumn === "Y" && - this.getTableFilterData() === 0 ? ( + this.getTableFilterData() === 0 ? ( {props.enabled || - this.findIsUpdByControlName(this.props, "BtnAdd") ? ( + this.findIsUpdByControlName(this.props, "BtnAdd") ? ( {props.enabled || - this.findIsUpdByControlName( - this.props, - "BtnHeadPopup" - ) ? ( + this.findIsUpdByControlName( + this.props, + "BtnHeadPopup" + ) ? ( {props.enabled || - this.findIsUpdByControlName(this.props, "BtnHeadPopup") ? ( + this.findIsUpdByControlName(this.props, "BtnHeadPopup") ? ( { - const { commonPopupTbName, commonPopupShowConfig } = this.state; + const { commonPopupTbName, commonPopupShowConfig, commonFieldPopupVisible, commonPopupVisible, commonFieldPopupTbName, commonFieldPopupShowConfig, + commonModalVisible, commonModalShowConfig, commonModalTbName } = this.state; /* 若是产品名称弹窗 并且配置了调用产品工艺卡标识copyFromTechnology 则走自己的逻辑 */ - if (selectConfig.sCompareColor === "copyFromTechnology") { - this.props.onSelectCommonPopupProduct( - name, - selectConfig, - selectData, - commonPopupTbName, - commonPopupShowConfig - ); + if (selectConfig.sCompareColor === 'copyFromTechnology') { + this.props.onSelectCommonPopupProduct(name, selectConfig, selectData, commonPopupTbName, commonPopupShowConfig); } else { - this.props.onSelectCommonPopup( - name, - selectConfig, - selectData, - commonPopupTbName, - commonPopupShowConfig - ); + let tb = commonPopupVisible ? { name: commonPopupTbName, config: commonPopupShowConfig } : commonFieldPopupVisible ? { name: commonFieldPopupTbName, config: commonFieldPopupShowConfig } : undefined; + tb = commonModalVisible ? { name: commonModalTbName, config: commonModalShowConfig } : tb; + if (selectConfig.sControlName?.startsWith('BtnPopupEdit')) { + this.props.onSelectCommonPopup(name, selectConfig, selectData, tb?.name, tb?.config, { index: this.rowClickRef.current }); + return; + } + + this.props.onSelectCommonPopup(name, selectConfig, selectData, tb?.name, commonPopupShowConfig); } }; @@ -6935,7 +7006,7 @@ class CommonTableRc extends React.Component { ) { const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) && - commonUtils.isNotEmptyObject(tableSelectedRowKeys[0]) + commonUtils.isNotEmptyObject(tableSelectedRowKeys[0]) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; selectData.forEach((item, index) => { @@ -7024,11 +7095,10 @@ class CommonTableRc extends React.Component { : record.sFormId : showConfig.sActiveId; const printsId = record[sActiveKey]; - const urlPrint = `${ - commonConfig.server_host - }printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent( - token - )}`; + const urlPrint = `${commonConfig.server_host + }printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent( + token + )}`; window.open(urlPrint); } else { if (this.handleHideModal()) { @@ -7133,9 +7203,8 @@ class CommonTableRc extends React.Component { const index = sActiveKey.lastIndexOf("."); sActiveKey = sActiveKey.substring(index + 1, sActiveKey.length); } - const sNameUrl = `${ - commonConfig.server_host - }gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}&sName=${formRoute}`; + const sNameUrl = `${commonConfig.server_host + }gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}&sName=${formRoute}`; const filterCondition = []; const conditionValues = this.props.getSqlCondition( picArr[0], @@ -7225,16 +7294,15 @@ class CommonTableRc extends React.Component { fileList.forEach(item => { let fileName = item.substring(item.lastIndexOf("/") + 1); fileName = fileName.substring(fileName.indexOf("_") + 1); - const filepath = `${ - commonConfig.server_host - }file/download?savePathStr=${encodeURIComponent( - item - )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`; + const filepath = `${commonConfig.server_host + }file/download?savePathStr=${encodeURIComponent( + item + )}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`; const xhr = new XMLHttpRequest(); xhr.open("get", filepath); xhr.responseType = "blob"; xhr.send(); - xhr.onload = function() { + xhr.onload = function () { if (this.status === 200 || this.status === 304) { // 如果是IE10及以上,不支持download属性,采用msSaveOrOpenBlob方法,但是IE10以下也不支持msSaveOrOpenBlob if ("msSaveOrOpenBlob" in navigator) { @@ -7308,9 +7376,8 @@ class CommonTableRc extends React.Component { const previewImageArr = []; dataUrlArr.forEach((item = "") => { const dataPreviewUrl = item.includes("xlyerpfiles") - ? `${ - commonConfig.server_host - }file/download?savePathStr=${item}&width=800&&height=500&sModelsId=100&token=${token}` + ? `${commonConfig.server_host + }file/download?savePathStr=${item}&width=800&&height=500&sModelsId=100&token=${token}` : item; /* 预览 */ previewImageArr.push(dataPreviewUrl); }); @@ -7364,9 +7431,8 @@ class CommonTableRc extends React.Component { : ""; console.log("sFormId:", sFormId); if (commonUtils.isNotEmptyObject(sBtnContent)) { - const urlPrint = `${ - commonConfig.server_host - }template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`; + const urlPrint = `${commonConfig.server_host + }template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`; const w = window.innerWidth || document.documentElement.clientWidth || @@ -7385,8 +7451,8 @@ class CommonTableRc extends React.Component { const newWin = window.open("", "SQL查看器", features); newWin.document.write( '' + urlPrint + + '">' ); // window.open(urlPrint); } else { @@ -7588,7 +7654,7 @@ class CommonTableRc extends React.Component { const { dNetMoney, dNetPrice } = this.props.app.decimals; const sModelsType = commonUtils.isNotEmptyObject(this.props) && - commonUtils.isNotEmptyObject(this.props.app) + commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : ""; let colSpan = 0; @@ -7889,13 +7955,13 @@ class CommonTableRc extends React.Component { ) { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } else { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } @@ -7942,13 +8008,13 @@ class CommonTableRc extends React.Component { ) { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } else { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } @@ -7967,13 +8033,13 @@ class CommonTableRc extends React.Component { ) { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } else { tableDataTotal[sumItem.sName] = commonUtils.convertFixNum( commonUtils.convertToNum(tableDataTotal[sumItem.sName]) + - commonUtils.convertToNum(tableDataRow[sumItem.sName]), + commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName) ); } @@ -8189,19 +8255,18 @@ class CommonTableRc extends React.Component { const sActiveId = isSlaveInfo ? this.props.slaveInfo.app.currentPane.formId : this.props.app.currentPane.formId; - const url = `${ - commonConfig.server_host - }configform/sHandleConfigform?sModelsId=${sActiveId}&sName=${formSrcRoute}`; + const url = `${commonConfig.server_host + }configform/sHandleConfigform?sModelsId=${sActiveId}&sName=${formSrcRoute}`; const headerArr = isSlaveInfo ? this.props.slaveInfo.headerColumn.map(item => item.dataIndex) : this.props.headerColumn.map(item => item.dataIndex); const handleData = isSlaveInfo ? this.props.slaveInfo.config.gdsconfigformslave.filter( - item => headerArr.indexOf(item.sName) !== -1 - ) + item => headerArr.indexOf(item.sName) !== -1 + ) : this.props.config.gdsconfigformslave.filter( - item => headerArr.indexOf(item.sName) !== -1 - ); + item => headerArr.indexOf(item.sName) !== -1 + ); let sortIndexFirst = 0; let sortIndexLast = 0; @@ -8220,11 +8285,11 @@ class CommonTableRc extends React.Component { const postData = isSlaveInfo ? { - [this.props.slaveInfo.config.sId]: handleData - } + [this.props.slaveInfo.config.sId]: handleData + } : { - [this.props.config.sId]: handleData - }; + [this.props.config.sId]: handleData + }; // console.log(postData, 'postData'); // console.log(sortItems, 'sortItems'); @@ -8438,9 +8503,8 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyObject(picAddr)) { const { token } = props.app; const dataUrl = picAddr[0].includes("xlyerpfiles") - ? `${commonConfig.server_host}file/download?savePathStr=${ - picAddr[0] - }&scale=0.1&sModelsId=100&token=${token}` + ? `${commonConfig.server_host}file/download?savePathStr=${picAddr[0] + }&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */ const officeFileTypeList = ["PDF", "DOCX", "XLSX"]; const imgTypeList = [ @@ -8565,8 +8629,8 @@ class CommonTableRc extends React.Component { const iIndex = commonUtils.isEmpty(record[sName]) ? -1 : showDropDown.findIndex( - item => item.sId === record[sName].toString() - ); + item => item.sId === record[sName].toString() + ); sValue = iIndex > -1 ? showDropDown[iIndex].value : ""; } else if ( firstDataIndex === "t" || @@ -8677,7 +8741,7 @@ class CommonTableRc extends React.Component { > {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === "b") || - imgBox !== "" ? ( + imgBox !== "" ? ( "" ) : (
@@ -8733,7 +8797,7 @@ class CommonTableRc extends React.Component { > {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === "b") || - imgBox !== "" ? ( + imgBox !== "" ? ( "" ) : ( @@ -9026,8 +9090,8 @@ class CommonTableRc extends React.Component { let iIndex = commonUtils.isEmpty(record[sName]) ? -1 : showDropDown.findIndex( - item => item.sId === record[sName].toString() - ); + item => item.sId === record[sName].toString() + ); if (iIndex === -1 && record[sName] === "") { iIndex = showDropDown.findIndex(item => item.sId === ""); } @@ -9037,7 +9101,7 @@ class CommonTableRc extends React.Component { /* 选择合版产品弹窗 */ const sModelsType = commonUtils.isNotEmptyObject(props) && - commonUtils.isNotEmptyObject(props.app) + commonUtils.isNotEmptyObject(props.app) ? props.app.currentPane.sModelsType : ""; if ( @@ -9340,7 +9404,7 @@ class CommonTableRc extends React.Component { {" "} {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === "b") || - imgBox !== "" ? ( + imgBox !== "" ? ( "" ) : ( @@ -9745,7 +9809,7 @@ class CommonTableRc extends React.Component { props.slaveInfo !== undefined && props.slaveInfo.selectedRowKeys !== undefined && JSON.stringify(slaveInfoSelectedRowKeys) !== - JSON.stringify(props.slaveInfo.selectedRowKeys) + JSON.stringify(props.slaveInfo.selectedRowKeys) ) { stateValue.slaveInfoSelectedRowKeys = [ ...props.slaveInfo.selectedRowKeys @@ -9796,7 +9860,7 @@ class CommonTableRc extends React.Component { stateValue.previewVisible = props.previewVisible; } function compare(property) { - return function(a, b) { + return function (a, b) { const value1 = a[property]; const value2 = b[property]; return value1 - value2; @@ -9970,8 +10034,8 @@ class CommonTableRc extends React.Component { this.props.tableProps.AutoTableHeight == "100%" ? "100%" : this.props.tableProps.AutoTableHeight + - tableHeaderHeight + - footerHeight; + tableHeaderHeight + + footerHeight; return; } @@ -10434,9 +10498,8 @@ class CommonTableRc extends React.Component { const { formId } = this.props; const { token } = this.props.app; - const url = `${ - commonConfig.server_host - }file/upload?sModelsId=${formId}&token=${token}`; + const url = `${commonConfig.server_host + }file/upload?sModelsId=${formId}&token=${token}`; fetch(url, { method: "POST", body: formData @@ -10553,8 +10616,8 @@ class CommonTableRc extends React.Component { ); masterData[`sSecond-${newKey}`] = sSecondConditionPro && - iIndex > -1 && - config.gdsconfigformslave[iIndex].sDropDownType === "sql" + iIndex > -1 && + config.gdsconfigformslave[iIndex].sDropDownType === "sql" ? commonConfig.seaJudge.s_proDropDown[0].sId : sSecondConditionPro ? commonConfig.seaJudge.s_pro[0].sId @@ -10666,9 +10729,8 @@ class CommonTableRc extends React.Component { const { formId, isSmall } = this.props; const { token } = this.props.app; const divProps = { - action: `${ - commonConfig.server_host - }file/upload?sModelsId=${formId}&token=${token}`, + action: `${commonConfig.server_host + }file/upload?sModelsId=${formId}&token=${token}`, onChange: this.handleUploadChange, accept: "*/*", showUploadList: false, @@ -10727,7 +10789,7 @@ class CommonTableRc extends React.Component { commonPopupConfig = config.gdsconfigformslave[iIndex]; commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupConfig) && - commonUtils.isNotEmptyObject(commonPopupConfig.sActiveName) + commonUtils.isNotEmptyObject(commonPopupConfig.sActiveName) ? commonPopupConfig.sActiveName : commonPopupTitle; commonPopupProps = { @@ -10840,7 +10902,7 @@ class CommonTableRc extends React.Component { } commonFieldPopupTitle = commonUtils.isNotEmptyObject(commonFieldPopupConfig) && - commonUtils.isNotEmptyObject(commonFieldPopupConfig.sActiveName) + commonUtils.isNotEmptyObject(commonFieldPopupConfig.sActiveName) ? commonFieldPopupConfig.sActiveName : commonFieldPopupTitle; commonFieldPopupProps = { @@ -11020,14 +11082,14 @@ class CommonTableRc extends React.Component {
{this.props.name === "picFile" || - (commonUtils.isNotEmptyObject(this.props.name) && - this.props.name.indexOf("file") > -1) || - (this.props.name.startsWith("slave") && - this.findIsUpdByControlName(this.props, "BtnUpload")) ? ( + (commonUtils.isNotEmptyObject(this.props.name) && + this.props.name.indexOf("file") > -1) || + (this.props.name.startsWith("slave") && + this.findIsUpdByControlName(this.props, "BtnUpload")) ? (
), - onOk() {}, + onOk() { }, }); } else if (dataReturn.code === -7) { /* 防呆校验 返回是-7 */ return dataReturn; @@ -314,7 +359,7 @@ export function getShowTypes(name, props) { getFloatNum: props.getFloatNum, getDateFormat: props.getDateFormat, // onChange: props.onChange, - onChange: () => {}, + onChange: () => { }, formRoute: props.formRoute, } } @@ -1052,7 +1097,7 @@ export function handleUnitType(app, resultValue) { } export function showLocalMessage(props, sName, sChineseName) { let sTitle = ''; - if(commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) && commonUtils.isNotEmptyArr(props.app.commonConst)) { + if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) && commonUtils.isNotEmptyArr(props.app.commonConst)) { const gdsformconst = props.app.commonConst; sTitle = showMessage(gdsformconst, sName) } else { @@ -1257,7 +1302,7 @@ export async function clearSocketData(param) { message.destroy(); const { token, value, sModelsId } = param; const { optName } = value; - const dataReturn = (await commonServices.postValueService( token, value, `${commonConfig.server_host}sysWebsocket/clearUserOperationRecord?sModelsId=${sModelsId}` )).data; + const dataReturn = (await commonServices.postValueService(token, value, `${commonConfig.server_host}sysWebsocket/clearUserOperationRecord?sModelsId=${sModelsId}`)).data; /* 成功的话返回数据 */ if (dataReturn.code === 1) { /* 成功 */ if (!commonUtils.isEmpty(optName)) { diff --git a/src/mes/common/commonModalComponent/index.js b/src/mes/common/commonModalComponent/index.js index 25356fe..81a6745 100644 --- a/src/mes/common/commonModalComponent/index.js +++ b/src/mes/common/commonModalComponent/index.js @@ -39,7 +39,7 @@ const CommonModalComponent = props => { window.deviceTargetInfoModalAutoShow = false; }; }, []); - + return ( { onChangeRouter: rest.onChangeRouter, onOpenModal: handleOpenModal, onOpenFilePreviewModal: handleOpenfilePreviewModal, - onOpenCommonModal: rest.onOpenCommonModal + onOpenCommonModal: rest.onOpenCommonModal, }; let viewComponent = { -- libgit2 0.22.2