Commit 559b4992292831a770e92e5de58c7f6e1942b7a3
Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi into main
Showing
2 changed files
with
244 additions
and
258 deletions
src/components/IndexCenter/index.less
src/components/QuickQuote/index.jsx
| @@ -84,13 +84,10 @@ const QuickQuoteEvent = props => { | @@ -84,13 +84,10 @@ const QuickQuoteEvent = props => { | ||
| 84 | const { bLinkFieledClick } = props; | 84 | const { bLinkFieledClick } = props; |
| 85 | const [hideBackBtn, setHideBackBtn] = useState(false); | 85 | const [hideBackBtn, setHideBackBtn] = useState(false); |
| 86 | const [enabled, setEnabled] = useState(props.enabled); | 86 | const [enabled, setEnabled] = useState(props.enabled); |
| 87 | - useEffect( | ||
| 88 | - () => { | ||
| 89 | - setHideBackBtn(!bLinkFieledClick); | ||
| 90 | - setEnabled(!bLinkFieledClick || props.enabled); | ||
| 91 | - }, | ||
| 92 | - [bLinkFieledClick, props.enabled] | ||
| 93 | - ); | 87 | + useEffect(() => { |
| 88 | + setHideBackBtn(!bLinkFieledClick); | ||
| 89 | + setEnabled(!bLinkFieledClick || props.enabled); | ||
| 90 | + }, [bLinkFieledClick, props.enabled]); | ||
| 94 | 91 | ||
| 95 | // 获取formData | 92 | // 获取formData |
| 96 | useEffect(() => { | 93 | useEffect(() => { |
| @@ -108,70 +105,61 @@ const QuickQuoteEvent = props => { | @@ -108,70 +105,61 @@ const QuickQuoteEvent = props => { | ||
| 108 | }, []); | 105 | }, []); |
| 109 | 106 | ||
| 110 | // 获取盒型定义配置 | 107 | // 获取盒型定义配置 |
| 111 | - useEffect( | ||
| 112 | - () => { | ||
| 113 | - if (!formData.length) return; | ||
| 114 | - const sBoxActiveId = formData.find(item => item.sGrd === "slave")?.gdsconfigformslave?.find(item => item.sName === "sName")?.sActiveId; | ||
| 115 | - if (!sBoxActiveId) return; | ||
| 116 | - const { token } = props; | ||
| 117 | - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sBoxActiveId}?sModelsId=${sBoxActiveId}`; | ||
| 118 | - commonServices.getService(token, configUrl).then(({ data: configReturn }) => { | ||
| 119 | - if (configReturn.code === 1) { | ||
| 120 | - const formData = configReturn.dataset.rows[0].formData; | ||
| 121 | - setState(pre => ({ ...pre, boxConfig: formData[0] })); | ||
| 122 | - } | ||
| 123 | - }); | ||
| 124 | - }, | ||
| 125 | - [formData.length] | ||
| 126 | - ); | 108 | + useEffect(() => { |
| 109 | + if (!formData.length) return; | ||
| 110 | + const sBoxActiveId = formData.find(item => item.sGrd === "slave")?.gdsconfigformslave?.find(item => item.sName === "sName")?.sActiveId; | ||
| 111 | + if (!sBoxActiveId) return; | ||
| 112 | + const { token } = props; | ||
| 113 | + const configUrl = `${commonConfig.server_host}business/getModelBysId/${sBoxActiveId}?sModelsId=${sBoxActiveId}`; | ||
| 114 | + commonServices.getService(token, configUrl).then(({ data: configReturn }) => { | ||
| 115 | + if (configReturn.code === 1) { | ||
| 116 | + const formData = configReturn.dataset.rows[0].formData; | ||
| 117 | + setState(pre => ({ ...pre, boxConfig: formData[0] })); | ||
| 118 | + } | ||
| 119 | + }); | ||
| 120 | + }, [formData.length]); | ||
| 127 | 121 | ||
| 128 | // 获取column | 122 | // 获取column |
| 129 | - useEffect( | ||
| 130 | - () => { | ||
| 131 | - if (!formData.length) return; | ||
| 132 | - | ||
| 133 | - let result = {}; | ||
| 134 | - for (let i = 0; i < formData.length; i++) { | ||
| 135 | - const tableConfig = formData[i]; | ||
| 136 | - const { sGrd } = tableConfig; | ||
| 137 | - if (!sGrd) continue; | ||
| 138 | - const column = commonFunc.getHeaderConfig(tableConfig); | ||
| 139 | - result = { | ||
| 140 | - ...result, | ||
| 141 | - [`${sGrd}Column`]: column, | ||
| 142 | - [`${sGrd}Config`]: tableConfig, | ||
| 143 | - }; | ||
| 144 | - } | ||
| 145 | - setState(pre => ({ ...pre, ...result })); | ||
| 146 | - }, | ||
| 147 | - [formData.length] | ||
| 148 | - ); | 123 | + useEffect(() => { |
| 124 | + if (!formData.length) return; | ||
| 125 | + | ||
| 126 | + let result = {}; | ||
| 127 | + for (let i = 0; i < formData.length; i++) { | ||
| 128 | + const tableConfig = formData[i]; | ||
| 129 | + const { sGrd } = tableConfig; | ||
| 130 | + if (!sGrd) continue; | ||
| 131 | + const column = commonFunc.getHeaderConfig(tableConfig); | ||
| 132 | + result = { | ||
| 133 | + ...result, | ||
| 134 | + [`${sGrd}Column`]: column, | ||
| 135 | + [`${sGrd}Config`]: tableConfig, | ||
| 136 | + }; | ||
| 137 | + } | ||
| 138 | + setState(pre => ({ ...pre, ...result })); | ||
| 139 | + }, [formData.length]); | ||
| 149 | 140 | ||
| 150 | // 获取树形数据 | 141 | // 获取树形数据 |
| 151 | - useEffect( | ||
| 152 | - () => { | ||
| 153 | - if (!masterConfig) return; | ||
| 154 | - // 产品分类 | ||
| 155 | - const treeConfig = masterConfig.gdsconfigformslave.find(item => item.sName === "sProductClassifyName"); | ||
| 156 | - if (!treeConfig) return; | ||
| 157 | - props | ||
| 158 | - .handleGetTreeDataSet({ | ||
| 159 | - name: "product", | ||
| 160 | - configData: treeConfig, | ||
| 161 | - condition: { | ||
| 162 | - pageNum: 1, | ||
| 163 | - pageSize: 1000, | ||
| 164 | - bFilter: [], | ||
| 165 | - }, | ||
| 166 | - isWait: true, | ||
| 167 | - }) | ||
| 168 | - .then(dataReturn => { | ||
| 169 | - const { treeData = [] } = dataReturn; | ||
| 170 | - setState(pre => ({ ...pre, treeData })); | ||
| 171 | - }); | ||
| 172 | - }, | ||
| 173 | - [masterConfig] | ||
| 174 | - ); | 142 | + useEffect(() => { |
| 143 | + if (!masterConfig) return; | ||
| 144 | + // 产品分类 | ||
| 145 | + const treeConfig = masterConfig.gdsconfigformslave.find(item => item.sName === "sProductClassifyName"); | ||
| 146 | + if (!treeConfig) return; | ||
| 147 | + props | ||
| 148 | + .handleGetTreeDataSet({ | ||
| 149 | + name: "product", | ||
| 150 | + configData: treeConfig, | ||
| 151 | + condition: { | ||
| 152 | + pageNum: 1, | ||
| 153 | + pageSize: 1000, | ||
| 154 | + bFilter: [], | ||
| 155 | + }, | ||
| 156 | + isWait: true, | ||
| 157 | + }) | ||
| 158 | + .then(dataReturn => { | ||
| 159 | + const { treeData = [] } = dataReturn; | ||
| 160 | + setState(pre => ({ ...pre, treeData })); | ||
| 161 | + }); | ||
| 162 | + }, [masterConfig]); | ||
| 175 | 163 | ||
| 176 | addState.onBackClick = () => { | 164 | addState.onBackClick = () => { |
| 177 | props.onSaveState({ masterData: { ...props.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(state)) }, quickQuoteModel: false }); | 165 | props.onSaveState({ masterData: { ...props.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(state)) }, quickQuoteModel: false }); |
| @@ -705,25 +693,27 @@ const QuickQuoteEvent = props => { | @@ -705,25 +693,27 @@ const QuickQuoteEvent = props => { | ||
| 705 | processData.push(processPrintDataRow); | 693 | processData.push(processPrintDataRow); |
| 706 | // 配套工序 | 694 | // 配套工序 |
| 707 | if (bProcessAssort) { | 695 | if (bProcessAssort) { |
| 708 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(itemProcessAssort => { | ||
| 709 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 710 | - const iProcessIndex = -1; | ||
| 711 | - const iNewProcessIndex = processData.findIndex( | ||
| 712 | - item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId | ||
| 713 | - ); | ||
| 714 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 715 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 716 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 717 | - processRow.handleType = "add"; | ||
| 718 | - processRow.sId = commonUtils.createSid(); | ||
| 719 | - processRow.sParentId = masterData.sId; | ||
| 720 | - processRow.sControlId = partsDataRow.sId; | ||
| 721 | - processRow.sPartsName = partsDataRow.sPartsName; | ||
| 722 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 723 | - // processRow.sSlaveId = ' '; | ||
| 724 | - processData.push(processRow); | ||
| 725 | - } | ||
| 726 | - }); | 696 | + returnProcessAssort |
| 697 | + .filter(item => item.sParentId === processPrintDataRow.sProcessId) | ||
| 698 | + .forEach(itemProcessAssort => { | ||
| 699 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 700 | + const iProcessIndex = -1; | ||
| 701 | + const iNewProcessIndex = processData.findIndex( | ||
| 702 | + item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId | ||
| 703 | + ); | ||
| 704 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 705 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 706 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 707 | + processRow.handleType = "add"; | ||
| 708 | + processRow.sId = commonUtils.createSid(); | ||
| 709 | + processRow.sParentId = masterData.sId; | ||
| 710 | + processRow.sControlId = partsDataRow.sId; | ||
| 711 | + processRow.sPartsName = partsDataRow.sPartsName; | ||
| 712 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 713 | + // processRow.sSlaveId = ' '; | ||
| 714 | + processData.push(processRow); | ||
| 715 | + } | ||
| 716 | + }); | ||
| 727 | } | 717 | } |
| 728 | 718 | ||
| 729 | partInfo.processInfo.forEach((process, iOrder) => { | 719 | partInfo.processInfo.forEach((process, iOrder) => { |
| @@ -754,25 +744,27 @@ const QuickQuoteEvent = props => { | @@ -754,25 +744,27 @@ const QuickQuoteEvent = props => { | ||
| 754 | processData.push(processAfterDataRow); | 744 | processData.push(processAfterDataRow); |
| 755 | // 配套工序 | 745 | // 配套工序 |
| 756 | if (bProcessAssort) { | 746 | if (bProcessAssort) { |
| 757 | - returnProcessAssort.filter(item => item.sParentId === processPrintDataRow.sProcessId).forEach(itemProcessAssort => { | ||
| 758 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 759 | - const iProcessIndex = -1; | ||
| 760 | - const iNewProcessIndex = processData.findIndex( | ||
| 761 | - item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId | ||
| 762 | - ); | ||
| 763 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 764 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 765 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 766 | - processRow.handleType = "add"; | ||
| 767 | - processRow.sId = commonUtils.createSid(); | ||
| 768 | - processRow.sParentId = masterData.sId; | ||
| 769 | - processRow.sControlId = partsDataRow.sId; | ||
| 770 | - processRow.sPartsName = partsDataRow.sPartsName; | ||
| 771 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 772 | - // processRow.sSlaveId = ' '; | ||
| 773 | - processData.push(processRow); | ||
| 774 | - } | ||
| 775 | - }); | 747 | + returnProcessAssort |
| 748 | + .filter(item => item.sParentId === processPrintDataRow.sProcessId) | ||
| 749 | + .forEach(itemProcessAssort => { | ||
| 750 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 751 | + const iProcessIndex = -1; | ||
| 752 | + const iNewProcessIndex = processData.findIndex( | ||
| 753 | + item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId | ||
| 754 | + ); | ||
| 755 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 756 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 757 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 758 | + processRow.handleType = "add"; | ||
| 759 | + processRow.sId = commonUtils.createSid(); | ||
| 760 | + processRow.sParentId = masterData.sId; | ||
| 761 | + processRow.sControlId = partsDataRow.sId; | ||
| 762 | + processRow.sPartsName = partsDataRow.sPartsName; | ||
| 763 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 764 | + // processRow.sSlaveId = ' '; | ||
| 765 | + processData.push(processRow); | ||
| 766 | + } | ||
| 767 | + }); | ||
| 776 | } | 768 | } |
| 777 | }); | 769 | }); |
| 778 | } | 770 | } |
| @@ -802,21 +794,23 @@ const QuickQuoteEvent = props => { | @@ -802,21 +794,23 @@ const QuickQuoteEvent = props => { | ||
| 802 | processData.push(processProductDataRow); | 794 | processData.push(processProductDataRow); |
| 803 | // 配套工序 | 795 | // 配套工序 |
| 804 | if (bProcessAssort) { | 796 | if (bProcessAssort) { |
| 805 | - returnProcessAssort.filter(item => item.sParentId === processProductDataRow.sProcessId).forEach(itemProcessAssort => { | ||
| 806 | - const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 807 | - const iProcessIndex = -1; | ||
| 808 | - const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | ||
| 809 | - if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 810 | - let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 811 | - processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 812 | - processRow.handleType = "add"; | ||
| 813 | - processRow.sId = commonUtils.createSid(); | ||
| 814 | - processRow.sParentId = masterData.sId; | ||
| 815 | - processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 816 | - // processRow.sSlaveId = ' '; | ||
| 817 | - processData.push(processRow); | ||
| 818 | - } | ||
| 819 | - }); | 797 | + returnProcessAssort |
| 798 | + .filter(item => item.sParentId === processProductDataRow.sProcessId) | ||
| 799 | + .forEach(itemProcessAssort => { | ||
| 800 | + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); | ||
| 801 | + const iProcessIndex = -1; | ||
| 802 | + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId); | ||
| 803 | + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) { | ||
| 804 | + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 | ||
| 805 | + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 | ||
| 806 | + processRow.handleType = "add"; | ||
| 807 | + processRow.sId = commonUtils.createSid(); | ||
| 808 | + processRow.sParentId = masterData.sId; | ||
| 809 | + processRow.sType = dropDownDataProcessName[iIndex].sType; | ||
| 810 | + // processRow.sSlaveId = ' '; | ||
| 811 | + processData.push(processRow); | ||
| 812 | + } | ||
| 813 | + }); | ||
| 820 | } | 814 | } |
| 821 | }); | 815 | }); |
| 822 | processData = props.sortData(controlData, processData); | 816 | processData = props.sortData(controlData, processData); |
| @@ -975,86 +969,87 @@ const TreeComponent = props => { | @@ -975,86 +969,87 @@ const TreeComponent = props => { | ||
| 975 | const timeRef = useRef(0); | 969 | const timeRef = useRef(0); |
| 976 | 970 | ||
| 977 | // 点击节点后查询数据 | 971 | // 点击节点后查询数据 |
| 978 | - useEffect( | ||
| 979 | - () => { | ||
| 980 | - if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return; | ||
| 981 | - | ||
| 982 | - timeRef.current += 1; | ||
| 983 | - | ||
| 984 | - const getSqlDropDownData = async ({ sId }) => { | ||
| 985 | - const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; | ||
| 986 | - const body = { | ||
| 987 | - sSqlCondition: { | ||
| 988 | - sProductClassifyId: selectedNode.sId, | ||
| 989 | - }, | ||
| 990 | - sKeyUpFilterName: "", | ||
| 991 | - pageNum: 1, | ||
| 992 | - pageSize: 20, | ||
| 993 | - }; | ||
| 994 | - const retrunData = await commonServices.postValueService(props.app.token, body, url); | ||
| 995 | - const sColumnNameConfigStr = retrunData.data?.dataset?.rows?.[0]?.sColumnNameConfig; | ||
| 996 | - // 取上机尺寸 | ||
| 997 | - return commonUtils.convertStrToObj(sColumnNameConfigStr, []); | ||
| 998 | - }; | ||
| 999 | - const getDropDownData = async props => { | ||
| 1000 | - const showDownConfig = slaveConfig.gdsconfigformslave.find(item => item.sControlName === "BtnDownConfig"); | 972 | + useEffect(() => { |
| 973 | + if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return; | ||
| 1001 | 974 | ||
| 1002 | - const downAbleConfigs = await getSqlDropDownData({ ...showDownConfig }); | 975 | + timeRef.current += 1; |
| 1003 | 976 | ||
| 1004 | - props.setState(pre => { | ||
| 1005 | - const { slaveData = [], slaveConfig } = pre; | ||
| 1006 | - const addState = {}; | ||
| 1007 | - const defaultData = commonFunc.getDefaultData(slaveConfig); | ||
| 1008 | - const slaveDataNew = slaveData.filter(item => item.sTreeNodeName === selectedNode.showName); | ||
| 1009 | - if (!slaveDataNew.length) { | ||
| 1010 | - const sAllPartsName = selectedNode.sAllPartsName || selectedNode.showName; | ||
| 1011 | - sAllPartsName.split(",").forEach((item, index) => { | ||
| 1012 | - const tempData = { | ||
| 1013 | - sId: commonUtils.createSid(), | ||
| 1014 | - handleType: "add", | ||
| 1015 | - ...defaultData, | ||
| 1016 | - sBoxModel: item, | ||
| 1017 | - sTreeNodeName: selectedNode.showName, | ||
| 1018 | - }; | ||
| 1019 | - if (selectedNode.sTypeKey === "huace") { | ||
| 1020 | - if (index !== 0) { | ||
| 1021 | - delete tempData.dSumPQty; | ||
| 1022 | - } else { | ||
| 1023 | - tempData.dSumPQty = 4; | ||
| 1024 | - } | 977 | + const getSqlDropDownData = async ({ sId }) => { |
| 978 | + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; | ||
| 979 | + const body = { | ||
| 980 | + sSqlCondition: { | ||
| 981 | + sProductClassifyId: selectedNode.sId, | ||
| 982 | + }, | ||
| 983 | + sKeyUpFilterName: "", | ||
| 984 | + pageNum: 1, | ||
| 985 | + pageSize: 20, | ||
| 986 | + }; | ||
| 987 | + const retrunData = await commonServices.postValueService(props.app.token, body, url); | ||
| 988 | + const sColumnNameConfigStr = retrunData.data?.dataset?.rows?.[0]?.sColumnNameConfig; | ||
| 989 | + // 取上机尺寸 | ||
| 990 | + return commonUtils.convertStrToObj(sColumnNameConfigStr, []); | ||
| 991 | + }; | ||
| 992 | + const getDropDownData = async props => { | ||
| 993 | + const showDownConfig = slaveConfig.gdsconfigformslave.find(item => item.sControlName === "BtnDownConfig"); | ||
| 994 | + | ||
| 995 | + const downAbleConfigs = await getSqlDropDownData({ ...showDownConfig }); | ||
| 996 | + | ||
| 997 | + props.setState(pre => { | ||
| 998 | + const { slaveData = [], slaveConfig } = pre; | ||
| 999 | + const addState = {}; | ||
| 1000 | + const defaultData = commonFunc.getDefaultData(slaveConfig); | ||
| 1001 | + const slaveDataNew = slaveData.filter(item => item.sTreeNodeName === selectedNode.showName); | ||
| 1002 | + if (!slaveDataNew.length) { | ||
| 1003 | + const sAllPartsName = selectedNode.sAllPartsName || selectedNode.showName; | ||
| 1004 | + sAllPartsName.split(",").forEach((item, index) => { | ||
| 1005 | + const tempData = { | ||
| 1006 | + sId: commonUtils.createSid(), | ||
| 1007 | + handleType: "add", | ||
| 1008 | + ...defaultData, | ||
| 1009 | + sBoxModel: item, | ||
| 1010 | + sTreeNodeName: selectedNode.showName, | ||
| 1011 | + }; | ||
| 1012 | + if (selectedNode.sTypeKey === "huace") { | ||
| 1013 | + if (index !== 0) { | ||
| 1014 | + delete tempData.dSumPQty; | ||
| 1015 | + } else { | ||
| 1016 | + tempData.dSumPQty = 4; | ||
| 1025 | } | 1017 | } |
| 1026 | - slaveDataNew.push(tempData); | ||
| 1027 | - }); | ||
| 1028 | - addState.slaveData = slaveDataNew; | ||
| 1029 | - } | 1018 | + } |
| 1019 | + slaveDataNew.push(tempData); | ||
| 1020 | + }); | ||
| 1021 | + addState.slaveData = slaveDataNew; | ||
| 1022 | + } | ||
| 1030 | 1023 | ||
| 1031 | - if (timeRef.current > 1) { | ||
| 1032 | - addState.slaveData = slaveDataNew; | ||
| 1033 | - addState.extraParts = {}; | ||
| 1034 | - } | ||
| 1035 | - return { | ||
| 1036 | - ...pre, | ||
| 1037 | - ...addState, | ||
| 1038 | - downAbleConfigs: downAbleConfigs.filter(item => item.sType === "2").map((item, index) => ({ | 1024 | + if (timeRef.current > 1) { |
| 1025 | + addState.slaveData = slaveDataNew; | ||
| 1026 | + addState.extraParts = {}; | ||
| 1027 | + } | ||
| 1028 | + return { | ||
| 1029 | + ...pre, | ||
| 1030 | + ...addState, | ||
| 1031 | + downAbleConfigs: downAbleConfigs | ||
| 1032 | + .filter(item => item.sType === "2") | ||
| 1033 | + .map((item, index) => ({ | ||
| 1039 | ...item, | 1034 | ...item, |
| 1040 | sName: `sParams${index}`, | 1035 | sName: `sParams${index}`, |
| 1041 | iColValue: item.iColValue || 4, | 1036 | iColValue: item.iColValue || 4, |
| 1042 | sVisColumnName: "sProcessName", | 1037 | sVisColumnName: "sProcessName", |
| 1043 | })), | 1038 | })), |
| 1044 | - finishedConfigs: downAbleConfigs.filter(item => item.sType === "3").map((item, index) => ({ | 1039 | + finishedConfigs: downAbleConfigs |
| 1040 | + .filter(item => item.sType === "3") | ||
| 1041 | + .map((item, index) => ({ | ||
| 1045 | ...item, | 1042 | ...item, |
| 1046 | sName: `sParams${index}`, | 1043 | sName: `sParams${index}`, |
| 1047 | iColValue: item.iColValue || 4, | 1044 | iColValue: item.iColValue || 4, |
| 1048 | sVisColumnName: "sProcessName", | 1045 | sVisColumnName: "sProcessName", |
| 1049 | })), | 1046 | })), |
| 1050 | - }; | ||
| 1051 | - }); | ||
| 1052 | - }; | 1047 | + }; |
| 1048 | + }); | ||
| 1049 | + }; | ||
| 1053 | 1050 | ||
| 1054 | - getDropDownData(props); | ||
| 1055 | - }, | ||
| 1056 | - [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)] | ||
| 1057 | - ); | 1051 | + getDropDownData(props); |
| 1052 | + }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]); | ||
| 1058 | 1053 | ||
| 1059 | return ( | 1054 | return ( |
| 1060 | <Tree | 1055 | <Tree |
| @@ -1096,13 +1091,10 @@ const ContentComponent = props => { | @@ -1096,13 +1091,10 @@ const ContentComponent = props => { | ||
| 1096 | const boxModelList = sAllPartsName.split(","); | 1091 | const boxModelList = sAllPartsName.split(","); |
| 1097 | const [activeKey, setActiveKey] = useState(0); | 1092 | const [activeKey, setActiveKey] = useState(0); |
| 1098 | 1093 | ||
| 1099 | - useEffect( | ||
| 1100 | - () => { | ||
| 1101 | - if (!boxModelList.length) return; | ||
| 1102 | - setActiveKey(0); | ||
| 1103 | - }, | ||
| 1104 | - [sAllPartsName] | ||
| 1105 | - ); | 1094 | + useEffect(() => { |
| 1095 | + if (!boxModelList.length) return; | ||
| 1096 | + setActiveKey(0); | ||
| 1097 | + }, [sAllPartsName]); | ||
| 1106 | 1098 | ||
| 1107 | const dividerProps = { | 1099 | const dividerProps = { |
| 1108 | className: styles.divider, | 1100 | className: styles.divider, |
| @@ -1772,22 +1764,24 @@ const MaterialsComponent = props => { | @@ -1772,22 +1764,24 @@ const MaterialsComponent = props => { | ||
| 1772 | const materialsInfoDefaultData = sParam ? new Array(sParamList.length).fill({}).map((_, index) => ({ showName: sParamList[index] })) : [{}]; | 1764 | const materialsInfoDefaultData = sParam ? new Array(sParamList.length).fill({}).map((_, index) => ({ showName: sParamList[index] })) : [{}]; |
| 1773 | const { materialsInfo = materialsInfoDefaultData } = slaveRowData; | 1765 | const { materialsInfo = materialsInfoDefaultData } = slaveRowData; |
| 1774 | 1766 | ||
| 1775 | - const materialsConfig = slaveConfig.gdsconfigformslave.filter(item => item.iTag === 11).map(item => { | ||
| 1776 | - const { sName } = item; | ||
| 1777 | - if (sName === "sMaterialsName") { | ||
| 1778 | - return { | ||
| 1779 | - ...item, | ||
| 1780 | - sVisColumnName: "sMaterialsName", | ||
| 1781 | - iColValue: 20, | ||
| 1782 | - }; | ||
| 1783 | - } else if (sName === "sComMaterials") { | ||
| 1784 | - return { | ||
| 1785 | - ...item, | ||
| 1786 | - sName: "bComMaterials", | ||
| 1787 | - iColValue: 4, | ||
| 1788 | - }; | ||
| 1789 | - } | ||
| 1790 | - }); | 1767 | + const materialsConfig = slaveConfig.gdsconfigformslave |
| 1768 | + .filter(item => item.iTag === 11) | ||
| 1769 | + .map(item => { | ||
| 1770 | + const { sName } = item; | ||
| 1771 | + if (sName === "sMaterialsName") { | ||
| 1772 | + return { | ||
| 1773 | + ...item, | ||
| 1774 | + sVisColumnName: "sMaterialsName", | ||
| 1775 | + iColValue: 20, | ||
| 1776 | + }; | ||
| 1777 | + } else if (sName === "sComMaterials") { | ||
| 1778 | + return { | ||
| 1779 | + ...item, | ||
| 1780 | + sName: "bComMaterials", | ||
| 1781 | + iColValue: 4, | ||
| 1782 | + }; | ||
| 1783 | + } | ||
| 1784 | + }); | ||
| 1791 | 1785 | ||
| 1792 | const extraState = { | 1786 | const extraState = { |
| 1793 | calcPriceFinished: false, | 1787 | calcPriceFinished: false, |
| @@ -1795,7 +1789,8 @@ const MaterialsComponent = props => { | @@ -1795,7 +1789,8 @@ const MaterialsComponent = props => { | ||
| 1795 | }; | 1789 | }; |
| 1796 | 1790 | ||
| 1797 | return materialsInfo.map((item, index) => { | 1791 | return materialsInfo.map((item, index) => { |
| 1798 | - const viewRow = { ...materialsInfo[index], sProductClassifyId: selectedNode.sId }; | 1792 | + let viewRow = { ...materialsInfo[index], sProductClassifyId: selectedNode.sId }; |
| 1793 | + viewRow = { ...viewRow, sMaterialsName0: viewRow.showName || "" }; | ||
| 1799 | let materialsConfigNew = cloneDeep(materialsConfig); | 1794 | let materialsConfigNew = cloneDeep(materialsConfig); |
| 1800 | if (viewRow.showName) { | 1795 | if (viewRow.showName) { |
| 1801 | const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName"); | 1796 | const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName"); |
| @@ -1905,59 +1900,50 @@ const ManyComponent = props => { | @@ -1905,59 +1900,50 @@ const ManyComponent = props => { | ||
| 1905 | }; | 1900 | }; |
| 1906 | 1901 | ||
| 1907 | // 根据主表数量更改多数量表 | 1902 | // 根据主表数量更改多数量表 |
| 1908 | - useEffect( | ||
| 1909 | - () => { | ||
| 1910 | - const baseCount = masterData.dProductQty || 1000; | ||
| 1911 | - if (manyData[0]?.dManyQty === baseCount) return; | ||
| 1912 | - | ||
| 1913 | - const manyDataNew = Array(5) | ||
| 1914 | - .fill("") | ||
| 1915 | - .map((item, index) => ({ | ||
| 1916 | - sId: commonUtils.createSid(), | ||
| 1917 | - handleType: "add", | ||
| 1918 | - dManyQty: baseCount * (index + 1), | ||
| 1919 | - })); | ||
| 1920 | - setState(pre => ({ | ||
| 1921 | - ...pre, | ||
| 1922 | - manyData: manyDataNew, | ||
| 1923 | - manySelectedRowKeys: [manyDataNew[0].sId], | ||
| 1924 | - dProductQty: baseCount, | ||
| 1925 | - dQuickQuoteProductQty: baseCount, | 1903 | + useEffect(() => { |
| 1904 | + const baseCount = masterData.dProductQty || 1000; | ||
| 1905 | + if (manyData[0]?.dManyQty === baseCount) return; | ||
| 1906 | + | ||
| 1907 | + const manyDataNew = Array(5) | ||
| 1908 | + .fill("") | ||
| 1909 | + .map((item, index) => ({ | ||
| 1910 | + sId: commonUtils.createSid(), | ||
| 1911 | + handleType: "add", | ||
| 1912 | + dManyQty: baseCount * (index + 1), | ||
| 1926 | })); | 1913 | })); |
| 1927 | - props.onSaveState({ | ||
| 1928 | - manyDataCache: [], | ||
| 1929 | - }); | ||
| 1930 | - }, | ||
| 1931 | - [masterData.dProductQty, manyData.length] | ||
| 1932 | - ); | 1914 | + setState(pre => ({ |
| 1915 | + ...pre, | ||
| 1916 | + manyData: manyDataNew, | ||
| 1917 | + manySelectedRowKeys: [manyDataNew[0].sId], | ||
| 1918 | + dProductQty: baseCount, | ||
| 1919 | + dQuickQuoteProductQty: baseCount, | ||
| 1920 | + })); | ||
| 1921 | + props.onSaveState({ | ||
| 1922 | + manyDataCache: [], | ||
| 1923 | + }); | ||
| 1924 | + }, [masterData.dProductQty, manyData.length]); | ||
| 1933 | 1925 | ||
| 1934 | // 获取核价进度 | 1926 | // 获取核价进度 |
| 1935 | - useEffect( | ||
| 1936 | - () => { | ||
| 1937 | - if (calcPriceLoading) { | ||
| 1938 | - setProcessPercent(0); | ||
| 1939 | - window.tempWsAction = ({ data } = {}) => { | ||
| 1940 | - const { action, msg } = commonUtils.convertStrToObj(data, {}); | ||
| 1941 | - if (action === "quotationAllprogress") { | ||
| 1942 | - setProcessPercent(msg); | ||
| 1943 | - } | ||
| 1944 | - }; | ||
| 1945 | - } else { | ||
| 1946 | - window.tempWsAction = null; | ||
| 1947 | - } | ||
| 1948 | - }, | ||
| 1949 | - [calcPriceLoading] | ||
| 1950 | - ); | 1927 | + useEffect(() => { |
| 1928 | + if (calcPriceLoading) { | ||
| 1929 | + setProcessPercent(0); | ||
| 1930 | + window.tempWsAction = ({ data } = {}) => { | ||
| 1931 | + const { action, msg } = commonUtils.convertStrToObj(data, {}); | ||
| 1932 | + if (action === "quotationAllprogress") { | ||
| 1933 | + setProcessPercent(msg); | ||
| 1934 | + } | ||
| 1935 | + }; | ||
| 1936 | + } else { | ||
| 1937 | + window.tempWsAction = null; | ||
| 1938 | + } | ||
| 1939 | + }, [calcPriceLoading]); | ||
| 1951 | 1940 | ||
| 1952 | // 监听确认下单数量结束 | 1941 | // 监听确认下单数量结束 |
| 1953 | - useEffect( | ||
| 1954 | - () => { | ||
| 1955 | - if (!loading && submitLoading) { | ||
| 1956 | - setSubmitLoading(false); | ||
| 1957 | - } | ||
| 1958 | - }, | ||
| 1959 | - [loading] | ||
| 1960 | - ); | 1942 | + useEffect(() => { |
| 1943 | + if (!loading && submitLoading) { | ||
| 1944 | + setSubmitLoading(false); | ||
| 1945 | + } | ||
| 1946 | + }, [loading]); | ||
| 1961 | 1947 | ||
| 1962 | const tableProps = { | 1948 | const tableProps = { |
| 1963 | ...commonBusiness.getTableTypes("many", { ...props, ...state }), | 1949 | ...commonBusiness.getTableTypes("many", { ...props, ...state }), |