From 3cd0cc03d4718b334e9daa71c5b64535590c70f1 Mon Sep 17 00:00:00 2001 From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com> Date: Mon, 10 Nov 2025 16:55:51 +0800 Subject: [PATCH] 快速报价复制到 --- src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js | 1015 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 file changed, 526 insertions(+), 489 deletions(-) diff --git a/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js b/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js index 6593e31..f9aec54 100644 --- a/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js +++ b/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js @@ -8,7 +8,7 @@ import React, { Component } from 'react'; import moment from 'moment'; import { Form } from '@ant-design/compatible'; // import '@ant-design/compatible/assets/index.css'; -import { Modal, Layout, Spin, Avatar, Select, message, Button, Slider, Tabs, Collapse, Radio, Row, Col, Table, Checkbox, } from 'antd-v4'; +import { Modal, Layout, Spin, Avatar, Select, message, Button, Slider, Tabs, Collapse, Radio, Row, Col, Table, Checkbox, } from 'antd-v4'; import { RightOutlined } from '@ant-design/icons'; import AddIcon from '../../../assets/add.svg'; import DisableAddIcon from '../../../assets/disableadd.svg'; @@ -104,19 +104,19 @@ class QuotationPackTableTree extends Component { const sId = currentId || nextProps.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; - if(masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout')[0]) { + if (masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout')[0]) { this.isLayout = masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout')[0].bVisible; } - if(masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout2')[0]) { + if (masterConfig && masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout2')[0]) { this.isLayout2 = masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'bLayout2')[0].bVisible; } /* bGrd代表是否是表格 */ const slaveConfig = formData.filter(item => item.bGrd && item.sTbName !== 'sysbillcheckresult')[0]; const slaveColumn = commonFunc.getHeaderConfig(slaveConfig); - let checkConfig ={}; - let checkColumn ={}; - if(commonUtils.isNotEmptyArr( formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult'))) { + let checkConfig = {}; + let checkColumn = {}; + if (commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult'))) { checkConfig = formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult')[0]; checkColumn = commonFunc.getHeaderConfig(checkConfig); } @@ -130,30 +130,30 @@ class QuotationPackTableTree extends Component { const finishedMaterialsConfig = formData.filter(item => item.sTbName.toUpperCase() === 'QuoQuotationMaterials'.toUpperCase() && item.showName === '成品材料')[0]; const finishedMaterialsColumn = finishedMaterialsConfig ? commonFunc.getHeaderConfig(finishedMaterialsConfig) : false; - const addState2 ={}; - const addStateConfig ={}; + const addState2 = {}; + const addStateConfig = {}; /* 取材料组配置放在数组 */ - let materialsInfoList = []; - let materialsChildInfoList = []; - const materialsFormData = formData.filter(item => item.showName !== '纸张1' && item.showName !== '成品辅料1' && item.sGrd && item.sGrd.includes('materials') && item.bGrdVisible ); + let materialsInfoList = []; + let materialsChildInfoList = []; + const materialsFormData = formData.filter(item => item.showName !== '纸张1' && item.showName !== '成品辅料1' && item.sGrd && item.sGrd.includes('materials') && item.bGrdVisible); // const materialsFormData = formData.filter(item => item.sTbName !== 'mftworkordermaterials' && item.sGrd && item.sGrd.includes('materials') && item.bGrdVisible ); /* 找到除了材料,成品材料外的其他所有父级材料 */ - if(commonUtils.isNotEmptyArr(materialsFormData) ) { + if (commonUtils.isNotEmptyArr(materialsFormData)) { materialsFormData.forEach((item, index) => { - const tableName = index === 0 ? 'materials' : `materials${index -1}`; + const tableName = index === 0 ? 'materials' : `materials${index - 1}`; addState2[`${tableName}Config`] = item; addStateConfig[`${tableName}Config`] = item; addState2[`${tableName}Column`] = commonFunc.getHeaderConfig(item); /* 找到该配置的子从表 */ - const childFormData = formData.filter(child => child.sGrd === item.sChildTableName ); - if(commonUtils.isNotEmptyArr(childFormData)) { + const childFormData = formData.filter(child => child.sGrd === item.sChildTableName); + if (commonUtils.isNotEmptyArr(childFormData)) { childFormData.forEach((child, num) => { addState2[`${tableName}ChildConfig`] = child; addStateConfig[`${tableName}ChildConfig`] = child; addState2[`${tableName}ChildColumn`] = commonFunc.getHeaderConfig(child); // materialsInfoList.push(child.showName); - const sChildName = item.showName + num +1; + const sChildName = item.showName + num + 1; materialsChildInfoList.push(`${tableName}Child`); }); } @@ -204,7 +204,7 @@ class QuotationPackTableTree extends Component { const manyqtysConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.sTbName.toUpperCase() === 'QuoQuotationManyQtys'.toUpperCase() && item.bGrdVisible)) ? formData.filter(item => item.sTbName.toUpperCase() === 'QuoQuotationManyQtys'.toUpperCase() && item.bGrdVisible)[0] : {}; - manyqtysColumn = commonUtils.isNotEmptyObject(manyqtysConfig) ? commonFunc.getHeaderConfig(manyqtysConfig, manyqtysColumn) : []; + manyqtysColumn = commonUtils.isNotEmptyObject(manyqtysConfig) ? commonFunc.getHeaderConfig(manyqtysConfig, manyqtysColumn) : []; let colorConfigGrdVisible; const colorConfigTrue = formData.filter(item => item.sTbName.toUpperCase() === 'quoquotationparam'.toUpperCase())[0]; @@ -358,7 +358,7 @@ class QuotationPackTableTree extends Component { } else { filterTree.style.display = 'block'; - const { masterData, slaveData, controlData, materialsData, processData }=this.props; + const { masterData, slaveData, controlData, materialsData, processData } = this.props; if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyArr(slaveData)) { const totalTreeState = this.handleGetTotalTreeData(masterData, slaveData, controlData, materialsData, processData, true); if (commonUtils.isNotEmptyObject(totalTreeState)) { @@ -420,7 +420,7 @@ class QuotationPackTableTree extends Component { } }); addStateProcess.processSelectedRowKeys = []; - if(commonUtils.isNotEmptyArr(addStateProcess.processData) && commonUtils.isNotEmptyArr(addStateControl.controlSelectedRowKeys)) { + if (commonUtils.isNotEmptyArr(addStateProcess.processData) && commonUtils.isNotEmptyArr(addStateControl.controlSelectedRowKeys)) { const processFilterData = addStateProcess.processData.filter(item => item.sControlId === addStateControl.controlSelectedRowKeys[0]) if (commonUtils.isNotEmptyArr(processFilterData)) { addStateProcess.processSelectedData = [processFilterData[0]]; @@ -436,7 +436,7 @@ class QuotationPackTableTree extends Component { name: 'pack', configData: packConfig, condition: { sSqlCondition: { sParentId: sId } }, isWait: true, }); - if(commonUtils.isNotEmptyObject(manyqtysConfig)) { + if (commonUtils.isNotEmptyObject(manyqtysConfig)) { this.props.handleGetDataSet({ name: 'manyqtys', configData: manyqtysConfig, condition: { sSqlCondition: { sParentId: sId } }, }); @@ -468,17 +468,17 @@ class QuotationPackTableTree extends Component { addStatePack.packData = packData; } /* 默认展开第一层结构 */ - const expandedRowKeys =[]; - if(commonUtils.isNotEmptyObject(addStateControl) && commonUtils.isNotEmptyArr(addStateControl.controlData)) { - const { controlData } = addStateControl; + const expandedRowKeys = []; + if (commonUtils.isNotEmptyObject(addStateControl) && commonUtils.isNotEmptyArr(addStateControl.controlData)) { + const { controlData } = addStateControl; const controlFilterData = controlData.filter(item => commonUtils.isEmptyObject(item.sControlParentId)); /* 筛选出第一层 */ - if(commonUtils.isNotEmptyArr(controlFilterData) && controlFilterData.length > 0) { /* 当显示全部时 展开所有部件层级 */ + if (commonUtils.isNotEmptyArr(controlFilterData) && controlFilterData.length > 0) { /* 当显示全部时 展开所有部件层级 */ controlFilterData.forEach((item) => { const { sId } = item; expandedRowKeys.push(sId); }); } - this.setState({ controlExpandedRowKeys:{ expandedRowKeys: expandedRowKeys }}) + this.setState({ controlExpandedRowKeys: { expandedRowKeys: expandedRowKeys } }) } /* 获取整体树结构s */ // const { materialsData } = addStateMaterials; /* 工序表 */ @@ -486,16 +486,16 @@ class QuotationPackTableTree extends Component { // const totalTreeState = this.handleGetTotalTreeData(masterData,slaveData,controlData,materialsData,processData, true); this.props.onSaveState({ - pageLoading: false, ...addStateControl,...addStateMaterials, ...addStateProcess, ...addStateColor, ...addStatePack, ...treeState, treeSelectedKeys: controlSelectedRowKeys, ...extraState, + pageLoading: false, ...addStateControl, ...addStateMaterials, ...addStateProcess, ...addStateColor, ...addStatePack, ...treeState, treeSelectedKeys: controlSelectedRowKeys, ...extraState, }); }; - /* 获取套件树形全部结构 */ - handleGetTotalTreeDataBak= (masterData,slaveData,controlData,materialsData,processData, isWait) => { + /* 获取套件树形全部结构 */ + handleGetTotalTreeDataBak = (masterData, slaveData, controlData, materialsData, processData, isWait) => { /* 生成部件树结构 */ let totalTreeData = []; const expandedKeys = []; - const addState ={}; + const addState = {}; // let { totalTreeSelectedKeys } = this.props; if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sProductName1)) { const rootData = [masterData]; /* 找到所有一级树结构 */ @@ -510,50 +510,50 @@ class QuotationPackTableTree extends Component { /* 添加从表作为二级节点 */ const childrenSlave = []; let bRelation = false; /* 从表与控制表没有关联性 */ - if(commonUtils.isNotEmptyArr(slaveData)){ - slaveData.forEach((itemSlave,index) => { + if (commonUtils.isNotEmptyArr(slaveData)) { + slaveData.forEach((itemSlave, index) => { const { sId, sProductName } = itemSlave; const treeSlaveRow = {}; treeSlaveRow.key = sId; - treeSlaveRow.showName ='产品-'+ sProductName; + treeSlaveRow.showName = '产品-' + sProductName; treeSlaveRow.sAllId = itemSlave.sId; /* 获取从表关联的控制表 */ const childrenControl = []; - if(commonUtils.isNotEmptyArr(controlData)){ - const controlCollection =[]; + if (commonUtils.isNotEmptyArr(controlData)) { + const controlCollection = []; controlData.forEach((itemControl) => { - if(itemControl.sCombinedMemo && itemControl.sCombinedMemo !== '') { + if (itemControl.sCombinedMemo && itemControl.sCombinedMemo !== '') { const sCombinedMemoArr = commonUtils.isJSON(itemControl.sCombinedMemo) ? JSON.parse(itemControl.sCombinedMemo) : []; const len = sCombinedMemoArr.filter(item => item.sProductNo.indexOf(itemSlave.sProductNo) !== -1).length; - if(len > 0) { - const sAllId =itemControl.sAllId; + if (len > 0) { + const sAllId = itemControl.sAllId; /* 找到这个sAllId的第一级 把整个部件挂到产品下面 */ if (commonUtils.isNotEmptyObject(sAllId)) { const arr = sAllId.split(','); - if (arr.length > 0){ - const firstsId =arr[0]; /* 从sAllId找第一级*/ - if(!controlCollection.includes(firstsId)){ - controlCollection.push(firstsId) - } + if (arr.length > 0) { + const firstsId = arr[0]; /* 从sAllId找第一级*/ + if (!controlCollection.includes(firstsId)) { + controlCollection.push(firstsId) + } } } } } }); - if(commonUtils.isNotEmptyArr(controlCollection)){ /* 作为子表子级 */ - bRelation =true; + if (commonUtils.isNotEmptyArr(controlCollection)) { /* 作为子表子级 */ + bRelation = true; for (const key of controlCollection) { - const iIndex =controlData.findIndex(item => item.sId === key); - if(iIndex > -1) { + const iIndex = controlData.findIndex(item => item.sId === key); + if (iIndex > -1) { const tableRow = controlData[iIndex]; - const { sId,sAllId } = tableRow; + const { sId, sAllId } = tableRow; const treeControlRow = {} - treeControlRow.key = sId + '-' +commonUtils.createSid(); + treeControlRow.key = sId + '-' + commonUtils.createSid(); treeControlRow.showName = '部件-' + tableRow.sPartsName; treeControlRow.sAllId = sAllId; /* 控制表根据一级菜单获取子集 */ let childrenChild = []; - childrenChild = this.handleGetControlTreeChildData(sId, controlData,materialsData,processData); + childrenChild = this.handleGetControlTreeChildData(sId, controlData, materialsData, processData); let sChildren = '1'; /* 树形结构最后一个节点设置为1 */ if (commonUtils.isNotEmptyArr(childrenChild)) { sChildren = '0'; /* 树形结构其他节点设置为0 */ @@ -573,53 +573,53 @@ class QuotationPackTableTree extends Component { childrenSlave.push(treeSlaveRow); /* 如果从表与控制表没有关联 */ - if(!bRelation){ + if (!bRelation) { controlData.forEach((itemControl) => { - const { sId,sAllId,sPartsName } = itemControl; + const { sId, sAllId, sPartsName } = itemControl; const treeControlRow = {} - treeControlRow.key = sId + '-' +commonUtils.createSid(); + treeControlRow.key = sId + '-' + commonUtils.createSid(); treeControlRow.showName = '部件-' + sPartsName; treeControlRow.sAllId = sAllId; - treeControlRow.sId =sId; + treeControlRow.sId = sId; /* 控制表根据一级菜单获取子集 */ let childrenChild = []; - childrenChild = this.handleGetControlTreeChildData(sId, controlData,materialsData,processData); + childrenChild = this.handleGetControlTreeChildData(sId, controlData, materialsData, processData); let sChildren = '1'; /* 树形结构最后一个节点设置为1 */ if (commonUtils.isNotEmptyArr(childrenChild)) { sChildren = '0'; /* 树形结构其他节点设置为0 */ } treeControlRow.sChildren = sChildren; treeControlRow.children = commonUtils.isNotEmptyArr(childrenChild) ? childrenChild : []; - const filterData =childrenSlave.filter(item => item.sId ===treeControlRow.sId); - if(commonUtils.isEmptyArr(filterData)){ + const filterData = childrenSlave.filter(item => item.sId === treeControlRow.sId); + if (commonUtils.isEmptyArr(filterData)) { childrenSlave.push(treeControlRow); } }); } /* 加载成品材料、成品工序作为从表的同级 */ - if(commonUtils.isNotEmptyArr(materialsData)){ + if (commonUtils.isNotEmptyArr(materialsData)) { const childTree = commonUtils.isNotEmptyArr(materialsData) ? materialsData.filter(item => item.sType === 2) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sMaterialsName,sPartsName } = child; + const { sId, sMaterialsName, sPartsName } = child; const treeDataRow = {}; treeDataRow.key = sId; - treeDataRow.showName = '成品材料' +'-'+ sMaterialsName; + treeDataRow.showName = '成品材料' + '-' + sMaterialsName; treeDataRow.sAllId = child.sAllId; childrenSlave.push(treeDataRow); }); } } /* 获取工序表 */ - if(commonUtils.isNotEmptyArr(processData)){ + if (commonUtils.isNotEmptyArr(processData)) { const childTree = commonUtils.isNotEmptyArr(processData) ? processData.filter(item => item.sType === 3) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sProcessName,sPartsName } = child; + const { sId, sProcessName, sPartsName } = child; const treeDataRow = {}; treeDataRow.key = sId; - treeDataRow.showName = '成品工序' +'-'+ sProcessName; + treeDataRow.showName = '成品工序' + '-' + sProcessName; treeDataRow.sAllId = child.sAllId; childrenSlave.push(treeDataRow); }); @@ -629,7 +629,7 @@ class QuotationPackTableTree extends Component { - if(!expandedKeys.includes(sId)){ + if (!expandedKeys.includes(sId)) { expandedKeys.push(sId); } }); @@ -640,8 +640,8 @@ class QuotationPackTableTree extends Component { } else { totalTreeData = []; } - addState.totalTreeData=totalTreeData; - addState.expandedKeys=expandedKeys; + addState.totalTreeData = totalTreeData; + addState.expandedKeys = expandedKeys; if (isWait) { return { ...addState }; } else { @@ -655,7 +655,7 @@ class QuotationPackTableTree extends Component { handleGetOtherData = async (tableList, childTableList, configMap) => { const { currentId, slaveData, sModelsType, masterData } = this.props; /* 当前页签数据 */ const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ - if(commonUtils.isNotEmptyObject(configMap)){ + if (commonUtils.isNotEmptyObject(configMap)) { for (const configName of Object.keys(configMap)) { const tableName = configName.replace('Config', '').trim(); const childConfig = configMap[configName]; @@ -667,26 +667,26 @@ class QuotationPackTableTree extends Component { }; /* 获取套件树形全部结构 */ - handleGetTotalTreeData= (masterData,slaveData,controlData,materialsData,processData, isWait) => { + handleGetTotalTreeData = (masterData, slaveData, controlData, materialsData, processData, isWait) => { /* 生成部件树结构 */ let totalTreeData = []; const childrenSlave = []; const expandedKeys = []; - const addState ={}; + const addState = {}; // let { totalTreeSelectedKeys } = this.props; if (commonUtils.isNotEmptyObject(masterData)) { /* 添加从表作为二级节点 */ let bRelation = false; /* 从表与控制表没有关联性 */ let bSuit = false; /* 默认是非套件 */ - if(commonUtils.isNotEmptyArr(processData)) { - const processFilterData= processData.filter(item => item.sType === '3' && commonUtils.isNotEmptyObject(item.sCombineChildProductName)); - if(commonUtils.isNotEmptyArr(processFilterData)) { + if (commonUtils.isNotEmptyArr(processData)) { + const processFilterData = processData.filter(item => item.sType === '3' && commonUtils.isNotEmptyObject(item.sCombineChildProductName)); + if (commonUtils.isNotEmptyArr(processFilterData)) { bSuit = true; /* 只要有一个成品工序有子产品 则代表是套装 */ } } - if(commonUtils.isNotEmptyArr(slaveData)){ - slaveData.forEach((itemSlave,index) => { + if (commonUtils.isNotEmptyArr(slaveData)) { + slaveData.forEach((itemSlave, index) => { const { sId, sProductName } = itemSlave; const treeSlaveRow = {}; treeSlaveRow.key = sId; @@ -695,20 +695,20 @@ class QuotationPackTableTree extends Component { treeSlaveRow.sIconType = '00'; /* 顶元素 */ /* 获取从表关联的控制表 */ const childrenControl = []; - if(commonUtils.isNotEmptyArr(controlData)){ - const controlCollection =[]; + if (commonUtils.isNotEmptyArr(controlData)) { + const controlCollection = []; controlData.forEach((itemControl) => { - if(itemControl.sCombinedMemo && itemControl.sCombinedMemo !== '') { + if (itemControl.sCombinedMemo && itemControl.sCombinedMemo !== '') { const sCombinedMemoArr = commonUtils.isJSON(itemControl.sCombinedMemo) ? JSON.parse(itemControl.sCombinedMemo) : []; const len = sCombinedMemoArr.filter(item => item.sProductNo.indexOf(itemSlave.sProductNo) !== -1).length; - if(len > 0) { - const sAllId =itemControl.sAllId; + if (len > 0) { + const sAllId = itemControl.sAllId; /* 找到这个sAllId的第一级 把整个部件挂到产品下面 */ if (commonUtils.isNotEmptyObject(sAllId)) { const arr = sAllId.split(','); - if (arr.length > 0){ - const firstsId =arr[0]; /* 从sAllId找第一级*/ - if(!controlCollection.includes(firstsId)){ + if (arr.length > 0) { + const firstsId = arr[0]; /* 从sAllId找第一级*/ + if (!controlCollection.includes(firstsId)) { controlCollection.push(firstsId) } } @@ -717,13 +717,13 @@ class QuotationPackTableTree extends Component { } }); const sTitle = bSuit ? '子产品-' : '部件-'; - if(commonUtils.isNotEmptyArr(controlCollection)){ /* 作为子表子级1 */ - bRelation =true; + if (commonUtils.isNotEmptyArr(controlCollection)) { /* 作为子表子级1 */ + bRelation = true; for (const key of controlCollection) { - const iIndex =controlData.findIndex(item => item.sId === key); - if(iIndex > -1) { + const iIndex = controlData.findIndex(item => item.sId === key); + if (iIndex > -1) { const tableRow = controlData[iIndex]; - const { sId,sAllId } = tableRow; + const { sId, sAllId } = tableRow; const treeControlRow = {} treeControlRow.key = sId; // treeControlRow.key = sId + '-' +commonUtils.createSid(); @@ -732,20 +732,20 @@ class QuotationPackTableTree extends Component { treeControlRow.sIconType = '10'; /* 部件 */ /* 控制表根据一级菜单获取子集 */ let childrenChild = []; - childrenChild = this.handleGetControlTreeChildData(sId, controlData,materialsData,processData); + childrenChild = this.handleGetControlTreeChildData(sId, controlData, materialsData, processData); let sChildren = '1'; /* 树形结构最后一个节点设置为1 */ if (commonUtils.isNotEmptyArr(childrenChild)) { sChildren = '0'; /* 树形结构其他节点设置为0 */ } /* 挂载子产品对应的成品工序 */ - if(bSuit && commonUtils.isNotEmptyArr(processData)){ + if (bSuit && commonUtils.isNotEmptyArr(processData)) { const childTree = commonUtils.isNotEmptyArr(processData) ? processData.filter(item => item.sType === '3' && key === item.sCombineChildProductName) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sProcessName,sPartsName } = child; + const { sId, sProcessName, sPartsName } = child; const treeProcessRow = {}; treeProcessRow.key = sId; - treeProcessRow.showName = '成品工序' +'-'+ sProcessName; + treeProcessRow.showName = '成品工序' + '-' + sProcessName; treeProcessRow.sAllId = child.sAllId; treeControlRow.sIconType = '03'; /* 成品工序 */ childrenChild.push(treeProcessRow); @@ -768,41 +768,41 @@ class QuotationPackTableTree extends Component { childrenSlave.push(treeSlaveRow); /* 如果从表与控制表没有关联 */ - if(!bRelation){ + if (!bRelation) { controlData.forEach((itemControl) => { - const { sId,sAllId,sPartsName } = itemControl; + const { sId, sAllId, sPartsName } = itemControl; const treeControlRow = {} - treeControlRow.key = sId + '-' +commonUtils.createSid(); + treeControlRow.key = sId + '-' + commonUtils.createSid(); // treeControlRow.key = sId; treeControlRow.showName = '部件-' + sPartsName; treeControlRow.sAllId = sAllId; - treeControlRow.sId =sId; + treeControlRow.sId = sId; treeControlRow.sIconType = '10'; /* 部件 */ /* 控制表根据一级菜单获取子集 */ let childrenChild = []; - childrenChild = this.handleGetControlTreeChildData(sId, controlData,materialsData,processData); + childrenChild = this.handleGetControlTreeChildData(sId, controlData, materialsData, processData); let sChildren = '1'; /* 树形结构最后一个节点设置为1 */ if (commonUtils.isNotEmptyArr(childrenChild)) { sChildren = '0'; /* 树形结构其他节点设置为0 */ } treeControlRow.sChildren = sChildren; treeControlRow.children = commonUtils.isNotEmptyArr(childrenChild) ? childrenChild : []; - const filterData =childrenSlave.filter(item => item.sId ===treeControlRow.sId); - if(commonUtils.isEmptyArr(filterData)){ + const filterData = childrenSlave.filter(item => item.sId === treeControlRow.sId); + if (commonUtils.isEmptyArr(filterData)) { childrenSlave.push(treeControlRow); } }); } /* 加载成品材料、成品工序作为从表的同级 */ - if(commonUtils.isNotEmptyArr(materialsData)){ + if (commonUtils.isNotEmptyArr(materialsData)) { const childTree = commonUtils.isNotEmptyArr(materialsData) ? materialsData.filter(item => item.sType === '2') : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sMaterialsName,sPartsName } = child; + const { sId, sMaterialsName, sPartsName } = child; const treeDataRow = {}; - treeDataRow.key = sId + '-' +commonUtils.createSid(); - treeDataRow.showName = '成品材料' +'-'+ sMaterialsName; + treeDataRow.key = sId + '-' + commonUtils.createSid(); + treeDataRow.showName = '成品材料' + '-' + sMaterialsName; treeDataRow.sIconType = '02'; /* 成品材料 */ treeDataRow.sAllId = child.sAllId; childrenSlave.push(treeDataRow); @@ -810,27 +810,27 @@ class QuotationPackTableTree extends Component { } } /* 获取工序表 */ - if(!bSuit){ + if (!bSuit) { const childTree = commonUtils.isNotEmptyArr(processData) ? processData.filter(item => item.sType === '3') : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sProcessName,sPartsName } = child; + const { sId, sProcessName, sPartsName } = child; const treeDataRow = {}; - treeDataRow.key = sId + '-' +commonUtils.createSid();; - treeDataRow.showName = '成品工序' +'-'+ sProcessName; + treeDataRow.key = sId + '-' + commonUtils.createSid();; + treeDataRow.showName = '成品工序' + '-' + sProcessName; treeDataRow.sIconType = '03'; /* 部件 */ treeDataRow.sAllId = child.sAllId; childrenSlave.push(treeDataRow); }); } - }else { /* 成品工序挂在从表下的 */ + } else { /* 成品工序挂在从表下的 */ const childTree = commonUtils.isNotEmptyArr(processData) ? processData.filter(item => item.sType === '3' && commonUtils.isEmptyObject(item.sCombineChildProductName)) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sProcessName,sPartsName } = child; + const { sId, sProcessName, sPartsName } = child; const treeDataRow = {}; - treeDataRow.key = sId + '-' +commonUtils.createSid();; - treeDataRow.showName = '成品工序' +'-'+ sProcessName; + treeDataRow.key = sId + '-' + commonUtils.createSid();; + treeDataRow.showName = '成品工序' + '-' + sProcessName; treeDataRow.sIconType = '03'; /* 部件 */ treeDataRow.sAllId = child.sAllId; childrenSlave.push(treeDataRow); @@ -838,17 +838,17 @@ class QuotationPackTableTree extends Component { } } - if(!expandedKeys.includes(sId)){ + if (!expandedKeys.includes(sId)) { expandedKeys.push(sId); } - totalTreeData= childrenSlave; + totalTreeData = childrenSlave; }); } } else { totalTreeData = []; } - addState.totalTreeData=totalTreeData; - addState.expandedKeys=expandedKeys; + addState.totalTreeData = totalTreeData; + addState.expandedKeys = expandedKeys; if (isWait) { return { ...addState }; } else { @@ -861,7 +861,7 @@ class QuotationPackTableTree extends Component { /** 获取部件树 */ - handleGetControlTreeData= (controlData, isWait) => { + handleGetControlTreeData = (controlData, isWait) => { /* 生成部件树结构 */ let treeData = []; if (isWait) { @@ -875,7 +875,7 @@ class QuotationPackTableTree extends Component { }; - handleGetControlTreeDataBak= (controlData, isWait) => { + handleGetControlTreeDataBak = (controlData, isWait) => { /* 生成部件树结构 */ let treeData = []; const expandedKeys = []; @@ -921,7 +921,7 @@ class QuotationPackTableTree extends Component { }; /** 获取子节点数据 */ - handleGetControlTreeChildData= (sParentId, controlData,materialsData,processData) => { + handleGetControlTreeChildData = (sParentId, controlData, materialsData, processData) => { if (commonUtils.isNotEmptyObject(sParentId) && commonUtils.isNotEmptyArr(controlData)) { const childTree = commonUtils.isNotEmptyArr(controlData) ? controlData.filter(item => item.sControlParentId === sParentId) : []; const children = []; @@ -934,7 +934,7 @@ class QuotationPackTableTree extends Component { treeDataRow.parentKey = sParentId; treeDataRow.sAllId = child.sAllId; treeDataRow.sIconType = '10'; /* 部件 */ - const data = this.handleGetControlTreeChildData(sId, controlData,materialsData,processData); + const data = this.handleGetControlTreeChildData(sId, controlData, materialsData, processData); let sChildren = '1'; /* 最后一个节点设置为1 */ if (commonUtils.isNotEmptyArr(data)) { sChildren = '0'; @@ -952,7 +952,7 @@ class QuotationPackTableTree extends Component { } /* 获取材料表 */ - if(commonUtils.isNotEmptyArr(materialsData)){ + if (commonUtils.isNotEmptyArr(materialsData)) { const childTree = commonUtils.isNotEmptyArr(materialsData) ? materialsData.filter(item => item.sControlId === sParentId) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { @@ -968,11 +968,11 @@ class QuotationPackTableTree extends Component { } } /* 获取工序表 */ - if(commonUtils.isNotEmptyArr(processData)){ + if (commonUtils.isNotEmptyArr(processData)) { const childTree = commonUtils.isNotEmptyArr(processData) ? processData.filter(item => item.sControlId === sParentId) : []; if (commonUtils.isNotEmptyArr(childTree)) { childTree.forEach((child) => { - const { sId, sProcessName } = child; + const { sId, sProcessName } = child; const treeDataRow = {}; treeDataRow.key = sId; // treeDataRow.showName = '部件工序-'+ sProcessName; @@ -989,7 +989,7 @@ class QuotationPackTableTree extends Component { }; /** 根据key查找树节点并改变属性 */ - handleSearchNodes= (key, data, showNameNew) => { + handleSearchNodes = (key, data, showNameNew) => { if (commonUtils.isNotEmptyObject(showNameNew)) { data.forEach((item) => { if (item.key === key) { @@ -1012,7 +1012,7 @@ class QuotationPackTableTree extends Component { const masterReturn = (await commonServices.postValueService(token, values, url)).data; if (masterReturn.code === 1) { - if(commonUtils.isNotEmptyObject(masterReturn.dataset) && commonUtils.isNotEmptyArr(masterReturn.dataset.rows) ) { + if (commonUtils.isNotEmptyObject(masterReturn.dataset) && commonUtils.isNotEmptyArr(masterReturn.dataset.rows)) { const sBackProcessDataValue = masterReturn.dataset.rows; if (isWait) { return { sBackProcessData: sBackProcessDataValue }; @@ -1182,7 +1182,7 @@ class QuotationPackTableTree extends Component { } const returnChange = await this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true, masterData); const masterDataDefault = commonFunc.getDefaultData(masterConfig, {}); - returnChange.masterData = { ...masterDataDefault, ...returnChange.masterData }; + returnChange.masterData = { ...masterDataDefault, ...returnChange.masterData }; if (isWait) { return { ...returnChange, sBackProcessClassifyData, masterConfig, ...backProcessData, @@ -1209,7 +1209,7 @@ class QuotationPackTableTree extends Component { }; /* 数据生成按钮 */ - handleDataCreate= async () => { + handleDataCreate = async () => { let { checkProcessClassifyData } = this.props; const { masterData, slaveConfig, materialsConfig, processConfig, sModelsId, app, dispatch, @@ -1650,7 +1650,7 @@ class QuotationPackTableTree extends Component { }; /* 勾选工序分类 */ - handleProcessChange=(e, value, sPartsName) => { + handleProcessChange = (e, value, sPartsName) => { let { checkProcessClassifyData } = this.props; let index = -1; if (commonUtils.isNotEmptyArr(checkProcessClassifyData)) { @@ -1750,7 +1750,7 @@ class QuotationPackTableTree extends Component { data.push(commonBusiness.mergeData('materials', materialsConfig.sTbName, materialsData, materialsDelData)); data.push(commonBusiness.mergeData('process', processConfig.sTbName, processData, processDelData)); - if(commonUtils.isNotEmptyObject(manyqtysConfig)) { + if (commonUtils.isNotEmptyObject(manyqtysConfig)) { data.push(commonBusiness.mergeData('manyqtys', manyqtysConfig.sTbName, manyqtysData, manyqtysDelData)); } @@ -1760,19 +1760,19 @@ class QuotationPackTableTree extends Component { if (commonUtils.isNotEmptyArr(data)) { for (const table of data) { for (const key of Object.keys(table)) { - if( key.includes('column')) { /* 只要一个column有值 代表有更改 要走自动计算 */ - if(commonUtils.isNotEmptyArr(table[key])) { + if (key.includes('column')) { /* 只要一个column有值 代表有更改 要走自动计算 */ + if (commonUtils.isNotEmptyArr(table[key])) { skipFlag = 0; break; } } } - if(skipFlag === 0) { /* skipFlag=0 代表不自动计算 */ + if (skipFlag === 0) { /* skipFlag=0 代表不自动计算 */ break; } } } - if(((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) { + if (((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) { this.handleCalculation(true); } else { this.props.onSaveData({ @@ -1819,7 +1819,7 @@ class QuotationPackTableTree extends Component { addState.controlSelectedRowKeys = [tableData[iIndex].sControlId]; } } - if(name === 'process') { + if (name === 'process') { addState.processSelectedData = [tableData[iIndex]]; addState.processSelectedRowKeys = selectedRowKeys; } @@ -1888,8 +1888,8 @@ class QuotationPackTableTree extends Component { /** 添加表格空行 */ handleTableAdd = (name, flag, bchild, bFinished, bModalAdd) => { const { masterConfig } = this.props; - if(bModalAdd === true) { - if(name === 'materials') { + if (bModalAdd === true) { + if (name === 'materials') { let iIndex = -1; if (bFinished) { iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnChooseProductMaterials"); @@ -1903,7 +1903,7 @@ class QuotationPackTableTree extends Component { } } } - if(name === 'process') { + if (name === 'process') { let iIndex = -1; if (bFinished) { iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnChooseProductProcess"); @@ -1925,7 +1925,7 @@ class QuotationPackTableTree extends Component { } = this.props; let slaveSelectedRow = {}; let controlSelectedRow = {}; - let { packData }=this.props; + let { packData } = this.props; if (name === 'control') { /* 增加子部件 */ const { @@ -1969,20 +1969,20 @@ class QuotationPackTableTree extends Component { } } - if(bchild !=='sameNode' && bchild !=='childNode') { /* 列头新增 */ + if (bchild !== 'sameNode' && bchild !== 'childNode') { /* 列头新增 */ tableDataRow.sAllId = tableDataRow.sId; } let slaveSelectedRow = {}; - if(commonUtils.isNotEmptyArr(slaveSelectedRowKeys)){ /* 从表有选中行 */ + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { /* 从表有选中行 */ const iSlaveIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId)); - if(iSlaveIndex > -1){ + if (iSlaveIndex > -1) { slaveSelectedRow = slaveData[iSlaveIndex]; } - }else{ /* 没有选中行 */ - if(slaveData.length ===1){ - slaveSelectedRow =slaveData[0]; - }else{ + } else { /* 没有选中行 */ + if (slaveData.length === 1) { + slaveSelectedRow = slaveData[0]; + } else { message.error('请选择从表!') } } @@ -1991,25 +1991,25 @@ class QuotationPackTableTree extends Component { tableDataRow.sPartsName = slaveSelectedRow.sProductName; /* 部件表新增时,若合版表没有该sControlId 则默认取从表选中行,合拼1 作为一条packData数据 */ - if(commonUtils.isEmptyArr(packData)){ - packData =[]; + if (commonUtils.isEmptyArr(packData)) { + packData = []; } - if(false){ - packData =[]; - } else{ - const iIndex =packData.findIndex(item=> item.sControlId === tableDataRow.sId); - if(iIndex ===-1){ + if (false) { + packData = []; + } else { + const iIndex = packData.findIndex(item => item.sControlId === tableDataRow.sId); + if (iIndex === -1) { - if(commonUtils.isEmptyObject(slaveSelectedRow.sProductId)) { + if (commonUtils.isEmptyObject(slaveSelectedRow.sProductId)) { message.error('请先选择产品!'); return; } - if(slaveSelectedRow){ + if (slaveSelectedRow) { const packDataRow = this.handlePackDataAdd(slaveSelectedRow, 0, tableDataRow.sId, 'add'); packDataRow.dCombineQty = 1; /* 排版数 */ - if(commonUtils.isNotEmptyObject(packDataRow) && commonUtils.isNotEmptyObject(packDataRow.sProductId)){ /* 从表要选择产品 */ - const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty,sCombinePartsName }= packDataRow; - const tableCombineSelectedData =[]; + if (commonUtils.isNotEmptyObject(packDataRow) && commonUtils.isNotEmptyObject(packDataRow.sProductId)) { /* 从表要选择产品 */ + const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty, sCombinePartsName } = packDataRow; + const tableCombineSelectedData = []; const jsonObj = {}; jsonObj.sId = sId; jsonObj.sProductNo = sProductNo; /* 产品编号 */ @@ -2019,7 +2019,7 @@ class QuotationPackTableTree extends Component { jsonObj.sCombinePartsName = sCombinePartsName; /* 合版部件名称 */ tableCombineSelectedData.push(jsonObj); const sCombinedMemo = commonUtils.isNotEmptyArr(tableCombineSelectedData) ? JSON.stringify(tableCombineSelectedData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ - tableDataRow.sCombinedMemo =commonUtils.isNotEmptyObject(sCombinedMemo)? sCombinedMemo: '合版信息'; + tableDataRow.sCombinedMemo = commonUtils.isNotEmptyObject(sCombinedMemo) ? sCombinedMemo : '合版信息'; } packData.push(packDataRow); @@ -2055,43 +2055,43 @@ class QuotationPackTableTree extends Component { }); } else if (name === 'materials' || name === 'process') { let slaveSelectedRow = {}; - if(commonUtils.isNotEmptyArr(slaveData)){ - if(commonUtils.isNotEmptyArr(slaveSelectedRowKeys)){ /* 从表有选中行 */ + if (commonUtils.isNotEmptyArr(slaveData)) { + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { /* 从表有选中行 */ const iSlaveIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId)); - if(iSlaveIndex > -1){ + if (iSlaveIndex > -1) { slaveSelectedRow = slaveData[iSlaveIndex]; } } else { /* 没有选中行 */ - slaveSelectedRow =slaveData[0]; + slaveSelectedRow = slaveData[0]; } } let controlSelectedRow = {}; - if(commonUtils.isNotEmptyArr(controlData)) { - if(commonUtils.isNotEmptyArr(controlSelectedRowKeys)){ /* 从表有选中行 */ + if (commonUtils.isNotEmptyArr(controlData)) { + if (commonUtils.isNotEmptyArr(controlSelectedRowKeys)) { /* 从表有选中行 */ const iControlIndex = controlData.findIndex(item => controlSelectedRowKeys.includes(item.sId)); - if(iControlIndex > -1){ + if (iControlIndex > -1) { controlSelectedRow = controlData[iControlIndex]; } - } else{ /* 没有选中行 */ - controlSelectedRow =controlData[0]; + } else { /* 没有选中行 */ + controlSelectedRow = controlData[0]; } } let processSelectedRow = {}; - if(commonUtils.isNotEmptyArr(processData)) { - if(commonUtils.isNotEmptyArr(processSelectedRowKeys)){ /* 从表有选中行 */ + if (commonUtils.isNotEmptyArr(processData)) { + if (commonUtils.isNotEmptyArr(processSelectedRowKeys)) { /* 从表有选中行 */ const iProcessIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); - if(iProcessIndex > -1){ + if (iProcessIndex > -1) { processSelectedRow = processData[iProcessIndex]; } - } else{ /* 没有选中行 */ + } else { /* 没有选中行 */ processSelectedRow = processData[0]; } } const tableDataRow = this.props.onDataRowAdd(name, true); - if(bFinished) { + if (bFinished) { const iIndex = slaveData.findIndex(item => item.sId === slaveSelectedRow.sId); if (iIndex > -1) { tableDataRow.sCombinePartsNameNew = `${slaveData[iIndex].sCustomerName}-${slaveData[iIndex].sProductName}`; @@ -2251,13 +2251,13 @@ class QuotationPackTableTree extends Component { })); processReturnData.processDelData.concat(tableDelData); /* 删除工序对应的材料 */ - const materialsFilterDelData = materialsData.filter(item => tableSelectedRowKeys.includes(item.sProcessTbId) && item.sProcessId === sProcessId ); + const materialsFilterDelData = materialsData.filter(item => tableSelectedRowKeys.includes(item.sProcessTbId) && item.sProcessId === sProcessId); let materialsSelectedDelRowKeys = []; - if(commonUtils.isNotEmptyArr(materialsFilterDelData)) { - materialsFilterDelData.forEach((item) =>{ - const materialsChildFilter = materialsData.filter(row => commonUtils.isNotEmptyObject(row.sParentMaterialsId ) && row.sParentMaterialsId === item.sId); /* 删除对应的替代料 */ - if(commonUtils.isNotEmptyArr(materialsChildFilter)) { - materialsChildFilter.forEach((child) =>{ + if (commonUtils.isNotEmptyArr(materialsFilterDelData)) { + materialsFilterDelData.forEach((item) => { + const materialsChildFilter = materialsData.filter(row => commonUtils.isNotEmptyObject(row.sParentMaterialsId) && row.sParentMaterialsId === item.sId); /* 删除对应的替代料 */ + if (commonUtils.isNotEmptyArr(materialsChildFilter)) { + materialsChildFilter.forEach((child) => { materialsSelectedDelRowKeys.push(child.sId); }) } @@ -2275,27 +2275,27 @@ class QuotationPackTableTree extends Component { materialsSelectedRowKeys: [], }); return true; - } if(name ==='materials0'){ /* 删除油墨时 同时删除油墨子集 */ + } if (name === 'materials0') { /* 删除油墨时 同时删除油墨子集 */ /* 从全部材料里 找到对应数据 进行更改 */ const { sModelsId, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, [`${name}Data`]: tableData, materialsConfig, materialsData: materials0Data, token, } = this.props; - if(commonUtils.isEmptyArr(tableSelectedRowKeys)) { + if (commonUtils.isEmptyArr(tableSelectedRowKeys)) { message.error('请选择数据!'); - return ; + return; } - if(commonUtils.isNotEmptyArr(materials0Data)) { - const iIndex = materials0Data.findIndex(item => tableSelectedRowKeys.includes(item.sId) ); + if (commonUtils.isNotEmptyArr(materials0Data)) { + const iIndex = materials0Data.findIndex(item => tableSelectedRowKeys.includes(item.sId)); let materials1Row = {}; - if(iIndex > -1) { - materials1Row = materials0Data[iIndex]; + if (iIndex > -1) { + materials1Row = materials0Data[iIndex]; } - const materials0ChildData = materials0Data.filter(item => commonUtils.isNotEmptyObject(item.sInkBOMId) && item.sInkBOMId === materials1Row.sInkBOMId - && commonUtils.isNotEmptyObject(item.sInkBOMsSlaveId) && item.sInkBOMsSlaveId === materials1Row.sInkBOMsSlaveId && + const materials0ChildData = materials0Data.filter(item => commonUtils.isNotEmptyObject(item.sInkBOMId) && item.sInkBOMId === materials1Row.sInkBOMId + && commonUtils.isNotEmptyObject(item.sInkBOMsSlaveId) && item.sInkBOMsSlaveId === materials1Row.sInkBOMsSlaveId && commonUtils.isEmptyObject(item.sInkBOMsMaterialsId)); - if(commonUtils.isNotEmptyArr(materials0ChildData)) { + if (commonUtils.isNotEmptyArr(materials0ChildData)) { materials0ChildData.forEach((item, index) => { tableSelectedRowKeys.push(item.sId); }); @@ -2305,14 +2305,14 @@ class QuotationPackTableTree extends Component { this.props.onSaveState(addState); } - } else if(name === 'materials1' || name === 'materials2' || name === 'materials0Child'){ /* 删除电化铝、油墨子集 */ + } else if (name === 'materials1' || name === 'materials2' || name === 'materials0Child') { /* 删除电化铝、油墨子集 */ /* 从全部材料里 找到对应数据 进行删除 */ const { - sModelsId, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, [`${name}Data`]: tableData, materialsConfig, materialsData : materials0Data, token, + sModelsId, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, [`${name}Data`]: tableData, materialsConfig, materialsData: materials0Data, token, } = this.props; - if(commonUtils.isEmptyArr(tableSelectedRowKeys)) { + if (commonUtils.isEmptyArr(tableSelectedRowKeys)) { message.error('请选择数据!'); - return ; + return; } const { materialsData, materialsDelData } = this.props.onDataRowDel('materials', true, tableSelectedRowKeys); const addState = { materialsData, materialsDelData }; @@ -2325,9 +2325,9 @@ class QuotationPackTableTree extends Component { handleCalculation = async (bSave, nextProps = this.props, isWait) => { const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`; const { - masterConfig, slaveConfig, slaveDelData, controlConfig, controlDelData, colorConfig, - colorData, colorDelData, materialsConfig, materialsDelData, processConfig, processDelData, - app, manyqtysConfig, manyqtysDelData, packConfig, packDelData, manyDataCache = [], dQuickQuoteProductQty, + masterConfig, slaveConfig, slaveDelData, controlConfig, controlDelData, colorConfig, + colorData, colorDelData, materialsConfig, materialsDelData, processConfig, processDelData, + app, manyqtysConfig, manyqtysDelData, packConfig, packDelData, manyDataCache = [], dQuickQuoteProductQty, } = nextProps; let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData, @@ -2340,7 +2340,7 @@ class QuotationPackTableTree extends Component { data.push(commonBusiness.mergeData('materials', `${materialsConfig.sTbName.toLowerCase()}_tmp`, materialsData, [], true)); data.push(commonBusiness.mergeData('process', `${processConfig.sTbName.toLowerCase()}_tmp`, processData, [], true)); - if(commonUtils.isNotEmptyObject(manyqtysConfig)) { + if (commonUtils.isNotEmptyObject(manyqtysConfig)) { data.push(commonBusiness.mergeData('manyqtys', `${manyqtysConfig.sTbName.toLowerCase()}_tmp`, manyqtysData?.map(item => { delete item.manyData; item.handleType = item.handleType || 'update'; @@ -2357,9 +2357,9 @@ class QuotationPackTableTree extends Component { if (cacheIndex === -1) { message.warning(calculating); } - const dataReturn = cacheIndex === -1 ? + const dataReturn = cacheIndex === -1 ? (await commonServices.postValueService(this.props.app.token, value, dataUrl)).data - : manyDataCache[cacheIndex]; + : manyDataCache[cacheIndex]; if (dataReturn.code === 1) { /* 成功 */ const valueReturn = dataReturn.dataset.rows[0]; const masterDataArr = valueReturn[`${masterConfig.sTbName.toLowerCase()}_tmp`]; @@ -2372,7 +2372,7 @@ class QuotationPackTableTree extends Component { masterData.sFormId = nextProps.masterData.sFormId; masterData.sBillNo = nextProps.masterData.sBillNo; } - masterData.handleType = masterData.sBillNo ? "update": "add"; + masterData.handleType = masterData.sBillNo ? "update" : "add"; if (masterData.handleType === 'update' && !commonUtils.isEmpty(sMakePerson)) { masterData.sMakePerson = sMakePerson; } @@ -2394,7 +2394,7 @@ class QuotationPackTableTree extends Component { });; processData = this.sortData(controlData, processData); const addState = {}; - if(commonUtils.isNotEmptyObject(manyqtysConfig)) { + if (commonUtils.isNotEmptyObject(manyqtysConfig)) { const manyqtysDataOld = cloneDeep(manyqtysData); manyqtysData = valueReturn[`${manyqtysConfig.sTbName.toLowerCase()}_tmp`]?.map((item, index) => { return { @@ -2464,7 +2464,7 @@ class QuotationPackTableTree extends Component { data.push(commonBusiness.mergeData('materials', materialsConfig.sTbName, materialsData, materialsDelData)); data.push(commonBusiness.mergeData('process', processConfig.sTbName, processData, processDelData)); - if(commonUtils.isNotEmptyObject(manyqtysConfig)) { + if (commonUtils.isNotEmptyObject(manyqtysConfig)) { data.push(commonBusiness.mergeData('manyqtys', manyqtysConfig.sTbName, manyqtysData, manyqtysDelData)); } @@ -2474,7 +2474,7 @@ class QuotationPackTableTree extends Component { data, sClientType: '1', loading: false, sSysLogSrcId: masterData.sId, }); this.props.onSaveState({ - slaveData, packData, controlData, materialsData, processData, masterData, manyqtysData, ...addState, + slaveData, packData, controlData, materialsData, processData, masterData, manyqtysData, ...addState, }); } else { if (isWait) { @@ -2760,24 +2760,24 @@ class QuotationPackTableTree extends Component { this.props.onSaveData({ data, sClientType: '1', loading: false, sSysLogSrcId: masterData.sId, bIsUnCcg: false, }); - } else if(name === 'BtnWorkFlow') { + } else if (name === 'BtnWorkFlow') { const dataUrl = `${commonConfig.server_host}workOrderFlow/getWorkOrderFlow/`; - let {token} = this.props.app - let { slaveData, controlData, materialsData, processData, packData} = this.props + let { token } = this.props.app + let { slaveData, controlData, materialsData, processData, packData } = this.props const value = { - slave:slaveData, - control:controlData, - materials:materialsData, - process:processData, - pack:packData + slave: slaveData, + control: controlData, + materials: materialsData, + process: processData, + pack: packData } - let dataReturn = (await commonServices.postValueService(token,value,dataUrl)).data; + let dataReturn = (await commonServices.postValueService(token, value, dataUrl)).data; if (commonUtils.isNotEmptyObject(dataReturn)) { if (dataReturn.code === 1) { const flowData = dataReturn.dataset.rows[0]; if (commonUtils.isNotEmptyObject(flowData)) { this.props.onSaveState({ - flowData: flowData,workFlowVisible:true + flowData: flowData, workFlowVisible: true }); // localStorage.setItem('flow', JSON.stringify(flowData)); } @@ -2851,6 +2851,11 @@ class QuotationPackTableTree extends Component { const dataUrl = `${commonConfig.server_host}bill/billCopyToCheck/?sModelsId=${sModelsId}&sActiveId=${sActiveId}&tbSuffix=${tbSuffix}&sName=${formRoute}`; const values = { sSlaveId: sId }; const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; + if (copyTo.name === 'BtnCopyTo.quoquotation') { + const sId = commonUtils.createSid() + const newCopyTo = this.deepReplaceString(copyTo, copyTo?.masterData?.sId, sId); + copyTo = newCopyTo + } if (dataReturn.code === 1) { // eslint-disable-next-line no-underscore-dangle const _this = this; // 解决confirm中this指向问题; @@ -2879,7 +2884,39 @@ class QuotationPackTableTree extends Component { }, }); } + deepReplaceString = (data, targetVal, newVal) => { + const isObj = v => v && typeof v === 'object' && !Array.isArray(v); + const isArr = v => Array.isArray(v); + const walk = item => { + if (typeof item === 'string') { + // 普通字符串直接替换 + if (item === targetVal) return newVal; + + //如果是 JSON 字符串,就解析→递归→再 stringify + if ((item.startsWith('{') && item.endsWith('}')) || (item.startsWith('[') && item.endsWith(']'))) { + try { + const parsed = JSON.parse(item); + const rebuilt = walk(parsed); + return JSON.stringify(rebuilt); + } catch (e) { + /* 不是合法 JSON,原样返回 */ + } + } + return item; + } + + if (isArr(item)) return item.map(walk); + if (isObj(item)) { + const tmp = {}; + for (const [k, v] of Object.entries(item)) tmp[k] = walk(v); + return tmp; + } + return item; // 数字、布尔、null 等 + }; + + return walk(data); + } /* 确定要删除 */ handleOkDel = async (props) => { /* 数据参数 */ @@ -3000,7 +3037,7 @@ class QuotationPackTableTree extends Component { } 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); @@ -3081,7 +3118,7 @@ class QuotationPackTableTree extends Component { app, sModelsId, token, sModelsType, } = this.props; const bCkxCopyFromTechnology = app.systemData.filter(item => item.sName === 'CkxCopyFromTechnology')[0].sValue; - const bCopyFromProcessCard = (commonUtils.isNotEmptyObject(copyTo.oldFormId) && copyTo.oldFormId === copyTo.newFormId); + const bCopyFromProcessCard = (commonUtils.isNotEmptyObject(copyTo.oldFormId) && copyTo.oldFormId === copyTo.newFormId); if (bCkxCopyFromTechnology === '1' && !bCopyFromProcessCard) { if (slaveData.length > 1) { const dataUrl = `${commonConfig.server_host}business/getCopyToQuotationData/?sModelsId=${sModelsId}`; @@ -4040,7 +4077,7 @@ class QuotationPackTableTree extends Component { tableDataRow.sSlaveId = ' '; tableDataRow.sCombinedMemo = '合版信息'; tableDataRow.sAllId = tableDataRow.sId; - if(commonUtils.isEmptyObject(tableDataRow.sPartsName)) { + if (commonUtils.isEmptyObject(tableDataRow.sPartsName)) { tableDataRow.sPartsName = commonUtils.isNotEmptyArr(slaveData) ? slaveData[0].sProductName : ''; } let dProductQty = 0; @@ -4053,7 +4090,7 @@ class QuotationPackTableTree extends Component { }); tableDataRow.dPartsQty = dProductQty; /* 点击新增按钮 控制表自动默认增一条 同时默认新增一条合版表 */ - if(commonUtils.isNotEmptyArr(slaveData) && slaveData.length === 1 && commonUtils.isEmptyArr(packData)){ + if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length === 1 && commonUtils.isEmptyArr(packData)) { const packDataRow = this.handlePackDataAdd(slaveData[0], 0, tableDataRow.sId, 'add'); packDataRow.dCombineQty = 1; packData.push(packDataRow); @@ -4099,7 +4136,7 @@ class QuotationPackTableTree extends Component { const { [`${name}Data`]: tableData, [`${name}Config`]: tableConfig, masterConfig, controlSelectedRowKeys, sModelsId, token, slaveSelectedRowKeys, processSelectedRowKeys, slaveConfig, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, slaveData, controlData, materialsData: materialsDataOld, processData: processDataOld, colorData: colorDataOld, - controlDelData: controlDelDataOld, materialsDelData: materialsDelDataOld, processDelData: processDelDataOld, colorDelData: colorDelDataOld,slaveDelData: slaveDelDataOld + controlDelData: controlDelDataOld, materialsDelData: materialsDelDataOld, processDelData: processDelDataOld, colorDelData: colorDelDataOld, slaveDelData: slaveDelDataOld } = this.props; const controlDataOld = controlData.slice(0); let { masterData } = this.props; @@ -4121,7 +4158,7 @@ class QuotationPackTableTree extends Component { const dataUrl = `${commonConfig.server_host}salesorder/getTmpInfoBySql/?sModelsId=${sModelsId}`; const sConfigformId = commonUtils.isEmpty(selectConfig) ? '' : selectConfig.sParentId; const sRowData = selectData; - const sControlName = selectConfig.sControlName; /* 按钮名称 */ + const sControlName = selectConfig.sControlName; /* 按钮名称 */ // const sSqlCondition = { sId: selectData[0].sSlaveId }; /* 后台根据rowData自己取 */ const condition = { sConfigformId, sControlName, sRowData }; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; @@ -4130,10 +4167,10 @@ class QuotationPackTableTree extends Component { const returnDataSet = dataReturn.dataset.rows[0]; const returnData = {}; const copyToMasterDetailConfig = copyTo.config.filter(item => item.sControlName.toLowerCase() === `${copyTo.name}`.toLowerCase()); - const copyToSlaveDetailConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add','').replace('_edit','').trim() === `${copyTo.name}.slave`.toLowerCase()); - const copyToControlConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add','').replace('_edit','').trim() === `${copyTo.name}.control`.toLowerCase()); - const copyToMaterialsConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add','').replace('_edit','').trim() === `${copyTo.name}.materials`.toLowerCase()); - const copyToProcessConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add','').replace('_edit','').trim() === `${copyTo.name}.process`.toLowerCase()); + const copyToSlaveDetailConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add', '').replace('_edit', '').trim() === `${copyTo.name}.slave`.toLowerCase()); + const copyToControlConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add', '').replace('_edit', '').trim() === `${copyTo.name}.control`.toLowerCase()); + const copyToMaterialsConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add', '').replace('_edit', '').trim() === `${copyTo.name}.materials`.toLowerCase()); + const copyToProcessConfig = copyTo.config.filter(item => item.sControlName.toLowerCase().replace('_add', '').replace('_edit', '').trim() === `${copyTo.name}.process`.toLowerCase()); const masterDetailAssignField = commonUtils.isNotEmptyArr(copyToMasterDetailConfig) ? copyToMasterDetailConfig[0].sAssignField : ''; const slaveDetailAssignField = commonUtils.isNotEmptyArr(copyToSlaveDetailConfig) ? copyToSlaveDetailConfig[0].sAssignField : ''; const copyToColorConfig = copyTo.config.filter(item => item.sControlName.toLowerCase() === `${copyTo.name}.param`.toLowerCase()); @@ -4143,13 +4180,13 @@ class QuotationPackTableTree extends Component { const colorAssignField = commonUtils.isNotEmptyArr(copyToColorConfig) ? copyToColorConfig[0].sAssignField : ''; /* 判断是插入 还是删除 */ - if(commonUtils.isNotEmptyArr(copyToControlConfig)) { - if(commonUtils.isNotEmptyArr(controlSelectedRowKeys)) { - if(!copyToControlConfig[0].sControlName.includes('_add') && !copyToControlConfig[0].sControlName.includes('_edit')) { /* 删除 */ + if (commonUtils.isNotEmptyArr(copyToControlConfig)) { + if (commonUtils.isNotEmptyArr(controlSelectedRowKeys)) { + if (!copyToControlConfig[0].sControlName.includes('_add') && !copyToControlConfig[0].sControlName.includes('_edit')) { /* 删除 */ controlData = []; const controlDelData = commonUtils.isEmptyArr(controlDelDataOld) ? [] : controlDelDataOld; const controlDataFilterData = controlDataOld.filter(obj => controlSelectedRowKeys.includes(obj.sId)); - if(commonUtils.isNotEmptyArr(controlDataFilterData)) { + if (commonUtils.isNotEmptyArr(controlDataFilterData)) { controlDataFilterData.forEach((item) => { item.handleType = 'del'; controlDelData.push(item); @@ -4162,12 +4199,12 @@ class QuotationPackTableTree extends Component { } } - if(commonUtils.isNotEmptyArr(copyToMaterialsConfig)) { - if(!copyToMaterialsConfig[0].sControlName.includes('_add') && !copyToMaterialsConfig[0].sControlName.includes('_edit')) { /* 删除 */ + if (commonUtils.isNotEmptyArr(copyToMaterialsConfig)) { + if (!copyToMaterialsConfig[0].sControlName.includes('_add') && !copyToMaterialsConfig[0].sControlName.includes('_edit')) { /* 删除 */ materialsData = []; const materialsDelData = commonUtils.isEmptyArr(materialsDelDataOld) ? [] : materialsDelDataOld; const materialsDataFilterData = materialsDataOld.filter(obj => controlSelectedRowKeys.includes(obj.sControlId)); - if(commonUtils.isNotEmptyArr(materialsDataFilterData)) { + if (commonUtils.isNotEmptyArr(materialsDataFilterData)) { materialsDataFilterData.forEach((item) => { item.handleType = 'del'; materialsDelData.push(item); @@ -4177,12 +4214,12 @@ class QuotationPackTableTree extends Component { } } - if(commonUtils.isNotEmptyArr(copyToProcessConfig)) { - if(!copyToProcessConfig[0].sControlName.includes('_add') && !copyToProcessConfig[0].sControlName.includes('_edit')) { /* 删除 */ + if (commonUtils.isNotEmptyArr(copyToProcessConfig)) { + if (!copyToProcessConfig[0].sControlName.includes('_add') && !copyToProcessConfig[0].sControlName.includes('_edit')) { /* 删除 */ processData = []; const processDelData = commonUtils.isEmptyArr(processDelDataOld) ? [] : processDelDataOld; const processDataFilterData = processDataOld.filter(obj => controlSelectedRowKeys.includes(obj.sControlId)); - if(commonUtils.isNotEmptyArr(processDataFilterData)) { + if (commonUtils.isNotEmptyArr(processDataFilterData)) { processDataFilterData.forEach((item) => { item.handleType = 'del'; processDelData.push(item); @@ -4192,8 +4229,8 @@ class QuotationPackTableTree extends Component { } } - if(commonUtils.isNotEmptyArr(colorAssignField)) { - if(!colorAssignField[0].sControlName.includes('_add') && !colorAssignField[0].sControlName.includes('_edit')) { /* 删除 */ + if (commonUtils.isNotEmptyArr(colorAssignField)) { + if (!colorAssignField[0].sControlName.includes('_add') && !colorAssignField[0].sControlName.includes('_edit')) { /* 删除 */ colorData = []; const colorDelData = commonUtils.isEmptyArr(colorDelDataOld) ? [] : colorDelDataOld; if (commonUtils.isNotEmptyArr(colorDataOld) && colorDataOld.length > 0) { @@ -4219,7 +4256,7 @@ class QuotationPackTableTree extends Component { let iControlIndex = -1; if (!commonUtils.isEmpty(controlSelectedRowKeys)) { iControlIndex = controlData.findIndex(item => controlSelectedRowKeys.includes(item.sId)); - if(iControlIndex > -1) { + if (iControlIndex > -1) { controlSelectedRow = controlData[iControlIndex]; } } @@ -4241,7 +4278,7 @@ class QuotationPackTableTree extends Component { } } } - if(commonUtils.isNotEmptyObject(returnDataSet)) { + if (commonUtils.isNotEmptyObject(returnDataSet)) { /* 数据塞到Data中 */ for (const key of Object.keys(returnDataSet)) { const sName = `${key}Data`; @@ -4262,7 +4299,7 @@ class QuotationPackTableTree extends Component { masterData = { ...masterData, ...commonFunc.getAssignFieldValue(masterDetailAssignField, returnData.slaveData[0], newCopyTo) }; // 取赋值字段 } - if(commonUtils.isNotEmptyObject(copyToSlaveDetailConfig)) { + if (commonUtils.isNotEmptyObject(copyToSlaveDetailConfig)) { slaveData.forEach((item, iSlaveIndex) => { if (commonUtils.isNotEmptyArr(returnData.slaveData)) { item = { ...item, ...commonFunc.getAssignFieldValue(slaveDetailAssignField, returnData.slaveData[0], newCopyTo) }; // 取赋值字段 @@ -4279,12 +4316,12 @@ class QuotationPackTableTree extends Component { returnData.controlData.forEach((controlItem) => { newCopyTo.control = controlItem; let controlRow = commonFunc.getDefaultData(config.controlConfig, newCopyTo); // 取默认值 - if(copyToControlConfig[0].sControlName.includes('_edit')) { + if (copyToControlConfig[0].sControlName.includes('_edit')) { controlRow = { ...controlSelectedRow, ...commonFunc.getAssignFieldValue(controlAssignField, controlItem, newCopyTo) }; // 取赋值字段 - if(iControlIndex > -1) { - controlData[iControlIndex] = { ...controlSelectedRow, ...controlRow}; + if (iControlIndex > -1) { + controlData[iControlIndex] = { ...controlSelectedRow, ...controlRow }; } - } else { + } else { controlRow = { ...controlRow, ...commonFunc.getAssignFieldValue(controlAssignField, controlItem, newCopyTo) }; // 取赋值字段 controlRow.handleType = 'add'; controlRow.sId = commonUtils.createSid(); @@ -4505,7 +4542,7 @@ class QuotationPackTableTree extends Component { config.colorConfig = colorConfig; config.packConfig = packConfig; - const condition = { sCardId: selectData[0].sId, sRowData:selectData }; + const condition = { sCardId: selectData[0].sId, sRowData: selectData }; const dataUrl = `${commonConfig.server_host}salesorder/getProcessCardDataByCustomIdProductId/?sModelsId=${sModelsId}`; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; if (dataReturn.code === 1) { @@ -4576,20 +4613,20 @@ class QuotationPackTableTree extends Component { if (commonUtils.isNotEmptyArr(returnData.slaveData)) { returnData.slaveData.forEach((slaveItem, iIndex) => { /* 从工艺卡数据集 找到从表相同产品ID,客户ID */ - const iSameIndex = slaveData.findIndex(itemCurrent => itemCurrent.sProductId === slaveItem.sProductId && itemCurrent.sCustomerId === slaveItem.sCustomerId); - if(iSameIndex > -1){ + const iSameIndex = slaveData.findIndex(itemCurrent => itemCurrent.sProductId === slaveItem.sProductId && itemCurrent.sCustomerId === slaveItem.sCustomerId); + if (iSameIndex > -1) { // masterData = { ...masterData, ...commonFunc.getAssignFieldValue(masterDetailAssignField, slaveItem, newCopyTo) }; // 取赋值字段 slaveData[iSameIndex].sOriginalId = commonUtils.isNotEmptyObject(slaveItem.sSlaveId) ? slaveItem.sSlaveId : slaveItem.sId; /* 原始sId */ - slaveData[iSameIndex] = { ...slaveData[iSameIndex], ...commonFunc.getAssignFieldValue(slaveDetailAssignField,slaveItem, newCopyTo) }; // 取赋值字段 + slaveData[iSameIndex] = { ...slaveData[iSameIndex], ...commonFunc.getAssignFieldValue(slaveDetailAssignField, slaveItem, newCopyTo) }; // 取赋值字段 if (bProductQtySelf) { dProductQty += commonUtils.isNull(slaveItem.dProductQty, 0); } else { dProductQty += commonUtils.isNull(slaveItem.dProductQty, 0) + commonUtils.isNull(slaveItem.dGiveQty, 0) + commonUtils.isNull(slaveItem.dStockupQty, 0); } - } else if(commonUtils.isNotEmptyObject(slaveDetailAssignField)){ /* 其他数据 新增 */ + } else if (commonUtils.isNotEmptyObject(slaveDetailAssignField)) { /* 其他数据 新增 */ newCopyTo.slave = slaveItem; - let slaveRow ={}; - slaveRow = { ...slaveRow, ...commonFunc.getAssignFieldValue(slaveDetailAssignField,slaveItem, newCopyTo) }; // 取赋值字段 + let slaveRow = {}; + slaveRow = { ...slaveRow, ...commonFunc.getAssignFieldValue(slaveDetailAssignField, slaveItem, newCopyTo) }; // 取赋值字段 slaveRow.handleType = 'add'; slaveRow.sId = commonUtils.createSid(); slaveRow.sParentId = masterData.sId; @@ -4875,8 +4912,8 @@ class QuotationPackTableTree extends Component { const treeState = this.handleGetControlTreeData(controlData, true); /* 因全部材料对应的是materials0 */ const materials0Data = materialsData; - addState.materials0Data = materials0Data; - addState.materials0DelData = addState.materialsDelData; + addState.materials0Data = materials0Data; + addState.materials0DelData = addState.materialsDelData; this.props.onSaveState({ [`${name}ChooseVisible`]: false, processData, @@ -4894,7 +4931,7 @@ class QuotationPackTableTree extends Component { this.props.getServiceError(dataReturn.msg); } } - }else if (name === 'productProcessInfo' && commonUtils.isNotEmptyObject(selectConfig) && selectConfig.sControlName.includes('mainproductProcessInfo')) { /* 复制从主产品工艺卡 */ + } else if (name === 'productProcessInfo' && commonUtils.isNotEmptyObject(selectConfig) && selectConfig.sControlName.includes('mainproductProcessInfo')) { /* 复制从主产品工艺卡 */ if (commonUtils.isNotEmptyArr(selectData)) { const { slaveData: slaveDataOld } = this.props; const slaveData = []; @@ -4946,7 +4983,7 @@ class QuotationPackTableTree extends Component { config.colorConfig = colorConfig; config.packConfig = packConfig; - const condition = { sCardId: selectData[0].sId, sRowData:selectData }; + const condition = { sCardId: selectData[0].sId, sRowData: selectData }; const dataUrl = `${commonConfig.server_host}salesorder/getProcessCardDataByCustomIdProductId/?sModelsId=${sModelsId}`; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; if (dataReturn.code === 1) { @@ -5267,16 +5304,16 @@ class QuotationPackTableTree extends Component { this.props.getServiceError(dataReturn.msg); } } - }else if (name === 'productProcessInfo' && commonUtils.isNotEmptyObject(selectConfig) && selectConfig.sControlName.includes('subproductProcessInfo')) { /* 复制从子工艺卡*/ + } else if (name === 'productProcessInfo' && commonUtils.isNotEmptyObject(selectConfig) && selectConfig.sControlName.includes('subproductProcessInfo')) { /* 复制从子工艺卡*/ if (commonUtils.isNotEmptyArr(selectData)) { - const {slaveSelectedRowKeys, packData}=this.props; + const { slaveSelectedRowKeys, packData } = this.props; let iSlaveIndex = -1; if (!commonUtils.isEmpty(slaveSelectedRowKeys)) { iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys.toString()); } - let {controlData} = this.props; - if(commonUtils.isEmptyArr(controlData)){ - controlData=[] + let { controlData } = this.props; + if (commonUtils.isEmptyArr(controlData)) { + controlData = [] } const materialsData = []; const processData = []; @@ -5288,20 +5325,20 @@ class QuotationPackTableTree extends Component { const colorDelData = commonUtils.isEmptyArr(colorDelDataOld) ? [] : colorDelDataOld; /* 选择子产品工艺卡 如果选择的从表的packData合拼的其他的 则不删除 没有合拼产品的 或是合拼产品为1的删除 */ controlDataOld.forEach((item) => { - const jsonArr =commonUtils.isEmptyObject(item.sCombinedMemo)? []: JSON.parse(item.sCombinedMemo); - if((jsonArr.length ===1 && jsonArr[0].sProductNo === slaveData[iSlaveIndex].sProductNo)){ + const jsonArr = commonUtils.isEmptyObject(item.sCombinedMemo) ? [] : JSON.parse(item.sCombinedMemo); + if ((jsonArr.length === 1 && jsonArr[0].sProductNo === slaveData[iSlaveIndex].sProductNo)) { item.handleType = 'del'; controlDelData.push(item); let tableDataIndex = controlData.findIndex(itemOld => itemOld.sId === item.sId); - if(tableDataIndex > -1){ + if (tableDataIndex > -1) { controlData.splice(tableDataIndex, 1); } } }); addState.controlDelData = controlDelData; materialsDataOld.forEach((item) => { - const filterData= controlDelData.filter(itemControl => itemControl.sId.includes(item.sControlId)); - if(commonUtils.isNotEmptyArr(filterData)){ + const filterData = controlDelData.filter(itemControl => itemControl.sId.includes(item.sControlId)); + if (commonUtils.isNotEmptyArr(filterData)) { item.handleType = 'del'; materialsDelData.push(item); } @@ -5309,8 +5346,8 @@ class QuotationPackTableTree extends Component { }); addState.materialsDelData = materialsDelData; processDataOld.forEach((item) => { - const filterData= controlDelData.filter(itemControl => itemControl.sId.includes(item.sControlId )); - if(commonUtils.isNotEmptyArr(filterData)){ + const filterData = controlDelData.filter(itemControl => itemControl.sId.includes(item.sControlId)); + if (commonUtils.isNotEmptyArr(filterData)) { item.handleType = 'del'; processDelData.push(item); } @@ -5332,7 +5369,7 @@ class QuotationPackTableTree extends Component { config.colorConfig = colorConfig; config.packConfig = packConfig; - const condition = { sCardId: selectData[0].sId, sRowData:selectData }; + const condition = { sCardId: selectData[0].sId, sRowData: selectData }; const dataUrl = `${commonConfig.server_host}salesorder/getProcessCardDataByCustomIdProductId/?sModelsId=${sModelsId}`; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; if (dataReturn.code === 1) { @@ -5753,7 +5790,7 @@ class QuotationPackTableTree extends Component { } })); } - } else if(name ==='materials') { + } else if (name === 'materials') { /* 将工序选中行 作为对应工序给材料 */ const iProcessIndex = commonUtils.isNotEmptyArr(processSelectedRowKeys) ? processDataOld.findIndex(item => item.sId === processSelectedRowKeys[0]) : -1; let processRow = {}; @@ -5790,7 +5827,7 @@ class QuotationPackTableTree extends Component { name = 'materials'; } const { - [`${name}Data`]: tableData, [`${name}Config`]: tableConfig, controlSelectedRowKeys, materialsConfig,masterConfig, + [`${name}Data`]: tableData, [`${name}Config`]: tableConfig, controlSelectedRowKeys, materialsConfig, masterConfig, } = this.props; const { masterData } = this.props; const { controlData } = this.props; @@ -5853,7 +5890,7 @@ class QuotationPackTableTree extends Component { const targetname = 'process'; const { [`${targetname}Data`]: tableData, [`${targetname}Config`]: tableConfig, controlSelectedRowKeys, sModelsId, token, - materialsConfig, processConfig,masterConfig, + materialsConfig, processConfig, masterConfig, } = this.props; const { masterData } = this.props; if (name === 'chooseProductProcess') { @@ -5998,7 +6035,7 @@ class QuotationPackTableTree extends Component { } - handleViewChoose= (name, sName, record) => { + handleViewChoose = (name, sName, record) => { const { sId } = record; /* 控制表主键 */ const { enabled, slaveData } = this.props; let { packData } = this.props; @@ -6168,11 +6205,11 @@ class QuotationPackTableTree extends Component { }); } else if (name === 'process' && sName === 'sColorSerialMemo') { this.props.onViewChoose(name, sName, record); - } else if(name === 'process' && (sName === 'sParams' || sName ==='sQuoParams')) { + } else if (name === 'process' && (sName === 'sParams' || sName === 'sQuoParams')) { this.props.onViewClick(name, sName, record); } } - handlePackDataAdd= (item, index, sControlId, handleType) => { + handlePackDataAdd = (item, index, sControlId, handleType) => { const tableDataRow = {}; if (handleType === 'add') { tableDataRow.sId = commonUtils.createSid(); @@ -6404,7 +6441,7 @@ class QuotationPackTableTree extends Component { tableDataRow.dProfitMoney = commonUtils.convertFixNum(commonUtils.isNull(dProductMoney, 0) - commonUtils.isNull(tableDataRow.dProductTaxMoney, 0) - commonUtils.isNull(tableDataRow.dStandardMoney, 0) - commonUtils.isNull(masterData.dPackMoney, 0) - commonUtils.isNull(masterData.dTransportMoney, 0), dNetMoney); } // eslint-disable-next-line no-mixed-operators - tableDataRow.dProfitRate = commonUtils.isNull(tableDataRow.dStandardMoney, 0) !== 0 ? commonUtils.convertFixNum(commonUtils.isNull(tableDataRow.dProfitMoney, 0) / commonUtils.isNull(tableDataRow.dStandardMoney, 0) * 100, 2) : 0; + tableDataRow.dProfitRate = commonUtils.isNull(tableDataRow.dStandardMoney, 0) !== 0 ? commonUtils.convertFixNum(commonUtils.isNull(tableDataRow.dProfitMoney, 0) / commonUtils.isNull(tableDataRow.dStandardMoney, 0) * 100, 2) : 0; } else if ((sFieldName === 'dProfitRate') && !commonUtils.isEmpty(tableDataRow.dStandardMoney)) { /* 利润 = 标准金额 dStandMoney * 利润率 dProfitRate */ tableDataRow.dProfitMoney = commonUtils.convertFixNum((commonUtils.isNull(tableDataRow.dStandardMoney, 0)) * (commonUtils.isNull(tableDataRow.dProfitRate, 0) / 100), dNetMoney); @@ -6516,27 +6553,27 @@ class QuotationPackTableTree extends Component { 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}; /* 根据选中的从表 找到所有的合版数据,将合版数据中的产品换成切换后的产品 */ + if (pIndex > -1) { + packData[pIndex] = { ...packData[pIndex], ...packDataRow }; /* 根据选中的从表 找到所有的合版数据,将合版数据中的产品换成切换后的产品 */ let sCombinedMemoStr = ''; /* 将控制表合版信息中的产品换成新选择的产品 */ - if(commonUtils.isNotEmptyArr(controlDataNew)) { + 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)) { + 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 ={}; + 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}; + sCombinedMemoArr[iIndex] = { ...sCombinedMemoArr[iIndex], ...addState }; const sCombinedMemo = commonUtils.isNotEmptyArr(sCombinedMemoArr) ? JSON.stringify(sCombinedMemoArr) : ''; /* JSON对象转换为字符串存放到合版信息中 */ - controlDataNew[iControlIndex].sCombinedMemo =sCombinedMemo; + controlDataNew[iControlIndex].sCombinedMemo = sCombinedMemo; controlDataNew[iControlIndex].sPartsName = tableDataRow.sProductName; } } @@ -6608,19 +6645,19 @@ class QuotationPackTableTree extends Component { tableDataRow.iOppositeColor = tableDataRow.iPositiveColor; tableDataRow.iOppositeSpecialColor = tableDataRow.iPositiveSpecialColor; } - } else if ( sFieldName === 'dSinglePQty' ) { /* 排版数改变时 如果该控制表合版数据只有一条 则改变packData该条的拼版数 改变备注 */ - if(commonUtils.isNotEmptyArr(packData)){ + } else if (sFieldName === 'dSinglePQty') { /* 排版数改变时 如果该控制表合版数据只有一条 则改变packData该条的拼版数 改变备注 */ + if (commonUtils.isNotEmptyArr(packData)) { const packFilterData = packData.filter(item => item.sControlId === tableDataRow.sId); - if (commonUtils.isNotEmptyArr(packFilterData) && packFilterData.length ===1 ) { + if (commonUtils.isNotEmptyArr(packFilterData) && packFilterData.length === 1) { const iIndex = packData.findIndex(itemPack => itemPack.sId === packFilterData[0].sId); - const addState ={}; - if(tableDataRow.dSinglePQty > 0){ + const addState = {}; + if (tableDataRow.dSinglePQty > 0) { addState.dCombineQty = tableDataRow.dSinglePQty; addState.handleType = commonUtils.isEmpty(tableDataRow.handleType) ? 'update' : tableDataRow.handleType; - if(iIndex > -1) { - packData[iIndex] ={ ...packData[iIndex] , ...addState}; - const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty,sCombinePartsName }= packData[iIndex]; - const tableCombineSelectedData =[]; + if (iIndex > -1) { + packData[iIndex] = { ...packData[iIndex], ...addState }; + const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty, sCombinePartsName } = packData[iIndex]; + const tableCombineSelectedData = []; const jsonObj = {}; jsonObj.sId = sId; jsonObj.sProductNo = sProductNo; /* 产品编号 */ @@ -6630,7 +6667,7 @@ class QuotationPackTableTree extends Component { jsonObj.sCombinePartsName = sCombinePartsName; /* 合版部件名称 */ tableCombineSelectedData.push(jsonObj); const sCombinedMemo = commonUtils.isNotEmptyArr(tableCombineSelectedData) ? JSON.stringify(tableCombineSelectedData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ - tableDataRow.sCombinedMemo =commonUtils.isNotEmptyObject(sCombinedMemo)? sCombinedMemo: '合版信息'; + tableDataRow.sCombinedMemo = commonUtils.isNotEmptyObject(sCombinedMemo) ? sCombinedMemo : '合版信息'; } } } @@ -6648,8 +6685,8 @@ class QuotationPackTableTree extends Component { } }); } - if(sFieldName === 'dPartsLength' || sFieldName === 'dPartsWidth' || sFieldName === 'dMachineLength' || sFieldName === 'dMachineWidth' - || sFieldName === 'sPrintingPlate' || sFieldName === 'sCutMethod' || sFieldName === 'sSpineDirection' || sFieldName === 'iPrintMode' || sFieldName === 'dBite' || sFieldName === 'dBlood' ) { + if (sFieldName === 'dPartsLength' || sFieldName === 'dPartsWidth' || sFieldName === 'dMachineLength' || sFieldName === 'dMachineWidth' + || sFieldName === 'sPrintingPlate' || sFieldName === 'sCutMethod' || sFieldName === 'sSpineDirection' || sFieldName === 'iPrintMode' || sFieldName === 'dBite' || sFieldName === 'dBlood') { /* 计算材料开数 */ if (true) { // if (commonUtils.isNotEmptyArr(slaveData)) { @@ -6663,7 +6700,7 @@ class QuotationPackTableTree extends Component { let slaveDataRow = {}; - if(commonUtils.isNotEmptyArr(slaveData)) { + if (commonUtils.isNotEmptyArr(slaveData)) { if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { slaveDataRow = slaveData[0]; } else if (commonUtils.isEmptyObject(tableDataRow.sCombinedMemo) || tableDataRow.sCombinedMemo === '合版信息') { @@ -6678,16 +6715,16 @@ class QuotationPackTableTree extends Component { } } } - if(commonUtils.isNotEmptyObject(slaveDataRow)) { + if (commonUtils.isNotEmptyObject(slaveDataRow)) { /* 如果有展开尺寸 则取展开尺寸 否则取产品规格 */ let sProductStyle = ''; - if(slaveDataRow.sPartsStyle) { + if (slaveDataRow.sPartsStyle) { sProductStyle = slaveDataRow.sPartsStyle; - }else if(slaveDataRow.sProductStyle) { + } else if (slaveDataRow.sProductStyle) { sProductStyle = slaveDataRow.sProductStyle; } if (sProductStyle) { - let dProductLength = !commonUtils.isEmpty(sProductStyle) && sProductStyle.split('*').length > 1 ? sProductStyle.split('*')[0] : 0; + let dProductLength = !commonUtils.isEmpty(sProductStyle) && sProductStyle.split('*').length > 1 ? sProductStyle.split('*')[0] : 0; dProductLength = commonUtils.convertStrToNumber(commonUtils.isNull(dProductLength, 0)); /* 产品长 */ dProductLength = (typeof dProductLength === 'number' && !isNaN(dProductLength)) ? dProductLength : 0; /* 产品长 */ let dProductWidth = !commonUtils.isEmpty(sProductStyle) && sProductStyle.split('*').length > 1 ? sProductStyle.split('*')[1] : 0; @@ -6736,18 +6773,18 @@ class QuotationPackTableTree extends Component { // } // } - if(commonUtils.isNotEmptyArr(packData)){ + if (commonUtils.isNotEmptyArr(packData)) { const packFilterData = packData.filter(item => item.sControlId === tableDataRow.sId); - if (commonUtils.isNotEmptyArr(packFilterData) && packFilterData.length ===1 ) { + if (commonUtils.isNotEmptyArr(packFilterData) && packFilterData.length === 1) { const iIndex = packData.findIndex(itemPack => itemPack.sId === packFilterData[0].sId); - const addState ={}; - if(tableDataRow.dSinglePQty > 0){ + const addState = {}; + if (tableDataRow.dSinglePQty > 0) { addState.dCombineQty = tableDataRow.dSinglePQty; addState.handleType = commonUtils.isEmpty(tableDataRow.handleType) ? 'update' : tableDataRow.handleType; - if(iIndex > -1) { - packData[iIndex] ={ ...packData[iIndex] , ...addState}; - const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty,sCombinePartsName }= packData[iIndex]; - const tableCombineSelectedData =[]; + if (iIndex > -1) { + packData[iIndex] = { ...packData[iIndex], ...addState }; + const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty, sCombinePartsName } = packData[iIndex]; + const tableCombineSelectedData = []; const jsonObj = {}; jsonObj.sId = sId; jsonObj.sProductNo = sProductNo; /* 产品编号 */ @@ -6757,17 +6794,17 @@ class QuotationPackTableTree extends Component { jsonObj.sCombinePartsName = sCombinePartsName; /* 合版部件名称 */ tableCombineSelectedData.push(jsonObj); const sCombinedMemo = commonUtils.isNotEmptyArr(tableCombineSelectedData) ? JSON.stringify(tableCombineSelectedData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ - tableDataRow.sCombinedMemo =commonUtils.isNotEmptyObject(sCombinedMemo)? sCombinedMemo: '合版信息'; + tableDataRow.sCombinedMemo = commonUtils.isNotEmptyObject(sCombinedMemo) ? sCombinedMemo : '合版信息'; } } } } else { /* packData没数据时 */ const packDataRow = this.handlePackDataAdd(slaveDataRow, 0, tableDataRow.sId, 'add'); packDataRow.dCombineQty = tableDataRow.dSinglePQty; - packDataRow.dFactProductQty = commonUtils.isNull(slaveDataRow.dProductQty, 0); /* 排版数为1时,实际生产数 = 产品数 */ + packDataRow.dFactProductQty = commonUtils.isNull(slaveDataRow.dProductQty, 0); /* 排版数为1时,实际生产数 = 产品数 */ if (tableDataRow.dSinglePQty > 0) { - const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty,sCombinePartsName }= packDataRow; - const tableCombineSelectedData =[]; + const { sId, sProductNo, dProductQty, dCombineQty, dFactProductQty, sCombinePartsName } = packDataRow; + const tableCombineSelectedData = []; const jsonObj = {}; jsonObj.sId = sId; jsonObj.sProductNo = sProductNo; /* 产品编号 */ @@ -6777,7 +6814,7 @@ class QuotationPackTableTree extends Component { jsonObj.sCombinePartsName = sCombinePartsName; /* 合版部件名称 */ tableCombineSelectedData.push(jsonObj); const sCombinedMemo = commonUtils.isNotEmptyArr(tableCombineSelectedData) ? JSON.stringify(tableCombineSelectedData) : ''; /* JSON对象转换为字符串存放到合版信息中 */ - tableDataRow.sCombinedMemo =commonUtils.isNotEmptyObject(sCombinedMemo)? sCombinedMemo: '合版信息'; + tableDataRow.sCombinedMemo = commonUtils.isNotEmptyObject(sCombinedMemo) ? sCombinedMemo : '合版信息'; packData.push(packDataRow); } } @@ -6911,20 +6948,20 @@ class QuotationPackTableTree extends Component { } } this.props.onSaveState({ [`${name}Data`]: tableData }); - }else if (name === 'materials0' || name === 'materials1' || name === 'materials2' || name === 'materials0Child') { + } else if (name === 'materials0' || name === 'materials1' || name === 'materials2' || name === 'materials0Child') { name = 'materials'; const { [`${name}Data`]: tableData, controlData, controlSelectedRowKeys, materials0Data, materials0SelectedRowKeys, } = this.props; let oldRowMap = {}; - if(sFieldName === 'sInkBOM') { + if (sFieldName === 'sInkBOM') { const iOldIndex = tableData.findIndex(item => item.sId === sId); - if(iOldIndex > -1) { + if (iOldIndex > -1) { const tableDataOldRow = JSON.parse(JSON.stringify(tableData[iOldIndex])); - oldRowMap ={ - sInkBOMId : tableDataOldRow.sInkBOMId, - sInkBOMsSlaveId : tableDataOldRow.sInkBOMsSlaveId, - sInkBOMsMaterialsId : tableDataOldRow.sInkBOMsMaterialsId, + oldRowMap = { + sInkBOMId: tableDataOldRow.sInkBOMId, + sInkBOMsSlaveId: tableDataOldRow.sInkBOMsSlaveId, + sInkBOMsMaterialsId: tableDataOldRow.sInkBOMsMaterialsId, } } } @@ -6938,7 +6975,7 @@ class QuotationPackTableTree extends Component { tableData[iIndex] = tableDataRow; } this.props.onSaveState({ [`${name}Data`]: tableData }); - }else if ( name === 'materialsChild') { /* 替代料 */ + } else if (name === 'materialsChild') { /* 替代料 */ name = 'materials'; const { [`${name}Data`]: tableData, controlData, controlSelectedRowKeys, materials0Data, materials0SelectedRowKeys, @@ -7183,7 +7220,7 @@ class QuotationPackTableTree extends Component { handleCancelProductCombinationChooseModal = () => { this.props.onSaveState({ productCombinationVisible: false }); }; - handleSelectProductCombination= () => { + handleSelectProductCombination = () => { const { controlData, sCombinationsControlId, packData, enabled, app, } = this.props; @@ -7409,7 +7446,7 @@ class QuotationPackTableTree extends Component { }); } this.props.onSaveState({ - [`${name}Data`]: tableData, [`${name}Pagination`]: { ...tablePagination, total: tableData.length, current: 9999 }, [`${name}SelectedRowKeys`]: tableSelectedNewRowKeys, treeSelectedKeys: tableSelectedNewRowKeys, packData,...treeState, + [`${name}Data`]: tableData, [`${name}Pagination`]: { ...tablePagination, total: tableData.length, current: 9999 }, [`${name}SelectedRowKeys`]: tableSelectedNewRowKeys, treeSelectedKeys: tableSelectedNewRowKeys, packData, ...treeState, }); } } @@ -7588,12 +7625,12 @@ class QuotationPackTableTree extends Component { commonUtils.isNull(tableDataRow.iOppositeSpecialColor, 0)); } else { if (tableDataRow.iPrintModePo !== 2) { // 单面样本 - tableDataRow.dPlateQty = Math.ceil( (commonUtils.isNull(tableDataRow.dSumPQty, 0) * 0.5) / tableDataRow.dSinglePQty); + tableDataRow.dPlateQty = Math.ceil((commonUtils.isNull(tableDataRow.dSumPQty, 0) * 0.5) / tableDataRow.dSinglePQty); tableDataRow.iStick = Math.ceil(tableDataRow.dPlateQty); tableDataRow.dSumPlateQty = tableDataRow.iStick * (commonUtils.isNull(tableDataRow.iPositiveColor, 0) + commonUtils.isNull(tableDataRow.iPositiveSpecialColor, 0)); } else { - tableDataRow.dPlateQty = Math.ceil(commonUtils.isNull(tableDataRow.dSumPQty, 0) / commonUtils.isNull(commonUtils.nullIf(tableDataRow.dSinglePQty, 0), 1)); + tableDataRow.dPlateQty = Math.ceil(commonUtils.isNull(tableDataRow.dSumPQty, 0) / commonUtils.isNull(commonUtils.nullIf(tableDataRow.dSinglePQty, 0), 1)); tableDataRow.iStick = Math.ceil(tableDataRow.dPlateQty / 2); } tableDataRow.dSumPlateQty = tableDataRow.iStick * ( @@ -7786,12 +7823,12 @@ class QuotationPackTableTree extends Component { /* 主产品选中时 清除所有表格选中 */ handleTotalTreeSelect = (name, checkedKeys, e) => { - const bMainProduct = (e && e.node && e.node.treeNode) ? e.node.treeNode.isRoot: false; /* 主产品 */ + const bMainProduct = (e && e.node && e.node.treeNode) ? e.node.treeNode.isRoot : false; /* 主产品 */ this.props.onTreeSelect(name, checkedKeys, e); - if(bMainProduct){ + if (bMainProduct) { this.props.onSaveState({ - slaveSelectedRowKeys:[], - controlSelectedRowKeys:[], + slaveSelectedRowKeys: [], + controlSelectedRowKeys: [], }); } }; @@ -7845,15 +7882,15 @@ class QuotationPackTableTree extends Component { handleDrag = (data) => { let { controlSelectedRowKeys } = this.props; - if(this.props.enabled && controlSelectedRowKeys.length) { - if(true) { + if (this.props.enabled && controlSelectedRowKeys.length) { + if (true) { // process : 0-1-2 部品工序 : 3成品工序; let processData = this.props.processData.slice(0); let preDataIndex = 0; let preData = data.filter(item => item.sControlId === this.props.controlSelectedRowKeys[0]).map((item) => { preDataIndex = preDataIndex + 1; - return {...item, iOrder: preDataIndex} + return { ...item, iOrder: preDataIndex } }); // let afterDataIndex = 0; @@ -7863,56 +7900,56 @@ class QuotationPackTableTree extends Component { // }); let allData = preData; //.concat(afterData); allData.forEach((item, index) => { - if(item.sControlId === this.props.controlSelectedRowKeys[0]) { - if(!allData[index].handleType) { + if (item.sControlId === this.props.controlSelectedRowKeys[0]) { + if (!allData[index].handleType) { allData[index].handleType = 'update'; } } }); processData = processData.filter(item => item.sControlId !== this.props.controlSelectedRowKeys[0]); processData = processData.concat(allData); - this.props.onSaveState({ processData}); + this.props.onSaveState({ processData }); } else { // process : 0-1-2 部品工序 : 3成品工序; let processData = this.props.processData.slice(0); let preDataIndex = 0; let preData = data.filter(item => item.sType === '0' && item.sControlId === this.props.controlSelectedRowKeys[0]).map((item) => { preDataIndex = preDataIndex + 1; - return {...item, iOrder: preDataIndex} + return { ...item, iOrder: preDataIndex } }); let inDataIndex = 0; let inData = data.filter(item => item.sType === '1' && item.sControlId === this.props.controlSelectedRowKeys[0]).map((item) => { inDataIndex = inDataIndex + 1; - return {...item, iOrder: inDataIndex} + return { ...item, iOrder: inDataIndex } }); let afterDataIndex = 0; let afterData = data.filter(item => item.sType === '2' && item.sControlId === this.props.controlSelectedRowKeys[0]).map((item) => { afterDataIndex = afterDataIndex + 1; - return {...item, iOrder: afterDataIndex} + return { ...item, iOrder: afterDataIndex } }); let allData = preData.concat(inData, afterData); allData.forEach((item, index) => { - if(item.sControlId === this.props.controlSelectedRowKeys[0]) { - if(!allData[index].handleType) { + if (item.sControlId === this.props.controlSelectedRowKeys[0]) { + if (!allData[index].handleType) { allData[index].handleType = 'update'; } } }); processData = processData.filter(item => item.sControlId !== this.props.controlSelectedRowKeys[0]); processData = processData.concat(allData); - this.props.onSaveState({ processData}); + this.props.onSaveState({ processData }); } } } handleProductDrag = (data) => { - if(this.props.enabled) { + if (this.props.enabled) { // process : 0-1-2 部品工序 : 3成品工序; let processData = this.props.processData.slice(0); let dataIndex = 0; const allData = data.filter(item => item.sType === '3' && item.sCombinePartsName === this.props.slaveSelectedRowKeys[0]).map((item) => { dataIndex = dataIndex + 1; - return {...item, iOrder: dataIndex, handleType: item.handleType ? item.handleType : 'update'}; + return { ...item, iOrder: dataIndex, handleType: item.handleType ? item.handleType : 'update' }; }); processData = processData.filter(item => item.sCombinePartsName !== this.props.slaveSelectedRowKeys[0]); processData = processData.concat(allData); @@ -8010,7 +8047,7 @@ const QuotationComponent = Form.create({ })((props) => { const { form, onReturnForm, masterConfig: masterConfigOld, slaveData, slavePagination, sModelsId, sTabId, app, Loading, colorConfigGrdVisible, productCombinationVisible, combinePartsChooseVisible, - sisColorChooseVisible, finishedMaterialsColumn, finishedMaterialsConfig, finishedProcessColumn, finishedProcessConfig, isLayout, isLayout2,visible, checkConditions, checkPersonData, sModelsType, + sisColorChooseVisible, finishedMaterialsColumn, finishedMaterialsConfig, finishedProcessColumn, finishedProcessConfig, isLayout, isLayout2, visible, checkConditions, checkPersonData, sModelsType, formData, materialsInfoList, materialsChildInfoList, @@ -8020,12 +8057,12 @@ const QuotationComponent = Form.create({ } = props; // 关联slave合版进行筛选control的数据 let controlTableData = []; - if(commonBusiness.getTableTypes('control', props).data && commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.slaveData)) { + if (commonBusiness.getTableTypes('control', props).data && commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.slaveData)) { const iSlaveIndex = props.slaveData.findIndex(item => item.sId === props.slaveSelectedRowKeys[0]); - const slaveSelectedRow = props.slaveData[iSlaveIndex] || {sProductNo: 0}; - if(iSlaveIndex !== -1) { + const slaveSelectedRow = props.slaveData[iSlaveIndex] || { sProductNo: 0 }; + if (iSlaveIndex !== -1) { commonBusiness.getTableTypes('control', props).data.forEach(item => { - if(item.sCombinedMemo && item.sCombinedMemo !== '' && item.sCombinedMemo !== '合版信息') { + if (item.sCombinedMemo && item.sCombinedMemo !== '' && item.sCombinedMemo !== '合版信息') { const sCombinedMemoArr = commonUtils.isJSON(item.sCombinedMemo) ? JSON.parse(item.sCombinedMemo) : []; const getSlaveSelectedRowChildren = (allData, sId) => { let result = []; @@ -8040,7 +8077,7 @@ const QuotationComponent = Form.create({ const slaveSelectedRowChildren = getSlaveSelectedRowChildren(props.slaveData, slaveSelectedRow.sId); const slaveRows = [slaveSelectedRow, ...slaveSelectedRowChildren]; const len = sCombinedMemoArr.filter(item => item.sProductNo && slaveRows.some(slaveRow => slaveRow.sProductNo === item.sProductNo)).length; - if(len) { + if (len) { controlTableData.push(item); } } else { @@ -8052,8 +8089,8 @@ const QuotationComponent = Form.create({ } } // 之前代码默认会选中第一行,第一行可能已经被筛选掉,需要判断 - if(controlTableData.length && props.controlSelectedRowKeys[0] !== controlTableData[0].sId && controlTableData.map(item => item.sId).indexOf(props.controlSelectedRowKeys[0]) === -1) { - if(commonUtils.isNotEmptyArr(props.slaveSelectedRowKeys)) { + if (controlTableData.length && props.controlSelectedRowKeys[0] !== controlTableData[0].sId && controlTableData.map(item => item.sId).indexOf(props.controlSelectedRowKeys[0]) === -1) { + if (commonUtils.isNotEmptyArr(props.slaveSelectedRowKeys)) { props.onSaveState({ controlSelectedRowKeys: [controlTableData[0].sId] }); @@ -8066,7 +8103,7 @@ const QuotationComponent = Form.create({ const slaveLen = props.slaveData ? props.slaveData.length : 0; let stickyHeight = 0; let stickyTabHeight = 0; - if(layoutChange) { + if (layoutChange) { if (controlLen && controlLen < 5) { stickyTabHeight += (slaveLen * 29) + 40; stickyHeight += (controlLen * 29) + 40 + 30 - 4; @@ -8075,7 +8112,7 @@ const QuotationComponent = Form.create({ } stickyHeight += 40; } else { - if(props.currentTab === 1) { + if (props.currentTab === 1) { if (controlLen && controlLen < 5) { stickyHeight = (controlLen * 29) + 40 + 30 - 4; // 153 } else { @@ -8284,11 +8321,11 @@ const QuotationComponent = Form.create({ bRowClick: true }; - let bShowMaterials = true; + let bShowMaterials = true; const iMaterialsIndex = props && props.masterConfig ? props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseMaterials') : -1; bShowMaterials = iMaterialsIndex > -1; - let bShowProcess = true; + let bShowProcess = true; const iProcessIndex = props && props.masterConfig ? props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseProcess') : -1; bShowProcess = iProcessIndex > -1; @@ -8373,7 +8410,7 @@ const QuotationComponent = Form.create({ showLine: true, }; - /* 整体树结构 */ + /* 整体树结构 */ const totalname = 'totalTree'; const totalTreeProps = { ...commonBusiness.getTreeTypes('totalTree', props), @@ -8455,7 +8492,7 @@ const QuotationComponent = Form.create({ return val.sType !== '3'; }); } - if(isQianCai) { + if (isQianCai) { const pre = res.filter(item => item.sType == '0').sort((a, b) => a.iOrder - b.iOrder); const after = res.filter(item => (item.sType == '1' || item.sType == '2')).sort((a, b) => a.iOrder - b.iOrder); res = pre.concat(after); @@ -8478,37 +8515,37 @@ const QuotationComponent = Form.create({ // materials : 0-1部件材料 : 2成品材料; // process : 0-1-2 部品工序 : 3成品工序; // bfinal: 是否成品 - const { materialsData, materials0Data, processSelectedRowKeys, processData, controlSelectedRowKeys, controlData } = props; + const { materialsData, materials0Data, processSelectedRowKeys, processData, controlSelectedRowKeys, controlData } = props; let oriData = commonUtils.isNotEmptyArr(data.data) ? data.data : []; let res = []; let newData = []; let processRow = {}; let controlRow = {}; - if(commonUtils.isNotEmptyArr(controlData) && commonUtils.isNotEmptyArr(controlSelectedRowKeys)){ /* 没有工序选中行 则不进行数据过滤 */ + if (commonUtils.isNotEmptyArr(controlData) && commonUtils.isNotEmptyArr(controlSelectedRowKeys)) { /* 没有工序选中行 则不进行数据过滤 */ const iIndex = controlData.findIndex(item => controlSelectedRowKeys.includes(item.sId)); - if(iIndex > -1) { + if (iIndex > -1) { controlRow = controlData[iIndex]; } } - if(commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)){ /* 没有工序选中行 则不进行数据过滤 */ + if (commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)) { /* 没有工序选中行 则不进行数据过滤 */ const iIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); - if(iIndex > -1) { + if (iIndex > -1) { processRow = processData[iIndex]; } } if (type === 'materials') { /* 根据工序表选中行的部件id +工序id 过滤全部材料数据 */ - if(commonUtils.isNotEmptyObject(processRow)){ - const filterData = oriData.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId + if (commonUtils.isNotEmptyObject(processRow)) { + const filterData = oriData.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { newData = filterData; } res = newData; - } else if(commonUtils.isNotEmptyObject(controlRow)){ - const filterData = oriData.filter(item => item.sControlId === controlRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId) ); + } else if (commonUtils.isNotEmptyObject(controlRow)) { + const filterData = oriData.filter(item => item.sControlId === controlRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { newData = filterData; } @@ -8517,17 +8554,17 @@ const QuotationComponent = Form.create({ res = oriData; } - } else if (type === 'materials0' || type ==='materials1' || type === 'materials2') { + } else if (type === 'materials0' || type === 'materials1' || type === 'materials2') { /* 根据工序表选中行的部件id +工序id 过滤全部材料数据 */ - if(commonUtils.isNotEmptyObject(processRow)){ - const filterData = materialsData.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId + if (commonUtils.isNotEmptyObject(processRow)) { + const filterData = materialsData.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { newData = filterData; } res = newData; - } else if(commonUtils.isNotEmptyObject(controlRow)){ - const filterData = materialsData.filter(item => item.sControlId === controlRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId) ); + } else if (commonUtils.isNotEmptyObject(controlRow)) { + const filterData = materialsData.filter(item => item.sControlId === controlRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { newData = filterData; } @@ -8541,16 +8578,16 @@ const QuotationComponent = Form.create({ const sSqlCondition = config ? config.sSqlCondition : 'materials0.sBclassifyName.油墨'; if (sSqlCondition) { let targetTbName = sSqlCondition.split('.')[0]; /* 1.表名 control */ - if(commonUtils.isEmptyObject(targetTbName)) { + if (commonUtils.isEmptyObject(targetTbName)) { targetTbName = 'materials0'; } let filteredValue = sSqlCondition.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ let sParentKey = sSqlCondition.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ - if(commonUtils.isEmptyObject(targetTbName)){ - if(type === 'materials1') { /* materials0.sBclassifyName.油墨 */ + if (commonUtils.isEmptyObject(targetTbName)) { + if (type === 'materials1') { /* materials0.sBclassifyName.油墨 */ filteredValue = 'sBclassifyName'; sParentKey = '油墨'; - } else if(type ==='materials2') { /* materials0.sBclassifyName.电化铝 */ + } else if (type === 'materials2') { /* materials0.sBclassifyName.电化铝 */ filteredValue = 'sBclassifyName'; sParentKey = '电化铝'; } @@ -8571,12 +8608,12 @@ const QuotationComponent = Form.create({ } else if (type === 'materials2') { /* 过滤后的 materials0Data */ let materials0FilterData = []; - if(commonUtils.isNotEmptyObject(processRow) && commonUtils.isNotEmptyArr(materials0Data)){ + if (commonUtils.isNotEmptyObject(processRow) && commonUtils.isNotEmptyArr(materials0Data)) { const filterData = materials0Data.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { materials0FilterData = filterData; } - }else if(commonUtils.isNotEmptyObject(controlRow) && commonUtils.isNotEmptyArr(materials0Data)){ + } else if (commonUtils.isNotEmptyObject(controlRow) && commonUtils.isNotEmptyArr(materials0Data)) { const filterData = materials0Data.filter(item => item.sControlId === controlRow.sId && commonUtils.isEmptyObject(item.sParentMaterialsId)); if (commonUtils.isNotEmptyArr(filterData)) { materials0FilterData = filterData; @@ -8589,16 +8626,16 @@ const QuotationComponent = Form.create({ const sSqlCondition = config ? config.sSqlCondition : 'materials0.sBclassifyName.油墨'; if (sSqlCondition) { let targetTbName = sSqlCondition.split('.')[0]; /* 1.表名 control */ - if(commonUtils.isEmptyObject(targetTbName)) { + if (commonUtils.isEmptyObject(targetTbName)) { targetTbName = 'materials0'; } let filteredValue = sSqlCondition.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ let sParentKey = sSqlCondition.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ - if(commonUtils.isEmptyObject(targetTbName)){ - if(type === 'materials1') { /* materials0.sBclassifyName.油墨 */ + if (commonUtils.isEmptyObject(targetTbName)) { + if (type === 'materials1') { /* materials0.sBclassifyName.油墨 */ filteredValue = 'sBclassifyName'; sParentKey = '油墨'; - } else if(type ==='materials2') { /* materials0.sBclassifyName.电化铝 */ + } else if (type === 'materials2') { /* materials0.sBclassifyName.电化铝 */ filteredValue = 'sBclassifyName'; sParentKey = '电化铝'; } @@ -8613,15 +8650,15 @@ const QuotationComponent = Form.create({ } res = newData; - } else if( type === 'materials1Child') { + } else if (type === 'materials1Child') { /* 过滤后的 materials0Data */ let materials0FilterData = []; - if(commonUtils.isNotEmptyObject(processRow) && commonUtils.isNotEmptyArr(materials0Data)){ - const filterData = materials0Data.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId ); + if (commonUtils.isNotEmptyObject(processRow) && commonUtils.isNotEmptyArr(materials0Data)) { + const filterData = materials0Data.filter(item => item.sControlId === processRow.sControlId && item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId); if (commonUtils.isNotEmptyArr(filterData)) { materials0FilterData = filterData; } - }else if(commonUtils.isNotEmptyObject(controlRow) && commonUtils.isNotEmptyArr(materials0Data)){ + } else if (commonUtils.isNotEmptyObject(controlRow) && commonUtils.isNotEmptyArr(materials0Data)) { const filterData = materials0Data.filter(item => item.sControlId === controlRow.sId); if (commonUtils.isNotEmptyArr(filterData)) { materials0FilterData = filterData; @@ -8634,16 +8671,16 @@ const QuotationComponent = Form.create({ const sSqlCondition = config && commonUtils.isNotEmptyObject(config.sSqlCondition) ? config.sSqlCondition : 'materials0.sBclassifyName.油墨'; if (sSqlCondition) { let targetTbName = sSqlCondition.split('.')[0]; /* 1.表名 control */ - if(commonUtils.isEmptyObject(targetTbName)) { + if (commonUtils.isEmptyObject(targetTbName)) { targetTbName = 'materials0'; } let filteredValue = sSqlCondition.split('.')[1]; /* 2.解析filterValue: controlSelectedRowKeys */ let sParentKey = sSqlCondition.split('.')[2]; /* 2.解析本身表对应的值,如控制表筛选材料表 则材料表的sControlId = 控制表的controlSelectedRowKeys[0] */ - if(commonUtils.isEmptyObject(targetTbName)){ - if(type === 'materials1') { /* materials0.sBclassifyName.油墨 */ + if (commonUtils.isEmptyObject(targetTbName)) { + if (type === 'materials1') { /* materials0.sBclassifyName.油墨 */ filteredValue = 'sBclassifyName'; sParentKey = '油墨'; - } else if(type ==='materials2') { /* materials0.sBclassifyName.电化铝 */ + } else if (type === 'materials2') { /* materials0.sBclassifyName.电化铝 */ filteredValue = 'sBclassifyName'; sParentKey = '电化铝'; } @@ -8658,12 +8695,12 @@ const QuotationComponent = Form.create({ } - if( type ==='materials1Child') { /* 油墨过滤子集 */ + if (type === 'materials1Child') { /* 油墨过滤子集 */ const { materials1Data, materials1SelectedRowKeys } = props; - let materials1Row ={}; /* 油墨子级 */ - if(commonUtils.isNotEmptyArr(materials1Data) && commonUtils.isNotEmptyArr(materials1SelectedRowKeys)){ /* 没有工序选中行 则不进行数据过滤 */ + let materials1Row = {}; /* 油墨子级 */ + if (commonUtils.isNotEmptyArr(materials1Data) && commonUtils.isNotEmptyArr(materials1SelectedRowKeys)) { /* 没有工序选中行 则不进行数据过滤 */ const iIndex = materials1Data.findIndex(item => materials1SelectedRowKeys.includes(item.sId)); - if(iIndex > -1) { + if (iIndex > -1) { materials1Row = materials1Data[iIndex]; } } @@ -8671,21 +8708,21 @@ const QuotationComponent = Form.create({ } - } else if(type ==='materials0Child') { /* 全部材料 过滤替代料 */ + } else if (type === 'materials0Child') { /* 全部材料 过滤替代料 */ const { materials0Data, materials0SelectedRowKeys } = props; - let materials0Row ={}; /* 油墨子级 */ - if(commonUtils.isNotEmptyArr(materials0Data) && commonUtils.isNotEmptyArr(materials0SelectedRowKeys)){ /* 没有工序选中行 则不进行数据过滤 */ + let materials0Row = {}; /* 油墨子级 */ + if (commonUtils.isNotEmptyArr(materials0Data) && commonUtils.isNotEmptyArr(materials0SelectedRowKeys)) { /* 没有工序选中行 则不进行数据过滤 */ const iIndex = materials0Data.findIndex(item => materials0SelectedRowKeys.includes(item.sId)); - if(iIndex > -1) { + if (iIndex > -1) { materials0Row = materials0Data[iIndex]; } } - if(commonUtils.isNotEmptyObject(materials0Row)) { /* 根据工序过滤所有替代料 */ + if (commonUtils.isNotEmptyObject(materials0Row)) { /* 根据工序过滤所有替代料 */ res = oriData.filter(item => item.sParentMaterialsId === materials0Row.sId); - } else if(commonUtils.isNotEmptyObject(processRow)) { /* 根据工序过滤所有替代料 */ + } else if (commonUtils.isNotEmptyObject(processRow)) { /* 根据工序过滤所有替代料 */ res = oriData.filter(item => item.sProcessId === processRow.sProcessId && item.sProcessTbId === processRow.sId); - } else if(commonUtils.isNotEmptyObject(controlRow)){ - res = oriData.filter(item => item.sControlId=== controlRow.sId && commonUtils.isNotEmptyObject(item.sParentMaterialsId)); + } else if (commonUtils.isNotEmptyObject(controlRow)) { + res = oriData.filter(item => item.sControlId === controlRow.sId && commonUtils.isNotEmptyObject(item.sParentMaterialsId)); } } else { @@ -8738,8 +8775,8 @@ const QuotationComponent = Form.create({ materialsInfoList.forEach((item, index) => { - const tableNameProps = index === 0 ? `materialsTable` : `materialsTable${index -1}`; - const tableName = index === 0 ? `materials` : `materials${index -1}`; + const tableNameProps = index === 0 ? `materialsTable` : `materialsTable${index - 1}`; + const tableName = index === 0 ? `materials` : `materials${index - 1}`; materialsTablePropsList[`${tableNameProps}Props`] = { ...commonBusiness.getTableTypes(tableName, props), // tableBelone: 'list', @@ -8991,7 +9028,7 @@ const QuotationComponent = Form.create({ chooseProdutProcessConfig = props.masterConfig.gdsconfigformslave[iIndex]; } let slaveFinalData = []; - let slaveFinalSelectedRowKeys =[]; + let slaveFinalSelectedRowKeys = []; if (commonUtils.isNotEmptyArr(props.slaveData)) { slaveFinalData = JSON.parse(JSON.stringify(props.slaveData)); if (commonUtils.isNotEmptyArr(slaveFinalData) && slaveFinalData.length > 0) { @@ -9000,7 +9037,7 @@ const QuotationComponent = Form.create({ }); } /* 选择成品工序 只有一条从表 则默认选中 */ - if(slaveFinalData.length ===1){ + if (slaveFinalData.length === 1) { slaveFinalSelectedRowKeys.push(slaveFinalData[0].sSlaveId); } } @@ -9047,7 +9084,7 @@ const QuotationComponent = Form.create({ chooseProductMaterialsConfig = props.masterConfig.gdsconfigformslave[iIndex]; } let slaveFinalData = []; - let slaveFinalSelectedRowKeys =[]; + let slaveFinalSelectedRowKeys = []; if (commonUtils.isNotEmptyArr(props.slaveData)) { slaveFinalData = JSON.parse(JSON.stringify(props.slaveData)); if (commonUtils.isNotEmptyArr(slaveFinalData) && slaveFinalData.length > 0) { @@ -9056,7 +9093,7 @@ const QuotationComponent = Form.create({ }); } /* 选择成品材料 只有一条从表 则默认选中 */ - if(slaveFinalData.length ===1){ + if (slaveFinalData.length === 1) { slaveFinalSelectedRowKeys.push(slaveFinalData[0].sSlaveId); } } @@ -9210,10 +9247,10 @@ const QuotationComponent = Form.create({ const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */ const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */ let sProcessParams = commonFunc.showMessage(app.commonConst, 'sProcessParams');/* 选择工艺参数标题 */ - if(commonUtils.isNotEmptyObject(props) && props.sParamModalType) { - if(props.sParamModalType === 'sQuo') { - sProcessParams = commonFunc.showMessage(app.commonConst, 'sQuoParams');/* 选择报价参数标题 */ - if(commonUtils.isEmpty(sProcessParams)) { + if (commonUtils.isNotEmptyObject(props) && props.sParamModalType) { + if (props.sParamModalType === 'sQuo') { + sProcessParams = commonFunc.showMessage(app.commonConst, 'sQuoParams');/* 选择报价参数标题 */ + if (commonUtils.isEmpty(sProcessParams)) { sProcessParams = '报价参数标准'; } } @@ -9221,11 +9258,11 @@ const QuotationComponent = Form.create({ // eslint-disable-next-line jsx-a11y/anchor-is-valid const operateAdd = {props.enabled ? setAdd.img : setAdd.disableimg} ; // eslint-disable-next-line jsx-a11y/anchor-is-valid - const operateAddChild = {props.enabled ? setAddChild.img : setAddChild.disableimg }; + const operateAddChild = {props.enabled ? setAddChild.img : setAddChild.disableimg}; // eslint-disable-next-line jsx-a11y/anchor-is-valid const operateCopy = {props.enabled ? setCopy.img : setCopy.disableimg}; // eslint-disable-next-line jsx-a11y/anchor-is-valid - const operateUpdate = {props.enabled ? setCopyAll.img : setCopyAll.disableimg }; + const operateUpdate = {props.enabled ? setCopyAll.img : setCopyAll.disableimg}; // eslint-disable-next-line jsx-a11y/anchor-is-valid const operateDel = {props.enabled ? setDelete.img : setDelete.disableimg}; @@ -9251,7 +9288,7 @@ const QuotationComponent = Form.create({ } } - const bFinalMaterialsTabShow = commonUtils.isEmptyObject(finishedMaterialsConfig) ? false :(bSplitMaterials ? true : false); /* 没有成品材料配置 则材料Tab不展示 */ + const bFinalMaterialsTabShow = commonUtils.isEmptyObject(finishedMaterialsConfig) ? false : (bSplitMaterials ? true : false); /* 没有成品材料配置 则材料Tab不展示 */ const bFinalProcessTabShow = commonUtils.isEmptyObject(finishedProcessConfig) ? false : (bSplitProcess ? true : false); /* 没有成品工序配置 则工序Tab不展示 */ const panelExtra = (type) => { @@ -9259,9 +9296,9 @@ const QuotationComponent = Form.create({ /* 根据materials找到其组所有配置头 */ let radioConfigArr = []; - if(commonUtils.isNotEmptyArr(formData)) { + if (commonUtils.isNotEmptyArr(formData)) { // radioConfigArr = formData.filter(item => commonUtils.isNotEmptyObject(item.sGrd) && item.sGrd.includes(type) ); - radioConfigArr = formData.filter(item => commonUtils.isNotEmptyObject(item.sGrd) && item.sGrd.includes(type) && item.bGrdVisible ); + radioConfigArr = formData.filter(item => commonUtils.isNotEmptyObject(item.sGrd) && item.sGrd.includes(type) && item.bGrdVisible); // console.log('radioConfigArr:', radioConfigArr); } if (type === 'material') { @@ -9274,10 +9311,10 @@ const QuotationComponent = Form.create({ {/*{materialsFlInfo}*/} { radioConfigArr.map((child, index) => { - const radioTitle = child.showName; - const radioValue = index + 2 + 10; + const radioTitle = child.showName; + const radioValue = index + 2 + 10; // console.log('radioValue', radioTitle, radioValue); - return( + return ( {radioTitle} ) }) @@ -9333,14 +9370,14 @@ const QuotationComponent = Form.create({ props.onActiveKey(e); }; - const okButtonStyle ={ - style:{ - display:"none", - backgroundColor:"red" + const okButtonStyle = { + style: { + display: "none", + backgroundColor: "red" } } const cancelButtonStyle = { - htmlType:"退出", + htmlType: "退出", style: { width: 70, height: 50, @@ -9405,15 +9442,15 @@ const QuotationComponent = Form.create({ res = (
+ style={{ paddingTop: '10px', marginRight: '10px', marginTop: '-10px', backgroundColor: '#fff' }} + onChange={tabChange}> - {bFinalMaterialsTabShow ? :''} - {bFinalProcessTabShow? :''} + {bFinalMaterialsTabShow ? : ''} + {bFinalProcessTabShow ? : ''} {props.currentTab === 4 && bMaterialShow ? - : '' + : '' } {finishedMaterialsColumn && props.currentTab === 2 ? : '' @@ -9421,7 +9458,7 @@ const QuotationComponent = Form.create({ {props.currentTab === 5 && bProcessShow ? : '' } - {finishedProcessColumn && props.currentTab === 3? + {finishedProcessColumn && props.currentTab === 3 ? : '' } @@ -9438,48 +9475,48 @@ const QuotationComponent = Form.create({ res = ( )} - showArrow={false} - extra={materialsInfo} - key="1" + header={()} + showArrow={false} + extra={materialsInfo} + key="1" > - + { bSplitMaterials ? )} - showArrow={false} - extra={productMaterialsInfo} - key="3" + header={()} + showArrow={false} + extra={productMaterialsInfo} + key="3" > : '' } )} - showArrow={false} - extra={processInfo} - key="2" + header={()} + showArrow={false} + extra={processInfo} + key="2" > { bSplitProcess ? )} - showArrow={false} - extra={productProcessInfo} - key="4" + header={()} + showArrow={false} + extra={productProcessInfo} + key="4" > : '' } )} - showArrow={false} - extra={manyqtysInfo} - key="5" + header={()} + showArrow={false} + extra={manyqtysInfo} + key="5" > @@ -9489,12 +9526,12 @@ const QuotationComponent = Form.create({ res = ( )} - showArrow={false} - extra={panelExtra('process')} - key="2" + header={()} + showArrow={false} + extra={panelExtra('process')} + key="2" > - { props.currentTab2 === 1 && commonUtils.isNotEmptyObject(processShowLeft) ? + {props.currentTab2 === 1 && commonUtils.isNotEmptyObject(processShowLeft) ?
@@ -9530,28 +9567,28 @@ const QuotationComponent = Form.create({
: props.currentTab2 === 1 && } - { props.currentTab2 === 3 && bSplitProcess && } + {props.currentTab2 === 3 && bSplitProcess && }
)} - showArrow={false} - extra={panelExtra('material')} - key="1" + header={()} + showArrow={false} + extra={panelExtra('material')} + key="1" > {/*{ props.currentTab === 11 && }*/} - { props.materialsInfoList?.map((item, index) => { + {props.materialsInfoList?.map((item, index) => { let num = 12 + index; - const tablePropsName = index ===0 ? `materialsTableProps` : `materialsTable${index - 1}Props`; + const tablePropsName = index === 0 ? `materialsTableProps` : `materialsTable${index - 1}Props`; const materialsOtherPropsType = materialsTablePropsList[tablePropsName]; let sWidth = '100%'; /* 找到子级 左右列 */ - let materialsChildTableProps ={}; - if(commonUtils.isNotEmptyArr(materialsChildInfoList)) { + let materialsChildTableProps = {}; + if (commonUtils.isNotEmptyArr(materialsChildInfoList)) { const iIndex = materialsChildInfoList.findIndex(child => child.includes(item)); - if(iIndex > -1) { - materialsChildTableProps = materialsChildTablePropsList[`${item}ChildTableProps`]; + if (iIndex > -1) { + materialsChildTableProps = materialsChildTablePropsList[`${item}ChildTableProps`]; sWidth = '50%'; } else { sWidth = '100%'; @@ -9562,15 +9599,15 @@ const QuotationComponent = Form.create({ return ( props.currentTab === num &&
-
+
{ - commonUtils.isNotEmptyObject(materialsChildTableProps)? -
+ commonUtils.isNotEmptyObject(materialsChildTableProps) ? +
: '' }
) - }) } + })} {/*{ props.currentTab === 13 &&*/} {/*
*/} @@ -9584,10 +9621,10 @@ const QuotationComponent = Form.create({ { commonUtils.isNotEmptyObject(manyqtysConfig) ? )} - showArrow={false} - extra={panelExtra('manyQty')} - key="3" + header={()} + showArrow={false} + extra={panelExtra('manyQty')} + key="3" > : '' @@ -9647,13 +9684,13 @@ const QuotationComponent = Form.create({
-
+
- { renderByLayout() } + {renderByLayout()}
{ colorConfigGrdVisible ? @@ -9686,7 +9723,7 @@ const QuotationComponent = Form.create({
- { commonUtils.isNotEmptyObject(checkPersonData) ? + {commonUtils.isNotEmptyObject(checkPersonData) ? checkPersonData.map((item) => { return ( @@ -9818,7 +9855,7 @@ const QuotationComponent = Form.create({ -
-
+
+
-
+
@@ -9897,10 +9934,10 @@ const QuotationComponent = Form.create({ cancelButtonProps={cancelButtonStyle} onCancel={props.onCancelModal.bind(this, 'workFlowVisible')} closable - style={{ backgroundColor:'#ffffff', top: 0 }} - // footer={null} + style={{ backgroundColor: '#ffffff', top: 0 }} + // footer={null} > - + : '' @@ -9930,10 +9967,10 @@ const QuotationComponent = Form.create({ onCancel={props.onCancelProcessParamsModalVisible} onSaveState={props.onSaveState} forbidResize - // footer={null} + // footer={null} >
- { commonUtils.isNotEmptyArr(props.sProcessParamsSelects) ? + {commonUtils.isNotEmptyArr(props.sProcessParamsSelects) ? props.sProcessParamsSelects.map((child) => { const sMemo = child.sName.toLowerCase().endsWith('memo'); let enabledNew = !child.bReadonly; @@ -9982,7 +10019,7 @@ const QuotationComponent = Form.create({ visible={props.sParamsModalVisible} onOk={props.onParamsOk} onCancel={props.onCancelModal.bind(this, 'sParamsModalVisible')} - // footer={null} + // footer={null} >
@@ -10065,13 +10102,13 @@ const QuotationComponent = Form.create({ )} - { true ? '' : eject } - { true ? '' : + {true ? '' : eject } + {true ? '' :
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - close + close
} -- libgit2 0.22.2