Commit 2dcfd1f75f251a0137ab1c6f1da2955552b97b9a
1 parent
e55278aa
处理默认值不能置空问题;
原报价单删除后处理优化;
Showing
1 changed file
with
40 additions
and
8 deletions
src/components/QuickQuote/index.jsx
| @@ -202,13 +202,16 @@ const QuickQuoteEvent = props => { | @@ -202,13 +202,16 @@ const QuickQuoteEvent = props => { | ||
| 202 | const finishedConfigsNew = finishedConfigs.filter(item => item.sDefaultProcessId); | 202 | const finishedConfigsNew = finishedConfigs.filter(item => item.sDefaultProcessId); |
| 203 | if (finishedConfigsNew.length) { | 203 | if (finishedConfigsNew.length) { |
| 204 | let [cpProcessNameList, productProcessInfo] = [[], []]; | 204 | let [cpProcessNameList, productProcessInfo] = [[], []]; |
| 205 | - finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName }) => { | 205 | + finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName, sId }) => { |
| 206 | const sChineseDropDown = commonUtils.convertStrToObj(sChineseDropDownStr, []); | 206 | const sChineseDropDown = commonUtils.convertStrToObj(sChineseDropDownStr, []); |
| 207 | const defaultProcess = sChineseDropDown.find(item => item.sId === sDefaultProcessId); | 207 | const defaultProcess = sChineseDropDown.find(item => item.sId === sDefaultProcessId); |
| 208 | const name = "finished"; | 208 | const name = "finished"; |
| 209 | const sFieldName = sName; | 209 | const sFieldName = sName; |
| 210 | const changeValue = { [sFieldName]: defaultProcess.sId }; | 210 | const changeValue = { [sFieldName]: defaultProcess.sId }; |
| 211 | - const dropDownData = sChineseDropDown; | 211 | + const dropDownData = sChineseDropDown.map(item => ({ |
| 212 | + ...item, | ||
| 213 | + sProductClassifyId: sId, | ||
| 214 | + })); | ||
| 212 | const { cpProcessName: cpProcessNameNew, productProcessInfo: productProcessInfoNew } = onDataChange( | 215 | const { cpProcessName: cpProcessNameNew, productProcessInfo: productProcessInfoNew } = onDataChange( |
| 213 | name, | 216 | name, |
| 214 | sFieldName, | 217 | sFieldName, |
| @@ -537,8 +540,35 @@ const QuickQuoteEvent = props => { | @@ -537,8 +540,35 @@ const QuickQuoteEvent = props => { | ||
| 537 | return addState; | 540 | return addState; |
| 538 | }; | 541 | }; |
| 539 | 542 | ||
| 543 | + // 判断单据是否被删除 | ||
| 544 | + const bDataDeleted = async () => { | ||
| 545 | + const { masterConfig, currentId, masterData = {}, slaveConfig } = props; | ||
| 546 | + if (!masterData.sBillNo) return false; | ||
| 547 | + const sId = currentId || masterData.sId || ""; | ||
| 548 | + const returnData = await props.handleGetDataOne({ | ||
| 549 | + name: "master", | ||
| 550 | + configData: masterConfig, | ||
| 551 | + condition: { sId, pageSize: "", pageNum: "" }, | ||
| 552 | + bEditClick: false, | ||
| 553 | + slaveConfig, | ||
| 554 | + isWait: true, | ||
| 555 | + }); | ||
| 556 | + | ||
| 557 | + if (returnData) return false; | ||
| 558 | + message.info("当前报价单已被删除!请重新核价以生成新的报价单!", 5); | ||
| 559 | + props.onAdd(); | ||
| 560 | + setState(pre => ({ | ||
| 561 | + ...pre, | ||
| 562 | + manyData: [], | ||
| 563 | + calcPriceFinished: false, | ||
| 564 | + })); | ||
| 565 | + return true; | ||
| 566 | + }; | ||
| 567 | + addState.bDataDeleted = bDataDeleted; | ||
| 568 | + | ||
| 540 | // 存草稿 | 569 | // 存草稿 |
| 541 | - const onSaveDraft = (nextState = state, nextProps = props) => { | 570 | + const onSaveDraft = async (nextState = state, nextProps = props) => { |
| 571 | + if (await bDataDeleted()) return; | ||
| 542 | const { masterData = {} } = nextState; | 572 | const { masterData = {} } = nextState; |
| 543 | const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData; | 573 | const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData; |
| 544 | if (!sProductName || !sCustomerName) { | 574 | if (!sProductName || !sCustomerName) { |
| @@ -610,6 +640,7 @@ const QuickQuoteEvent = props => { | @@ -610,6 +640,7 @@ const QuickQuoteEvent = props => { | ||
| 610 | 640 | ||
| 611 | // 核价按钮 | 641 | // 核价按钮 |
| 612 | addState.handleCalcPrice = async () => { | 642 | addState.handleCalcPrice = async () => { |
| 643 | + if (await bDataDeleted()) return; | ||
| 613 | if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { | 644 | if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { |
| 614 | console.log("================webSocket连接======================"); | 645 | console.log("================webSocket连接======================"); |
| 615 | props.dispatch({ | 646 | props.dispatch({ |
| @@ -1625,10 +1656,10 @@ const BoxComponent = props => { | @@ -1625,10 +1656,10 @@ const BoxComponent = props => { | ||
| 1625 | } | 1656 | } |
| 1626 | 1657 | ||
| 1627 | if (item.sName === "dWlcd" && selectedNode.sTypeKey === "juantong") { | 1658 | if (item.sName === "dWlcd" && selectedNode.sTypeKey === "juantong") { |
| 1628 | - return false | 1659 | + return false; |
| 1629 | } | 1660 | } |
| 1630 | if (item.sName === "dAuxiliaryQty" && selectedNode.sTypeKey !== "juantong") { | 1661 | if (item.sName === "dAuxiliaryQty" && selectedNode.sTypeKey !== "juantong") { |
| 1631 | - return false | 1662 | + return false; |
| 1632 | } | 1663 | } |
| 1633 | if (item.sName === "dWlkd") { | 1664 | if (item.sName === "dWlkd") { |
| 1634 | if (selectedNode.sTypeKey === "juantong") { | 1665 | if (selectedNode.sTypeKey === "juantong") { |
| @@ -1966,7 +1997,7 @@ const BoxComponent = props => { | @@ -1966,7 +1997,7 @@ const BoxComponent = props => { | ||
| 1966 | // 判断展长展宽是否可以放下原纸 | 1997 | // 判断展长展宽是否可以放下原纸 |
| 1967 | const isDPartsLength = | 1998 | const isDPartsLength = |
| 1968 | slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth; | 1999 | slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth; |
| 1969 | - const dProductQtys = props.state.masterData.dProductQty || 0 | 2000 | + const dProductQtys = props.state.masterData.dProductQty || 0; |
| 1970 | if (index !== undefined && index !== -1) { | 2001 | if (index !== undefined && index !== -1) { |
| 1971 | // 计算开数 | 2002 | // 计算开数 |
| 1972 | // 获取原始对象并创建一个新的对象进行更新 | 2003 | // 获取原始对象并创建一个新的对象进行更新 |
| @@ -1991,7 +2022,7 @@ const BoxComponent = props => { | @@ -1991,7 +2022,7 @@ const BoxComponent = props => { | ||
| 1991 | // dWlcd: selectedNode.sTypeKey === 'juantong' ? Math.floor(dProductQty / dSinglePQty * ( length/ 1000)) : dWlcd, | 2022 | // dWlcd: selectedNode.sTypeKey === 'juantong' ? Math.floor(dProductQty / dSinglePQty * ( length/ 1000)) : dWlcd, |
| 1992 | dWlcd: dWlcd, | 2023 | dWlcd: dWlcd, |
| 1993 | dWlkd: dWlkd, | 2024 | dWlkd: dWlkd, |
| 1994 | - dAuxiliaryQty: Math.floor(dProductQty / dSinglePQty * ( length/ 1000)), | 2025 | + dAuxiliaryQty: Math.floor((dProductQty / dSinglePQty) * (length / 1000)), |
| 1995 | dMachineQty: Math.floor(dProductQty / dSinglePQty), | 2026 | dMachineQty: Math.floor(dProductQty / dSinglePQty), |
| 1996 | dSinglePQty: dSinglePQty, | 2027 | dSinglePQty: dSinglePQty, |
| 1997 | dMaterialsKQty: dMaterialsKQty, | 2028 | dMaterialsKQty: dMaterialsKQty, |
| @@ -2784,7 +2815,8 @@ const ManyComponent = props => { | @@ -2784,7 +2815,8 @@ const ManyComponent = props => { | ||
| 2784 | disabled={!calcPriceFinished} | 2815 | disabled={!calcPriceFinished} |
| 2785 | loading={loading || submitLoading} | 2816 | loading={loading || submitLoading} |
| 2786 | className={styles.confirmOrder} | 2817 | className={styles.confirmOrder} |
| 2787 | - onClick={() => { | 2818 | + onClick={async () => { |
| 2819 | + if (await props.bDataDeleted()) return; | ||
| 2788 | props.onSaveState( | 2820 | props.onSaveState( |
| 2789 | { | 2821 | { |
| 2790 | ...props.onGetAllDelData(), | 2822 | ...props.onGetAllDelData(), |