zhangyun 4 лет назад
Родитель
Сommit
7d38540bc0

+ 10 - 11
minggao/src/components/tree-table/tree_table.vue

@@ -53,7 +53,7 @@ export default {
   data() {
     return {
       isDesc: false,
-      treeDataSource: [],
+      treeDataSource: []
     };
   },
 
@@ -63,11 +63,11 @@ export default {
         console.log("ddddd");
         this.initTreeData();
       },
-      deep: true,
+      deep: true
     },
     isDesc(nelVal, oldVal) {
       this.$emit("orderByFunc", nelVal);
-    },
+    }
   },
   computed: {},
   methods: {
@@ -95,7 +95,7 @@ export default {
       alert("滚动到底部加载更多");
       // 滚动到最后
       $("#scrollWrap").mCustomScrollbar("scrollTo", "top", {
-        scrollInertia: 0,
+        scrollInertia: 0
       });
     },
     // 编辑
@@ -108,22 +108,22 @@ export default {
     },
     // 添加下级组织
     addOrganization(m) {
-      this.$emit("addOrganization", m)
+      this.$emit("addOrganization", m);
     },
     // 展开
     handlerExpand(m) {
       this.$emit("handlerExpand", m);
-    },
+    }
   },
   components: {
-    treeItem: () => import("./tree-item.vue"),
+    treeItem: () => import("./tree-item.vue")
   },
   mounted() {
     const vm = this;
     vm.$nextTick(() => {
       vm.initTreeData();
     });
-  },
+  }
 };
 </script>
 
@@ -273,7 +273,7 @@ export default {
     }
   }
   .ellipsis {
-    overflow: hidden;
+    // overflow: hidden;
     white-space: nowrap;
     text-overflow: ellipsis;
   }
@@ -298,7 +298,7 @@ export default {
         color: #f56c6c;
       }
       .user {
-        color: #E6A23C;
+        color: #e6a23c;
       }
       .addr {
         color: #67c23a;
@@ -420,4 +420,3 @@ export default {
   }
 }
 </style>
-

+ 1 - 0
minggao/src/page/commandCenter/laboratory.vue

@@ -372,6 +372,7 @@ export default {
     dialogVisible(val) {
       if (val == false) {
         this.fillList = [];
+        this.models = [];
         this.spareData = []; // 备用数据
       }
     },

+ 45 - 36
minggao/src/page/systemmanger/customsManger.vue

@@ -142,7 +142,9 @@ export default {
         higher: ""
       },
       tltData: "添加隶属海关",
-      userData: {} // 点击编辑时获取到的当前数据
+      userData: {}, // 点击编辑时获取到的当前数据
+
+      isClick: true // 防止重复弹框
     };
   },
   //监听属性 类似于data概念
@@ -300,24 +302,28 @@ export default {
         }
       ];
       this.addrUserVisible = true;
