From c738f700b78cb82b20a846ec76b851e298bb11f5 Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Thu, 12 Jun 2025 13:14:53 +0800 Subject: [PATCH] 快速报价app 主表数据 --- src/components/QuickQuote/index.jsx | 2 ++ src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js | 5 ----- src/mobile/components/SelectInput.jsx | 2 +- src/mobile/quotation/detailNew.jsx | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------- 4 files changed, 85 insertions(+), 35 deletions(-) diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 234cf54..9b47257 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -246,6 +246,7 @@ const QuickQuoteEvent = props => { handleType: slaveData[iIndex].handleType || "update", }; } + } else { if (iIndex === -1) { slaveData.push({ @@ -1423,6 +1424,7 @@ const BoxComponent = props => { ); }, }; + // 获取sType为3的 const { productProcessInfo = [] } = masterData; const finishedViewProps = { diff --git a/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js b/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js index 9be16d0..f06048c 100644 --- a/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js +++ b/src/components/QuoQuotation/QuotationPackTableTree/QuotationPackTableTree.js @@ -1770,7 +1770,6 @@ class QuotationPackTableTree extends Component { } } } - console.log('222', skipFlag); if(((skipFlag === 0) || masterData.bNoVerify) && !skipCalculation) { this.handleCalculation(true); } else { @@ -2266,7 +2265,6 @@ class QuotationPackTableTree extends Component { if (commonUtils.isNotEmptyArr(materialsSelectedDelRowKeys)) { materialsReturnData = this.props.onDataRowDel('materials', true, materialsSelectedDelRowKeys); } - console.log('materialsReturnData', materialsReturnData); this.props.onSaveState({ ...processReturnData, ...materialsReturnData, @@ -2770,7 +2768,6 @@ class QuotationPackTableTree extends Component { if (commonUtils.isNotEmptyObject(dataReturn)) { if (dataReturn.code === 1) { const flowData = dataReturn.dataset.rows[0]; - console.log(flowData); if (commonUtils.isNotEmptyObject(flowData)) { this.props.onSaveState({ flowData: flowData,workFlowVisible:true @@ -4121,7 +4118,6 @@ class QuotationPackTableTree extends Component { // const sSqlCondition = { sId: selectData[0].sSlaveId }; /* 后台根据rowData自己取 */ const condition = { sConfigformId, sControlName, sRowData }; const dataReturn = (await commonServices.postValueService(token, condition, dataUrl)).data; - console.log('dataReturn', dataReturn); if (dataReturn.code === 1) { const copyTo = { config: masterConfig.gdsconfigformslave, name: selectConfig.sControlName }; const returnDataSet = dataReturn.dataset.rows[0]; @@ -4245,7 +4241,6 @@ class QuotationPackTableTree extends Component { returnData[sName] = returnDataSet[key]; } } - console.log('returnData', returnData); if (commonUtils.isNotEmptyArr(returnData.controlData)) { let dProductQty = 0; /* 主表配置bProductQtyAdd 则代表产品数量不叠加备货数 赠送数 */ diff --git a/src/mobile/components/SelectInput.jsx b/src/mobile/components/SelectInput.jsx index a9665c6..76bfdec 100644 --- a/src/mobile/components/SelectInput.jsx +++ b/src/mobile/components/SelectInput.jsx @@ -46,7 +46,7 @@ const SelectInput = props => { }; commonServices.postValueService(props.app.token, body, url).then(res => { if (res.data.code === 1) { - const list = res.data.dataset.rows?.map(item => ({ + const list = res.data.dataset.rows?.map((item,i) => ({ label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName, value: item.sId || item.sSlaveId, ...item, diff --git a/src/mobile/quotation/detailNew.jsx b/src/mobile/quotation/detailNew.jsx index ebda78b..76dc2f3 100644 --- a/src/mobile/quotation/detailNew.jsx +++ b/src/mobile/quotation/detailNew.jsx @@ -97,29 +97,32 @@ const QuickQuoteEvent = props => { }, [bLinkFieledClick, props.enabled]); useEffect(() => { // 获取 masterConfig - const { sModelsId } = props; - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`; - commonServices - .getService(props.app.token, configUrl) - .then(({ data: configReturn }) => { - if (configReturn.code === 1) { - const formData = configReturn.dataset.rows[0]?.formData; - setMasterConfig(formData); - // setState(pre => ({ ...pre, masterConfig: formData, slaveConfig: formData[1] })); - } - }) - .catch(error => {}); + const sActiveId = "172129113112117428019179600"; const configUrls = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`; - commonServices.getService(props.app.token, configUrls).then(({ data: configReturn }) => { + commonServices.getService(props.app.token, configUrls).then(async ({ data: configReturn }) => { if (configReturn.code === 1) { const formData = configReturn.dataset.rows[0].formData; - // 需要查询到processConfig和materialsConfig - setState(pre => ({ ...pre, formData, masterConfig: formData[0], processConfig: {} })); + setState(pre => ({ ...pre, formData, masterConfig: formData[0] })); } }); }, []); - + // 获取主表信息 + useEffect(() => { + const configUrl = `${commonConfig.server_host}business/getModelBysId/${props.sModelsId}?sModelsId=${props.sModelsId}`; + commonServices + .getService(props.app.token, configUrl) + .then(({ data: masterReturn }) => { + if (masterReturn.code === 1) { + const materFormData = masterReturn.dataset.rows[0].formData; + const processConfig = materFormData.find(x => x.sTbName === "QuoQuotationprocess"); + const materialsConfig = materFormData.find(x => x.sTbName === "QuoQuotationmaterials"); + setMasterConfig(materFormData); + setState(pre => ({ ...pre, processConfig, materialsConfig })); + } + }) + .catch(error => {}); + }, [props.sModelsId]); // 获取盒型定义配置 useEffect(() => { if (!formData.length) return; @@ -180,6 +183,7 @@ const QuickQuoteEvent = props => { } setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState })); } else if (name.includes("slave")) { + const boxModel = name.replace("slaveUp", "").replace("slaveDown", ""); if (sFieldName === "sName") { if (!changeValue.sName) return; @@ -224,7 +228,6 @@ const QuickQuoteEvent = props => { } else { const sBackProcessData = slaveData[iIndex].sBackProcessData || []; const iIndex1 = sBackProcessData.findIndex(item => item.value === dropDownData[0].value); - if (iIndex1 === -1) { dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected); } else { @@ -295,6 +298,13 @@ const QuickQuoteEvent = props => { if (sFieldName === "sPrint") { slaveData[saveIndex] = { ...slaveData[saveIndex], + sProcessId: changeValue.sId, + sPrintProcessId: changeValue.sId, + }; + } + if (sFieldName === "sPrint") { + slaveData[saveIndex] = { + ...slaveData[saveIndex], dMachineWidth: slaveData[saveIndex].dWlkd, dMachineLength: slaveData[saveIndex].dWlcd, }; @@ -511,6 +521,8 @@ const QuickQuoteEvent = props => { }) .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length) .map(item => { + // slaveData里的sMaterialRate sMaterialsStyle + return { ...Object.keys(item).reduce((pre, cur) => { if (typeof item[cur] !== "object") { @@ -541,8 +553,8 @@ const QuickQuoteEvent = props => { const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; if (dataReturn.code === 1) { - const { app, sModelsId, materialsConfig } = props; - const { slaveConfig, masterData: masterData1, processConfig } = state; + const { app, sModelsId } = props; + const { slaveConfig, masterData: masterData1, processConfig, materialsConfig } = state; const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0]; const slaveData = []; @@ -673,7 +685,7 @@ const QuickQuoteEvent = props => { const materialInfo = partInfo.materialsInfo[i]; const iOrder = i; let materialDataRow = {}; - for (const item of materialsConfig?.gdsconfigformslave) { + for (const item of materialsConfig.gdsconfigformslave) { materialDataRow[item.sName] = materialInfo[item.sName]; } materialDataRow.handleType = "add"; @@ -861,9 +873,12 @@ const QuickQuoteEvent = props => { // quickQuoteModel: false, }; delete newState.masterData.sQuoConfig; + const masterProps = { + ...props, + }; const result = await props.handleCalculation( false, - { ...props, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData }, + { ...masterProps, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData }, true ); @@ -1073,7 +1088,35 @@ const sortData = (tableData, processData) => { }); return processData; }; -const QuotationAllprogressDetail = baseProps => { +// 计算数量 +const handleCalculation = async (bSave, nextProps, 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, + } = nextProps; + let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps; + const sMakePerson = masterData.sMakePerson; + const data = []; +}; +const getProps = baseProps => { const { location, quotationData, app, sModelsId } = baseProps; const getSqlDropDownDatas = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => { const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`; @@ -1110,10 +1153,17 @@ const QuotationAllprogressDetail = baseProps => { getSqlDropDownData: getSqlDropDownDatas, onMaterialsChange: handleMaterialsChange, sortData, + handleCalculation, + }; + return { + ...baseProps, + ...propss, }; +}; +const QuotationAllprogressDetail = baseProps => { + const props = QuickQuoteEvent(getProps(baseProps)); - const props = QuickQuoteEvent(propss); - const { selectedNode } = props; + const { selectedNode, location, quotationData, app, sModelsId } = props; const { showName, sUnit } = quotationData; const timeRef = useRef(0); @@ -1593,7 +1643,7 @@ const BoxComponent = props => { const newSwitchStates = downAbleConfigsNew .filter(item => item.sPartsName === boxModel || !item.sPartsName) .reduce((acc, item, index) => { - acc[item.sName] = sBackProcessData[index][item.sName] !== ""; + acc[item.sName] = sBackProcessData ? sBackProcessData[index][item.sName] !== "" : false; return acc; }, {}); @@ -1613,9 +1663,11 @@ const BoxComponent = props => { // 过滤后的数据 const downViewConfigs = downAbleConfigsNew .filter(item => item.sPartsName === boxModel || !item.sPartsName) - .map(item => ({ + .map((item, i) => ({ ...item, isSelect: switchStates ? switchStates[item.sName] : false, + sName: "sParams" + i, + sProductClassifyId: item.sId, })); const downViewProps = { @@ -1626,6 +1678,7 @@ const BoxComponent = props => { viewRow: slaveRowData, tableName: `slaveDown${boxModel}`, }; + const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); const radioValue = calcMethodData[0]?.sCode; const [materialLength, setMaterialLength] = useState(0); @@ -1653,7 +1706,7 @@ const BoxComponent = props => { dMachineWidth: width, // 上机宽 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸 - sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2), + sMaterialRate: (((length * width) / (dWlcd * dWlkd)) * 100).toFixed(2), newMaterialLength: length, newMaterialWidth: width, sLayoutRate: Number( @@ -2069,11 +2122,11 @@ const MaterialsComponent = props => { tableName: `slaveUp${boxModel}`, onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => { const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); - const { sMaterialsName, sMaterialsNo, sMaterialsId, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue; + const { sMaterialsName, sMaterialsNo, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, sMaterialsType, dWlkd, dWlcd } = changeValue; const masterials = { sMaterialsName, sMaterialsNo, - sMaterialsId, + sMaterialsId: changeValue.sId, sAuxiliaryUnit, sMaterialsUnit, dGramWeight, -- libgit2 0.22.2