Просмотр исходного кода

机构管理删除添加密码框

lihongxiao 2 лет назад
Родитель
Сommit
01ea69d04c
3 измененных файлов с 47 добавлено и 16 удалено
  1. 2 2
      config/dev.env.js
  2. 7 0
      src/http/moudules/dept.js
  3. 38 14
      src/views/Sys/Deptall.vue

+ 2 - 2
config/dev.env.js

@@ -9,9 +9,9 @@ module.exports = merge(prodEnv, {
   // BASE_URL:'"https://sxzgkj.baoxianzhanggui.com/web-api"'//正式服务器
   // BASE_URL:'"https://sxzgkj.baoxianzhanggui.com/web-api"'//正式服务器
   // BASE_URL: '"http://192.168.0.115:8080/"' //凯森
-  // BASE_URL: '"http:///192.168.0.106:8080/"',//屈晨
+  BASE_URL: '"http:///192.168.0.106:8080/"',//屈晨
   // BASE_URL: '"http:///192.168.0.253:8080/"',//田智
-  BASE_URL: '"http:///192.168.0.42:8080/"',//武鸿鹏
+  // BASE_URL: '"http:///192.168.0.42:8080/"',//武鸿鹏
   // BASE_URL: '"http://192.168.1.101:8080/"',
   // BASE_URL: '"http:///192.168.0.22:8080/"',//郝宇
   // BASE_URL: '"http:///192.168.0.103:8080/"',//

+ 7 - 0
src/http/moudules/dept.js

@@ -195,3 +195,10 @@ export const findAllTree = () => {
         method: 'get',
     })
 }
+export const deptDelete = (data) => {
+    return axios({
+        url: '/dept/deleteDept',
+        method: 'post',
+        data
+    })
+}

+ 38 - 14
src/views/Sys/Deptall.vue

@@ -1076,31 +1076,55 @@ export default {
     },
     //删除机构或部门
     deleteMechanism(data) {
-      let that = this;
-      that
-        .$confirm("此操作将删除该数据, 是否继续?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        })
-        .then(() => {
-          that.$api.dept.deleteDept(data.id).then((res) => {
+      this.$prompt('请输入密码', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          inputPattern:  /.+/,
+          inputErrorMessage: '请输入密码'
+        }).then(({ value  }) => {
+          this.$api.dept.deptDelete({password:value ,deptId:data.id,code:'dept'}).then((res) => {
             if (res.code == 200) {
               this.findSubDeptPage();
               this.findTreeData();
               this.currentTreeNode = null;
-              that.$message({
+              this.$message({
                 type: "success",
                 message: "删除成功!",
               });
-            } else {
-              that.$message({
-                type: "warning",
+            } 
+            else {
+              this.$message({
+                type: "error",
                 message: res.msg,
               });
             }
-          });
         })
+      })
+      // let that = this;
+      // that
+      //   .$confirm("此操作将删除该数据, 是否继续?", "提示", {
+      //     confirmButtonText: "确定",
+      //     cancelButtonText: "取消",
+      //     type: "warning",
+      //   })
+      //   .then(() => {
+      //     that.$api.dept.deleteDept(data.id).then((res) => {
+      //       if (res.code == 200) {
+      //         this.findSubDeptPage();
+      //         this.findTreeData();
+      //         this.currentTreeNode = null;
+      //         that.$message({
+      //           type: "success",
+      //           message: "删除成功!",
+      //         });
+      //       } else {
+      //         that.$message({
+      //           type: "warning",
+      //           message: res.msg,
+      //         });
+      //       }
+      //     });
+      //   })
     },
     handleDeleteFlag(data) {
       let that = this;