From 002417b764a61b75aff056162120f3501feff8f3 Mon Sep 17 00:00:00 2001 From: xusd Date: Mon, 14 Oct 2024 14:27:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E9=A1=B5=E9=9D=A2=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E5=B7=A5=E5=8D=95=E5=90=8E=E5=85=B3=E9=97=AD=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/MaintenanceOrderSaveReqVO.java | 3 ++ .../service/alarm/AlarmDataServiceImpl.java | 6 ++- .../MaintenanceOrderServiceImpl.java | 8 ++++ .../views/system/alarm/alarmdata/index.vue | 41 +++++++++++-------- .../system/alarm/equipalarmdata/index.vue | 15 +++++-- .../AlarmSubmitMaintenancePatrolPlanForm.vue | 1 + .../alarmSubmitMaintenanceOrderForm.vue | 2 + 7 files changed, 56 insertions(+), 20 deletions(-) diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java index fc479d5..09260c7 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java @@ -70,4 +70,7 @@ public class MaintenanceOrderSaveReqVO { @Schema(description = "点检方案") private String patrolPlan; + @Schema(description = "维修工单提交标识,报警提交时为0") + private String submitFlag; + } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java index 5c76941..9a4079b 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/alarm/AlarmDataServiceImpl.java @@ -1,5 +1,6 @@ package com.inspur.module.system.service.alarm; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.inspur.framework.tenant.core.aop.TenantIgnore; @@ -103,11 +104,14 @@ public class AlarmDataServiceImpl implements AlarmDataService { @Transactional public int closeAllAlarmDataByEquipAlarmId(String equipAlarmId){ List alarmDataList = alarmDataMapper.selectAlarmDatas(new AlarmDataPageReqVO().setEquipAlarmId(equipAlarmId)); - List alarmDataIdList = alarmDataList.stream().map(AlarmDataDO::getAlarmDataId).collect(Collectors.toList()); EquipAlarmDataSaveReqVO equipAlarmDataSaveReqVO = new EquipAlarmDataSaveReqVO(); equipAlarmDataSaveReqVO.setEquipAlarmId(equipAlarmId); equipAlarmDataSaveReqVO.setStatus(1);//关闭 equipAlarmDataService.updateEquipAlarmData(equipAlarmDataSaveReqVO); + if (CollUtil.isEmpty(alarmDataList)){ + return 0; + } + List alarmDataIdList = alarmDataList.stream().map(AlarmDataDO::getAlarmDataId).collect(Collectors.toList()); return alarmDataMapper.batchUpdateAlarmDataStatus(alarmDataIdList); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java index 538ad8f..a87c422 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java @@ -20,6 +20,7 @@ import com.inspur.module.system.dal.dataobject.user.AdminUserDO; import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper; import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderRecordMapper; import com.inspur.module.system.dal.mysql.maintenance.MaintenanceReportMapper; +import com.inspur.module.system.service.alarm.AlarmDataService; import com.inspur.module.system.service.baseData.CustomerInfoService; import com.inspur.module.system.service.equip.ComponentInfoService; import com.inspur.module.system.service.equip.EquipInfoService; @@ -77,6 +78,9 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { @Resource private TaskService taskService; + @Resource + private AlarmDataService alarmDataService; + /** * OA 请假对应的流程定义 KEY */ @@ -116,11 +120,15 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { } @Override + @Transactional(rollbackFor = Exception.class) public void updateRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO updateReqVO) { // 校验存在 validateRemoteMaintenanceOrderExists(updateReqVO.getMaintenanceOrderId()); // 更新 MaintenanceOrderDO updateObj = BeanUtils.toBean(updateReqVO, MaintenanceOrderDO.class); + if ("0".equals(updateReqVO.getSubmitFlag()) && StrUtil.isNotBlank(updateReqVO.getAlarmId())) { + alarmDataService.closeAllAlarmDataByEquipAlarmId(updateReqVO.getAlarmId()); + } maintenanceOrderMapper.updateById(updateObj); } diff --git a/imt-ui/src/views/system/alarm/alarmdata/index.vue b/imt-ui/src/views/system/alarm/alarmdata/index.vue index 81d6dbe..6ad496b 100644 --- a/imt-ui/src/views/system/alarm/alarmdata/index.vue +++ b/imt-ui/src/views/system/alarm/alarmdata/index.vue @@ -519,8 +519,8 @@ style="height:500px" > - - + + @@ -540,6 +540,7 @@ export default { name: "AlarmData", components: { AlarmSubmitMaintenanceOrderForm, + AlarmSubmitMaintenancePatrolPlanForm, AlarmDataForm, }, data() { @@ -633,20 +634,28 @@ export default { }, methods: { //判断显示维修工单提交还是显示点检方案提交 - showSubmitButton() { - EquipAlarmDataApi.isSubmitPatrolPlan(this.$route.query.equipAlarmId).then( - (res) => { - this.showPatrolPlanSubmit = res.data; - console.log("this.showPatrolPlanSubmit", this.showPatrolPlanSubmit); - if (res.data) { - EquipAlarmDataApi.isSubmitOrder( - this.$route.query.equipAlarmId - ).then((res) => { - this.maintenanceOrderId = res.data; - }); + showSubmitButton(flag) { + if (flag === "0"){ + this.$store.dispatch("tagsView/delView", this.$router.currentRoute); + //跳转到前一个页面 + this.$router.push("/alarm/equipalarm"); + }else { + EquipAlarmDataApi.isSubmitPatrolPlan(this.$route.query.equipAlarmId).then( + (res) => { + this.showPatrolPlanSubmit = res.data; + console.log("this.showPatrolPlanSubmit", this.showPatrolPlanSubmit); + if (res.data) { + EquipAlarmDataApi.isSubmitOrder( + this.$route.query.equipAlarmId + ).then((res) => { + if(res.data !== null){ + this.maintenanceOrderId = res.data; + } + }); + } } - } - ); + ); + } }, cardChange(e) { // console.log("选择:", e); @@ -764,7 +773,7 @@ export default { * 维修工单 */ handelMaintanence() { - this.$refs.submitOrderForm.open(this.$route.query.equipAlarmId); + this.$refs.submitOrderForm.open(this.$route.query.equipAlarmId,this.maintenanceOrderId); }, handelPatrolPlan() { this.$refs.submitPatrolPlanForm.open(this.$route.query.equipAlarmId); diff --git a/imt-ui/src/views/system/alarm/equipalarmdata/index.vue b/imt-ui/src/views/system/alarm/equipalarmdata/index.vue index d6c3214..f76c8ca 100644 --- a/imt-ui/src/views/system/alarm/equipalarmdata/index.vue +++ b/imt-ui/src/views/system/alarm/equipalarmdata/index.vue @@ -293,6 +293,14 @@ import { getEquipSelection, } from "@/api/system/equip/equipInfo"; export default { + beforeRouteEnter(to, from, next) { + // 在导航确认前调用, 但是此时组件实例还未被创建 + next(vm => { + // 在组件实例被创建后执行 + vm.getList(); + + }); + }, name: "EquipAlarmData", components: { EquipAlarmDataForm, @@ -333,9 +341,9 @@ export default { equipSelection: [], }; }, - created() { - this.getList(); - }, + // created() { + // this.getList(); + // }, methods: { cascaderChange(value) { if (value.length > 0) { @@ -346,6 +354,7 @@ export default { }, /** 查询列表 */ async getList() { + console.log("getList!!!!!!!!!") try { this.loading = true; const res = await EquipAlarmDataApi.getEquipAlarmDataPage( diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/AlarmSubmitMaintenancePatrolPlanForm.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/AlarmSubmitMaintenancePatrolPlanForm.vue index a69326b..7ac842c 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/AlarmSubmitMaintenancePatrolPlanForm.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/AlarmSubmitMaintenancePatrolPlanForm.vue @@ -128,6 +128,7 @@ export default { this.submitFormData.status = -1; await MaintenanceOrderApi.createRemoteMaintenanceOrder(this.submitFormData) this.$modal.msgSuccess("提交成功"); + this.$emit('child-event'); this.dialogVisible = false; this.submitFormLoading = false; }, diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue index 7268af9..d0cfef0 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue @@ -148,8 +148,10 @@ export default { this.submitFormData.customerId = this.alarmFormData.customerId; this.submitFormData.alarmId = this.alarmFormData.equipAlarmId; this.submitFormData.status = 0; + this.submitFormData.submitFlag = "0"; await MaintenanceOrderApi.updateRemoteMaintenanceOrder(this.submitFormData) this.$modal.msgSuccess("提交成功"); + this.$emit('child-event','0'); this.dialogVisible = false; this.submitFormLoading = false; },