Commit 344d1338d99d596bb51500deeaafbfecb0b3a18c
1 parent
72e240c1
快速报价app
Showing
10 changed files
with
118205 additions
and
146035 deletions
Too many changes to show.
To preserve performance only 5 of 10 files are displayed.
src/components/Common/BoxDesignCompontent/svg.js
| ... | ... | @@ -266,7 +266,7 @@ const SvgBox = props => { |
| 266 | 266 | } else { |
| 267 | 267 | leftSize = zbtb?.value; |
| 268 | 268 | } |
| 269 | - svg.setAttribute("viewBox", `${-(leftSize * scale)} ${-ySvg} ${viewBoxWidth} ${viewBoxHeight}`); | |
| 269 | + svg.setAttribute("viewBox", `${-(leftSize * scale)||0} ${-ySvg} ${viewBoxWidth} ${viewBoxHeight}`); | |
| 270 | 270 | svg.setAttribute("width", `${viewBoxWidth}px`); |
| 271 | 271 | svg.setAttribute("height", `${viewBoxHeight}px`); |
| 272 | 272 | svgContainerRef.current.style.width = `${viewBoxWidth}px`; |
| ... | ... | @@ -311,7 +311,7 @@ const SvgBox = props => { |
| 311 | 311 | } else { |
| 312 | 312 | leftSize = zbtb?.value; |
| 313 | 313 | } |
| 314 | - svg.setAttribute("viewBox", `${-((leftSize * scale))} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); | |
| 314 | + svg.setAttribute("viewBox", `${-(((leftSize * scale) || 0))} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); | |
| 315 | 315 | svg.setAttribute("width", `${dSvgBoxWidth}px`); |
| 316 | 316 | svg.setAttribute("height", `${dSvgBoxHeight}px`); |
| 317 | 317 | svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; | ... | ... |
src/components/Common/BoxShowImgMaterial/indexNew.js
| ... | ... | @@ -191,7 +191,9 @@ const BoxShowImgMaterial = props => { |
| 191 | 191 | |
| 192 | 192 | const isShow = |
| 193 | 193 | isDPartsLength && slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax; |
| 194 | - return ( | |
| 194 | + console.log(slaveDataDetail?.dMaxWidth,slaveDataDetail?.dMaxLength,slaveDataDetail?.dMachineLength,slaveDataDetail?.dMachineWidth,'dropDownData'); | |
| 195 | + | |
| 196 | + return ( | |
| 195 | 197 | <> |
| 196 | 198 | {isShow ? ( |
| 197 | 199 | <div | ... | ... |
src/components/QuickQuote/index.jsx
| ... | ... | @@ -17,6 +17,7 @@ import Typesetting from "@/components/Common/Typesetting/typesetting"; |
| 17 | 17 | import DynamicSVG from "@/components/Common/BoxDesignCompontent/svg"; |
| 18 | 18 | // 事件 |
| 19 | 19 | const QuickQuoteEvent = props => { |
| 20 | + console.log("🚀 ~ QuickQuoteEvent:", props) | |
| 20 | 21 | const addState = {}; |
| 21 | 22 | |
| 22 | 23 | addState.onGetFilterState = (state, bInit) => { |
| ... | ... | @@ -612,6 +613,7 @@ const QuickQuoteEvent = props => { |
| 612 | 613 | const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === "sProcessName"); |
| 613 | 614 | if (iIndex > -1) { |
| 614 | 615 | const sqlDropDownData = await props.getSqlDropDownData(sModelsId, "slave", processConfig.gdsconfigformslave[iIndex]); |
| 616 | + console.log("🚀 ~ addState.handleCalcPrice= ~ sqlDropDownData:", sqlDropDownData) | |
| 615 | 617 | dropDownDataProcessName = sqlDropDownData.dropDownData; |
| 616 | 618 | processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; |
| 617 | 619 | } |
| ... | ... | @@ -1361,6 +1363,7 @@ const BoxComponent = props => { |
| 1361 | 1363 | onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => { |
| 1362 | 1364 | const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); |
| 1363 | 1365 | const iIndex1 = slaveData[iIndex].sBackProcessData.findIndex(item => item[child.sName]); |
| 1366 | + console.log("🚀 ~ child:", child) | |
| 1364 | 1367 | slaveData[iIndex].sBackProcessData[iIndex1][sFieldName] = changeValue[sFieldName]; |
| 1365 | 1368 | const { dManualLength, dManualWidth } = slaveData[iIndex].sBackProcessData[iIndex1]; |
| 1366 | 1369 | if (dManualLength !== undefined && dManualWidth !== undefined) { |
| ... | ... | @@ -1424,7 +1427,6 @@ const BoxComponent = props => { |
| 1424 | 1427 | ); |
| 1425 | 1428 | }, |
| 1426 | 1429 | }; |
| 1427 | - | |
| 1428 | 1430 | // 获取sType为3的 |
| 1429 | 1431 | const { productProcessInfo = [] } = masterData; |
| 1430 | 1432 | const finishedViewProps = { | ... | ... |
src/mobile/components/SelectInput.jsx
| ... | ... | @@ -20,15 +20,14 @@ const SelectInput = props => { |
| 20 | 20 | const { bReadonly } = itemDetail || {}; |
| 21 | 21 | useEffect(() => { |
| 22 | 22 | if (!itemDetail) return; |
| 23 | - | |
| 24 | 23 | const viewRowNew = itemDetail.sName ? viewRow?.[itemDetail.sName] : ""; |
| 25 | 24 | if (itemDetail.sDropDownType === "const") { |
| 26 | 25 | return |
| 27 | 26 | } |
| 28 | 27 | if (tableName.includes("slaveDown")) { |
| 29 | 28 | if (!viewRow.sBackProcessData) return; |
| 30 | - const data = viewRow.sBackProcessData[downIndex][itemDetail.sName]; | |
| 31 | - setValue(data); | |
| 29 | + // const data = viewRow.sBackProcessData[downIndex][itemDetail.sName]; | |
| 30 | + // setValue(data); | |
| 32 | 31 | } else { |
| 33 | 32 | setValue(viewRowNew || ""); // 动态更新 value |
| 34 | 33 | } |
| ... | ... | @@ -62,7 +61,7 @@ const SelectInput = props => { |
| 62 | 61 | const data = coplyColumns[index]; |
| 63 | 62 | data[itemDetail.sName] = data[itemDetail.sName] ? data[itemDetail.sName] : data.label || data.sName || data.sProcessName || data.sColorName; |
| 64 | 63 | setValue(columns[index]?.label || ""); |
| 65 | - props.onDataChange(tableName, itemDetail.sName, data, null, coplyColumns); | |
| 64 | + props.onDataChange(tableName, itemDetail.sName, data, data.sId, coplyColumns); | |
| 66 | 65 | setVisible(false); |
| 67 | 66 | }; |
| 68 | 67 | ... | ... |
src/mobile/quotation/detailNew.jsx
| 1 | 1 | import { useRef, useEffect, useState, useCallback, useMemo } from "react"; |
| 2 | 2 | import { history } from "umi"; |
| 3 | -import { Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog, Toast } from "antd-mobile"; | |
| 3 | +import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog } from "antd-mobile"; | |
| 4 | 4 | import { AddOutline, MinusOutline } from "antd-mobile-icons"; |
| 5 | 5 | import commonConfig from "@/utils/config"; |
| 6 | 6 | import * as commonServices from "@/services/services"; |
| ... | ... | @@ -9,6 +9,8 @@ import * as commonBusiness from "@/components/Common/commonBusiness"; |
| 9 | 9 | import styles from "./quotationDetail.less"; |
| 10 | 10 | import SelectInput from "../components/SelectInput"; |
| 11 | 11 | import JsonData from "./index.json"; |
| 12 | +import PropsJson from "./props.json"; | |
| 13 | +import ProcessData from "./process.json"; | |
| 12 | 14 | import * as commonUtils from "@/utils/utils"; |
| 13 | 15 | import Typesetting from "@/components/Common/Typesetting/typesetting"; |
| 14 | 16 | import DynamicSVG from "@/components/Common/BoxDesignCompontent/svg"; |
| ... | ... | @@ -90,6 +92,7 @@ const QuickQuoteEvent = props => { |
| 90 | 92 | useEffect(() => { |
| 91 | 93 | setState(pre => ({ ...pre, selectedNode })); |
| 92 | 94 | }, []); |
| 95 | + | |
| 93 | 96 | useEffect(() => { |
| 94 | 97 | setHideBackBtn(!bLinkFieledClick); |
| 95 | 98 | setEnabled(!bLinkFieledClick || props.enabled); |
| ... | ... | @@ -113,7 +116,7 @@ const QuickQuoteEvent = props => { |
| 113 | 116 | commonServices.getService(props.app.token, configUrls).then(({ data: configReturn }) => { |
| 114 | 117 | if (configReturn.code === 1) { |
| 115 | 118 | const formData = configReturn.dataset.rows[0].formData; |
| 116 | - setState(pre => ({ ...pre, formData, masterConfig: formData[0] })); | |
| 119 | + setState(pre => ({ ...pre, formData, masterConfig: formData[0], processConfig: ProcessData })); | |
| 117 | 120 | } |
| 118 | 121 | }); |
| 119 | 122 | }, []); |
| ... | ... | @@ -201,7 +204,7 @@ const QuickQuoteEvent = props => { |
| 201 | 204 | const { showName: sTreeNodeName } = selectedNode; |
| 202 | 205 | const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel); |
| 203 | 206 | if (name.includes("slaveDown")) { |
| 204 | - const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]); | |
| 207 | + const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue.sId); | |
| 205 | 208 | dropDownDataSelected && (dropDownDataSelected[sFieldName] = dropDownDataSelected.sProcessName); |
| 206 | 209 | const extraRowData = {}; |
| 207 | 210 | // if (dropDownDataSelected.sProcessName === "胶印") { |
| ... | ... | @@ -218,7 +221,8 @@ const QuickQuoteEvent = props => { |
| 218 | 221 | }); |
| 219 | 222 | } else { |
| 220 | 223 | const sBackProcessData = slaveData[iIndex].sBackProcessData || []; |
| 221 | - const iIndex1 = sBackProcessData.findIndex(item => item.sProductClassifyId === dropDownData[0].sProductClassifyId); | |
| 224 | + const iIndex1 = sBackProcessData.findIndex(item => item.value === dropDownData[0].value); | |
| 225 | + | |
| 222 | 226 | if (iIndex1 === -1) { |
| 223 | 227 | dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected); |
| 224 | 228 | } else { |
| ... | ... | @@ -286,6 +290,14 @@ const QuickQuoteEvent = props => { |
| 286 | 290 | dMaxWidth: Number(selectedNode.sMachineStyle.split("*")[1]), |
| 287 | 291 | }; |
| 288 | 292 | } |
| 293 | + if (sFieldName === "sPrint") { | |
| 294 | + slaveData[saveIndex] = { | |
| 295 | + ...slaveData[saveIndex], | |
| 296 | + dMachineWidth: slaveData[saveIndex].dWlkd, | |
| 297 | + dMachineLength: slaveData[saveIndex].dWlcd, | |
| 298 | + }; | |
| 299 | + } | |
| 300 | + console.log("dropDownData", slaveData); | |
| 289 | 301 | |
| 290 | 302 | setState(pre => ({ ...pre, slaveData, ...extraState })); |
| 291 | 303 | } else if (name === "finished") { |
| ... | ... | @@ -344,7 +356,10 @@ const QuickQuoteEvent = props => { |
| 344 | 356 | const { masterData = {} } = nextState; |
| 345 | 357 | const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData; |
| 346 | 358 | if (!sProductName || !sCustomerName) { |
| 347 | - message.info("请先填写客户名称和产品名称"); | |
| 359 | + // message.info("请先填写客户名称和产品名称"); | |
| 360 | + Toast.show({ | |
| 361 | + content: "请先填写客户名称和产品名称", | |
| 362 | + }); | |
| 348 | 363 | return; |
| 349 | 364 | } |
| 350 | 365 | |
| ... | ... | @@ -415,7 +430,11 @@ const QuickQuoteEvent = props => { |
| 415 | 430 | const { masterData = {}, slaveData = [], selectedNode = {}, extraParts = {} } = state; |
| 416 | 431 | |
| 417 | 432 | if (commonUtils.isEmptyObject(selectedNode)) { |
| 418 | - message.error("请先选择产品"); | |
| 433 | + // message.error("请先选择产品"); | |
| 434 | + Toast.show({ | |
| 435 | + icon: "fail", | |
| 436 | + content: "请先选择产品", | |
| 437 | + }); | |
| 419 | 438 | return; |
| 420 | 439 | } |
| 421 | 440 | const mustFieldsMap = { |
| ... | ... | @@ -429,7 +448,11 @@ const QuickQuoteEvent = props => { |
| 429 | 448 | |
| 430 | 449 | const checkResult = Object.keys(mustFieldsMap).find(item => masterData[item] === undefined); |
| 431 | 450 | if (checkResult) { |
| 432 | - message.error(mustFieldsMap[checkResult]); | |
| 451 | + // message.error(mustFieldsMap[checkResult]); | |
| 452 | + Toast.show({ | |
| 453 | + icon: "fail", | |
| 454 | + content: mustFieldsMap[checkResult], | |
| 455 | + }); | |
| 433 | 456 | return; |
| 434 | 457 | } |
| 435 | 458 | |
| ... | ... | @@ -445,7 +468,11 @@ const QuickQuoteEvent = props => { |
| 445 | 468 | .filter(item => (bBox ? item.sName : true)) |
| 446 | 469 | .filter(item => item.sPrint !== undefined && item.sColor !== undefined && item.iPrintModePo !== undefined) || []; |
| 447 | 470 | if (!slaveRowDataList.length) { |
| 448 | - message.error("请至少保证一个部件的材料信息填写完整"); | |
| 471 | + // message.error("请至少保证一个部件的材料信息填写完整"); | |
| 472 | + Toast.show({ | |
| 473 | + icon: "fail", | |
| 474 | + content: "请至少保证一个部件的材料信息填写完整", | |
| 475 | + }); | |
| 449 | 476 | return; |
| 450 | 477 | } |
| 451 | 478 | |
| ... | ... | @@ -464,6 +491,8 @@ const QuickQuoteEvent = props => { |
| 464 | 491 | dProductWidth: masterData.dWidth, |
| 465 | 492 | dProductLength: masterData.dLength, |
| 466 | 493 | dProductHeight: masterData.dHeight, |
| 494 | + sConsigneeMobile: masterData.sMobile, | |
| 495 | + sConsignee: masterData.sContacts, | |
| 467 | 496 | sProductStyle: |
| 468 | 497 | masterData.dHeight !== undefined |
| 469 | 498 | ? `${masterData.dLength}*${masterData.dWidth}*${masterData.dHeight}` |
| ... | ... | @@ -506,11 +535,15 @@ const QuickQuoteEvent = props => { |
| 506 | 535 | if (paramMap.sPartsStyle === "0*0") { |
| 507 | 536 | delete paramMap.sPartsStyle; |
| 508 | 537 | } |
| 538 | + // 先用好的数据模拟后面在调整 | |
| 539 | + const newParamMap = JsonData; | |
| 509 | 540 | const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`; |
| 510 | - const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data; | |
| 541 | + const dataReturn = (await commonServices.postValueService(token, newParamMap, url)).data; | |
| 511 | 542 | |
| 512 | 543 | if (dataReturn.code === 1) { |
| 513 | - const { slaveConfig, masterData: masterData1, materialsConfig, processConfig, sModelsId, app } = props; | |
| 544 | + const { app, sModelsId } = props; | |
| 545 | + const { slaveConfig, masterData: masterData1, materialsConfig, processConfig } = state; | |
| 546 | + console.log("🚀 ~ addState.handleCalcPrice= ~ state:", materialsConfig,slaveConfig) | |
| 514 | 547 | const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0]; |
| 515 | 548 | |
| 516 | 549 | const slaveData = []; |
| ... | ... | @@ -602,7 +635,9 @@ const QuickQuoteEvent = props => { |
| 602 | 635 | const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === "sProcessName"); |
| 603 | 636 | if (iIndex > -1) { |
| 604 | 637 | const sqlDropDownData = await props.getSqlDropDownData(sModelsId, "slave", processConfig.gdsconfigformslave[iIndex]); |
| 605 | - dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 638 | + if (sqlDropDownData) { | |
| 639 | + dropDownDataProcessName = sqlDropDownData.dropDownData; | |
| 640 | + } | |
| 606 | 641 | processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; |
| 607 | 642 | } |
| 608 | 643 | } |
| ... | ... | @@ -638,7 +673,7 @@ const QuickQuoteEvent = props => { |
| 638 | 673 | const materialInfo = partInfo.materialsInfo[i]; |
| 639 | 674 | const iOrder = i; |
| 640 | 675 | let materialDataRow = {}; |
| 641 | - for (const item of materialsConfig.gdsconfigformslave) { | |
| 676 | + for (const item of materialsConfig?.gdsconfigformslave) { | |
| 642 | 677 | materialDataRow[item.sName] = materialInfo[item.sName]; |
| 643 | 678 | } |
| 644 | 679 | materialDataRow.handleType = "add"; |
| ... | ... | @@ -854,7 +889,11 @@ const QuickQuoteEvent = props => { |
| 854 | 889 | return preNew; |
| 855 | 890 | }); |
| 856 | 891 | } else { |
| 857 | - message.error(dataReturn.erroMsg || dataReturn.msg); | |
| 892 | + // message.error(dataReturn.erroMsg || dataReturn.msg); | |
| 893 | + Toast.show({ | |
| 894 | + icon: "fail", | |
| 895 | + content: dataReturn.erroMsg || dataReturn.msg, | |
| 896 | + }); | |
| 858 | 897 | setState(pre => ({ ...pre, calcPriceLoading: false })); |
| 859 | 898 | } |
| 860 | 899 | }; |
| ... | ... | @@ -895,71 +934,122 @@ const QuickQuoteEvent = props => { |
| 895 | 934 | }; |
| 896 | 935 | |
| 897 | 936 | const QuotationAllprogressDetail = baseProps => { |
| 898 | - const { location, quotationData } = baseProps; | |
| 937 | + const { location, quotationData, app } = baseProps; | |
| 899 | 938 | // 处理 formData |
| 900 | - const propss = { | |
| 939 | + let propss = { | |
| 901 | 940 | ...baseProps, |
| 902 | 941 | selectedNode: quotationData, |
| 903 | 942 | state: {}, |
| 943 | + manyDataCache: [], | |
| 944 | + token: baseProps.app.token, | |
| 945 | + onSaveState: newState => { | |
| 946 | + propss = { ...propss, ...newState }; | |
| 947 | + }, | |
| 948 | + getSqlDropDownData: async sId => { | |
| 949 | + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; | |
| 950 | + const body = { | |
| 951 | + sSqlCondition: { | |
| 952 | + sSqlCondition: "", | |
| 953 | + }, | |
| 954 | + sKeyUpFilterName: "", | |
| 955 | + pageNum: 1, | |
| 956 | + pageSize: 20, | |
| 957 | + }; | |
| 958 | + const retrunData = await commonServices.postValueService(propss.token, body, url); | |
| 959 | + console.log("🚀 ~ retrunData:", retrunData); | |
| 960 | + }, | |
| 904 | 961 | }; |
| 962 | + | |
| 905 | 963 | const props = QuickQuoteEvent(propss); |
| 906 | 964 | const { selectedNode } = props; |
| 907 | 965 | const { showName, sUnit } = quotationData; |
| 908 | 966 | const timeRef = useRef(0); |
| 909 | 967 | useEffect(() => { |
| 910 | - props.setState(pre => { | |
| 911 | - const { slaveData = [], slaveConfig } = pre; | |
| 912 | - const addState = {}; | |
| 913 | - const defaultData = commonFunc.getDefaultData(slaveConfig); | |
| 914 | - const slaveDataNew = slaveData.filter(item => item.sTreeNodeName === selectedNode.showName); | |
| 915 | - if (!slaveDataNew.length) { | |
| 916 | - const sAllPartsName = selectedNode.sAllPartsName || selectedNode.showName; | |
| 917 | - sAllPartsName.split(",").forEach((item, index) => { | |
| 918 | - const tempData = { | |
| 919 | - sId: commonUtils.createSid(), | |
| 920 | - handleType: "add", | |
| 921 | - ...defaultData, | |
| 922 | - sBoxModel: item, | |
| 923 | - sTreeNodeName: selectedNode.showName, | |
| 924 | - }; | |
| 925 | - if (selectedNode.sTypeKey === "huace") { | |
| 926 | - if (index !== 0) { | |
| 927 | - delete tempData.dSumPQty; | |
| 928 | - } else { | |
| 929 | - tempData.dSumPQty = 4; | |
| 968 | + const getDropDownData = async props => { | |
| 969 | + props.setState(pre => { | |
| 970 | + const { slaveData = [], slaveConfig } = pre; | |
| 971 | + const addState = {}; | |
| 972 | + const defaultData = commonFunc.getDefaultData(slaveConfig); | |
| 973 | + const slaveDataNew = slaveData.filter(item => item.sTreeNodeName === selectedNode.showName); | |
| 974 | + if (!slaveDataNew.length) { | |
| 975 | + const sAllPartsName = selectedNode.sAllPartsName || selectedNode.showName; | |
| 976 | + sAllPartsName.split(",").forEach((item, index) => { | |
| 977 | + const tempData = { | |
| 978 | + sId: commonUtils.createSid(), | |
| 979 | + handleType: "add", | |
| 980 | + ...defaultData, | |
| 981 | + sBoxModel: item, | |
| 982 | + sTreeNodeName: selectedNode.showName, | |
| 983 | + }; | |
| 984 | + if (selectedNode.sTypeKey === "huace") { | |
| 985 | + if (index !== 0) { | |
| 986 | + delete tempData.dSumPQty; | |
| 987 | + } else { | |
| 988 | + tempData.dSumPQty = 4; | |
| 989 | + } | |
| 930 | 990 | } |
| 931 | - } | |
| 932 | - slaveDataNew.push(tempData); | |
| 933 | - }); | |
| 934 | - addState.slaveData = slaveDataNew; | |
| 935 | - } | |
| 936 | - if (timeRef.current > 1) { | |
| 937 | - addState.slaveData = slaveDataNew; | |
| 938 | - addState.extraParts = {}; | |
| 939 | - } | |
| 940 | - return { | |
| 941 | - ...pre, | |
| 942 | - ...addState, | |
| 943 | - masterData: { ...quotationData, sProductName: showName, sProductUnit: sUnit }, | |
| 944 | - // downAbleConfigs: downAbleConfigs | |
| 945 | - // .filter(item => item.sType === "2") | |
| 946 | - // .map((item, index) => ({ | |
| 947 | - // ...item, | |
| 948 | - // sName: `sParams${index}`, | |
| 949 | - // iColValue: item.iColValue || 4, | |
| 950 | - // sVisColumnName: "sProcessName", | |
| 951 | - // })), | |
| 952 | - // finishedConfigs: downAbleConfigs | |
| 953 | - // .filter(item => item.sType === "3") | |
| 954 | - // .map((item, index) => ({ | |
| 955 | - // ...item, | |
| 956 | - // sName: `sParams${index}`, | |
| 957 | - // iColValue: item.iColValue || 4, | |
| 958 | - // sVisColumnName: "sProcessName", | |
| 959 | - // })), | |
| 960 | - }; | |
| 961 | - }); | |
| 991 | + slaveDataNew.push(tempData); | |
| 992 | + }); | |
| 993 | + addState.slaveData = slaveDataNew; | |
| 994 | + } | |
| 995 | + if (timeRef.current > 1) { | |
| 996 | + addState.slaveData = slaveDataNew; | |
| 997 | + addState.extraParts = {}; | |
| 998 | + } | |
| 999 | + return { | |
| 1000 | + ...pre, | |
| 1001 | + ...addState, | |
| 1002 | + masterData: { ...quotationData, sProductName: showName, sProductUnit: sUnit }, | |
| 1003 | + // downAbleConfigs: downAbleConfigs | |
| 1004 | + // .filter(item => item.sType === "2") | |
| 1005 | + // .map((item, index) => ({ | |
| 1006 | + // ...item, | |
| 1007 | + // sName: `sParams${index}`, | |
| 1008 | + // iColValue: item.iColValue || 4, | |
| 1009 | + // sVisColumnName: "sProcessName", | |
| 1010 | + // })), | |
| 1011 | + // finishedConfigs: downAbleConfigs | |
| 1012 | + // .filter(item => item.sType === "3") | |
| 1013 | + // .map((item, index) => ({ | |
| 1014 | + // ...item, | |
| 1015 | + // sName: `sParams${index}`, | |
| 1016 | + // iColValue: item.iColValue || 4, | |
| 1017 | + // sVisColumnName: "sProcessName", | |
| 1018 | + // })), | |
| 1019 | + }; | |
| 1020 | + }); | |
| 1021 | + }; | |
| 1022 | + getDropDownData(props); | |
| 962 | 1023 | }, []); |
| 1024 | + const getSqlDropDownData = async ({ sId }) => { | |
| 1025 | + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; | |
| 1026 | + const body = { | |
| 1027 | + sSqlCondition: { | |
| 1028 | + sProductClassifyId: selectedNode.sId, | |
| 1029 | + }, | |
| 1030 | + sKeyUpFilterName: "", | |
| 1031 | + pageNum: 1, | |
| 1032 | + pageSize: 20, | |
| 1033 | + }; | |
| 1034 | + const retrunData = await commonServices.postValueService(props.app.token, body, url); | |
| 1035 | + const sColumnNameConfigStr = retrunData.data?.dataset?.rows?.[0]?.sColumnNameConfig; | |
| 1036 | + // 取上机尺寸 | |
| 1037 | + return commonUtils.convertStrToObj(sColumnNameConfigStr, []); | |
| 1038 | + }; | |
| 1039 | + useEffect(() => { | |
| 1040 | + const getData = async props => { | |
| 1041 | + const showDownConfig = props.state.slaveConfig?.gdsconfigformslave.find(item => item.sControlName === "BtnDownConfig"); | |
| 1042 | + const downAbleConfigs = await getSqlDropDownData({ ...showDownConfig }); | |
| 1043 | + // downAbleConfigs.forEach((x, i) => { | |
| 1044 | + // x.sName = "sParams" + i; | |
| 1045 | + // }); | |
| 1046 | + props.setState(pre => ({ | |
| 1047 | + ...pre, | |
| 1048 | + downAbleConfigs, | |
| 1049 | + })); | |
| 1050 | + }; | |
| 1051 | + getData(props); | |
| 1052 | + }, [props.state.slaveConfig]); | |
| 963 | 1053 | return ( |
| 964 | 1054 | <div className={styles.quotationDetailBox}> |
| 965 | 1055 | <QuotationDetail {...props} /> |
| ... | ... | @@ -1133,14 +1223,9 @@ const QuotationTabs = props => { |
| 1133 | 1223 | }; |
| 1134 | 1224 | |
| 1135 | 1225 | // 内容 |
| 1136 | -const BoxComponent = async props => { | |
| 1226 | +const BoxComponent = props => { | |
| 1137 | 1227 | const { state, boxModel } = props; |
| 1138 | - console.log("🚀 ~ BoxComponent:", props); | |
| 1139 | - | |
| 1140 | - const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, slaveData } = state || {}; | |
| 1141 | - const showDownConfig = slaveConfig.gdsconfigformslave.find(item => item.sControlName === "BtnDownConfig"); | |
| 1142 | - const downAbleConfigs = await getSqlDropDownData({ ...showDownConfig }); | |
| 1143 | - console.log("🚀 ~ downAbleConfigs:", downAbleConfigs); | |
| 1228 | + const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, downAbleConfigs = [], slaveData } = state || {}; | |
| 1144 | 1229 | const slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {}; |
| 1145 | 1230 | |
| 1146 | 1231 | const { sModelsId } = props; |
| ... | ... | @@ -1345,9 +1430,7 @@ const BoxComponent = async props => { |
| 1345 | 1430 | const [downAbleConfigsNew, setDownAbleConfigsNew] = useState([]); |
| 1346 | 1431 | useEffect(() => { |
| 1347 | 1432 | setDownAbleConfigsNew(downAbleConfigs); |
| 1348 | - }, [selectedNode.showName, boxModel]); | |
| 1349 | - console.log("🚀 ~ useEffect ~ downAbleConfigs:", downAbleConfigs); | |
| 1350 | - | |
| 1433 | + }, [downAbleConfigs]); | |
| 1351 | 1434 | // 初始化状态,存储每个 Switch 的状态 |
| 1352 | 1435 | const [switchStates, setSwitchStates] = useState(null); |
| 1353 | 1436 | useEffect(() => { |
| ... | ... | @@ -1363,10 +1446,13 @@ const BoxComponent = async props => { |
| 1363 | 1446 | }, [downAbleConfigsNew, boxModel]); // 依赖数组 |
| 1364 | 1447 | |
| 1365 | 1448 | // 处理 Switch 变化的函数 |
| 1366 | - const handleSwitchChange = (sName, val) => { | |
| 1449 | + const handleSwitchChange = (item, val) => { | |
| 1450 | + // const dropDownData = JSON.parse(item.sChineseDropDown) | |
| 1451 | + // console.log("🚀 ~ handleSwitchChange ~ dropDownData:", dropDownData) | |
| 1452 | + // const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]); | |
| 1367 | 1453 | setSwitchStates({ |
| 1368 | 1454 | ...switchStates, |
| 1369 | - [sName]: val, | |
| 1455 | + [item.sName]: val, | |
| 1370 | 1456 | }); |
| 1371 | 1457 | }; |
| 1372 | 1458 | // 过滤后的数据 |
| ... | ... | @@ -1376,6 +1462,7 @@ const BoxComponent = async props => { |
| 1376 | 1462 | ...item, |
| 1377 | 1463 | isSelect: switchStates ? switchStates[item.sName] : false, |
| 1378 | 1464 | })); |
| 1465 | + | |
| 1379 | 1466 | const downViewProps = { |
| 1380 | 1467 | ...props, |
| 1381 | 1468 | viewConfigs: downViewConfigs, |
| ... | ... | @@ -1384,8 +1471,6 @@ const BoxComponent = async props => { |
| 1384 | 1471 | viewRow: slaveRowData, |
| 1385 | 1472 | tableName: `slaveDown${boxModel}`, |
| 1386 | 1473 | }; |
| 1387 | - console.log(downViewProps, "downViewProps"); | |
| 1388 | - | |
| 1389 | 1474 | const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); |
| 1390 | 1475 | const radioValue = calcMethodData[0]?.sCode; |
| 1391 | 1476 | const [materialLength, setMaterialLength] = useState(0); |
| ... | ... | @@ -1492,6 +1577,8 @@ const BoxComponent = async props => { |
| 1492 | 1577 | height: 150, |
| 1493 | 1578 | size: 9, |
| 1494 | 1579 | }; |
| 1580 | + console.log(showImgMProps, "showImgMProps"); | |
| 1581 | + | |
| 1495 | 1582 | const handleChange = v => { |
| 1496 | 1583 | if (v.length) { |
| 1497 | 1584 | const newValue = v[0]; |
| ... | ... | @@ -1512,7 +1599,8 @@ const BoxComponent = async props => { |
| 1512 | 1599 | |
| 1513 | 1600 | const getTableCloum = (i, child) => { |
| 1514 | 1601 | if (!sBackProcessData) return; |
| 1515 | - const value = sBackProcessData[i]; | |
| 1602 | + const value = sBackProcessData.find(item => item[child.sName]) || {}; | |
| 1603 | + if (!value) return; | |
| 1516 | 1604 | const { bSetArea, bSetQty, sName, sSetQtyUnt } = value; |
| 1517 | 1605 | const viewConfigs = []; |
| 1518 | 1606 | if (bSetArea) { |
| ... | ... | @@ -1521,14 +1609,14 @@ const BoxComponent = async props => { |
| 1521 | 1609 | showName: "x", |
| 1522 | 1610 | iColValue: bSetQty ? 8 : 12, |
| 1523 | 1611 | placeholder: "长", |
| 1524 | - value: value.dManualLength + "", | |
| 1612 | + value: value.dManualLength ? value.dManualLength + "" : "", | |
| 1525 | 1613 | }); |
| 1526 | 1614 | viewConfigs.push({ |
| 1527 | 1615 | sName: "dManualWidth", |
| 1528 | 1616 | showName: "mm", |
| 1529 | 1617 | iColValue: bSetQty ? 8 : 12, |
| 1530 | 1618 | placeholder: "宽", |
| 1531 | - value: value.dManualWidth + "", | |
| 1619 | + value: value.dManualWidth ? value.dManualWidth + "" : "", | |
| 1532 | 1620 | }); |
| 1533 | 1621 | } |
| 1534 | 1622 | if (bSetQty) { |
| ... | ... | @@ -1537,7 +1625,7 @@ const BoxComponent = async props => { |
| 1537 | 1625 | showName: sSetQtyUnt || "", |
| 1538 | 1626 | iColValue: bSetArea ? 8 : 24, |
| 1539 | 1627 | placeholder: "数量", |
| 1540 | - value: value.dManualQty + "", | |
| 1628 | + value: value.dManualQty ? value.dManualQty + "" : "", | |
| 1541 | 1629 | }); |
| 1542 | 1630 | } |
| 1543 | 1631 | const viewProps = { |
| ... | ... | @@ -1547,16 +1635,17 @@ const BoxComponent = async props => { |
| 1547 | 1635 | iColValueView: 24, |
| 1548 | 1636 | viewRow: value, |
| 1549 | 1637 | tableName: `slaveDown${boxModel}${sName}`, |
| 1550 | - onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => { | |
| 1551 | - const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); | |
| 1552 | - const iIndex1 = slaveData[iIndex].sBackProcessData.findIndex(item => item[child.sName]); | |
| 1553 | - slaveData[iIndex].sBackProcessData[iIndex1][sFieldName] = changeValue; | |
| 1554 | - const { dManualLength, dManualWidth } = slaveData[iIndex].sBackProcessData[iIndex1]; | |
| 1555 | - if (dManualLength !== undefined && dManualWidth !== undefined) { | |
| 1556 | - slaveData[iIndex].sBackProcessData[iIndex1].dManualValue = dManualLength * dManualWidth; | |
| 1557 | - } | |
| 1558 | - props.setState(pre => ({ ...pre, slaveData })); | |
| 1559 | - }, | |
| 1638 | + }; | |
| 1639 | + const onDataChange = (name, sFieldName, changeValue) => { | |
| 1640 | + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); | |
| 1641 | + const iIndex1 = slaveData[iIndex].sBackProcessData.findIndex(item => item[child.sName]); | |
| 1642 | + | |
| 1643 | + slaveData[iIndex].sBackProcessData[iIndex1][sFieldName] = changeValue; | |
| 1644 | + const { dManualLength, dManualWidth } = slaveData[iIndex].sBackProcessData[iIndex1]; | |
| 1645 | + if (dManualLength !== undefined && dManualWidth !== undefined) { | |
| 1646 | + slaveData[iIndex].sBackProcessData[iIndex1].dManualValue = dManualLength * dManualWidth; | |
| 1647 | + } | |
| 1648 | + props.setState(pre => ({ ...pre, slaveData })); | |
| 1560 | 1649 | }; |
| 1561 | 1650 | return viewConfigs.length ? ( |
| 1562 | 1651 | <Grid columns={3} gap={8}> |
| ... | ... | @@ -1565,9 +1654,8 @@ const BoxComponent = async props => { |
| 1565 | 1654 | <div className={styles.customer} key={x.id || x.showName} style={{ marginTop: "0", display: "flex", alignItems: "center" }}> |
| 1566 | 1655 | <Input |
| 1567 | 1656 | placeholder="" |
| 1568 | - value={x.value} | |
| 1569 | 1657 | onChange={e => { |
| 1570 | - viewProps.onDataChange("", x.sName, e, ""); | |
| 1658 | + onDataChange(viewProps.tableName, x.sName, e, x); | |
| 1571 | 1659 | }} |
| 1572 | 1660 | ></Input> |
| 1573 | 1661 | <div style={{ width: "30%", textAlign: "center" }}>{x.showName}</div> |
| ... | ... | @@ -1579,6 +1667,25 @@ const BoxComponent = async props => { |
| 1579 | 1667 | "" |
| 1580 | 1668 | ); |
| 1581 | 1669 | }; |
| 1670 | + const { loading } = props; | |
| 1671 | + // 核价事件 | |
| 1672 | + const onCalcPrice = async () => { | |
| 1673 | + const addState = { | |
| 1674 | + ...props.onGetAllDelData(), | |
| 1675 | + manyDataCache: [], | |
| 1676 | + }; | |
| 1677 | + | |
| 1678 | + props.onSaveState( | |
| 1679 | + { | |
| 1680 | + masterData: { ...props.masterData, handleType: props.masterData.handleType || "update" }, | |
| 1681 | + ...addState, | |
| 1682 | + }, | |
| 1683 | + () => { | |
| 1684 | + props.handleCalcPrice(); | |
| 1685 | + } | |
| 1686 | + ); | |
| 1687 | + await props.handleCalcPrice(); | |
| 1688 | + }; | |
| 1582 | 1689 | return ( |
| 1583 | 1690 | <div> |
| 1584 | 1691 | <Selector |
| ... | ... | @@ -1655,18 +1762,44 @@ const BoxComponent = async props => { |
| 1655 | 1762 | <div> |
| 1656 | 1763 | <div className={styles.backBox}> |
| 1657 | 1764 | <div className={styles.backEnd}>{x.showName}</div> |
| 1658 | - <Switch checked={switchStates ? switchStates[x.sName] : ""} onChange={val => handleSwitchChange(x.sName, val)} /> | |
| 1765 | + <Switch checked={switchStates ? switchStates[x.sName] : ""} onChange={val => handleSwitchChange(x, val)} /> | |
| 1659 | 1766 | <div className={styles.customer} style={{ marginTop: "0", marginLeft: "2rem", width: "40%" }}> |
| 1660 | - <SelectInput {...downViewProps} itemDetail={x} downIndex={i} /> | |
| 1767 | + {switchStates && switchStates[x.sName] ? ( | |
| 1768 | + <SelectInput {...downViewProps} itemDetail={{ ...x, sVisColumnName: "sProcessName", sDropDownType: "sql" }} downIndex={i} /> | |
| 1769 | + ) : ( | |
| 1770 | + "" | |
| 1771 | + )} | |
| 1661 | 1772 | </div> |
| 1662 | - {/* <div>{downViewProps.viewRow.sBackProcessData[i].bSetArea === 1 ? downViewProps.viewRow.sBackProcessData[i].bSetArea : ""}</div> */} | |
| 1663 | 1773 | </div> |
| 1664 | 1774 | {getTableCloum(i, x)} |
| 1665 | 1775 | </div> |
| 1666 | 1776 | ))} |
| 1667 | 1777 | </div> |
| 1668 | 1778 | <div> |
| 1669 | - 多数量报价 | |
| 1779 | + <div className={styles.projectBtn}> | |
| 1780 | + 多数量报价 | |
| 1781 | + {/* <Button color="primary" fill="solid" loading={loading} onClick={props.onAdd}> | |
| 1782 | + 新报价 | |
| 1783 | + </Button> | |
| 1784 | + <Button | |
| 1785 | + color="primary" | |
| 1786 | + fill="solid" | |
| 1787 | + loading={loading} | |
| 1788 | + onClick={() => { | |
| 1789 | + props.onSaveDraft(); | |
| 1790 | + }} | |
| 1791 | + > | |
| 1792 | + 存草稿 | |
| 1793 | + </Button> */} | |
| 1794 | + <div> | |
| 1795 | + <Button color="primary" fill="solid" onClick={onCalcPrice} size="small" style={{ marginRight: "1rem" }}> | |
| 1796 | + 核价 | |
| 1797 | + </Button> | |
| 1798 | + <Button color="success" size="small"> | |
| 1799 | + 确认下单数量 | |
| 1800 | + </Button> | |
| 1801 | + </div> | |
| 1802 | + </div> | |
| 1670 | 1803 | <ManyComponent {...props}></ManyComponent> |
| 1671 | 1804 | </div> |
| 1672 | 1805 | <Dialog |
| ... | ... | @@ -1716,13 +1849,13 @@ const BoxComponent = async props => { |
| 1716 | 1849 | const MaterialsComponent = props => { |
| 1717 | 1850 | const { state, boxModel } = props; |
| 1718 | 1851 | const { slaveConfig, slaveData = [], selectedNode = {} } = state; |
| 1719 | - let { slaveRowData } = state; | |
| 1852 | + let { slaveRowData } = props; | |
| 1720 | 1853 | if (!slaveRowData) return; |
| 1721 | 1854 | const { sParam = "" } = selectedNode; |
| 1722 | 1855 | const sParamList = sParam.split(","); |
| 1723 | 1856 | let materialsInfoDefaultData = sParam ? new Array(sParamList.length).fill({}).map((_, index) => ({ showName: sParamList[index] })) : [{}]; |
| 1724 | 1857 | let { materialsInfo = materialsInfoDefaultData } = slaveRowData; |
| 1725 | - const materialsConfig = slaveConfig.gdsconfigformslave | |
| 1858 | + const materialsConfig = slaveConfig?.gdsconfigformslave | |
| 1726 | 1859 | .filter(item => item.iTag === 11) |
| 1727 | 1860 | .map(item => { |
| 1728 | 1861 | const { sName } = item; |
| ... | ... | @@ -1749,6 +1882,7 @@ const MaterialsComponent = props => { |
| 1749 | 1882 | return materialsInfo.map((item, index) => { |
| 1750 | 1883 | let viewRow = { ...materialsInfo[index], sProductClassifyId: selectedNode.sId }; |
| 1751 | 1884 | viewRow = { ...viewRow, sMaterialsName0: viewRow.showName || "" }; |
| 1885 | + if (!materialsConfig) return; | |
| 1752 | 1886 | let materialsConfigNew = JSON.parse(JSON.stringify(materialsConfig)); |
| 1753 | 1887 | if (viewRow.showName) { |
| 1754 | 1888 | const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName"); |
| ... | ... | @@ -1862,6 +1996,29 @@ const ManyComponent = props => { |
| 1862 | 1996 | const { masterData = {}, calcPriceLoading, calcPriceFinished, manyData = [] } = state; |
| 1863 | 1997 | const [submitLoading, setSubmitLoading] = useState(false); |
| 1864 | 1998 | const [processPercent, setProcessPercent] = useState(0); |
| 1999 | + // 根据主表数量更改多数量表 | |
| 2000 | + useEffect(() => { | |
| 2001 | + const baseCount = masterData.dProductQty || 1000; | |
| 2002 | + if (manyData[0]?.dManyQty === baseCount) return; | |
| 2003 | + | |
| 2004 | + const manyDataNew = Array(5) | |
| 2005 | + .fill("") | |
| 2006 | + .map((item, index) => ({ | |
| 2007 | + sId: commonUtils.createSid(), | |
| 2008 | + handleType: "add", | |
| 2009 | + dManyQty: baseCount * (index + 1), | |
| 2010 | + })); | |
| 2011 | + setState(pre => ({ | |
| 2012 | + ...pre, | |
| 2013 | + manyData: manyDataNew, | |
| 2014 | + manySelectedRowKeys: [manyDataNew[0].sId], | |
| 2015 | + dProductQty: baseCount, | |
| 2016 | + dQuickQuoteProductQty: baseCount, | |
| 2017 | + })); | |
| 2018 | + // props.onSaveState({ | |
| 2019 | + // manyDataCache: [], | |
| 2020 | + // }); | |
| 2021 | + }, [masterData.dProductQty, manyData.length]); | |
| 1865 | 2022 | const tableProps = { |
| 1866 | 2023 | ...commonBusiness.getTableTypes("many", { ...props, ...state }), |
| 1867 | 2024 | fixedHeight: 185, | ... | ... |