From e07ea726958cc64871e366be4812868972ac691d Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Wed, 21 Sep 2022 10:21:41 +0800
Subject: [PATCH] 巡检计划添加启用/禁用功能

---
 src/views/taskinfo/taskinfoPlan.vue |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/views/taskinfo/taskinfoPlan.vue b/src/views/taskinfo/taskinfoPlan.vue
index 492fabe..27e7d70 100644
--- a/src/views/taskinfo/taskinfoPlan.vue
+++ b/src/views/taskinfo/taskinfoPlan.vue
@@ -46,12 +46,12 @@
           <el-col :span="12">
             <el-dropdown-item icon="el-icon-check" :size="size" :type="type" divided
                               :disabled="row.state >= 1"
-            >启 用</el-dropdown-item>
+                              @click.native="isChangeStatus(row.id,2)">启 用</el-dropdown-item>
           </el-col>
           <el-col :span="12">
             <el-dropdown-item icon="el-icon-error" :size="size" :type="type" divided
                               :disabled="row.state >= 2"
-            >停 用</el-dropdown-item>
+                              @click.native="isChangeStatus(row.id,1)">停 用</el-dropdown-item>
           </el-col>
         </el-row>
 
@@ -62,7 +62,7 @@
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/taskinfo/taskinfoPlan";
+  import {getList, getDetail, add, update, remove, changeStatus} from "@/api/taskinfo/taskinfoPlan";
   import option from "@/const/taskinfo/taskinfoPlan";
   import {mapGetters} from "vuex";
 
@@ -211,6 +211,16 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      isChangeStatus(id,status) {
+        changeStatus(id,status).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.$refs.crud.toggleSelection();
+        })
       }
     }
   };

--
Gitblit v1.9.3