-      this.tabListData()
+      this.tabListData();
     },
 
     // 添加用户 || 编辑用户 -- 确定
     onSubmit() {
       var that = this;
       if (this.form.name == "") {
-        this.$message({
-          message: "请填写组织名称!",
-          type: "warning",
-          duration: 1500
-        });
+        if (document.getElementsByClassName("el-message").length == 0) {
+          this.$message({
+            message: "请填写组织名称!",
+            type: "warning",
+            duration: 1500
+          });
+        }
       } else if (this.form.name.split(" ").join("").length == 0) {
-        this.$message({
-          message: "不能填写空格!",
-          type: "warning",
-          duration: 1500
-        });
+        if (document.getElementsByClassName("el-message").length == 0) {
+          this.$message({
+            message: "不能填写空格!",
+            type: "warning",
+            duration: 1500
+          });
+        }
       } else {
         // 请求添加接口
         if (this.tltData == "编辑隶属海关") {
@@ -336,31 +342,34 @@ export default {
           });
         }
 
-        this.$axios({
-          method: "POST",
-          url,
-          data: postData
-        })
-          .then(res => {
-            console.log(res);
-            if (res.data.data == true) {
-              this.$message({
-                message: "成功!",
-                type: "success",
-                duration: 1500
-              });
-              this.addrUserVisible = false;
-              this.tabListData();
-            }
-            //  else {
-            //   this.$message({
-            //     message: "失败!",
-            //     type: "error",
-            //     duration: 1500
-            //   });
-            // }
+        if (this.isClick == true) {
+          this.isClick = false;
+          this.$axios({
+            method: "POST",
+            url,
+            data: postData
           })
-          .catch(err => {});
+            .then(res => {
+              console.log(res);
+              if (res.data.data == true) {
+                this.$message({
+                  message: "成功!",
+                  type: "success",
+                  duration: 1500
+                });
+                this.addrUserVisible = false;
+                this.tabListData();
+              }
+              setTimeout(() => {
+                that.isClick = true;
+              }, 2500);
+            })
+            .catch(err => {
+              setTimeout(() => {
+                that.isClick = true;
+              }, 2500);
+            });
+        }
       }
     },
 

+ 111 - 107
minggao/src/page/systemmanger/role.vue

@@ -28,7 +28,12 @@
       </el-row>
 
       <!-- 列表 -->
-      <el-table :data="tableData" v-loading="loading" stripe style="width: 100%">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        stripe
+        style="width: 100%"
+      >
         <el-table-column prop="ind" label="序号" width="280"></el-table-column>
         <el-table-column prop="role_name" label="角色名称" width="380">
         </el-table-column>
@@ -145,17 +150,17 @@ export default {
       addrUserVisible: false,
       form: {
         name: "",
-        describe: "",
+        describe: ""
       },
       rules: {
         name: [
-          { required: true, message: "请输入角色名称", trigger: "blur" },
+          { required: true, message: "请输入角色名称", trigger: "blur" }
           //   { min: 3, max: 5, message: "长度在 1 到 15 个字符", trigger: "blur" },
         ],
         describe: [
-          { required: true, message: "请输入角色描述", trigger: "blur" },
+          { required: true, message: "请输入角色描述", trigger: "blur" }
           //   { min: 3, max: 5, message: "长度在 1 到 30 个字符", trigger: "blur" },
-        ],
+        ]
       },
 
       // 分配权限
@@ -167,8 +172,10 @@ export default {
       //  树形控件的属性绑定对象
       treeProps: {
         label: "purview_name",
-        children: "children",
+        children: "children"
       },
+
+      isClick: true // 防止重复弹框
     };
   },
   //监听属性 类似于data概念
@@ -189,7 +196,7 @@ export default {
         this.fullHeight = val;
         this.timer = true;
         let that = this;
-        setTimeout(function () {
+        setTimeout(function() {
           //防止过度调用监测事件,导致卡顿
           that.timer = false;
         }, 400);
@@ -198,9 +205,9 @@ export default {
 
     setRightDialogVisible(val) {
       if (val == false) {
-        this.defKeys = []
+        this.defKeys = [];
       }
-    },
+    }
   },
   //方法集合
   methods: {
@@ -222,10 +229,10 @@ export default {
         data: this.qs.stringify({
           page: this.page,
           page_item: "10",
-          role_name: this.input,
-        }),
+          role_name: this.input
+        })
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.data.total_item !== 0) {
             var data = res.data.data.page_list;
             this.pagesum = res.data.data.total_item;
@@ -239,10 +246,10 @@ export default {
             this.tableData = [];
             this.pagesum = 0;
           }
-          this.loading = false
+          this.loading = false;
         })
