diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5dcaf80 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,21 @@ +{ + "printWidth": 150, + "eslintIntegration": true, + "stylelintIntegration": true, + "tabWidth": 2, + "semi": true, + "singleQuote": false, + "quoteProps": "as-needed", + "jsxSingleQuote": false, + "bracketSpacing": true, + "arrowParens": "avoid", + "htmlWhitespaceSensitivity": "css", + "javascript.format.insertSpaceBeforeFunctionParenthesis": true, + "files.insertFinalNewline": true, + "useTabs": false, + "endOfLine": "lf", + "ignorePath": ".gnore", + "trailingComma": "es5", + "jsxBracketSameLine": false, + "bracketSameLine": false +} \ No newline at end of file diff --git a/src/mes/common/commonModelComponent/index.js b/src/mes/common/commonModelComponent/index.js index b2de772..21385c3 100644 --- a/src/mes/common/commonModelComponent/index.js +++ b/src/mes/common/commonModelComponent/index.js @@ -348,6 +348,7 @@ const useCommonModelEvent = props => { useEffect( () => { if (!props.bFinish) return; + window.refreshTableList = undefined; const { firstTableName } = props; if (!firstTableName) return; diff --git a/src/mes/costomPageFun/index.js b/src/mes/costomPageFun/index.js index 8000dda..118b3d7 100644 --- a/src/mes/costomPageFun/index.js +++ b/src/mes/costomPageFun/index.js @@ -126,6 +126,58 @@ const costomPageFun = ({ props, tableName, sFieldName, actionName }) => { result = true; handleZlxjCheck(props, sFieldName); break; + case "mesBtnClick-slave0-BtnRight.foremanReview": + result = true; + window.refreshTableList = ["slave1"]; + handleCjlbshCheck(props); + break; + case "mesBtnClick-slave0-BtnRight.reverseReview": + result = true; + window.refreshTableList = ["slave1"]; + handleCjlbfsCheck(props); + break; + case "mesBtnClick-slave0-BtnRight.ipqcReview": + result = true; + window.refreshTableList = ["slave1"]; + handlePgshCheck(props); + break; + case "mesBtnClick-slave0-BtnRight.ipqcReverseReview": + result = true; + window.refreshTableList = ["slave1"]; + handlePgfsCheck(props); + break; + case "mesBtnClick-slave0-BtnRight.confirmSubmit": + result = true; + window.refreshTableList = ["slave1"]; + handleConfirmSubmit(props); + break; + case "mesBtnClick-slave0-BtnRight..edit": + case "mesBtnClick-slave0-BtnRight.edit": + { + window.refreshTableList = ["slave1"]; + const { slave0Data } = props; + result = true; + const slave0DataNew = [{ ...slave0Data[0], bSubmit: 0, handleType: slave0Data[0].handleType || "update" }]; + props.onExecInstructSet({ + nextProps: { ...props, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ], + }, + ]), + }, + }); + break; + } + default: break; } @@ -968,7 +1020,6 @@ const handleSlaveWyrj2BtnPre = props => { const [rowData = {}] = listData; const iIndex = tableData.findIndex(item => item.sId === rowData.sId); - console.log("=====rowData", rowData, tableData); if (iIndex === -1) { message.info("暂无数据!"); return; @@ -1444,7 +1495,7 @@ const mesTableBtnClick4 = async props => { sInstruct: JSON.stringify([ { opr: "save", - doNotRefresh: true, + // doNotRefresh: true, data: [ { tablename: "qlyqualityinspectionmaster", @@ -1462,4 +1513,288 @@ const mesTableBtnClick4 = async props => { } }; +// 完工情场确认-车间领班审核 +const handleCjlbshCheck = async props => { + const faceResult = await getFaceResult(props); + + if (!faceResult) return; + + const { name } = faceResult; + const { slave0Config, slave0Data = [] } = props; + const filterConfig = slave0Config?.gdsconfigformslave?.filter(item => { + return item.sName === "sForemanCheckMemo"; + }); + + const returnData = await new Promise(resolve => { + props.onSaveState({ + commonRepairModalParams: { + visible: true, + title: "领班审核备注", + tableName: "slave0", + config: slave0Config, + record: { ...slave0Data[0], bSubmit: 0 }, + filterConfig, + callback: rowData => { + resolve(rowData); + }, + }, + }); + }); + + if (commonUtils.isEmptyObject(returnData)) return; + + const slave0DataNew = [ + { + ...returnData, + bSubmit: 1, + tForemanCheckDate: moment().format("YYYY-MM-DD HH:mm:ss"), + sForemanCheckPerson: name, + bForemanCheck: 1, + handleType: returnData.handleType || "update", + }, + ]; + + props.onSaveState({ slave0Data: slave0DataNew }); + props.onExecInstructSet({ + nextProps: { ...props, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ], + }, + ]), + }, + }); +}; + +// 完工情场确认-车间领班反审 +const handleCjlbfsCheck = async props => { + const faceResult = await getFaceResult(props); + if (!faceResult) return; + + const { slave0Data = [] } = props; + + const slave0DataNew = [{ ...slave0Data[0], bForemanCheck: 0, bIPQCCheck: 0, handleType: slave0Data[0].handleType || "update" }]; + + props.onSaveState({ slave0Data: slave0DataNew }); + props.onExecInstructSet({ + nextProps: { ...props, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ], + }, + ]), + }, + }); +}; + +// 完工情场确认-品管审核 +const handlePgshCheck = async props => { + const faceResult = await getFaceResult(props); + + if (!faceResult) return; + + const { name } = faceResult; + const { slave0Config, slave0Data = [] } = props; + const filterConfig = slave0Config?.gdsconfigformslave?.filter(item => { + return item.sName === "sIPQCCheckMemo"; + }); + + const returnData = await new Promise(resolve => { + props.onSaveState({ + commonRepairModalParams: { + visible: true, + title: "品管审核备注", + tableName: "slave0", + config: slave0Config, + record: { ...slave0Data[0], bSubmit: 0 }, + filterConfig, + callback: rowData => { + resolve(rowData); + }, + }, + }); + }); + + if (commonUtils.isEmptyObject(returnData)) return; + + const slave0DataNew = [ + { + ...returnData, + bSubmit: 1, + tIPQCCheckDate: moment().format("YYYY-MM-DD HH:mm:ss"), + sIPQCCheckPerson: name, + bIPQCCheck: 1, + handleType: returnData.handleType || "update", + }, + ]; + + props.onSaveState({ slave0Data: slave0DataNew }); + props.onExecInstructSet({ + nextProps: { ...props, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ], + }, + ]), + }, + }); +}; + +// 完工情场确认-品管反审 +const handlePgfsCheck = async props => { + const faceResult = await getFaceResult(props); + if (!faceResult) return; + + const { slave0Data = [] } = props; + + const slave0DataNew = [{ ...slave0Data[0], bIPQCCheck: 0, handleType: slave0Data[0].handleType || "update" }]; + + props.onSaveState({ slave0Data: slave0DataNew }); + props.onExecInstructSet({ + nextProps: { ...props, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ], + }, + ]), + }, + }); +}; + +// 完工清场确认-确认提交 +const handleConfirmSubmit = async props => { + const { slave0Data } = props; + const slave0RowData = slave0Data[0]; + const { tFirstCompleteTime, tFirstClearanceTime, tSecondStartTime } = slave0RowData; + if (tFirstCompleteTime) { + // 完工时间需小于清场时间 + if (moment(tFirstCompleteTime).isAfter(moment(tFirstClearanceTime))) { + message.error("完工时间需小于清场时间", 3); + return; + } + } + + if (tSecondStartTime) { + // 清场时间需小于第二单开单时间 + if (moment(tFirstClearanceTime).isAfter(moment(tSecondStartTime))) { + message.error("清场时间需小于第二单开单时间", 3); + return; + } + } + + if (!tFirstCompleteTime || !tSecondStartTime) { + const confirmResult = await new Promise(resolve => { + Modal.confirm({ + title: "温馨提示:", + content: "工单完工时间或者第二单开工时间未填写是否继续提交?", + closable: true, + maskClosable: true, + wrapClassName: "mesCommonModal", + onOk() { + resolve(1); + }, + onCancel() { + resolve(0); + }, + }); + }); + + if (!confirmResult) return; + } + + const { sMachineGuid, sUserName, sTeamNo, sTeamId } = commonUtils.getAppData("userinfo"); + const addState = { + sMachineId: sMachineGuid, + bSave: 1, + bSubmit: 1, + sFormId: "17086722220003015078585693314000", + sMakePerson: sUserName, + sFirstTeamNo: sTeamNo, + sSecondTeamNo: sTeamNo, + sFirstTeamId: sTeamId, + sSecondTeamId: sTeamId, + sFirstClearancePerson: sUserName, + handleType: slave0RowData.handleType || "update" + }; + const slave0DataNew = [{ ...slave0RowData, ...addState }]; + + let refreshDataset = "slave1"; + if (addState.handleType === 'add') { + window.rowclickAfterFunc = (nextProps) => { + const { slave1Data } = nextProps; + props.onSaveState({ slave1SelectedRowKeys: [slave1Data[0].sId] }); + } + } else { + refreshDataset = "*"; + } + + props.onExecInstructSet({ + nextProps: { ...props, bSaveAndUpdate: true, slave0Data: slave0DataNew }, + btnConfig: { + showName: "保存", + sInstruct: JSON.stringify([ + { + opr: "save", + doNotRefresh: true, + data: [ + { + tablename: "EptCompletionSiteClearanceMaster", + srcDataset: "slave0", + }, + ].map(item => { + if (!slave0RowData.sBillNo) { + return { + ...item, + maxBillNo: "sBillNo" + } + } else { + return item; + } + }), + }, + { + opr: "refresh", + dataset: refreshDataset + }, + ]), + }, + }); +}; + export default costomPageFun;