Commit f898dd111ccd53244734f269d8f6056b41a10ae3
1 parent
46534cc1
自定义按钮
Showing
5 changed files
with
907 additions
and
30 deletions
src/mes/common/commonModelComponent/index.js
| ... | ... | @@ -993,7 +993,7 @@ const useCommonModelEvent = props => { |
| 993 | 993 | } |
| 994 | 994 | }); |
| 995 | 995 | } else { |
| 996 | - const tableDataRow = this.handlePackDataAdd( | |
| 996 | + const tableDataRow = handlePackDataAdd( | |
| 997 | 997 | item, |
| 998 | 998 | index, |
| 999 | 999 | sId, |
| ... | ... | @@ -1082,7 +1082,6 @@ const useCommonModelEvent = props => { |
| 1082 | 1082 | // 审核 |
| 1083 | 1083 | /** toolbar审核(消审) */ |
| 1084 | 1084 | const handleAudit = async (flag) => { |
| 1085 | - console.log("🚀 ~ handleAudit ~ flag:", flag) | |
| 1086 | 1085 | /* 待用数据声明 */ |
| 1087 | 1086 | let bResult = true; |
| 1088 | 1087 | const { masterData, gdsformconst } = props; |
| ... | ... | @@ -1090,7 +1089,7 @@ const useCommonModelEvent = props => { |
| 1090 | 1089 | /* 作废订单不能审核 */ |
| 1091 | 1090 | if (masterData.bInvalid) { |
| 1092 | 1091 | message.warning(commonFunc.showMessage(app.commonConst, 'sToVoid')); |
| 1093 | - handleSaveState({ | |
| 1092 | + props.onSaveState({ | |
| 1094 | 1093 | loading: false, |
| 1095 | 1094 | }); |
| 1096 | 1095 | return ''; |
| ... | ... | @@ -1098,7 +1097,7 @@ const useCommonModelEvent = props => { |
| 1098 | 1097 | /** 数据审核 */ |
| 1099 | 1098 | bResult = await dataAudit(flag); |
| 1100 | 1099 | } else { |
| 1101 | - handleSaveState({ | |
| 1100 | + props.onSaveState({ | |
| 1102 | 1101 | loading: false, |
| 1103 | 1102 | }); |
| 1104 | 1103 | } |
| ... | ... | @@ -1142,7 +1141,7 @@ const useCommonModelEvent = props => { |
| 1142 | 1141 | } |
| 1143 | 1142 | } |
| 1144 | 1143 | } else { |
| 1145 | - handleSaveState({ | |
| 1144 | + props.onSaveState({ | |
| 1146 | 1145 | loading: false, |
| 1147 | 1146 | }); |
| 1148 | 1147 | return; |
| ... | ... | @@ -1158,7 +1157,7 @@ const useCommonModelEvent = props => { |
| 1158 | 1157 | const check = commonFunc.showMessage(app.commonConst, 'BtnExamine');/* 审核 */ |
| 1159 | 1158 | const BtnCancelExamine = commonFunc.showMessage(app.commonConst, 'BtnCancelExamine');/* 销审 */ |
| 1160 | 1159 | if (returnData.code === 1) { /* 成功 */ |
| 1161 | - handleSaveState({ | |
| 1160 | + props.onSaveState({ | |
| 1162 | 1161 | loading: false, |
| 1163 | 1162 | }); |
| 1164 | 1163 | if (flag === 1) { |
| ... | ... | @@ -1245,13 +1244,13 @@ const useCommonModelEvent = props => { |
| 1245 | 1244 | ), |
| 1246 | 1245 | onOk() { }, |
| 1247 | 1246 | }); |
| 1248 | - handleSaveState({ | |
| 1247 | + props.onSaveState({ | |
| 1249 | 1248 | loading: false, |
| 1250 | 1249 | }); |
| 1251 | 1250 | return false; |
| 1252 | 1251 | } else { /* 失败 */ |
| 1253 | 1252 | props.getServiceError(returnData); |
| 1254 | - handleSaveState({ | |
| 1253 | + props.onSaveState({ | |
| 1255 | 1254 | loading: false, |
| 1256 | 1255 | }); |
| 1257 | 1256 | return false; |
| ... | ... | @@ -1259,6 +1258,172 @@ const useCommonModelEvent = props => { |
| 1259 | 1258 | return true; |
| 1260 | 1259 | } |
| 1261 | 1260 | }; |
| 1261 | + /**自定义按钮事件 */ | |
| 1262 | + const handleCostomChange = async (name, showConfig, other) => { | |
| 1263 | + const { | |
| 1264 | + app, | |
| 1265 | + sModelsId, | |
| 1266 | + [`${name}Data`]: tableData, | |
| 1267 | + [`${name}SelectedRowKeys`]: tableSelectedRowKeys, | |
| 1268 | + masterData, | |
| 1269 | + slave1Child0Config, | |
| 1270 | + slave2Child0Config, | |
| 1271 | + slave2Child0InfoConfig, | |
| 1272 | + slave6Child1Config, | |
| 1273 | + slave6Child1InfoConfig, | |
| 1274 | + } = props; | |
| 1275 | + const confirmSetting = commonFunc.showLocalMessage(props, 'confirmSetting', '请配置按钮的存储过程'); | |
| 1276 | + const confirmSettingParam = commonFunc.showLocalMessage(props, 'confirmSettingParam', '请先操作参数运算'); | |
| 1277 | + const iIndex = | |
| 1278 | + commonUtils.isNotEmptyObject(tableSelectedRowKeys) && | |
| 1279 | + commonUtils.isNotEmptyArr(tableData) | |
| 1280 | + ? tableData.findIndex(item => tableSelectedRowKeys.includes(item.sId)) | |
| 1281 | + : -1; | |
| 1282 | + let slaveRow = {}; | |
| 1283 | + if (iIndex > -1) { | |
| 1284 | + slaveRow = tableData[iIndex]; | |
| 1285 | + } else if (commonUtils.isNotEmptyArr(tableData) && tableData.length > 0) { | |
| 1286 | + slaveRow = tableData[0]; | |
| 1287 | + } | |
| 1288 | + if ( | |
| 1289 | + commonUtils.isNotEmptyObject(showConfig) && | |
| 1290 | + showConfig.sControlName && | |
| 1291 | + showConfig.sControlName.includes("BtnCustom.dSplitworkQty") | |
| 1292 | + ) { | |
| 1293 | + if (masterData.bFirstCalc !== 1) { | |
| 1294 | + message.error(confirmSettingParam); | |
| 1295 | + return; | |
| 1296 | + } | |
| 1297 | + props.onSaveState({ pageLoading: true }); | |
| 1298 | + /* 拆分工单单据 - 拆分工单 生成工单 */ | |
| 1299 | + const sButtonParam = showConfig.sButtonParam; | |
| 1300 | + if ( | |
| 1301 | + commonUtils.isNotEmptyObject(sButtonParam) && | |
| 1302 | + commonUtils.isJSON(sButtonParam) | |
| 1303 | + ) { | |
| 1304 | + const proObj = JSON.parse(sButtonParam); | |
| 1305 | + const proName = proObj.sproName; | |
| 1306 | + const sRowData = slaveRow; | |
| 1307 | + const value = { | |
| 1308 | + sProName: proName, | |
| 1309 | + sProInParam: JSON.stringify({ params: sRowData }) | |
| 1310 | + }; | |
| 1311 | + if (other?.iFlag === 1) { | |
| 1312 | + value.iFlag = 1; | |
| 1313 | + } | |
| 1314 | + const url = `${commonConfig.server_host | |
| 1315 | + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | |
| 1316 | + const returnData = (await commonServices.postValueService( | |
| 1317 | + app.token, | |
| 1318 | + value, | |
| 1319 | + url | |
| 1320 | + )).data; | |
| 1321 | + if (returnData.code === 1) { | |
| 1322 | + message.success(returnData.msg); | |
| 1323 | + props.onSaveState({ pageLoading: false }); | |
| 1324 | + const conditonValues = props.onGetSqlConditionValues(slave1Child0Config); | |
| 1325 | + const addState1 = await props.handleGetDataSet({ | |
| 1326 | + name: 'slave1Child0', configData: slave1Child0Config, condition: { sSqlCondition: { ...conditonValues, sParentId: masterData.sId } }, isWait: true, | |
| 1327 | + }); | |
| 1328 | + props.onSaveState({ | |
| 1329 | + ...addState1 | |
| 1330 | + }); | |
| 1331 | + } else { | |
| 1332 | + props.onSaveState({ pageLoading: false }); | |
| 1333 | + props.getServiceError({ | |
| 1334 | + ...returnData, | |
| 1335 | + fn: () => handleCostomChange(name, showConfig, { iFlag: 1 }) | |
| 1336 | + }); | |
| 1337 | + } | |
| 1338 | + } else { | |
| 1339 | + message.error(confirmSetting); | |
| 1340 | + } | |
| 1341 | + } else if ( | |
| 1342 | + commonUtils.isNotEmptyObject(showConfig) && | |
| 1343 | + showConfig.sControlName && | |
| 1344 | + (showConfig.sControlName.includes("BtnCustom.tEstimateCompletDate") || | |
| 1345 | + showConfig.sControlName.includes("BtnCustom.tRecalculatedDate")) | |
| 1346 | + ) { | |
| 1347 | + /* 单生管评审单据 - 生管评审 - 交期推算 */ | |
| 1348 | + const { | |
| 1349 | + app, | |
| 1350 | + sModelsId, | |
| 1351 | + [`${name}Data`]: tableData, | |
| 1352 | + slaveSelectedRowKeys: tableSelectedRowKeys | |
| 1353 | + } = props; | |
| 1354 | + const index = | |
| 1355 | + commonUtils.isNotEmptyObject(tableSelectedRowKeys) && | |
| 1356 | + commonUtils.isNotEmptyArr(tableData) | |
| 1357 | + ? tableData.findIndex(item => tableSelectedRowKeys.includes(item.sId)) | |
| 1358 | + : -1; | |
| 1359 | + slaveRow = index > -1 ? tableData[index] : slaveRow; | |
| 1360 | + const controlRow = handleGetSelectedData(props, 'slave0Child1'); /* 控制表当前选中行 */ | |
| 1361 | + const sButtonParam = showConfig.sButtonParam; | |
| 1362 | + if ( | |
| 1363 | + commonUtils.isNotEmptyObject(sButtonParam) && | |
| 1364 | + commonUtils.isJSON(sButtonParam) | |
| 1365 | + ) { | |
| 1366 | + const proObj = JSON.parse(sButtonParam); | |
| 1367 | + const proName = proObj.sproName; | |
| 1368 | + let sRowData = slaveRow; | |
| 1369 | + //取第一条BOM的id | |
| 1370 | + sRowData = { ...sRowData, sBomId: tableData[0].sBomId }; | |
| 1371 | + const value = { | |
| 1372 | + sProName: proName, | |
| 1373 | + sProInParam: JSON.stringify({ params: sRowData, control: controlRow }) | |
| 1374 | + }; | |
| 1375 | + if (other?.iFlag === 1) { | |
| 1376 | + value.iFlag = 1; | |
| 1377 | + } | |
| 1378 | + const url = `${commonConfig.server_host | |
| 1379 | + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | |
| 1380 | + const returnData = (await commonServices.postValueService( | |
| 1381 | + app.token, | |
| 1382 | + value, | |
| 1383 | + url | |
| 1384 | + )).data; | |
| 1385 | + if (returnData.code === 1) { | |
| 1386 | + message.success(returnData.msg); | |
| 1387 | + if (showConfig.sControlName.includes("BtnCustom.tEstimateCompletDate")) { | |
| 1388 | + const conditonValues1 = props.onGetSqlConditionValues(slave2Child0Config); | |
| 1389 | + const addState1 = await props.handleGetDataSet({ | |
| 1390 | + name: 'slave2Child0', configData: slave2Child0Config, condition: { sSqlCondition: { ...conditonValues1, sParentId: masterData.sId } }, isWait: true, | |
| 1391 | + }); | |
| 1392 | + const conditonValues2 = props.onGetSqlConditionValues(slave2Child0InfoConfig); | |
| 1393 | + const addState2 = await props.handleGetDataSet({ | |
| 1394 | + name: 'slave2Child0Info', configData: slave2Child0InfoConfig, condition: { sSqlCondition: { ...conditonValues2, sParentId: masterData.sId } }, isWait: true, | |
| 1395 | + }); | |
| 1396 | + tableData[index].handleType = commonUtils.isEmpty(tableData[index].handleType) ? "update" : tableData[index].handleType; | |
| 1397 | + tableData[index].tEstimateCompletDate = returnData.dataset?.rows[0].dataSet?.proData[0].tEstimateCompletDate; | |
| 1398 | + props.onSaveState({ | |
| 1399 | + ...addState1, ...addState2, | |
| 1400 | + }); | |
| 1401 | + } else if (showConfig.sControlName.includes("BtnCustom.tRecalculatedDate")) { | |
| 1402 | + const conditonValues1 = props.onGetSqlConditionValues(slave6Child1Config); | |
| 1403 | + const addState1 = await props.handleGetDataSet({ | |
| 1404 | + name: 'slave6Child1', configData: slave6Child1Config, condition: { sSqlCondition: { ...conditonValues1, sParentId: masterData.sId } }, isWait: true, | |
| 1405 | + }); | |
| 1406 | + const conditonValues2 = props.onGetSqlConditionValues(slave6Child1InfoConfig); | |
| 1407 | + const addState2 = await props.handleGetDataSet({ | |
| 1408 | + name: 'slave6Child1Info', configData: slave6Child1InfoConfig, condition: { sSqlCondition: { ...conditonValues2, sParentId: masterData.sId } }, isWait: true, | |
| 1409 | + }); | |
| 1410 | + tableData[index].handleType = commonUtils.isEmpty(tableData[index].handleType) ? "update" : tableData[index].handleType; | |
| 1411 | + tableData[index].tRecalculatedDate = returnData.dataset?.rows[0].dataSet?.proData[0].tRecalculatedDate; | |
| 1412 | + props.onSaveState({ | |
| 1413 | + ...addState1, ...addState2, [`${name}Data`]: tableData | |
| 1414 | + }); | |
| 1415 | + } | |
| 1416 | + } else { | |
| 1417 | + props.getServiceError({ | |
| 1418 | + ...returnData, | |
| 1419 | + fn: () => handleCostomChange(name, showConfig, { iFlag: 1 }) | |
| 1420 | + }); | |
| 1421 | + } | |
| 1422 | + } else { | |
| 1423 | + message.error(confirmSetting); | |
| 1424 | + } | |
| 1425 | + } | |
| 1426 | + }; | |
| 1262 | 1427 | return { |
| 1263 | 1428 | ...props, |
| 1264 | 1429 | onGetColumnData: handleGetColumnData, |
| ... | ... | @@ -1268,9 +1433,21 @@ const useCommonModelEvent = props => { |
| 1268 | 1433 | handleStartWork, |
| 1269 | 1434 | onViewChoose: handleViewChoose, |
| 1270 | 1435 | onBtnExamine: handleAudit, |
| 1436 | + onBtnCancelExamine: handleAudit, | |
| 1437 | + onCostomChange: handleCostomChange | |
| 1271 | 1438 | }; |
| 1272 | 1439 | }; |
| 1273 | - | |
| 1440 | +/* 解析消息 */ | |
| 1441 | +const handleGetMsg = (str) => { | |
| 1442 | + const msgArr = commonUtils.isNotEmptyObject(str) ? str.split('xpm') : ''; | |
| 1443 | + const divStr = []; | |
| 1444 | + if (commonUtils.isNotEmptyArr(msgArr)) { | |
| 1445 | + for (let i = 0; i < msgArr.length; i++) { | |
| 1446 | + divStr.push(<p>{msgArr[i]}</p>); | |
| 1447 | + } | |
| 1448 | + } | |
| 1449 | + return divStr; | |
| 1450 | +} | |
| 1274 | 1451 | // 计算commonDiv高度 |
| 1275 | 1452 | const useComputedCommonDivHeight = props => { |
| 1276 | 1453 | let returnHeight = "calc(100% - 20px)"; | ... | ... |
src/mes/common/commonOperationBarComponent/MesToolbar.js
| ... | ... | @@ -2,11 +2,14 @@ |
| 2 | 2 | import { message } from "antd"; |
| 3 | 3 | import * as commonUtils from "@/utils/utils"; |
| 4 | 4 | import * as commonFunc from "@/components/Common/commonFunc"; |
| 5 | +import commonConfig from "@/utils/config"; | |
| 6 | +import * as commonServices from "@/services/services"; | |
| 7 | +let xlyProcessTimer = null; | |
| 5 | 8 | const ToolbarFun = async (props) => { |
| 6 | - const { btnConfig, bMesBill } = props; | |
| 9 | + const { btnConfig, bMesBill, name } = props; | |
| 7 | 10 | const currentMesPane = commonUtils.getAppData("currentMesPane"); |
| 8 | 11 | const { sModelType = '' } = currentMesPane; |
| 9 | - const { sControlName } = btnConfig; | |
| 12 | + const { sControlName, sButtonParam } = btnConfig; | |
| 10 | 13 | const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); |
| 11 | 14 | if ((btnName.includes('btnscanface')) && !bMesBill) { |
| 12 | 15 | handleScanFace(props); |
| ... | ... | @@ -17,8 +20,9 @@ const ToolbarFun = async (props) => { |
| 17 | 20 | |
| 18 | 21 | // const { sControlName } = btnConfig; |
| 19 | 22 | // const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); |
| 20 | - console.log(btnName, 'btnName'); | |
| 21 | - | |
| 23 | + console.log(btnName, props, 'btnName'); | |
| 24 | + let flag = 0; | |
| 25 | + let interfaceArr = btnConfig.interface; | |
| 22 | 26 | if (btnName === 'btnadd') { |
| 23 | 27 | handleAdd(props); |
| 24 | 28 | } else if (btnName === 'btnsave') { |
| ... | ... | @@ -32,8 +36,8 @@ const ToolbarFun = async (props) => { |
| 32 | 36 | } else if (btnName === 'btndel') { |
| 33 | 37 | props.onDel(props) |
| 34 | 38 | } else if (btnName.includes('btnexamine')) { |
| 35 | - let flag = 0; | |
| 36 | - let interfaceArr = btnConfig.interface; | |
| 39 | + // 审核 | |
| 40 | + | |
| 37 | 41 | if (commonUtils.isNotEmptyArr(interfaceArr)) { |
| 38 | 42 | const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1"); |
| 39 | 43 | const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2"); |
| ... | ... | @@ -42,7 +46,7 @@ const ToolbarFun = async (props) => { |
| 42 | 46 | |
| 43 | 47 | const asyncFunc = async () => { |
| 44 | 48 | for (let i = 0; i < beforeInterfaceArr.length; i++) { |
| 45 | - const data = await handleInterfaceCall(beforeInterfaceArr[i]); | |
| 49 | + const data = await handleInterfaceCall(props, beforeInterfaceArr[i]); | |
| 46 | 50 | if (!data) { |
| 47 | 51 | flag += 1; |
| 48 | 52 | return; |
| ... | ... | @@ -53,7 +57,7 @@ const ToolbarFun = async (props) => { |
| 53 | 57 | } |
| 54 | 58 | let result; |
| 55 | 59 | if (flag == 0) { |
| 56 | - result = await props.onBtnExamine(); | |
| 60 | + result = await props.onBtnExamine(1); | |
| 57 | 61 | } else { |
| 58 | 62 | props.onSaveState({ |
| 59 | 63 | loading: false, |
| ... | ... | @@ -62,12 +66,12 @@ const ToolbarFun = async (props) => { |
| 62 | 66 | |
| 63 | 67 | if (commonUtils.isNotEmptyArr(afterInterfaceArr)) { |
| 64 | 68 | /* 之后调用 */ |
| 65 | - // const result = await this.props.onBtnExamine(); | |
| 69 | + // const result = await props.onBtnExamine(); | |
| 66 | 70 | if (result) { |
| 67 | 71 | /* 只有审核成功 才能调用接口 -5代表审核失败 */ |
| 68 | 72 | const asyncFunc = async () => { |
| 69 | 73 | for (let i = 0; i < afterInterfaceArr.length; i++) { |
| 70 | - await handleInterfaceCall(afterInterfaceArr[i], true); | |
| 74 | + await handleInterfaceCall(props, afterInterfaceArr[i], true); | |
| 71 | 75 | } |
| 72 | 76 | }; |
| 73 | 77 | await asyncFunc(); |
| ... | ... | @@ -76,14 +80,696 @@ const ToolbarFun = async (props) => { |
| 76 | 80 | } |
| 77 | 81 | } else { |
| 78 | 82 | // console.log(props, 'masterData'); |
| 79 | - props.onBtnExamine(); | |
| 83 | + props.onBtnExamine(1); | |
| 84 | + } | |
| 85 | + } else if (btnName.includes('btncancelexamine')) { | |
| 86 | + if (commonUtils.isNotEmptyArr(interfaceArr)) { | |
| 87 | + const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1"); | |
| 88 | + const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2"); | |
| 89 | + if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) { | |
| 90 | + /* 之前调用 */ | |
| 91 | + let flag = 0; | |
| 92 | + const asyncFunc = async () => { | |
| 93 | + for (let i = 0; i < beforeInterfaceArr.length; i++) { | |
| 94 | + const data = await handleInterfaceCall(props, beforeInterfaceArr[i]); | |
| 95 | + if (!data) { | |
| 96 | + flag += 1; | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + } | |
| 100 | + }; | |
| 101 | + await asyncFunc(); | |
| 102 | + if (flag == 0) { | |
| 103 | + props.onBtnCancelExamine(0); | |
| 104 | + } else { | |
| 105 | + props.onSaveState({ | |
| 106 | + loading: false, | |
| 107 | + }); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + if (commonUtils.isNotEmptyArr(afterInterfaceArr)) { | |
| 111 | + /* 之后调用 */ | |
| 112 | + const result = await props.onBtnCancelExamine(0); | |
| 113 | + if (result) { | |
| 114 | + /* 只有审核成功 才能调用接口 -5代表审核失败 */ | |
| 115 | + const asyncFunc = async () => { | |
| 116 | + for (let i = 0; i < afterInterfaceArr.length; i++) { | |
| 117 | + await handleInterfaceCall(props, afterInterfaceArr[i], true); | |
| 118 | + } | |
| 119 | + }; | |
| 120 | + await asyncFunc(); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + } else { | |
| 124 | + props.onBtnCancelExamine(0); | |
| 125 | + } | |
| 126 | + } else if (['btnevent', 'btnsubmit', 'btnsubmitcancel'].includes(btnName) || sButtonParam) { | |
| 127 | + const { | |
| 128 | + slaveSelectedRowKeys, | |
| 129 | + slaveData, | |
| 130 | + formRoute, | |
| 131 | + slave0Child1Data: controlData, | |
| 132 | + materialsData: materialsData, | |
| 133 | + slave0Data: processData, | |
| 134 | + } = props; | |
| 135 | + let { slaveSelectedData } = props; | |
| 136 | + if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData) && slaveSelectedRowKeys) { | |
| 137 | + slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 138 | + } | |
| 139 | + props.onSaveState({ | |
| 140 | + loading: true, | |
| 141 | + }); | |
| 142 | + // const btnConfig = props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]; // sButtonEnabled sButtonParam | |
| 143 | + if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) { | |
| 144 | + /* 根据接口返回是之前调用还是之后调用 */ | |
| 145 | + if (commonUtils.isNotEmptyArr(interfaceArr)) { | |
| 146 | + const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1"); | |
| 147 | + const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2"); | |
| 148 | + const bProgressBar = btnConfig.sRelation === "progressBar"; | |
| 149 | + | |
| 150 | + let bContinue = true; | |
| 151 | + if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) { | |
| 152 | + /* 之前调用 */ | |
| 153 | + let flag = 0; | |
| 154 | + const asyncFunc = async () => { | |
| 155 | + for (let i = 0; i < beforeInterfaceArr.length; i++) { | |
| 156 | + if (bProgressBar) { | |
| 157 | + let xlyProcessPercent = 0; | |
| 158 | + clearInterval(xlyProcessTimer); | |
| 159 | + message.loading({ | |
| 160 | + content: <Progress percent={xlyProcessPercent} />, | |
| 161 | + key: "xlyProcess", | |
| 162 | + duration: 0, | |
| 163 | + className: styles.xlyProcess, | |
| 164 | + }); | |
| 165 | + for (let j = 0; j < slaveSelectedRowKeys.length; j++) { | |
| 166 | + const slaveSelectedRowOneKey = slaveSelectedRowKeys[j]; | |
| 167 | + const data = await handleInterfaceCall(beforeInterfaceArr[i], false, key, slaveSelectedRowOneKey, slaveSelectedRowOneKey); | |
| 168 | + if (!data) { | |
| 169 | + message.destroy("xlyProcess"); | |
| 170 | + flag += 1; | |
| 171 | + break; | |
| 172 | + } | |
| 173 | + xlyProcessPercent = ((((i + 1) * (j + 1)) / (beforeInterfaceArr.length * slaveSelectedRowKeys.length)) * 100).toFixed(2); | |
| 174 | + message.loading({ | |
| 175 | + content: <Progress percent={xlyProcessPercent} />, | |
| 176 | + key: "xlyProcess", | |
| 177 | + duration: xlyProcessPercent >= 100 ? 3 : 0, | |
| 178 | + className: styles.xlyProcess, | |
| 179 | + }); | |
| 180 | + } | |
| 181 | + } else { | |
| 182 | + const data = await handleInterfaceCall(beforeInterfaceArr[i], false, key, slaveSelectedRowKeys); | |
| 183 | + if (!data) { | |
| 184 | + flag += 1; | |
| 185 | + return; | |
| 186 | + } | |
| 187 | + } | |
| 188 | + } | |
| 189 | + }; | |
| 190 | + await asyncFunc(); | |
| 191 | + if (flag == 0) { | |
| 192 | + await handleBtnEent(props, btnConfig); | |
| 193 | + } else { | |
| 194 | + bContinue = false; | |
| 195 | + } | |
| 196 | + } | |
| 197 | + if (commonUtils.isNotEmptyArr(afterInterfaceArr) && bContinue) { | |
| 198 | + /* 之后调用 */ | |
| 199 | + const result = await handleBtnEent(props, btnConfig); | |
| 200 | + if (result === 1) { | |
| 201 | + /* 只有按钮成功 才能调用接口 -5代表审核失败 */ | |
| 202 | + const asyncFunc = async () => { | |
| 203 | + for (let i = 0; i < afterInterfaceArr.length; i++) { | |
| 204 | + if (bProgressBar) { | |
| 205 | + xlyProcessPercent = 0; | |
| 206 | + clearInterval(xlyProcessTimer); | |
| 207 | + message.loading({ | |
| 208 | + content: <Progress percent={xlyProcessPercent} />, | |
| 209 | + key: "xlyProcess", | |
| 210 | + duration: 0, | |
| 211 | + className: styles.xlyProcess, | |
| 212 | + }); | |
| 213 | + for (let j = 0; j < slaveSelectedRowKeys.length; j++) { | |
| 214 | + const slaveSelectedRowOneKey = slaveSelectedRowKeys[j]; | |
| 215 | + const data = await handleInterfaceCall(afterInterfaceArr[i], false, key, slaveSelectedRowOneKey, slaveSelectedRowOneKey); | |
| 216 | + if (!data) { | |
| 217 | + message.destroy("xlyProcess"); | |
| 218 | + break; | |
| 219 | + } | |
| 220 | + xlyProcessPercent = ((((i + 1) * (j + 1)) / (afterInterfaceArr.length * slaveSelectedRowKeys.length)) * 100).toFixed(2); | |
| 221 | + message.loading({ | |
| 222 | + content: <Progress percent={xlyProcessPercent} />, | |
| 223 | + key: "xlyProcess", | |
| 224 | + duration: xlyProcessPercent >= 100 ? 3 : 0, | |
| 225 | + className: styles.xlyProcess, | |
| 226 | + }); | |
| 227 | + } | |
| 228 | + } else { | |
| 229 | + await handleInterfaceCall(afterInterfaceArr[i], false, key, slaveSelectedRowKeys); | |
| 230 | + } | |
| 231 | + } | |
| 232 | + }; | |
| 233 | + await asyncFunc(); | |
| 234 | + } | |
| 235 | + } | |
| 236 | + | |
| 237 | + // for (const child of slaveSelectedDataNew) { | |
| 238 | + // | |
| 239 | + // } | |
| 240 | + } else if (btnConfig.sButtonParam?.includes("Sp_BtnEven_CalcJsHs") && btnConfig.showName?.includes("工资核算")) { | |
| 241 | + // 工资核算特殊处理 | |
| 242 | + const { slave3Data = [], slave3SelectedRowKeys = [] } = props; | |
| 243 | + const slave3SelectedData = slave3Data.filter(item => slave3SelectedRowKeys.includes(item.sId)); | |
| 244 | + if (slave3SelectedData.length) { | |
| 245 | + for (let i = 0; i < slave3SelectedData.length; i++) { | |
| 246 | + const slave3DataOne = slave3SelectedData[i]; | |
| 247 | + const { sCalcProName: sCalcProDetail, sId, sCalcDepart } = slave3DataOne; | |
| 248 | + const inParams = [ | |
| 249 | + { | |
| 250 | + key: "slave3", | |
| 251 | + value: [{ sId, sCalcProDetail }], | |
| 252 | + }, | |
| 253 | + ]; | |
| 254 | + const percent = ((i / slave3SelectedData.length) * 100).toFixed(2); | |
| 255 | + message.loading({ content: <Progress percent={percent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 256 | + await handleBtnEent(props, btnConfig, undefined, undefined, inParams); | |
| 257 | + // message.success(`【${sCalcDepart}】核算完成。`); | |
| 258 | + } | |
| 259 | + message.loading({ content: <Progress percent={99} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 260 | + message.success(`全部方案计算成功。`); | |
| 261 | + setTimeout(() => { | |
| 262 | + message.loading({ content: <Progress percent={100} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 263 | + }, 1000); | |
| 264 | + setTimeout(() => { | |
| 265 | + message.destroy("xlyProcess"); | |
| 266 | + }, 2000); | |
| 267 | + } else { | |
| 268 | + message.warning("请先选择计算方案!"); | |
| 269 | + } | |
| 270 | + } else { | |
| 271 | + handleBtnEent(props, btnConfig); | |
| 272 | + } | |
| 273 | + props.onSaveState({ | |
| 274 | + loading: false, | |
| 275 | + }); | |
| 276 | + } else { | |
| 277 | + message.error(confirmSetting); | |
| 278 | + props.onSaveState({ | |
| 279 | + loading: false, | |
| 280 | + }); | |
| 80 | 281 | } |
| 81 | 282 | } |
| 82 | 283 | |
| 83 | 284 | |
| 84 | 285 | return true; |
| 85 | 286 | } |
| 287 | +// 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"} | |
| 288 | +const handleBtnEent = async (props, btnConfig, name, sValue, nextInParams) => { | |
| 289 | + let xlyProcessPercent = 0; | |
| 290 | + clearInterval(xlyProcessTimer); | |
| 291 | + if (props.app?.currentPane?.title === "工单损耗及无形损跟踪" && btnConfig?.sControlName === "BtnEventAllWork") { | |
| 292 | + message.loading({ content: <Progress percent={0} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 293 | + xlyProcessTimer = setInterval(() => { | |
| 294 | + if (xlyProcessPercent >= 50) { | |
| 295 | + xlyProcessPercent += 0.2; | |
| 296 | + } else if (xlyProcessPercent >= 90) { | |
| 297 | + return; | |
| 298 | + } else { | |
| 299 | + xlyProcessPercent += 0.5; | |
| 300 | + } | |
| 301 | + message.loading({ content: <Progress percent={xlyProcessPercent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 302 | + }, 500); | |
| 303 | + } | |
| 304 | + props.onSaveState({ | |
| 305 | + pageLoading: true, | |
| 306 | + }); | |
| 307 | + const menuData = [] | |
| 308 | + // const { menuData } = state; | |
| 309 | + let iResult = 0; | |
| 310 | + let bFirst = false; | |
| 311 | + if ( | |
| 312 | + commonUtils.isNotEmptyObject(btnConfig) && | |
| 313 | + (btnConfig.sControlName === "BtnEventReceiveReturn" || btnConfig.sControlName === "BtnEventReceive") | |
| 314 | + ) { | |
| 315 | + // 刀模归还, 刀模领用判断是否选择数据 | |
| 316 | + const { slaveSelectedRowKeys, app } = props; | |
| 317 | + if (slaveSelectedRowKeys && commonUtils.isEmptyArr(slaveSelectedRowKeys)) { | |
| 318 | + message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录 | |
| 319 | + props.onSaveState({ | |
| 320 | + pageLoading: false, | |
| 321 | + }); | |
| 322 | + return; | |
| 323 | + } | |
| 324 | + } | |
| 325 | + | |
| 326 | + if (commonUtils.isNotEmptyObject(btnConfig) && btnConfig.sControlName.includes("BtnEventAutoOrder")) { | |
| 327 | + // 刀模归还, 刀模领用判断是否选择数据 | |
| 328 | + bFirst = true; /* 沒有选中行时 默认第一条 */ | |
| 329 | + } | |
| 330 | + const { masterData, sCurrMemoProps, masterConditionData } = props; | |
| 331 | + if (commonUtils.isNotEmptyObject(name) && name.indexOf("BtnRepair") > -1 && commonUtils.isNotEmptyObject(sCurrMemoProps)) { | |
| 332 | + sCurrMemoProps.bVisibleMemo = false; | |
| 333 | + props.onSaveState({ sCurrMemoProps }); | |
| 334 | + } | |
| 335 | + const sButtonParam = btnConfig.sButtonParam; | |
| 336 | + console.log("11", btnConfig); | |
| 337 | + const btn = commonUtils.convertStrToObj(sButtonParam); | |
| 338 | + const sProName = btn.sproName; | |
| 339 | + const inParams = []; | |
| 340 | + const inMap = btn.inMap; | |
| 341 | + const inlist = inMap ? inMap.split(",") : []; | |
| 342 | + const masterArr = []; | |
| 343 | + const masterConditionArr = []; | |
| 344 | + const slaveArr = []; | |
| 345 | + const slaveInfoArr = []; | |
| 346 | + const controlArr = []; | |
| 347 | + const materialsArr = []; | |
| 348 | + const processArr = []; | |
| 349 | + const sTableName = btn.sTableName; | |
| 86 | 350 | |
| 351 | + if (!sTableName && !inMap) { | |
| 352 | + // 都为undefined时直接退出 | |
| 353 | + props.onSaveState({ | |
| 354 | + pageLoading: false, | |
| 355 | + }); | |
| 356 | + return; | |
| 357 | + } | |
| 358 | + | |
| 359 | + if (inlist.length > 0) { | |
| 360 | + inlist.forEach(item => { | |
| 361 | + const itemArr = item.split("."); | |
| 362 | + if (itemArr.length > 0) { | |
| 363 | + const sname = itemArr[0]; | |
| 364 | + const stype = itemArr[1]; | |
| 365 | + const stypeNew = itemArr.length > 2 ? itemArr[2] : stype; | |
| 366 | + if (commonUtils.isNotEmptyStr(sname) && sname === "master") { | |
| 367 | + masterArr.push([stype, stypeNew]); | |
| 368 | + } | |
| 369 | + if (commonUtils.isNotEmptyStr(sname) && sname === "masterCondition") { | |
| 370 | + /* 参数数据集 */ | |
| 371 | + masterConditionArr.push([stype, stypeNew]); | |
| 372 | + } | |
| 373 | + if (commonUtils.isNotEmptyStr(sname) && sname === "slave") { | |
| 374 | + slaveArr.push([stype, stypeNew]); | |
| 375 | + } | |
| 376 | + if (commonUtils.isNotEmptyStr(sname) && sname === "slaveInfo") { | |
| 377 | + slaveInfoArr.push([stype, stypeNew]); | |
| 378 | + } | |
| 379 | + if (commonUtils.isNotEmptyStr(sname) && sname === "control") { | |
| 380 | + controlArr.push([stype, stypeNew]); | |
| 381 | + } | |
| 382 | + if (commonUtils.isNotEmptyStr(sname) && sname === "materials") { | |
| 383 | + materialsArr.push([stype, stypeNew]); | |
| 384 | + } | |
| 385 | + if (commonUtils.isNotEmptyStr(sname) && sname === "process") { | |
| 386 | + processArr.push([stype, stypeNew]); | |
| 387 | + } | |
| 388 | + if ( | |
| 389 | + commonUtils.isNotEmptyStr(sname) && | |
| 390 | + !["master", "masterCondition", "slave", "slaveInfo", "control", "materials", "process"].includes(sname) | |
| 391 | + ) { | |
| 392 | + const addState = handleProParams(sname, [[stype, stypeNew]]); | |
| 393 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 394 | + inParams.push({ ...addState }); | |
| 395 | + } | |
| 396 | + } | |
| 397 | + } | |
| 398 | + }); | |
| 399 | + | |
| 400 | + if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) { | |
| 401 | + const addState = {}; | |
| 402 | + addState.key = "master"; | |
| 403 | + const val = []; | |
| 404 | + const currVal = {}; | |
| 405 | + masterArr.forEach(([stype, stypeNew]) => { | |
| 406 | + currVal[`${stypeNew}`] = masterData[`${stype}`]; | |
| 407 | + }); | |
| 408 | + val.push(currVal); | |
| 409 | + addState.value = val; | |
| 410 | + inParams.push({ ...addState }); | |
| 411 | + } | |
| 412 | + if (commonUtils.isNotEmptyArr(masterConditionArr) && commonUtils.isNotEmptyObject(masterConditionData)) { | |
| 413 | + const addState = {}; | |
| 414 | + addState.key = "masterCondition"; | |
| 415 | + const val = []; | |
| 416 | + const currVal = {}; | |
| 417 | + masterConditionArr.forEach(filed => { | |
| 418 | + currVal[`${filed}`] = masterConditionData[`${filed}`]; | |
| 419 | + }); | |
| 420 | + val.push(currVal); | |
| 421 | + addState.value = val; | |
| 422 | + inParams.push({ ...addState }); | |
| 423 | + } | |
| 424 | + if (commonUtils.isNotEmptyArr(slaveArr)) { | |
| 425 | + const addState = handleProParams("slave", slaveArr, bFirst); | |
| 426 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 427 | + inParams.push({ ...addState }); | |
| 428 | + } | |
| 429 | + } | |
| 430 | + if (commonUtils.isNotEmptyArr(slaveInfoArr)) { | |
| 431 | + const addState = handleProParams("slaveInfo", slaveInfoArr); | |
| 432 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 433 | + inParams.push({ ...addState }); | |
| 434 | + } | |
| 435 | + } | |
| 436 | + if (commonUtils.isNotEmptyArr(controlArr)) { | |
| 437 | + const addState = handleProParams("control", controlArr); | |
| 438 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 439 | + inParams.push({ ...addState }); | |
| 440 | + } | |
| 441 | + } | |
| 442 | + if (commonUtils.isNotEmptyArr(materialsArr)) { | |
| 443 | + const addState = handleProParams("materials", materialsArr); | |
| 444 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 445 | + inParams.push({ ...addState }); | |
| 446 | + } | |
| 447 | + } | |
| 448 | + if (commonUtils.isNotEmptyArr(processArr)) { | |
| 449 | + const addState = handleProParams("process", processArr); | |
| 450 | + if (commonUtils.isNotEmptyObject(addState)) { | |
| 451 | + inParams.push({ ...addState }); | |
| 452 | + } | |
| 453 | + } | |
| 454 | + } | |
| 455 | + | |
| 456 | + if (commonUtils.isNotEmptyStr(sTableName) && commonUtils.isNotEmptyArr(inParams)) { | |
| 457 | + inParams.forEach(item => { | |
| 458 | + if (commonUtils.isNotEmptyArr(item.value)) { | |
| 459 | + item.value.forEach(item1 => { | |
| 460 | + item1.sTableName = sTableName; | |
| 461 | + }); | |
| 462 | + } | |
| 463 | + }); | |
| 464 | + } | |
| 465 | + | |
| 466 | + /* 列表增加查询条件的传参 */ | |
| 467 | + if ( | |
| 468 | + location.pathname?.includes("indexPage/commonList") && | |
| 469 | + (btnConfig?.sControlName === "BtnEventOneWork" || btnConfig?.sControlName === "BtnEventAllWork") | |
| 470 | + ) { | |
| 471 | + const { slaveFilterCondition = [] } = props; | |
| 472 | + if (commonUtils.isNotEmptyArr(slaveFilterCondition) && commonUtils.isNotEmptyArr(inParams)) { | |
| 473 | + inParams.forEach(item => { | |
| 474 | + item.bFilter = slaveFilterCondition; | |
| 475 | + }); | |
| 476 | + } | |
| 477 | + console.log("inParams", inParams); | |
| 478 | + } | |
| 479 | + | |
| 480 | + const iIndex = commonUtils.isNotEmptyObject(btnConfig) ? menuData.findIndex(item => item.sControlName === btnConfig.sControlName) : -1; | |
| 481 | + let interfaceArr = []; | |
| 482 | + if (iIndex > -1) { | |
| 483 | + interfaceArr = menuData[iIndex].interface; | |
| 484 | + } | |
| 485 | + if (commonUtils.isNotEmptyArr(interfaceArr) && commonUtils.isNotEmptyObject(btnConfig) && btnConfig.sControlName.includes("BtnRepair")) { | |
| 486 | + if (true) { | |
| 487 | + const { slaveSelectedRowKeys, app, slaveData } = props; | |
| 488 | + if (inMap && inMap.includes("slave.") && slaveSelectedRowKeys && commonUtils.isEmptyArr(slaveSelectedRowKeys)) { | |
| 489 | + message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录 | |
| 490 | + props.onSaveState({ | |
| 491 | + pageLoading: false, | |
| 492 | + }); | |
| 493 | + return; | |
| 494 | + } | |
| 495 | + let slaveRow = {}; | |
| 496 | + const iSlaveDataIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 497 | + if (iSlaveDataIndex > -1) { | |
| 498 | + slaveRow = slaveData[iSlaveDataIndex]; | |
| 499 | + } | |
| 500 | + let ids = ""; | |
| 501 | + if (location.pathname.includes("commonList")) { | |
| 502 | + let { slaveSelectedData } = props; | |
| 503 | + if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) { | |
| 504 | + slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 505 | + } | |
| 506 | + const slaveSelectedDataNew = deteleObject(slaveSelectedData); // 删除sid重复的数据 | |
| 507 | + if (commonUtils.isNotEmptyArr(slaveSelectedDataNew)) { | |
| 508 | + slaveSelectedDataNew.forEach(item => { | |
| 509 | + if (commonUtils.isNotEmptyObject(item)) { | |
| 510 | + ids += `${item.sId},`; | |
| 511 | + } | |
| 512 | + }); | |
| 513 | + ids = commonUtils.isNotEmptyObject(ids) ? ids.substr(0, ids.length - 1) : ""; | |
| 514 | + } | |
| 515 | + } else { | |
| 516 | + ids = slaveRow.sId; | |
| 517 | + } | |
| 518 | + const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1"); | |
| 519 | + const afterInterfaceArr = commonUtils.isNotEmptyArr(interfaceArr) ? interfaceArr.filter(item => item.sInterfaceCallMethod === "2") : []; | |
| 520 | + if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) { | |
| 521 | + /* 之前调用 */ | |
| 522 | + let flag = 0; | |
| 523 | + const asyncFunc = async () => { | |
| 524 | + for (let i = 0; i < beforeInterfaceArr.length; i++) { | |
| 525 | + const data = await handleInterfaceCall(beforeInterfaceArr[i], true, btnConfig.sControlName, ids); | |
| 526 | + if (!data) { | |
| 527 | + flag += 1; | |
| 528 | + props.onSaveState({ | |
| 529 | + pageLoading: false, | |
| 530 | + }); | |
| 531 | + return; | |
| 532 | + } | |
| 533 | + } | |
| 534 | + }; | |
| 535 | + await asyncFunc(); | |
| 536 | + if (flag == 0) { | |
| 537 | + await handleProcedureCall(props, btnConfig, sProName, JSON.stringify({ params: inParams, changeValue: sValue, sButtonParam: btn })); | |
| 538 | + } | |
| 539 | + } | |
| 540 | + if (commonUtils.isNotEmptyArr(afterInterfaceArr)) { | |
| 541 | + /* 之后调用 */ | |
| 542 | + const result = await handleProcedureCall( | |
| 543 | + props, | |
| 544 | + btnConfig, | |
| 545 | + sProName, | |
| 546 | + JSON.stringify({ params: inParams, changeValue: sValue, sButtonParam: btn }) | |
| 547 | + ); | |
| 548 | + console.log("result", result); | |
| 549 | + if (result > 0) { | |
| 550 | + /* 只有成功 才能调用接口 -5代表失败 */ | |
| 551 | + const asyncFunc = async () => { | |
| 552 | + for (let i = 0; i < afterInterfaceArr.length; i++) { | |
| 553 | + await handleInterfaceCall(afterInterfaceArr[i], true, btnConfig.sControlName, ids); | |
| 554 | + } | |
| 555 | + }; | |
| 556 | + await asyncFunc(); | |
| 557 | + } | |
| 558 | + } | |
| 559 | + } | |
| 560 | + } else { | |
| 561 | + const inParamsNew = nextInParams || inParams; | |
| 562 | + iResult = await handleProcedureCall(props, btnConfig, sProName, JSON.stringify({ params: inParamsNew, changeValue: sValue, sButtonParam: btn })); | |
| 563 | + } | |
| 564 | + | |
| 565 | + if (props.app?.currentPane?.title === "工单损耗及无形损跟踪" && btnConfig?.sControlName === "BtnEventAllWork") { | |
| 566 | + clearInterval(xlyProcessTimer); | |
| 567 | + xlyProcessPercent = 91; | |
| 568 | + message.loading({ content: <Progress percent={91} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 569 | + xlyProcessTimer = setInterval(() => { | |
| 570 | + xlyProcessPercent += 1; | |
| 571 | + message.loading({ content: <Progress percent={xlyProcessPercent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess }); | |
| 572 | + if (xlyProcessPercent === 100) { | |
| 573 | + clearInterval(xlyProcessTimer); | |
| 574 | + setTimeout(() => { | |
| 575 | + message.destroy(); | |
| 576 | + }, 1000); | |
| 577 | + } | |
| 578 | + }, 100); | |
| 579 | + } | |
| 580 | + | |
| 581 | + props.onSaveState({ | |
| 582 | + pageLoading: false, | |
| 583 | + }); | |
| 584 | + return iResult; | |
| 585 | +}; | |
| 586 | + | |
| 587 | +// 存储过程按钮调用存储过程 | |
| 588 | +const handleProcedureCall = async (props, btnConfig, proName, proInParam, other) => { | |
| 589 | + const { app, sModelsId } = props; | |
| 590 | + let iResult = 0; | |
| 591 | + const sBtnName = btnConfig.sControlName; | |
| 592 | + const value = { sProName: proName, sProInParam: proInParam, sBtnName }; | |
| 593 | + if (other?.iFlag === 1) { | |
| 594 | + value.iFlag = 1; | |
| 595 | + } | |
| 596 | + const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | |
| 597 | + // const url = ''; | |
| 598 | + const returnData = (await commonServices.postValueService(app.token, value, url)).data; | |
| 599 | + if (proName === "Sp_BtnEven_CalcJsHs") { | |
| 600 | + if (returnData.code === 1) { | |
| 601 | + message.success(returnData.msg); | |
| 602 | + } else { | |
| 603 | + message.warning(returnData.msg); | |
| 604 | + } | |
| 605 | + const proInParamJson = commonUtils.convertStrToObj(proInParam); | |
| 606 | + const sId = proInParamJson.params?.[0]?.value?.[0]?.sId; | |
| 607 | + const { slave3Data = [] } = props; | |
| 608 | + const iIndex = slave3Data.findIndex(item => item.sId === sId); | |
| 609 | + if (iIndex !== -1) { | |
| 610 | + slave3Data[iIndex].sCalcProDetail = returnData.msg; | |
| 611 | + props.onSaveState({ slave3Data }); | |
| 612 | + } | |
| 613 | + props.onExecInstructSet({ | |
| 614 | + btnConfig: { | |
| 615 | + showName: "刷新", | |
| 616 | + sInstruct: JSON.stringify([ | |
| 617 | + { | |
| 618 | + opr: "refresh", | |
| 619 | + }, | |
| 620 | + ]) | |
| 621 | + } | |
| 622 | + }); | |
| 623 | + } else if (returnData.code === 1) { | |
| 624 | + message.success(returnData.msg); | |
| 625 | + // props.onButtonClick("BtnRefresh"); | |
| 626 | + } else if (returnData.code === -8) { | |
| 627 | + Modal.info({ | |
| 628 | + title: "温馨提示:", | |
| 629 | + content: <div>{handleGetMsg(returnData.msg)}</div>, | |
| 630 | + okText: "确认", | |
| 631 | + onOk() { }, | |
| 632 | + }); | |
| 633 | + } else { | |
| 634 | + props.getServiceError({ ...returnData, fn: () => handleProcedureCall(props, btnConfig, proName, proInParam, { iFlag: 1 }) }); | |
| 635 | + } | |
| 636 | + iResult = returnData.code; | |
| 637 | + props.onSaveState({ loading: false }); | |
| 638 | + // 点击返回重排的时候刷新树 | |
| 639 | + if (btnConfig.sControlName === "BtnEventReturn") { | |
| 640 | + if (props.refreshTreeData) { | |
| 641 | + props.refreshTreeData(); | |
| 642 | + } | |
| 643 | + } | |
| 644 | + return iResult; | |
| 645 | +}; | |
| 646 | +/* 调用后台配置的接口 */ | |
| 647 | +const handleInterfaceCall = async (props, obj, showTip, key, ids, slaveSelectedRowKeysOld) => { | |
| 648 | + let bResult = false; | |
| 649 | + const { app, sModelsId, masterData, slaveData, masterConfig, slaveFilterCondition } = props; | |
| 650 | + const slaveSelectedRowKeys = slaveSelectedRowKeysOld || props.slaveSelectedRowKeys; | |
| 651 | + const sInterfaceName = obj.sInterfaceName; | |
| 652 | + /* 如果key是BtnSendList 传从表的主键集合 */ | |
| 653 | + let idArr = ""; | |
| 654 | + /* 如果有对应字段 则取对应字段 ,否则 取默认值 */ | |
| 655 | + const btnConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)) | |
| 656 | + ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0] | |
| 657 | + : {}; | |
| 658 | + | |
| 659 | + let sActiveKey = ""; | |
| 660 | + if (commonUtils.isNotEmptyObject(btnConfig)) { | |
| 661 | + sActiveKey = btnConfig.sActiveKey; | |
| 662 | + } | |
| 663 | + if (sActiveKey) { | |
| 664 | + if (sActiveKey.includes("master.sId")) { | |
| 665 | + idArr = masterData.sId; | |
| 666 | + } | |
| 667 | + } else if (key && (key.includes("BtnSendList") || key.includes("BtnBatchExamine"))) { | |
| 668 | + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { | |
| 669 | + slaveSelectedRowKeys.forEach(item => { | |
| 670 | + if (commonUtils.isNotEmptyObject(item)) { | |
| 671 | + idArr += `${item},`; | |
| 672 | + } | |
| 673 | + }); | |
| 674 | + idArr = commonUtils.isNotEmptyObject(idArr) ? idArr.substr(0, idArr.length - 1) : ""; | |
| 675 | + } | |
| 676 | + } else if (location.pathname.includes("commonList")) { | |
| 677 | + const { slaveSelectedRowKeys, slaveData } = props; | |
| 678 | + let { slaveSelectedData } = props; | |
| 679 | + if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) { | |
| 680 | + slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 681 | + } | |
| 682 | + const slaveSelectedDataNew = deteleObject(slaveSelectedData); // 删除sid重复的数据 | |
| 683 | + | |
| 684 | + if (commonUtils.isNotEmptyArr(slaveSelectedDataNew)) { | |
| 685 | + slaveSelectedDataNew.forEach(item => { | |
| 686 | + if (commonUtils.isNotEmptyObject(item)) { | |
| 687 | + idArr += `${item.sId},`; | |
| 688 | + } | |
| 689 | + }); | |
| 690 | + idArr = commonUtils.isNotEmptyObject(idArr) ? idArr.substr(0, idArr.length - 1) : ""; | |
| 691 | + } | |
| 692 | + if (commonUtils.isNotEmptyObject(ids)) { | |
| 693 | + /* 如果是勾选多行 则sId为循环的每一条 */ | |
| 694 | + idArr = ids; | |
| 695 | + } | |
| 696 | + } else { | |
| 697 | + idArr = masterData.sId; | |
| 698 | + } | |
| 699 | + const value = { | |
| 700 | + sId: commonUtils.isNotEmptyObject(idArr) ? idArr : commonUtils.isNotEmptyObject(ids) ? ids : masterData.sId, | |
| 701 | + sSlaveId: slaveSelectedRowKeys?.toString(), | |
| 702 | + masterData, | |
| 703 | + userInfo: app.userinfo, | |
| 704 | + }; | |
| 705 | + if (location.pathname.includes("commonList") && commonUtils.isNotEmptyArr(slaveFilterCondition)) { | |
| 706 | + value.bFilter = JSON.stringify(slaveFilterCondition); | |
| 707 | + } | |
| 708 | + const url = `${commonConfig.interface_host}interfaceDefine/callthirdparty/${sInterfaceName}?sModelsId=${sModelsId}`; | |
| 709 | + const returnData = (await commonServices.postValueService(app.token, value, url, app)).data; | |
| 710 | + if (showTip) { | |
| 711 | + if (!returnData || returnData.code < 0) { | |
| 712 | + if (commonUtils.isNotEmptyObject(returnData) && returnData.code === -8) { | |
| 713 | + Modal.info({ | |
| 714 | + title: "温馨提示:", | |
| 715 | + content: <div>{handleGetMsg(returnData.msg)}</div>, | |
| 716 | + okText: "确认", | |
| 717 | + onOk() { }, | |
| 718 | + }); | |
| 719 | + } else { | |
| 720 | + Modal.info({ | |
| 721 | + title: "温馨提示:", | |
| 722 | + content: <div>{handleGetMsg(returnData.msg)}</div>, | |
| 723 | + okText: "确认", | |
| 724 | + onOk() { }, | |
| 725 | + }); | |
| 726 | + return; | |
| 727 | + } | |
| 728 | + // message.error('同步INFOR失败!'); | |
| 729 | + return; | |
| 730 | + } else { | |
| 731 | + // message.success('同步INFOR成功!'); | |
| 732 | + } | |
| 733 | + } | |
| 734 | + if (!returnData) { | |
| 735 | + message.error("接口调用失败!"); | |
| 736 | + return false; | |
| 737 | + } | |
| 738 | + if (returnData.code === 1) { | |
| 739 | + bResult = true; | |
| 740 | + // message.success(returnData.msg); | |
| 741 | + } else if (returnData.code === 2) { | |
| 742 | + // Modal.info({ | |
| 743 | + // title: '温馨提示:', | |
| 744 | + // content: ( | |
| 745 | + // <div> | |
| 746 | + // {handleGetMsg(returnData.msg)} | |
| 747 | + // </div> | |
| 748 | + // ), | |
| 749 | + // okText: '确认', | |
| 750 | + // onOk() {}, | |
| 751 | + // }); | |
| 752 | + bResult = true; | |
| 753 | + } else if (returnData.code === -8) { | |
| 754 | + Modal.info({ | |
| 755 | + title: "温馨提示:", | |
| 756 | + content: <div>{handleGetMsg(returnData.msg)}</div>, | |
| 757 | + okText: "确认", | |
| 758 | + onOk() { }, | |
| 759 | + }); | |
| 760 | + bResult = false; | |
| 761 | + } else { | |
| 762 | + bResult = false; | |
| 763 | + props.getServiceError(returnData); | |
| 764 | + } | |
| 765 | + /* 若配置的是按钮后调用第三方, 则调用成功后 需要重新回刷一次数据 */ | |
| 766 | + if (commonUtils.isNotEmptyObject(obj) && obj.sInterfaceCallMethod === "2") { | |
| 767 | + if (bResult) { | |
| 768 | + props.onButtonClick("BtnRefresh"); | |
| 769 | + } | |
| 770 | + } | |
| 771 | + return bResult; | |
| 772 | +}; | |
| 87 | 773 | // 新增 |
| 88 | 774 | const handleAdd = (props) => { |
| 89 | 775 | const { slaveConfig } = props; |
| ... | ... | @@ -171,6 +857,9 @@ const handleScanFace = (props) => { |
| 171 | 857 | opr: "faceauth", |
| 172 | 858 | newDataset: "face" |
| 173 | 859 | }, |
| 860 | + { | |
| 861 | + opr: "refresh", | |
| 862 | + }, | |
| 174 | 863 | ]) |
| 175 | 864 | }, |
| 176 | 865 | inscallback: (result) => { | ... | ... |
src/mes/common/commonOperationBarComponent/index.js
| ... | ... | @@ -365,8 +365,8 @@ const useCommonOperationBarComponentEvent = props => { |
| 365 | 365 | } else if (location.pathname.includes("commonList")) { |
| 366 | 366 | const { slaveSelectedRowKeys, slaveData } = props; |
| 367 | 367 | let { slaveSelectedData } = props; |
| 368 | - if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) { | |
| 369 | - slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 368 | + if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData) && slaveSelectedRowKeys) { | |
| 369 | + slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys?.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId)); | |
| 370 | 370 | } |
| 371 | 371 | const slaveSelectedDataNew = deteleObject(slaveSelectedData); // 删除sid重复的数据 |
| 372 | 372 | |
| ... | ... | @@ -621,11 +621,10 @@ const useCommonOperationBarComponentEvent = props => { |
| 621 | 621 | }; |
| 622 | 622 | |
| 623 | 623 | const { sDefault, sControlName } = config; |
| 624 | - | |
| 625 | 624 | const delayedOvertime = commonFunc.showLocalMessage(props, 'delayedOvertime', '延迟加班'); |
| 626 | 625 | const cancelDelayedOvertime = commonFunc.showLocalMessage(props, 'cancelDelayedOvertime', '取消延迟加班'); |
| 627 | - | |
| 628 | - | |
| 626 | + const { masterData = {} } = props | |
| 627 | + let { bCheck , bSubmit} = masterData | |
| 629 | 628 | // 根据sDefault配置控制按钮是否可以操作 |
| 630 | 629 | if (sDefault && sDefault.includes("${")) { |
| 631 | 630 | // 当前页面全部数据 |
| ... | ... | @@ -740,13 +739,22 @@ const useCommonOperationBarComponentEvent = props => { |
| 740 | 739 | } else if (props.bMesBill) { |
| 741 | 740 | const btnName = sControlName.replace('BtnLeft.', '').replace('BtnRight.', '').toLowerCase(); |
| 742 | 741 | if (props.enabled) { |
| 743 | - if (["btnupd"].includes(btnName)) { | |
| 742 | + if (["btnupd", 'btnevent', 'btnsubmit', 'btnsubmitcancel'].includes(btnName)) { | |
| 744 | 743 | defaultProps.disabled = true; |
| 745 | 744 | } |
| 746 | 745 | } else { |
| 747 | 746 | if (["btnsave", "btnscanface"].includes(btnName)) { |
| 748 | 747 | defaultProps.disabled = true; |
| 749 | 748 | } |
| 749 | + if (!bSubmit) { | |
| 750 | + if (["btnsubmitcancel"].includes(btnName)) { | |
| 751 | + defaultProps.disabled = true; | |
| 752 | + } | |
| 753 | + } else { | |
| 754 | + if (['btnevent', 'btnsubmit'].includes(btnName)) { | |
| 755 | + defaultProps.disabled = true; | |
| 756 | + } | |
| 757 | + } | |
| 750 | 758 | } |
| 751 | 759 | } |
| 752 | 760 | |
| ... | ... | @@ -814,6 +822,8 @@ const useCommonOperationBarComponentEvent = props => { |
| 814 | 822 | style.color = "#000"; |
| 815 | 823 | defaultProps.style = style; |
| 816 | 824 | } |
| 825 | + console.log(defaultProps, 'defaultProps'); | |
| 826 | + | |
| 817 | 827 | return defaultProps; |
| 818 | 828 | }; |
| 819 | 829 | ... | ... |
src/mes/costomPageFun/index.js
src/utils/config.js
| ... | ... | @@ -4,10 +4,10 @@ const bHttps = location.protocol === 'https:'; |
| 4 | 4 | export const webSite = { |
| 5 | 5 | // ipAddress: '//t0.xlyprint.com:8000/xlyEntry/', /* 服务器地址 */ |
| 6 | 6 | // faceAddress: isDev ? '//192.168.11.22:8080/xlyFace' : '//' + location.host + '/xlyFace', |
| 7 | - fileAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyReport/' : '//' + location.host + '/xlyReport/', // 接口地址 | |
| 8 | - faceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyFace' : '//' + location.host + '/xlyFace', | |
| 9 | - ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:43920/xlyEntry/' : '//' + location.host + '/xlyEntry/', | |
| 10 | - interfaceAddress: isDev ? '//km5cjx.gnway.cc:43920/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 | |
| 7 | + fileAddress: isDev ? '//km5cjx.gnway.cc:47400/xlyReport/' : '//' + location.host + '/xlyReport/', // 接口地址 | |
| 8 | + faceAddress: isDev ? '//km5cjx.gnway.cc:47400/xlyFace' : '//' + location.host + '/xlyFace', | |
| 9 | + ipAddress: localStorage.ipAddress ? localStorage.ipAddress : isDev ? '//km5cjx.gnway.cc:47400/xlyEntry/' : '//' + location.host + '/xlyEntry/', | |
| 10 | + interfaceAddress: isDev ? '//km5cjx.gnway.cc:47400/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 | |
| 11 | 11 | // ipAddress: isDev ? '//ebc.jinjia.com:8091/xlyEntry/' : '//' + location.host + '/xlyEntry/', |
| 12 | 12 | // interfaceAddress: isDev ? '//ebc.jinjia.com:8091/xlyApi/' : '//' + location.host + '/xlyApi/', // 接口地址 |
| 13 | 13 | // ipAddress: isDev ? '//192.168.11.26:8080/xlyEntry/' : '//' + location.host + '/xlyEntry/', | ... | ... |