-        .catch((err) => {
-          this.loading = false
+        .catch(err => {
+          this.loading = false;
         });
     },
 
@@ -264,7 +271,6 @@ export default {
     },
     // 编辑角色
     actionFunc(data) {
-      //   console.log(data);
       this.describeData = data;
       this.tltData = "编辑角色";
       this.form.name = data.role_name; // 角色名称
@@ -273,7 +279,7 @@ export default {
     },
     // 添加、编辑角色确定
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.tltData == "添加角色") {
             // 添加
@@ -283,43 +289,44 @@ export default {
             this.editRoleAxios(); // 编辑
           }
         } else {
-          //   console.log("error submit!!");
           return false;
         }
       });
     },
     // 添加 - 确定
     addrRoleAxios() {
-      this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=sysmenage.usermanager.role_add",
-        data: this.qs.stringify({
-          role_name: this.form.name,
-          role_message: this.form.describe,
-        }),
-      })
-        .then((res) => {
-          if (res.data.data == true) {
-            this.$message({
-              message: "成功!",
-              type: "success",
-              duration: 1500,
-            });
-            this.addrUserVisible = false;
-            this.tabListData();
-          } else {
-            this.$message({
-              message: "失败!",
-              type: "error",
-              duration: 1500,
-            });
-          }
-          //   console.log(res);
-          this.addrUserVisible = false;
+      var that = this;
+      if (this.isClick == true) {
+        this.isClick = false;
+        this.$axios({
+          method: "POST",
+          url: "/api/api_gateway?method=sysmenage.usermanager.role_add",
+          data: this.qs.stringify({
+            role_name: this.form.name,
+            role_message: this.form.describe
+          })
         })
-        .catch((err) => {
-          //   console.log(err);
-        });
+          .then(res => {
+            if (res.data.data == true) {
+              this.$message({
+                message: "成功!",
+                type: "success",
+                duration: 1500
+              });
+              this.addrUserVisible = false;
+              this.tabListData();
+            }
+            setTimeout(() => {
+              that.isClick = true;
+            }, 2500);
+            // this.addrUserVisible = false;
+          })
+          .catch(err => {
+            setTimeout(() => {
+              that.isClick = true;
+            }, 2500);
+          });
+      }
     },
     // 编辑 - 确定
     editRoleAxios() {
@@ -329,15 +336,15 @@ export default {
         data: this.qs.stringify({
           role_id: this.describeData.id,
           role_name: this.form.name,
-          role_message: this.form.describe,
-        }),
+          role_message: this.form.describe
+        })
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.data == true) {
             this.$message({
               message: "成功!",
               type: "success",
-              duration: 1500,
+              duration: 1500
             });
             this.addrUserVisible = false;
             this.tabListData();
@@ -345,15 +352,12 @@ export default {
             this.$message({
               message: "失败!",
               type: "error",
-              duration: 1500,
+              duration: 1500
             });
           }
-          //   console.log(res);
           this.addrUserVisible = false;
         })
-        .catch((err) => {
-          //   console.log(err);
-        });
+        .catch(err => {});
     },
 
     // 分配权限
@@ -361,22 +365,20 @@ export default {
       this.describeData = val;
       this.$axios({
         method: "POST",
-        url: "/api/api_gateway?method=sysmenage.usermanager.user_info",
+        url: "/api/api_gateway?method=sysmenage.usermanager.user_info"
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.message == "") {
             var data = res.data.data.children;
-            this.rightsList = []
+            this.rightsList = [];
             this.rightsList = data;
             this.limitsList(); //获取当前角色的权限
           } else {
-            this.rightsList = []
+            this.rightsList = [];
             this.$message.error("获取权限列表失败!");
           }
         })
-        .catch((err) => {
-          // console.log(err)
-        });
+        .catch(err => {});
     },
     // 当前角色权限
     limitsList() {
@@ -384,10 +386,10 @@ export default {
         method: "POST",
         url: "/api/api_gateway?method=sysmenage.usermanager.role_info",
         data: this.qs.stringify({
-          role_id: this.describeData.id, //角色ID
-        }),
+          role_id: this.describeData.id //角色ID
+        })
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.data) {
             this.setRightDialogVisible = true;
             var list = this.tableData;
@@ -400,54 +402,58 @@ export default {
             }
             this.tableData = list;
           } else {
-            this.tableData = []
+            this.tableData = [];
           }
-        //   this.tabListData = list;
+          //   this.tabListData = list;
           // this.tableData = list;
         })
