| | |
| | | {code: 'openProject', name: '打开工程', prefixIcon: 'vxe-icon-folder-open'}, |
| | | {code: 'compute', name: '模拟计算', prefixIcon: 'vxe-icon-subtable'}, |
| | | //{code: 'optimizeTypography', name: '优化排版', prefixIcon: 'vxe-icon-menu'}, |
| | | {code: 'production', name: '允许生产', prefixIcon: 'vxe-icon-square-checked'}, |
| | | {code: 'novisible', name: '生产不可见', prefixIcon: 'vxe-icon-eye-fill-close'}, |
| | | {code: 'production', name: '确认生产', prefixIcon: 'vxe-icon-square-checked'}, |
| | | {code: 'novisible', name: '取消生产', prefixIcon: 'vxe-icon-eye-fill-close'}, |
| | | {code: 'copyproject', name: '复刻工程', prefixIcon: 'vxe-icon-copy'}, |
| | | {code: 'undoOptimize', name: '撤销优化', prefixIcon: 'vxe-icon-error-circle-fill'}, |
| | | {code: 'undoCompute', name: '撤销模拟计算', prefixIcon: 'vxe-icon-error-circle-fill'}, |
| | |
| | | { |
| | | code: 'production', |
| | | initialState: 1, |
| | | temperingState: 1, |
| | | // temperingState: 1, |
| | | optimizeState: 1, |
| | | targetState: 100, |
| | | targetStates: 0, |
| | |
| | | { |
| | | code: 'novisible', |
| | | initialState: 100, |
| | | temperingState: 1, |
| | | // temperingState: 1, |
| | | optimizeState: 1, |
| | | targetState: 1, |
| | | targetStates: 0, |
| | |
| | | return; |
| | | } |
| | | if (config.code === 'compute') { |
| | | // 增加逻辑:检查钢化模拟列是否已经是"是" |
| | | if (row.temperingState === 1) { |
| | | ElMessage.warning('该项目已模拟计算'); |
| | | return; |
| | | } |
| | | if(row.state===1 && row.temperingState===0){ |
| | | config.actionFunction({row}); |
| | | }else{ |
| | |
| | | xGrid.value.reloadData(produceList.value); |
| | | } |
| | | |
| | | // 显示成功消息 |
| | | ElMessage.success(config.successMsg); |
| | | }else{ |
| | | ElMessage.warning(config.checkMessage); |
| | | return; |
| | | } |
| | | } |
| | | else if(config.code === 'production'){ |
| | | if(row.temperingState==1&&row.optimizeState===1&&row.state===1){ |
| | | if(row.optimizeState===1&&row.state===1){ |
| | | row.state = config.targetState; |
| | | code=3 |
| | | }else{ |
| | |
| | | } |
| | | } |
| | | |
| | | function updateProjectStateAndHandleResponse(row, projectNumber, targetState,targetStates,code, successMsg) { |
| | | function updateProjectStateAndHandleResponse(row, projectNumber, targetState, targetStates, code, successMsg) { |
| | | const updateParams = { |
| | | projectNumber: projectNumber, |
| | | stateToUpdate: targetState, |
| | |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then((res) => { |
| | | // 检查业务状态码,如果是201则抛出错误以在catch中处理 |
| | | if (Number(res.code) === 201) { |
| | | // 抛出自定义错误对象,包含后端返回的msg信息 |
| | | throw new Error(res.msg || '操作失败'); |
| | | } |
| | | if (Number(res.code) === 200 && (res.msg === "" || res.msg === null)) { |
| | | ElMessage.success(successMsg); |
| | | } else { |
| | |
| | | } |
| | | }).catch((error) => { |
| | | console.error('请求出错,操作未完成,详细错误信息:', error); |
| | | const errorMsg = (res.data && res.data.errorMessage) ? res.data.errorMessage : '操作失败,未获取到具体原因,请联系管理员'; |
| | | ElMessage.error(`请求出错,操作未完成,原因: ${errorMsg}`); |
| | | //const errorMsg = (res.data && res.data.errorMessage) ? res.data.errorMessage : '操作失败,未获取到具体原因,请联系管理员'; |
| | | ElMessage.error(`请求出错,操作未完成 `+error); |
| | | rollbackStateAndReloadGrid(row, targetState); // 调用回滚函数 |
| | | }); |
| | | } |