Commit f073433865e842305fb857b6cdc78db88228f22a
1 parent
0da7e2fe
优化材料下拉传参;
Showing
1 changed file
with
243 additions
and
257 deletions
src/components/QuickQuote/index.jsx
| ... | ... | @@ -84,13 +84,10 @@ const QuickQuoteEvent = props => { |
| 84 | 84 | const { bLinkFieledClick } = props; |
| 85 | 85 | const [hideBackBtn, setHideBackBtn] = useState(false); |
| 86 | 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 | 92 | // 获取formData |
| 96 | 93 | useEffect(() => { |
| ... | ... | @@ -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 | 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 | 164 | addState.onBackClick = () => { |
| 177 | 165 | props.onSaveState({ masterData: { ...props.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(state)) }, quickQuoteModel: false }); |
| ... | ... | @@ -705,25 +693,27 @@ const QuickQuoteEvent = props => { |
| 705 | 693 | processData.push(processPrintDataRow); |
| 706 | 694 | // 配套工序 |
| 707 | 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 | 719 | partInfo.processInfo.forEach((process, iOrder) => { |
| ... | ... | @@ -754,25 +744,27 @@ const QuickQuoteEvent = props => { |
| 754 | 744 | processData.push(processAfterDataRow); |
| 755 | 745 | // 配套工序 |
| 756 | 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 | 794 | processData.push(processProductDataRow); |
| 803 | 795 | // 配套工序 |
| 804 | 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 | 816 | processData = props.sortData(controlData, processData); |
| ... | ... | @@ -975,86 +969,87 @@ const TreeComponent = props => { |
| 975 | 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 | 1034 | ...item, |
| 1040 | 1035 | sName: `sParams${index}`, |
| 1041 | 1036 | iColValue: item.iColValue || 4, |
| 1042 | 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 | 1042 | ...item, |
| 1046 | 1043 | sName: `sParams${index}`, |
| 1047 | 1044 | iColValue: item.iColValue || 4, |
| 1048 | 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 | 1054 | return ( |
| 1060 | 1055 | <Tree |
| ... | ... | @@ -1096,13 +1091,10 @@ const ContentComponent = props => { |
| 1096 | 1091 | const boxModelList = sAllPartsName.split(","); |
| 1097 | 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 | 1099 | const dividerProps = { |
| 1108 | 1100 | className: styles.divider, |
| ... | ... | @@ -1772,22 +1764,24 @@ const MaterialsComponent = props => { |
| 1772 | 1764 | const materialsInfoDefaultData = sParam ? new Array(sParamList.length).fill({}).map((_, index) => ({ showName: sParamList[index] })) : [{}]; |
| 1773 | 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 | 1786 | const extraState = { |
| 1793 | 1787 | calcPriceFinished: false, |
| ... | ... | @@ -1795,7 +1789,8 @@ const MaterialsComponent = props => { |
| 1795 | 1789 | }; |
| 1796 | 1790 | |
| 1797 | 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 | 1794 | let materialsConfigNew = cloneDeep(materialsConfig); |
| 1800 | 1795 | if (viewRow.showName) { |
| 1801 | 1796 | const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName"); |
| ... | ... | @@ -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 | 1948 | const tableProps = { |
| 1963 | 1949 | ...commonBusiness.getTableTypes("many", { ...props, ...state }), | ... | ... |