-        .catch((err) => {
-          console.log(err);
-        });
+        .catch(err => {});
     },
 
     getLeafkeys(node, arr) {
       if (!node.children) {
         return arr.push(node.pur_id);
       }
-      node.children.forEach((item) => this.getLeafkeys(item, arr));
+      node.children.forEach(item => this.getLeafkeys(item, arr));
     },
     setRightDialogClosed() {
       this.rightsList = [];
     },
     // 确定 - 分配权限
     allotRights() {
-        var that = this
+      var that = this;
       // 获得当前选中的Id
       const keys = [
         ...this.$refs.treeRef.getCheckedKeys(),
-        ...this.$refs.treeRef.getHalfCheckedKeys(),
+        ...this.$refs.treeRef.getHalfCheckedKeys()
       ];
       const idStr = keys.join(",");
-      console.log(idStr);
-      this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=sysmenage.usermanager.role_perm",
-        data: this.qs.stringify({
-          pur_id: idStr, // 权限id
-          role_id: this.describeData.id, // 角色id
-        }),
-      })
-        .then((res) => {
-          console.log(res);
-          if (res.data.message == "") {
-            this.$message.success("分配权限成功!");
-            that.setRightDialogVisible = false;
-            that.tabListData();
-          }
+      if (this.isClick == true) {
+        this.isClick = false;
+        this.$axios({
+          method: "POST",
+          url: "/api/api_gateway?method=sysmenage.usermanager.role_perm",
+          data: this.qs.stringify({
+            pur_id: idStr, // 权限id
+            role_id: this.describeData.id // 角色id
+          })
         })
-        .catch((err) => {
-          console.log(err);
-        });
+          .then(res => {
+            if (res.data.message == "") {
+              this.$message.success("分配权限成功!");
+              that.setRightDialogVisible = false;
+              that.tabListData();
+            }
+            setTimeout(() => {
+              that.isClick = true;
+            }, 2500);
+          })
+          .catch(err => {
+            setTimeout(() => {
+              that.isClick = true;
+            }, 2500);
+          });
+      }
     },
 
     // 删除
@@ -455,43 +461,41 @@ export default {
       this.$confirm("此操作将永久删除, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           this.$axios({
             method: "POST",
             url: "/api/api_gateway?method=sysmenage.usermanager.role_delete",
             data: this.qs.stringify({
-              role_id: data.id,
-            }),
+              role_id: data.id
+            })
           })
-            .then((res) => {
+            .then(res => {
               if (res.data.message == "") {
                 this.$message({
                   type: "success",
                   message: "删除成功!",
-                  duration: 1500,
+                  duration: 1500
                 });
               }
               this.tabListData();
             })
-            .catch((err) => {
-              console.log(err);
-            });
+            .catch(err => {});
         })
         .catch(() => {
           this.$message({
             type: "info",
-            message: "已取消删除",
+            message: "已取消删除"
           });
         });
-    },
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
-    this.loading = true
+    this.loading = true;
     this.tabListData(); // 表格数据
   },
   beforeCreate() {}, //生命周期 - 创建之前
@@ -500,10 +504,10 @@ export default {
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 .role_box {
   .search_box {
     display: flex;
@@ -535,4 +539,4 @@ export default {
     height: 14px;
   }
 }
-</style>
+</style>

+ 7 - 4
minggao/src/page/systemmanger/userManger.vue

@@ -390,7 +390,10 @@ export default {
         state: "" // 账号状态
       },
       rules: {
-        user: [{ required: true, message: "请输入账号", trigger: "blur" }],
+        user: [
+          { required: true, message: "请输入账号", trigger: "blur" },
+          { min: 3, max: 20, message: "长度在 3 到 20 位之间", trigger: "blur" }
+        ],
         password: [
           { required: true, validator: checkPath, trigger: "blur" }
           // { validator: checkPath, trigger: "blur" }
@@ -441,9 +444,9 @@ export default {
       if (val == false) {
         // this.$refs["form"].resetFields();
         for (var key in this.form) {
-            this.form[key] = "";
-            // console.log(key)
-          }
+          this.form[key] = "";
+          // console.log(key)
+        }
         this.refreshItem++;
       }
     }