Commit 291c59190bc0001697a1634c46b80b807e351013
1 parent
f514bccf
选择工序
Showing
3 changed files
with
40 additions
and
10 deletions
src/components/Common/CommonHooks/useCommonBase.js
| ... | ... | @@ -357,7 +357,7 @@ const useCommonBase = props => { |
| 357 | 357 | condition.pageSize = '' |
| 358 | 358 | delete condition.sSqlCondition |
| 359 | 359 | } |
| 360 | - if (name.includes('slave') && pageRoute.includes('indexPage/commonBill') ) { | |
| 360 | + if (name.includes('slave') && pageRoute.includes('indexPage/commonBill')) { | |
| 361 | 361 | delete condition.sSqlCondition |
| 362 | 362 | delete condition.sId |
| 363 | 363 | condition.sSqlCondition = { |
| ... | ... | @@ -365,7 +365,7 @@ const useCommonBase = props => { |
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | // 只有弹窗没有不查询 |
| 368 | - if (name === 'master' && sId === '' && props.parentProps && pageRoute.includes('indexPage/commonBill') ) return | |
| 368 | + if (name === 'master' && sId === '' && props.parentProps && pageRoute.includes('indexPage/commonBill')) return | |
| 369 | 369 | const dataUrl = `${commonConfig.server_host |
| 370 | 370 | }business/getBusinessDataByFormcustomId/${configDataId}?sModelsId=${sModelsId}&sName=${formSrcRoute}`; |
| 371 | 371 | const dataReturn = (await commonServices.postValueService( |
| ... | ... | @@ -2503,12 +2503,12 @@ const useCommonBase = props => { |
| 2503 | 2503 | const handleTableBlur = async (name, sFileName, record, tableConfig, other) => { |
| 2504 | 2504 | const { sModelsId, app } = props; |
| 2505 | 2505 | const { controlData, slaveConfig, [`${name}Data`]: tableData, [`${name}Config`]: tempConfig } = state; |
| 2506 | - let { slaveData: slaveDataOld, masterData, slaveDelData,slaveSelectedData = []} = state; | |
| 2506 | + let { slaveData: slaveDataOld, masterData, slaveDelData, slaveSelectedData = [] } = state; | |
| 2507 | 2507 | const addState = {}; |
| 2508 | 2508 | if (commonUtils.isEmptyArr(slaveDelData)) { |
| 2509 | 2509 | slaveDelData = []; |
| 2510 | 2510 | } |
| 2511 | - | |
| 2511 | + | |
| 2512 | 2512 | if (sFileName === 'sPartsNameNew') { |
| 2513 | 2513 | if (commonUtils.isNotEmptyArr(controlData)) { |
| 2514 | 2514 | /* 离开时 把sPartsNameNewId数据挂载到sControlParentId */ |
| ... | ... | @@ -2570,7 +2570,7 @@ const useCommonBase = props => { |
| 2570 | 2570 | newCopyTo.master = masterData; |
| 2571 | 2571 | // newCopyTo.slave = commonUtils.isEmpty(slaveData) ? [] : slaveData[0]; |
| 2572 | 2572 | // const sRowData = copyTo.slaveData; |
| 2573 | - const sRowData = masterData ? masterData : slaveDataOld[0]; | |
| 2573 | + const sRowData = masterData ? masterData : slaveDataOld[0]; | |
| 2574 | 2574 | const value = { sProName, sProInParam: JSON.stringify({ params: sRowData }) }; |
| 2575 | 2575 | if (other?.iFlag === 1) { |
| 2576 | 2576 | value.iFlag = 1; |
| ... | ... | @@ -2981,7 +2981,7 @@ const useCommonBase = props => { |
| 2981 | 2981 | if (location.pathname.includes("indexPad")) { |
| 2982 | 2982 | addState.enabled = true; |
| 2983 | 2983 | } |
| 2984 | - | |
| 2984 | + | |
| 2985 | 2985 | handleSaveState( |
| 2986 | 2986 | { |
| 2987 | 2987 | ...addState, |
| ... | ... | @@ -3444,6 +3444,21 @@ const useCommonBase = props => { |
| 3444 | 3444 | const props = { ...obj, ...state }; |
| 3445 | 3445 | handleOkDel(props); |
| 3446 | 3446 | }; |
| 3447 | + const handleBtnChoose = async (name, sControlName, chooseConfig, recordIndex, tableName) => { | |
| 3448 | + console.log("🚀 ~ handleBtnChoose ~ chooseConfig:", name, sControlName, chooseConfig, recordIndex, tableName) | |
| 3449 | + return | |
| 3450 | + const { token } = props; | |
| 3451 | + const url = `${commonConfig.server_host}/gdsmodule/getGdsmoduleById/${chooseConfig.sActiveId}?sModelsId=${chooseConfig.sActiveId}`; | |
| 3452 | + const dataReturn = (await commonServices.getService(token, url)).data; | |
| 3453 | + if (dataReturn.code === 1) { | |
| 3454 | + const [returnData] = dataReturn.dataset.rows; | |
| 3455 | + props.onSaveState({ | |
| 3456 | + [`${name}ChooseVisible`]: true, [`${name}ChooseData`]: returnData, slaveSelectedIndex: recordIndex, tableName, | |
| 3457 | + }); | |
| 3458 | + } else { | |
| 3459 | + props.getServiceError(dataReturn); | |
| 3460 | + } | |
| 3461 | + }; | |
| 3447 | 3462 | /* 确定要删除 */ |
| 3448 | 3463 | const handleOkDel = async (props) => { |
| 3449 | 3464 | /* 数据参数 */ |
| ... | ... | @@ -3723,6 +3738,7 @@ const useCommonBase = props => { |
| 3723 | 3738 | onSelectCommonPopup: handleSelectCommonPopup, |
| 3724 | 3739 | onDropDownBlur: handleTableBlur, |
| 3725 | 3740 | onDel: handleDel, // 删除 |
| 3741 | + onBtnChoose: handleBtnChoose, // 工序选择 | |
| 3726 | 3742 | // onBtnExamine: handleAudit, |
| 3727 | 3743 | }; |
| 3728 | 3744 | ... | ... |
src/components/Common/CommonTable/index.js
| ... | ... | @@ -4770,11 +4770,16 @@ class CommonTableRc extends React.Component { |
| 4770 | 4770 | let { rowTag } = record || {} |
| 4771 | 4771 | let operateMaterial = null; |
| 4772 | 4772 | let operatePopupModal = null |
| 4773 | + let operateProcess = null; | |
| 4773 | 4774 | const modalProps = { ...this.getModalPropsTableRow(), disabled: false }; |
| 4774 | 4775 | /* 通用弹窗按钮 */ |
| 4775 | 4776 | const choosePopupProps = { ...this.getPopupPropsTableRow(), disabled: false }; |
| 4776 | 4777 | const chooseParamProps = { ...this.getParamPropsTableRow(), disabled: false }; |
| 4777 | 4778 | const materialIcon = true || props.tableProps.setMaterial; /* 材料操作 */ |
| 4779 | + const processIcon = true; /* 工序操作 */ | |
| 4780 | + /* 获取choose的props */ | |
| 4781 | + const chooseProcessProps = { ...this.getChooseProcessPropsTableRow(), disabled: false }; | |
| 4782 | + console.log("🚀 ~ CommonTableRc ~ processIcon:", processIcon) | |
| 4778 | 4783 | /** 放置选择材料图标 */ |
| 4779 | 4784 | if (materialIcon) { |
| 4780 | 4785 | const setMaterial = commonFunc.showMessage( |
| ... | ... | @@ -4791,7 +4796,12 @@ class CommonTableRc extends React.Component { |
| 4791 | 4796 | }} |
| 4792 | 4797 | /> |
| 4793 | 4798 | } |
| 4794 | - | |
| 4799 | + /** 放置选择工序材料图标 */ | |
| 4800 | + if (!commonUtils.isEmpty(processIcon)) { | |
| 4801 | + const enabled = this.getTableBtnState('BtnChooseProcess', record); | |
| 4802 | + const setProcess = commonFunc.showMessage(props.app.commonConst, 'setProcess');/* 选择工序 */ | |
| 4803 | + operateProcess = <a title={setProcess} {...chooseProcessProps} onClick={enabled ? this.chooseProcessTbRow.bind(this, index) : null} >{enabled ? <SvgIcon iconClass="process" fill="#1296db" size="14" alt="选择工序"></SvgIcon> : <SvgIcon iconClass="process" fill="rgb(189, 189, 189)" size="14" alt="选择工序"></SvgIcon>}</a>; | |
| 4804 | + } | |
| 4795 | 4805 | if (this.isPopupShow) { |
| 4796 | 4806 | const enabled = this.getTableBtnState('BtnPopup', record); |
| 4797 | 4807 | const setDownload = commonFunc.showMessage(props.app.commonConst, 'setPopup');/* 弹窗 */ |
| ... | ... | @@ -4806,7 +4816,7 @@ class CommonTableRc extends React.Component { |
| 4806 | 4816 | tableData: props.data |
| 4807 | 4817 | }) |
| 4808 | 4818 | : props.tableBtnsConfig || []; |
| 4809 | - | |
| 4819 | + | |
| 4810 | 4820 | return ( |
| 4811 | 4821 | <div |
| 4812 | 4822 | className="operate-bar" |
| ... | ... | @@ -4905,6 +4915,7 @@ class CommonTableRc extends React.Component { |
| 4905 | 4915 | props.mesMaterials ? props.mesMaterials({ tableName: props.name, record, index }) : '' |
| 4906 | 4916 | } */} |
| 4907 | 4917 | {operatePopupModal} |
| 4918 | + {operateProcess} | |
| 4908 | 4919 | </div> |
| 4909 | 4920 | ); |
| 4910 | 4921 | }, |
| ... | ... | @@ -8093,8 +8104,9 @@ class CommonTableRc extends React.Component { |
| 8093 | 8104 | handleChooseProcessRow = () => { |
| 8094 | 8105 | if ( |
| 8095 | 8106 | commonUtils.isNotEmptyObject(this.props.tableProps.chooseProcessConfigRow) |
| 8096 | - ) { | |
| 8107 | + ) { | |
| 8097 | 8108 | const iIndex = this.props.tableProps.chooseProcessConfigRow; |
| 8109 | + console.log("🚀 ~ CommonTableRc ~ this.props.tableProps:", this.props) | |
| 8098 | 8110 | this.props.onBtnChoose("process", "BtnChooseProcess", iIndex); |
| 8099 | 8111 | } |
| 8100 | 8112 | }; | ... | ... |
src/routes/mes/routerComponent.js
| ... | ... | @@ -18,6 +18,7 @@ export const Route = ({ |
| 18 | 18 | modalCallback, // 弹窗按钮回调(弹窗用) |
| 19 | 19 | setExtraBtns, // 设置弹窗下方按钮(弹窗用) |
| 20 | 20 | onCancel, // 弹窗关闭方法 |
| 21 | + onBtnChoose, | |
| 21 | 22 | }) => { |
| 22 | 23 | const props = { |
| 23 | 24 | app, |
| ... | ... | @@ -34,7 +35,8 @@ export const Route = ({ |
| 34 | 35 | parentProps, |
| 35 | 36 | modalCallback, |
| 36 | 37 | setExtraBtns, |
| 37 | - onCancel | |
| 38 | + onCancel, | |
| 39 | + onBtnChoose | |
| 38 | 40 | }; |
| 39 | 41 | |
| 40 | 42 | return <RouterComponent {...props} />; | ... | ... |