维修工单中心新增修改工单以及控制按钮显示
This commit is contained in:
parent
f0720d360b
commit
cbbf76a8b8
@ -43,6 +43,7 @@ public class MaintenanceOrderSaveReqVO {
|
||||
private Date completeTime;
|
||||
|
||||
@Schema(description = "状态")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "维修人id")
|
||||
|
@ -75,11 +75,17 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
|
||||
// 插入
|
||||
MaintenanceOrderDO remoteMaintenanceOrder = BeanUtils.toBean(createReqVO, MaintenanceOrderDO.class);
|
||||
remoteMaintenanceOrder.setMaintenanceOrderNo("WXGD" + DateUtil.format(new Date(),"yyyyMMddHHmmss") + RandomUtil.randomInt(1, 10));
|
||||
//设置为审批中
|
||||
remoteMaintenanceOrder.setStatus(1);
|
||||
//等于1的时候是在审批流程那边提交的
|
||||
if (createReqVO.getStatus() == 1){
|
||||
//设置为审批中
|
||||
remoteMaintenanceOrder.setApproveStatus(1);
|
||||
}else {
|
||||
//设置为待审批
|
||||
remoteMaintenanceOrder.setApproveStatus(0);
|
||||
}
|
||||
maintenanceOrderMapper.insert(remoteMaintenanceOrder);
|
||||
//等于1的时候是在审批流程那边提交的
|
||||
if (createReqVO.getStatus() == 1){
|
||||
// 发起 BPM 流程
|
||||
// Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
// processInstanceVariables.put("day", day);
|
||||
@ -91,6 +97,7 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
|
||||
|
||||
// 将工作流的编号,更新到 业务表 中
|
||||
maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(remoteMaintenanceOrder.getMaintenanceOrderId()).setProcessInstanceId(processInstanceId));
|
||||
}
|
||||
// 返回
|
||||
return remoteMaintenanceOrder.getMaintenanceOrderId();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.inspur.module.system.service.maintenance.listener;
|
||||
|
||||
import com.inspur.module.bpm.event.BpmProcessInstanceStatusEvent;
|
||||
import com.inspur.module.bpm.event.BpmProcessInstanceStatusEventListener;
|
||||
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
|
||||
import com.inspur.module.system.service.maintenance.MaintenanceOrderService;
|
||||
import com.inspur.module.system.service.maintenance.MaintenanceOrderServiceImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -27,6 +28,13 @@ public class MaintenanceStatusListener extends BpmProcessInstanceStatusEventList
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
System.out.println("MaintenanceStatusListener~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
|
||||
System.out.println(event);
|
||||
//如果是取消,把业务表的状态改为待提交
|
||||
if (event.getStatus() == 3 || event.getStatus() == 4){
|
||||
MaintenanceOrderDO maintenanceOrderDO = new MaintenanceOrderDO();
|
||||
maintenanceOrderDO.setMaintenanceOrderId(event.getBusinessKey());
|
||||
maintenanceOrderDO.setStatus(0);
|
||||
maintenanceOrderService.updateStatus(maintenanceOrderDO);
|
||||
}
|
||||
maintenanceOrderService.updateApproveStatus(event.getBusinessKey(),event.getStatus());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="160px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="机床设备" prop="equipId">
|
||||
<el-cascader
|
||||
v-model="cascaderValue"
|
||||
:options="equipCascader"
|
||||
:props="{ value: 'id',label: 'name',children: 'children'}"
|
||||
clearable
|
||||
@change="cascaderChange"></el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="机床组件" prop="componentId">
|
||||
<el-select v-model="formData.componentId" placeholder="请选择机床组件">
|
||||
<el-option v-for="item in componentSelection"
|
||||
:key="item.componentId" :label="item.componentName" :value="item.componentId"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="机床客户信息" prop="customerId">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择机床客户信息">
|
||||
<el-option v-for="item in customerSelection"
|
||||
:key="item.customerId" :label="item.customerName" :value="item.customerId"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="故障类型" prop="faultType">
|
||||
<el-select v-model="formData.faultType" placeholder="请选择故障类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.FAULT_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="优先级" prop="priority">
|
||||
<el-select v-model="formData.priority" placeholder="请选择优先级">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MAINTENANCE_PRIORITY)"
|
||||
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="故障描述" prop="description">
|
||||
<el-input v-model="formData.description" :rows="4" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as MaintenanceOrderApi from '@/api/system/maintenance/maintenance';
|
||||
import Editor from '@/components/Editor';
|
||||
import {getEquipCascader} from "@/api/system/equip/equipInfo";
|
||||
import {getComponentSelection} from "@/api/system/equip/componentInfo";
|
||||
import {getCustomerSelection} from "@/api/system/baseData/customerInfo";
|
||||
import {listSimpleUsers} from "@/api/system/user";
|
||||
export default {
|
||||
name: "MaintenanceOrderForm",
|
||||
components: {
|
||||
Editor,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userList:[],
|
||||
cascaderValue:[],
|
||||
equipCascader:[],
|
||||
componentSelection:[],
|
||||
customerSelection:[],
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
maintenanceOrderId: undefined,
|
||||
maintenanceOrderNo: undefined,
|
||||
diagnoiseReportId: undefined,
|
||||
equipId: undefined,
|
||||
componentId: undefined,
|
||||
faultType: undefined,
|
||||
description: undefined,
|
||||
priority: undefined,
|
||||
completeTime: undefined,
|
||||
status: undefined,
|
||||
executorId: undefined,
|
||||
processInstanceId: undefined,
|
||||
customerId: undefined,
|
||||
approveStatus: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
equipId: [{ required: true, message: '机床设备不能为空', trigger: 'blur' }],
|
||||
componentId: [{ required: true, message: '机床组件不能为空', trigger: 'blur' }],
|
||||
faultType: [{ required: true, message: '故障类型不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '故障描述不能为空', trigger: 'blur' }],
|
||||
priority: [{ required: true, message: '优先级不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '机床客户信息不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initSelection();
|
||||
},
|
||||
methods: {
|
||||
//回显(多级)
|
||||
changeDetSelect(key, treeData) {
|
||||
let arr = []; // 在递归时操作的数组
|
||||
let returnArr = []; // 存放结果的数组
|
||||
let depth = 0; // 定义全局层级
|
||||
// 定义递归函数
|
||||
function childrenEach(childrenData, depthN) {
|
||||
for (var j = 0; j < childrenData.length; j++) {
|
||||
depth = depthN; // 将执行的层级赋值 到 全局层级
|
||||
arr[depthN] = childrenData[j].id;
|
||||
if (childrenData[j].id === key) {
|
||||
returnArr = arr.slice(0, depthN + 1); //将目前匹配的数组,截断并保存到结果数组,
|
||||
break;
|
||||
} else {
|
||||
if (childrenData[j].children) {
|
||||
depth++;
|
||||
childrenEach(childrenData[j].children, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnArr;
|
||||
}
|
||||
return childrenEach(treeData, depth);
|
||||
},
|
||||
cascaderChange(value){
|
||||
if (value.length > 0){
|
||||
this.formData.equipId = value[1];
|
||||
}else {
|
||||
this.formData.equipId = null;
|
||||
}
|
||||
},
|
||||
initSelection(){
|
||||
getEquipCascader().then(res=>{
|
||||
this.equipCascader = res;
|
||||
});
|
||||
getComponentSelection().then(res=>{
|
||||
this.componentSelection = res;
|
||||
});
|
||||
getCustomerSelection().then(res=>{
|
||||
this.customerSelection = res;
|
||||
});
|
||||
listSimpleUsers().then(res=>{
|
||||
this.userList = res.data;
|
||||
})
|
||||
},
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await MaintenanceOrderApi.getRemoteMaintenanceOrderRecord(id);
|
||||
this.formData = res.data;
|
||||
this.cascaderValue = this.changeDetSelect(this.formData.equipId,this.equipCascader);
|
||||
this.title = "修改维修工单";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增维修工单";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
data.status = 0;
|
||||
// 修改的提交
|
||||
if (data.maintenanceOrderId) {
|
||||
await MaintenanceOrderApi.updateRemoteMaintenanceOrder(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await MaintenanceOrderApi.createRemoteMaintenanceOrder(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
maintenanceOrderId: undefined,
|
||||
maintenanceOrderNo: undefined,
|
||||
diagnoiseReportId: undefined,
|
||||
equipId: undefined,
|
||||
componentId: undefined,
|
||||
faultType: undefined,
|
||||
description: undefined,
|
||||
priority: undefined,
|
||||
completeTime: undefined,
|
||||
status: undefined,
|
||||
executorId: undefined,
|
||||
processInstanceId: undefined,
|
||||
customerId: undefined,
|
||||
approveStatus: undefined,
|
||||
};
|
||||
this.cascaderValue = [];
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -208,6 +208,7 @@ export default {
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formData.status = 1;
|
||||
await RemoteMaintenanceOrderApi.createRemoteMaintenanceOrder(this.formData)
|
||||
this.$modal.msgSuccess("提交成功");
|
||||
this.$tab.closeOpenPage({ path: "/maintenance/remote-maintenance-order" });
|
||||
|
@ -46,17 +46,17 @@
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"-->
|
||||
<!-- v-hasPermi="['imt:remote-maintenance-order:create']">新增-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['imt:remote-maintenance-order:export']">导出
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['imt:remote-maintenance-order:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"-->
|
||||
<!-- :loading="exportLoading"-->
|
||||
<!-- v-hasPermi="['imt:remote-maintenance-order:export']">导出-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -99,13 +99,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.maintenanceOrderId)"-->
|
||||
<!-- v-hasPermi="['imt:remote-maintenance-order:update']">修改-->
|
||||
<!-- </el-button>-->
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.maintenanceOrderId)"
|
||||
v-hasPermi="['imt:remote-maintenance-order:update']">修改
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['imt:remote-maintenance-order:delete']">删除
|
||||
</el-button>
|
||||
<el-button 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -114,7 +114,7 @@
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<!-- <RemoteMaintenanceOrderForm ref="formRef" @success="getList"/>-->
|
||||
<RemoteMaintenanceOrderForm ref="formRef" @success="getList"/>
|
||||
<approve-record ref="approve" />
|
||||
</div>
|
||||
</template>
|
||||
@ -124,7 +124,7 @@ import * as RemoteMaintenanceOrderApi from '@/api/system/maintenance/maintenance
|
||||
import {getEquipCascader} from '@/api/system/equip/equipInfo'
|
||||
import {getComponentSelection} from '@/api/system/equip/componentInfo'
|
||||
import {getCustomerSelection} from '@/api/system/baseData/customerInfo'
|
||||
import RemoteMaintenanceOrderForm from './create.vue';
|
||||
import RemoteMaintenanceOrderForm from './RemoteMaintenanceOrderForm.vue';
|
||||
import {DICT_TYPE} from "@/utils/dict";
|
||||
import ApproveRecord from "@/views/bpm/processInstance/approveRecord.vue";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user