diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 6d3c332..55eba5c 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -202,13 +202,16 @@ const QuickQuoteEvent = props => { const finishedConfigsNew = finishedConfigs.filter(item => item.sDefaultProcessId); if (finishedConfigsNew.length) { let [cpProcessNameList, productProcessInfo] = [[], []]; - finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName }) => { + finishedConfigsNew.forEach(({ sChineseDropDown: sChineseDropDownStr, sDefaultProcessId, sName, sId }) => { const sChineseDropDown = commonUtils.convertStrToObj(sChineseDropDownStr, []); const defaultProcess = sChineseDropDown.find(item => item.sId === sDefaultProcessId); const name = "finished"; const sFieldName = sName; const changeValue = { [sFieldName]: defaultProcess.sId }; - const dropDownData = sChineseDropDown; + const dropDownData = sChineseDropDown.map(item => ({ + ...item, + sProductClassifyId: sId, + })); const { cpProcessName: cpProcessNameNew, productProcessInfo: productProcessInfoNew } = onDataChange( name, sFieldName, @@ -537,8 +540,35 @@ const QuickQuoteEvent = props => { return addState; }; + // 判断单据是否被删除 + const bDataDeleted = async () => { + const { masterConfig, currentId, masterData = {}, slaveConfig } = props; + if (!masterData.sBillNo) return false; + const sId = currentId || masterData.sId || ""; + const returnData = await props.handleGetDataOne({ + name: "master", + configData: masterConfig, + condition: { sId, pageSize: "", pageNum: "" }, + bEditClick: false, + slaveConfig, + isWait: true, + }); + + if (returnData) return false; + message.info("当前报价单已被删除!请重新核价以生成新的报价单!", 5); + props.onAdd(); + setState(pre => ({ + ...pre, + manyData: [], + calcPriceFinished: false, + })); + return true; + }; + addState.bDataDeleted = bDataDeleted; + // 存草稿 - const onSaveDraft = (nextState = state, nextProps = props) => { + const onSaveDraft = async (nextState = state, nextProps = props) => { + if (await bDataDeleted()) return; const { masterData = {} } = nextState; const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData; if (!sProductName || !sCustomerName) { @@ -610,6 +640,7 @@ const QuickQuoteEvent = props => { // 核价按钮 addState.handleCalcPrice = async () => { + if (await bDataDeleted()) return; if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { console.log("================webSocket连接======================"); props.dispatch({ @@ -2798,7 +2829,8 @@ const ManyComponent = props => { disabled={!calcPriceFinished} loading={loading || submitLoading} className={styles.confirmOrder} - onClick={() => { + onClick={async () => { + if (await props.bDataDeleted()) return; props.onSaveState( { ...props.onGetAllDelData(),