Procházet zdrojové kódy

feat: 封装删除后数据不可恢复,请谨慎进行该操作。

Damon před 9 měsíci
rodič
revize
21ee285f68
1 změnil soubory, kde provedl 40 přidání a 13 odebrání
  1. 40 13
      src/views/device/function/index.vue

+ 40 - 13
src/views/device/function/index.vue

@@ -80,6 +80,7 @@
 
 <script>
 import { create, edit, list } from "@/api/device/function";
+import { callBack } from "@/utils/DialogUtil";
 export default {
   dicts: ["sys_normal_disable"],
   data() {
@@ -186,20 +187,46 @@ export default {
 
     // 删除
     getDelete(row) {
-      this.$confirm(`是否删除${row.name}?`, "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      }).then(() => {
-        this.form = row;
-        this.form.isDelete = 1;
-        edit(this.form).then((res) => {
-          if (res.code === 0) {
-            this.$message.success("已删除!");
-            this.getList();
-          }
-        });
+      var that = this;
+      callBack(that, function () {
+        that
+          .$confirm(`是否删除${row.name}?`, "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            that.form = row;
+            that.form.isDelete = 1;
+            edit(that.form).then((res) => {
+              if (res.code === 0) {
+                that.$message.success("已删除!");
+                that.getList();
+              }
+            });
+          });
       });
+
+      // this.$alert(`删除后数据不可恢复,请谨慎进行该操作!`, "温馨提示", {
+      //   confirmButtonText: "确定",
+      // }).then(() => {
+      //   setTimeout(() => {
+      //     this.$confirm(`是否删除${row.name}?`, "提示", {
+      //       confirmButtonText: "确定",
+      //       cancelButtonText: "取消",
+      //       type: "warning",
+      //     }).then(() => {
+      //       this.form = row;
+      //       this.form.isDelete = 1;
+      //       edit(this.form).then((res) => {
+      //         if (res.code === 0) {
+      //           this.$message.success("已删除!");
+      //           this.getList();
+      //         }
+      //       });
+      //     });
+      //   }, 300);
+      // });
     },
   },
 };