Merge branch 'refs/heads/xusd'

# Conflicts:
#	imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java
This commit is contained in:
xusd 2024-10-08 15:20:26 +08:00
commit cce28a2f1a
8 changed files with 334 additions and 38 deletions

View File

@ -107,9 +107,9 @@ public class MaintenanceOrderController {
@Operation(summary = "提交审批") @Operation(summary = "提交审批")
@PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:submitApprove')") @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:submitApprove')")
@GetMapping("/submitApprove/{id}") @PostMapping("/submitApprove")
public Boolean submitApprove(@PathVariable("id") String id){ public Boolean submitApprove(@Valid @RequestBody MaintenanceSubmitApproveVO vo){
return maintenanceOrderService.submitApprove(id); return maintenanceOrderService.submitApprove(vo);
} }
@Operation(summary = "根据设备id获取故障次数") @Operation(summary = "根据设备id获取故障次数")

View File

@ -0,0 +1,24 @@
package com.inspur.module.system.controller.maintenance.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @Author xusd
* @Date 2024/9/19 17:51
**/
@Data
public class MaintenanceSubmitApproveVO {
@Schema(description = "维修工单id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "维修工单id不能为空")
private String maintenanceOrderId;
@Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
private Map<String, List<Long>> startUserSelectAssignees;
}

View File

@ -95,10 +95,10 @@ public interface MaintenanceOrderService {
* *
* @Author xusd * @Author xusd
* @Date 18:19 2024/9/12 * @Date 18:19 2024/9/12
* @param id * @param vo
* @return java.lang.Boolean * @return java.lang.Boolean
*/ */
Boolean submitApprove(String id); Boolean submitApprove(MaintenanceSubmitApproveVO vo);
/** /**
* 根据设备id获取故障次数 * 根据设备id获取故障次数

View File

@ -234,20 +234,19 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean submitApprove(String id) { public Boolean submitApprove(MaintenanceSubmitApproveVO vo) {
// 发起 BPM 流程 // 发起 BPM 流程
// Map<String, Object> processInstanceVariables = new HashMap<>(); // Map<String, Object> processInstanceVariables = new HashMap<>();
// processInstanceVariables.put("day", day); // processInstanceVariables.put("day", day);
Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(), String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(),
new BpmProcessInstanceCreateReqDTO() new BpmProcessInstanceCreateReqDTO()
.setProcessDefinitionKey(PROCESS_KEY) .setProcessDefinitionKey(PROCESS_KEY)
// .setVariables(processInstanceVariables) // .setVariables(processInstanceVariables)
.setBusinessKey(String.valueOf(id)) .setBusinessKey(vo.getMaintenanceOrderId())
.setStartUserSelectAssignees(startUserSelectAssignees)); .setStartUserSelectAssignees(vo.getStartUserSelectAssignees()));
// 将工作流的编号状态审批状态更新到 业务表 // 将工作流的编号状态审批状态更新到 业务表
return maintenanceOrderMapper.updateById(new MaintenanceOrderDO() return maintenanceOrderMapper.updateById(new MaintenanceOrderDO()
.setMaintenanceOrderId(id) .setMaintenanceOrderId(vo.getMaintenanceOrderId())
.setProcessInstanceId(processInstanceId) .setProcessInstanceId(processInstanceId)
.setStatus(1) .setStatus(1)
.setApproveStatus(1)) > 0; .setApproveStatus(1)) > 0;

View File

@ -70,10 +70,11 @@ export function getRemoteMaintenanceOrderRecord(id) {
} }
// 提交审批 // 提交审批
export function submitMaintenanceApprove(id) { export function submitMaintenanceApprove(data) {
return request({ return request({
url: '/maintenance/submitApprove/' + id, url: '/maintenance/submitApprove',
method: 'get' method: 'post',
data: data
}) })
} }

View File

@ -33,10 +33,45 @@
<span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span> <span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span>
<el-button style="float: right;" type="primary" @click="selectProcessInstance = undefined">选择其它流程</el-button> <el-button style="float: right;" type="primary" @click="selectProcessInstance = undefined">选择其它流程</el-button>
</div> </div>
<el-col :span="16" :offset="6"> <el-col :span="16" :offset="6" style="margin-top: 20px">
<div> <div>
<parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> <parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" />
</div> </div>
<div>
<template>
<el-col :span="24">
<el-card class="mb-10px">
<template>指定审批人</template>
<el-form
:model="startUserSelectAssignees"
:rules="startUserSelectAssigneesFormRules"
ref="startUserSelectAssigneesFormRef"
>
<el-form-item
v-for="userTask in startUserSelectTasks"
:key="userTask.id"
:label="`任务【${userTask.name}】`"
:prop="userTask.id"
>
<el-select
v-model="startUserSelectAssignees[userTask.id]"
multiple
placeholder="请选择审批人"
style="width: 100%"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:value="user.id"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
</el-col>
</template>
</div>
</el-col> </el-col>
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
@ -61,6 +96,7 @@ import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {decodeFields} from "@/utils/formGenerator"; import {decodeFields} from "@/utils/formGenerator";
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import {createProcessInstance} from "@/api/bpm/processInstance"; import {createProcessInstance} from "@/api/bpm/processInstance";
import {listSimpleUsers} from '@/api/system/user'
import {getModel} from "@/api/bpm/model"; import {getModel} from "@/api/bpm/model";
// //
@ -71,6 +107,7 @@ export default {
}, },
data() { data() {
return { return {
test:[],
// //
loading: true, loading: true,
// //
@ -95,6 +132,9 @@ export default {
// //
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
startUserSelectAssigneesFormRules:{},
startUserSelectTasks:[],
userList:[],
}; };
}, },
created() { created() {
@ -123,24 +163,49 @@ export default {
}, },
/** 处理选择流程的按钮操作 **/ /** 处理选择流程的按钮操作 **/
handleSelect(row) { handleSelect(row) {
console.log("row",row);
// //
this.selectProcessInstance = row; this.selectProcessInstance = row;
console.log(row) this.startUserSelectAssignees = {}
console.log("row",row)
// //
if (row.formId) { if (row.formType === 10) {
//
getProcessDefinitionBpmnXML(row.id).then(async response => {
console.log("response.data", response.data)
this.bpmnXML = response.data.bpmnXml;
this.startUserSelectTasks = response.data.startUserSelectTasks;
//
if (this.startUserSelectTasks.length > 0) {
console.log("this.startUserSelectTasks",this.startUserSelectTasks)
// this.detailForm.formRules.push({
// type: 'startUserSelect',
// props: {
// title: ''
// }
// })
//
for (const userTask of this.startUserSelectTasks) {
this.$set(this.startUserSelectAssignees, userTask.id, []);
this.$set(this.startUserSelectAssigneesFormRules, userTask.id, [{required: true, message: '请选择审批人', trigger: 'change'}]);
}
//
await listSimpleUsers().then(res=>{
this.userList = res.data;
console.log("this.userList",this.userList);
})
}
console.log("this.startUserSelectAssigneesFormRules",this.startUserSelectAssigneesFormRules)
// //
this.detailForm = { this.detailForm = {
...JSON.parse(row.formConf), ...JSON.parse(row.formConf),
fields: decodeFields(row.formFields) fields: decodeFields(row.formFields),
formRules: this.startUserSelectAssigneesFormRules,
} }
console.log("this.detailForm",this.detailForm)
//
getProcessDefinitionBpmnXML(row.id).then(response => {
this.bpmnXML = response.data.bpmnXml;
}) })
} else if (row.formCustomCreatePath) { } else if (row.formCustomCreatePath) {
this.$router.push({ path: row.formCustomCreatePath}); this.$router.push({ path: row.formCustomCreatePath, query: { id: row.id}});
// Tab
} }
}, },
/** 提交按钮 */ /** 提交按钮 */

View File

@ -79,7 +79,36 @@
<!-- <el-input v-model="formData.processInstanceId" placeholder="请输入流程实例编号"/>--> <!-- <el-input v-model="formData.processInstanceId" placeholder="请输入流程实例编号"/>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer" style="text-align: center"> <el-card class="mb-10px" v-if="this.startUserSelectTasks.length > 0">
<template>指定审批人</template>
<el-form
:model="startUserSelectAssignees"
:rules="startUserSelectAssigneesFormRules"
ref="startUserSelectAssigneesFormRef"
>
<el-form-item
v-for="userTask in startUserSelectTasks"
:key="userTask.id"
:label="`任务【${userTask.name}】`"
:prop="userTask.id"
>
<el-select
v-model="startUserSelectAssignees[userTask.id]"
multiple
placeholder="请选择审批人"
style="width: 100%"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:value="user.id"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
<div slot="footer" class="dialog-footer" style="text-align: center;margin-top: 20px">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button> <el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<!-- <el-button @click="dialogVisible = false"> </el-button>--> <!-- <el-button @click="dialogVisible = false"> </el-button>-->
</div> </div>
@ -92,12 +121,17 @@ import {getEquipCascader} from "@/api/system/equip/equipInfo";
import {getComponentSelection} from "@/api/system/equip/componentInfo"; import {getComponentSelection} from "@/api/system/equip/componentInfo";
import {getCustomerSelection} from "@/api/system/baseData/customerInfo"; import {getCustomerSelection} from "@/api/system/baseData/customerInfo";
import {listSimpleUsers} from "@/api/system/user"; import {listSimpleUsers} from "@/api/system/user";
import {getProcessDefinitionBpmnXML} from "@/api/bpm/definition";
import {decodeFields} from "@/utils/formGenerator";
export default { export default {
name: "RemoteMaintenanceOrderForm", name: "RemoteMaintenanceOrderForm",
data() { data() {
return { return {
startUserSelectAssignees:{},
startUserSelectAssigneesFormRules:{},
startUserSelectTasks:[],
userList:[], userList:[],
cascaderValue:[], cascaderValue:[],
equipCascader:[], equipCascader:[],
@ -129,17 +163,18 @@ export default {
// //
// //
formRules: { formRules: {
equipId: [{ required: true, message: '机床设备不能为空', trigger: 'blur' }], equipId: [{ required: true, message: '机床设备不能为空', trigger: 'change' }],
componentId: [{ required: true, message: '机床组件不能为空', trigger: 'blur' }], componentId: [{ required: true, message: '机床组件不能为空', trigger: 'change' }],
faultType: [{ required: true, message: '故障类型不能为空', trigger: 'blur' }], faultType: [{ required: true, message: '故障类型不能为空', trigger: 'change' }],
description: [{ required: true, message: '故障描述不能为空', trigger: 'blur' }], description: [{ required: true, message: '故障描述不能为空', trigger: 'change' }],
priority: [{ required: true, message: '优先级不能为空', trigger: 'blur' }], priority: [{ required: true, message: '优先级不能为空', trigger: 'change' }],
customerId: [{ required: true, message: '机床客户信息不能为空', trigger: 'blur' }], customerId: [{ required: true, message: '机床客户信息不能为空', trigger: 'blur' }],
}, },
}; };
}, },
created() { created() {
this.initSelection(); this.initSelection();
this.getApproverForm();
}, },
methods: { methods: {
//() //()
@ -211,13 +246,37 @@ export default {
} }
this.dialogTitle = "新增远程维修工单"; this.dialogTitle = "新增远程维修工单";
}, },
getApproverForm(){
//
getProcessDefinitionBpmnXML(this.$route.query.id).then(async response => {
console.log("response.data", response.data)
this.bpmnXML = response.data.bpmnXml;
this.startUserSelectTasks = response.data.startUserSelectTasks;
//
if (this.startUserSelectTasks.length > 0) {
console.log("this.startUserSelectTasks",this.startUserSelectTasks)
//
for (const userTask of this.startUserSelectTasks) {
this.$set(this.startUserSelectAssignees, userTask.id, []);
this.$set(this.startUserSelectAssigneesFormRules, userTask.id, [{required: true, message: '请选择审批人', trigger: 'change'}]);
}
}
console.log("this.startUserSelectAssigneesFormRules",this.startUserSelectAssigneesFormRules)
console.log("this.startUserSelectAssignees",this.startUserSelectAssignees);
})
},
/** 提交按钮 */ /** 提交按钮 */
async submitForm() { async submitForm() {
console.log("this.startUserSelectAssignees",this.startUserSelectAssignees);
console.log(this.formData) console.log(this.formData)
// //
await this.$refs["formRef"].validate(); await this.$refs["formRef"].validate();
if (this.startUserSelectTasks.length > 0){
await this.$refs["startUserSelectAssigneesFormRef"].validate();
}
this.formData.status = 1; this.formData.status = 1;
console.log(this.formData) console.log(this.formData)
this.formData.startUserSelectAssignees = this.startUserSelectAssignees;
await RemoteMaintenanceOrderApi.createRemoteMaintenanceOrder(this.formData) await RemoteMaintenanceOrderApi.createRemoteMaintenanceOrder(this.formData)
this.$modal.msgSuccess("提交成功"); this.$modal.msgSuccess("提交成功");
this.$tab.closeOpenPage({ path: "/maintenance/remote-maintenance-order" }); this.$tab.closeOpenPage({ path: "/maintenance/remote-maintenance-order" });

View File

@ -108,7 +108,7 @@
</el-button> </el-button>
<el-button v-if="scope.row.status !== 0" size="mini" type="text" icon="el-icon-coordinate" @click="openApproveRecord(scope.row.processInstanceId)">审批记录 <el-button v-if="scope.row.status !== 0" size="mini" type="text" icon="el-icon-coordinate" @click="openApproveRecord(scope.row.processInstanceId)">审批记录
</el-button> </el-button>
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-promotion" @click="submitApprove(scope.row)" <el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-promotion" @click="openSubmitApprove(scope.row)"
v-hasPermi="['imt:remote-maintenance-order:submitApprove']">提交审批 v-hasPermi="['imt:remote-maintenance-order:submitApprove']">提交审批
</el-button> </el-button>
</template> </template>
@ -120,6 +120,105 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<RemoteMaintenanceOrderForm ref="formRef" @success="getList"/> <RemoteMaintenanceOrderForm ref="formRef" @success="getList"/>
<approve-record ref="approve" /> <approve-record ref="approve" />
<!-- 指定审批人弹窗 -->
<el-dialog title="选择指定审批人" :visible.sync="submitApproveOpen" append-to-body>
<el-form
:model="submitApproveForm"
:rules="startUserSelectAssigneesFormRules"
ref="submitApproveForm"
>
<el-col :span="12">
<el-form-item label="维修工单:" prop="maintenanceOrderNo">
{{ submitApproveForm.maintenanceOrderNo }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机床设备:" prop="equipName">
{{ submitApproveForm.equipNo }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机床组件:" prop="componentName">
{{ submitApproveForm.componentName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机床客户信息:" prop="customerName">
{{ submitApproveForm.customerName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="故障类型:" prop="faultType">
<dict-tag :type="DICT_TYPE.FAULT_TYPE" :value="submitApproveForm.faultType"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="故障描述:" prop="description">
{{ submitApproveForm.description }}
</el-form-item>
</el-col>
<el-form-item label="优先级:" prop="priority">
<dict-tag :type="DICT_TYPE.MAINTENANCE_PRIORITY" :value="submitApproveForm.priority"/>
</el-form-item>
<!-- <el-card class="mb-10px">-->
<!-- <template>指定审批人</template>-->
<!-- <el-form-item-->
<!-- v-for="userTask in startUserSelectTasks"-->
<!-- :key="userTask.id"-->
<!-- :label="`任务【${userTask.name}】`"-->
<!-- :prop="userTask.id"-->
<!-- >-->
<!-- <el-select-->
<!-- v-model="startUserSelectAssignees[userTask.id]"-->
<!-- multiple-->
<!-- placeholder="请选择审批人"-->
<!-- style="width: 100%"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="user in userList"-->
<!-- :key="user.id"-->
<!-- :label="user.nickname"-->
<!-- :value="user.id"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-card>-->
</el-form>
<el-card class="mb-10px" v-if="this.startUserSelectTasks.length > 0">
<template>指定审批人</template>
<el-form
:model="startUserSelectAssignees"
:rules="startUserSelectAssigneesFormRules"
ref="startUserSelectAssigneesFormRef"
>
<el-form-item
v-for="userTask in startUserSelectTasks"
:key="userTask.id"
:label="`任务【${userTask.name}】`"
:prop="userTask.id"
>
<el-select
v-model="startUserSelectAssignees[userTask.id]"
multiple
placeholder="请选择审批人"
style="width: 100%"
>
<el-option
v-for="user in userList"
:key="user.id"
:label="user.nickname"
:value="user.id"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
<div slot="footer" class="dialog-footer" style="text-align: right;">
<el-button type="primary" @click="submitApprove(submitApproveForm.maintenanceOrderId)" v-hasPermi="['imt:remote-maintenance-order:submitApprove']"> </el-button>
<el-button @click="closeSubmitApprove"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -131,6 +230,8 @@ import {getCustomerSelection} from '@/api/system/baseData/customerInfo'
import RemoteMaintenanceOrderForm from './RemoteMaintenanceOrderForm.vue'; import RemoteMaintenanceOrderForm from './RemoteMaintenanceOrderForm.vue';
import {DICT_TYPE} from "@/utils/dict"; import {DICT_TYPE} from "@/utils/dict";
import ApproveRecord from "@/views/bpm/processInstance/approveRecord.vue"; import ApproveRecord from "@/views/bpm/processInstance/approveRecord.vue";
import {getProcessDefinitionBpmnXML} from "@/api/bpm/definition";
import {listSimpleUsers} from "@/api/system/user";
export default { export default {
name: "RemoteMaintenanceOrder", name: "RemoteMaintenanceOrder",
@ -145,6 +246,12 @@ export default {
}, },
data() { data() {
return { return {
submitApproveForm:{},
startUserSelectAssignees:{},
startUserSelectAssigneesFormRules:{},
startUserSelectTasks:[],
userList:[],
submitApproveOpen: false,
cascaderValue:[], cascaderValue:[],
equipCascader:[], equipCascader:[],
componentSelection:[], componentSelection:[],
@ -181,14 +288,55 @@ export default {
this.initSelection(); this.initSelection();
}, },
methods: { methods: {
submitApprove(row){ closeSubmitApprove(){
this.submitApproveOpen = false;
this.$refs.startUserSelectAssigneesFormRef.resetFields();
},
openSubmitApprove(row){
const maintenanceOrderId = row.maintenanceOrderId; const maintenanceOrderId = row.maintenanceOrderId;
this.$modal.confirm('是否确认提交维修工单编号为"' + row.maintenanceOrderNo + '"的数据项?').then(()=>{ console.log(maintenanceOrderId);
this.loading = true; //
RemoteMaintenanceOrderApi.submitMaintenanceApprove(maintenanceOrderId).then(res=>{ getProcessDefinitionBpmnXML(null,"maintenance_approve").then(async response => {
this.getList(); console.log("response.data", response.data)
this.$modal.msgSuccess("提交审批成功"); this.bpmnXML = response.data.bpmnXml;
this.startUserSelectTasks = response.data.startUserSelectTasks;
//
if (this.startUserSelectTasks.length > 0) {
this.submitApproveOpen = true;
RemoteMaintenanceOrderApi.getRemoteMaintenanceOrderRecord(maintenanceOrderId).then(res=>{
console.log("res.data",res.data);
this.submitApproveForm = res.data;
}) })
listSimpleUsers().then(res=>{
this.userList = res.data;
})
console.log("this.startUserSelectTasks",this.startUserSelectTasks)
//
for (const userTask of this.startUserSelectTasks) {
this.$set(this.startUserSelectAssignees, userTask.id, []);
this.$set(this.startUserSelectAssigneesFormRules, userTask.id, [{required: true, message: '请选择审批人', trigger: 'change'}]);
}
}else {
this.$modal.confirm('是否确认提交维修工单编号为"' + row.maintenanceOrderNo + '"的数据项?').then(()=>{
this.submitApprove(row.maintenanceOrderId);
})
}
})
},
async submitApprove(maintenanceOrderId){
console.log(maintenanceOrderId);
if (this.startUserSelectTasks.length > 0) {
await this.$refs.startUserSelectAssigneesFormRef.validate();
}
const data = {
maintenanceOrderId:maintenanceOrderId,
startUserSelectAssignees: this.startUserSelectAssignees
}
await RemoteMaintenanceOrderApi.submitMaintenanceApprove(data).then(res=>{
this.loading = true;
this.$modal.msgSuccess("提交审批成功");
this.submitApproveOpen = false;
this.getList();
}) })
}, },
openApproveRecord(approveId){ openApproveRecord(approveId){