From 8edf0fc193df875b6e05d77be428e9134438857b Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: Tue, 16 Aug 2022 19:32:54 +0800
Subject: [PATCH] Default Changelist
---
src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
index 9dc80c7..e1f2ed4 100644
--- a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
+++ b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
@@ -85,7 +85,7 @@
<template #default="scope">
<el-button link type="primary" size="small" :icon="View" @click="openInspectTaskDialog('查看', scope.row)">查看</el-button>
<el-button link type="primary" size="small" :icon="Edit" @click="openInspectTaskDialog('修改', scope.row)">修改</el-button>
- <el-button link type="danger" size="small" :icon="Delete" @click="deleteInspectTask(scope.$index)">删除</el-button>
+ <el-button link type="danger" size="small" :icon="Delete" v-if="scope.row.taskUnitStatus === 2" @click="deleteInspectTask(scope.row)">删除</el-button>
<div @click="changeStatus(scope.row)">
<el-switch v-model="scope.row.taskUnitStatus" inline-prompt active-text="开" inactive-text="关" :active-value="1" :inactive-value="2" style="margin: 0 10px" />
</div>
@@ -295,6 +295,7 @@
.then(async () => {
let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 2 });
if (res.data.code === '200') {
+ await getInspectionTask();
ElMessage({
type: 'success',
duration: 2000,
@@ -307,9 +308,7 @@
});
}
})
- .catch((error) => {
- debugger;
- });
+ .catch((error) => {});
} else {
ElMessageBox.confirm(`此操作将开启该巡检任务”,是否继续?`, '提示', {
confirmButtonText: '确认',
@@ -319,6 +318,7 @@
.then(async () => {
let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 1 });
if (res.data.code === '200') {
+ await getInspectionTask();
ElMessage({
type: 'success',
duration: 2000,
@@ -334,6 +334,32 @@
.catch((error) => {});
}
await getInspectionTask();
+ };
+
+ // 删除
+ const deleteInspectTask = (row: any) => {
+ ElMessageBox.confirm(`此操作将永久删除该任务:“${row.unitName}”,是否继续?`, '提示', {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ .then(async () => {
+ let res = await inspectTaskApi().deleteInspectTask({ id: row.id });
+ if (res.data.code === '200') {
+ ElMessage({
+ type: 'success',
+ duration: 2000,
+ message: '删除成功'
+ });
+ await getInspectionTask();
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ })
+ .catch(() => {});
};
const openInspectTaskDialog = (type: string, value: {}) => {
@@ -394,6 +420,7 @@
reset,
changeStatus,
parseNumber,
+ deleteInspectTask,
getInspectionTask,
onHandleSizeChange,
onHandleCurrentChange,
@@ -408,7 +435,7 @@
<style scoped lang="scss">
$homeNavLengh: 8;
.home-container {
- height: calc(100vh - 114px);
+ height: calc(100vh - 144px);
box-sizing: border-box;
overflow: hidden;
.homeCard {
--
Gitblit v1.9.2