Commit dfd5a027455a5fe27587026993d17635dbf37b4d
Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi into main
Showing
1 changed file
with
36 additions
and
4 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({ |
| @@ -2798,7 +2829,8 @@ const ManyComponent = props => { | @@ -2798,7 +2829,8 @@ const ManyComponent = props => { | ||
| 2798 | disabled={!calcPriceFinished} | 2829 | disabled={!calcPriceFinished} |
| 2799 | loading={loading || submitLoading} | 2830 | loading={loading || submitLoading} |
| 2800 | className={styles.confirmOrder} | 2831 | className={styles.confirmOrder} |
| 2801 | - onClick={() => { | 2832 | + onClick={async () => { |
| 2833 | + if (await props.bDataDeleted()) return; | ||
| 2802 | props.onSaveState( | 2834 | props.onSaveState( |
| 2803 | { | 2835 | { |
| 2804 | ...props.onGetAllDelData(), | 2836 | ...props.onGetAllDelData(), |