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 | 202 | const finishedConfigsNew = finishedConfigs.filter(item => item.sDefaultProcessId); |
| 203 | 203 | if (finishedConfigsNew.length) { |
| 204 | 204 | let [cpProcessNameList, productProcessInfo] = [[], []]; |
| 205 | - finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName }) => { | |
| 205 | + finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName, sId }) => { | |
| 206 | 206 | const sChineseDropDown = commonUtils.convertStrToObj(sChineseDropDownStr, []); |
| 207 | 207 | const defaultProcess = sChineseDropDown.find(item => item.sId === sDefaultProcessId); |
| 208 | 208 | const name = "finished"; |
| 209 | 209 | const sFieldName = sName; |
| 210 | 210 | const changeValue = { [sFieldName]: defaultProcess.sId }; |
| 211 | - const dropDownData = sChineseDropDown; | |
| 211 | + const dropDownData = sChineseDropDown.map(item => ({ | |
| 212 | + ...item, | |
| 213 | + sProductClassifyId: sId, | |
| 214 | + })); | |
| 212 | 215 | const { cpProcessName: cpProcessNameNew, productProcessInfo: productProcessInfoNew } = onDataChange( |
| 213 | 216 | name, |
| 214 | 217 | sFieldName, |
| ... | ... | @@ -537,8 +540,35 @@ const QuickQuoteEvent = props => { |
| 537 | 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 | 572 | const { masterData = {} } = nextState; |
| 543 | 573 | const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData; |
| 544 | 574 | if (!sProductName || !sCustomerName) { |
| ... | ... | @@ -610,6 +640,7 @@ const QuickQuoteEvent = props => { |
| 610 | 640 | |
| 611 | 641 | // 核价按钮 |
| 612 | 642 | addState.handleCalcPrice = async () => { |
| 643 | + if (await bDataDeleted()) return; | |
| 613 | 644 | if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { |
| 614 | 645 | console.log("================webSocket连接======================"); |
| 615 | 646 | props.dispatch({ |
| ... | ... | @@ -1625,10 +1656,10 @@ const BoxComponent = props => { |
| 1625 | 1656 | } |
| 1626 | 1657 | |
| 1627 | 1658 | if (item.sName === "dWlcd" && selectedNode.sTypeKey === "juantong") { |
| 1628 | - return false | |
| 1659 | + return false; | |
| 1629 | 1660 | } |
| 1630 | 1661 | if (item.sName === "dAuxiliaryQty" && selectedNode.sTypeKey !== "juantong") { |
| 1631 | - return false | |
| 1662 | + return false; | |
| 1632 | 1663 | } |
| 1633 | 1664 | if (item.sName === "dWlkd") { |
| 1634 | 1665 | if (selectedNode.sTypeKey === "juantong") { |
| ... | ... | @@ -1966,7 +1997,7 @@ const BoxComponent = props => { |
| 1966 | 1997 | // 判断展长展宽是否可以放下原纸 |
| 1967 | 1998 | const isDPartsLength = |
| 1968 | 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 | 2001 | if (index !== undefined && index !== -1) { |
| 1971 | 2002 | // 计算开数 |
| 1972 | 2003 | // 获取原始对象并创建一个新的对象进行更新 |
| ... | ... | @@ -1991,7 +2022,7 @@ const BoxComponent = props => { |
| 1991 | 2022 | // dWlcd: selectedNode.sTypeKey === 'juantong' ? Math.floor(dProductQty / dSinglePQty * ( length/ 1000)) : dWlcd, |
| 1992 | 2023 | dWlcd: dWlcd, |
| 1993 | 2024 | dWlkd: dWlkd, |
| 1994 | - dAuxiliaryQty: Math.floor(dProductQty / dSinglePQty * ( length/ 1000)), | |
| 2025 | + dAuxiliaryQty: Math.floor((dProductQty / dSinglePQty) * (length / 1000)), | |
| 1995 | 2026 | dMachineQty: Math.floor(dProductQty / dSinglePQty), |
| 1996 | 2027 | dSinglePQty: dSinglePQty, |
| 1997 | 2028 | dMaterialsKQty: dMaterialsKQty, |
| ... | ... | @@ -2784,7 +2815,8 @@ const ManyComponent = props => { |
| 2784 | 2815 | disabled={!calcPriceFinished} |
| 2785 | 2816 | loading={loading || submitLoading} |
| 2786 | 2817 | className={styles.confirmOrder} |
| 2787 | - onClick={() => { | |
| 2818 | + onClick={async () => { | |
| 2819 | + if (await props.bDataDeleted()) return; | |
| 2788 | 2820 | props.onSaveState( |
| 2789 | 2821 | { |
| 2790 | 2822 | ...props.onGetAllDelData(), | ... | ... |