From 044d8f67cc414187c353b620ce8ad014fcfe44f4 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 29 八月 2025 10:20:59 +0800
Subject: [PATCH] 1.密码强校验

---
 src/views/system/user/index.vue |   94 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 64 insertions(+), 30 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index b151160..fbc3581 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -28,7 +28,7 @@
                     @keyup.enter.native="handleQuery" />
                 </el-form-item>
                 <el-form-item label="鐘舵��" prop="status">
-                  <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable>
+                  <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable @change="handleQuery">
                     <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
                       :value="dict.value" />
                   </el-select>
@@ -213,7 +213,7 @@
           <el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length != 1">
             <el-input v-model="search2" placeholder="杈撳叆鍏抽敭瀛楁悳绱�" clearable size="small" @clear="searchFilter2"
               @keyup.enter.native="searchFilter2" prefix-icon="el-icon-search" style="margin-bottom: 20px;width: 90%" />
-            <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps" @node-click="nodeClick2"
+            <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps1" @node-click="nodeClick2"
               style="height: calc(100% - 42px);" @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2"
               highlight-current>
             </el-tree>
@@ -231,7 +231,7 @@
               </el-table-column>
               <el-table-column prop="employeeID" label="鍛樺伐鍙�">
               </el-table-column>
-              <el-table-column prop="nickName" label="鍛樺伐濮撳悕">
+              <el-table-column prop="name" label="鍛樺伐濮撳悕">
               </el-table-column>
               <el-table-column prop="department" label="閮ㄩ棬" min-width="200">
               </el-table-column>
@@ -294,6 +294,7 @@
     return {
       // 閬僵灞�
       loading: true,
+      multipleSelection: [],
       // 閫変腑鏁扮粍
       ids: [],
       // 闈炲崟涓鐢�
@@ -329,6 +330,10 @@
       defaultProps: {
         children: "children",
         label: "label"
+      },
+      defaultProps1: {
+        children: "children",
+        label: "companyName"
       },
       // 鐢ㄦ埛瀵煎叆鍙傛暟
       upload: {
@@ -382,9 +387,35 @@
         roleIds: [
           { required: true, message: "璇烽�夋嫨瑙掕壊", trigger: "change" }
         ],
-        // password: [
-        //   { required: true, message: "瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
-        // ],
+        password: [
+          { required: true, message: "瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
+          { min: 8, max: 20, message: "瀵嗙爜闀垮害蹇呴』鍦�8-20涓瓧绗︿箣闂�", trigger: "blur" },
+          {
+            validator: (rule, value, callback) => {
+              if (!value) {
+                callback();
+                return;
+              }
+              // 妫�鏌ユ槸鍚﹀寘鍚ぇ鍐欏瓧姣�
+              const hasUpperCase = /[A-Z]/.test(value);
+              // 妫�鏌ユ槸鍚﹀寘鍚皬鍐欏瓧姣�
+              const hasLowerCase = /[a-z]/.test(value);
+              // 妫�鏌ユ槸鍚﹀寘鍚壒娈婄鍙�
+              const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(value);
+              
+              if (!hasUpperCase) {
+                callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓ぇ鍐欏瓧姣�'));
+              } else if (!hasLowerCase) {
+                callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓皬鍐欏瓧姣�'));
+              } else if (!hasSpecialChar) {
+                callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓壒娈婄鍙�'));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
         phonenumber: [
           {
             required: true,
@@ -542,6 +573,7 @@
     },
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
+      this.multipleSelection = selection;
       this.ids = selection.map(item => item.userId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
@@ -560,30 +592,31 @@
       }
     },
     // 鑾峰彇涓夋柟浜哄憳
-    openthirdParty() {
-      this.addthirdParty = true;
-      this.thirdPartyLoading = true;
-      selectCompaniesList().then(res => {
-        this.companiesList = this.HaveJson(res.data);
-        if (this.companiesList.length == 1) {
-          selectSimpleList({ companyId: this.companiesList[0].companyId }).then(res => {
-            this.thirdPartyLoading = false;
-            this.personListCopy = JSON.parse(JSON.stringify(res.data))
-            this.personList = res.data
-            this.$refs.personTable.doLayout()
-          })
-        } else {
-          this.thirdPartyLoading = false;
+    async openthirdParty() {
+      try {
+        this.addthirdParty = true;
+        this.thirdPartyLoading = true;
+
+        const companiesResponse = await selectCompaniesList();
+        this.companiesList = this.HaveJson(companiesResponse.data);
+
+        if (this.companiesList.length === 1) {
+          const personResponse = await selectSimpleList({ companyId: this.companiesList[0].companyId });
+          this.personListCopy = JSON.parse(JSON.stringify(personResponse.data));
+          this.personList = personResponse.data;
+          this.$refs.personTable.doLayout();
         }
-        this.datathirdParty = this.tranListToTreeData(res.data, "ROOT");
-      }).catch(() => {
+
+        this.datathirdParty = this.tranListToTreeData(this.companiesList, "ROOT");
+        console.log(' this.datathirdParty---',  this.datathirdParty)
+      } catch (error) {
+        console.error("Error fetching third party data:", error);
+      } finally {
         this.thirdPartyLoading = false;
-      })
-      if (this.componentData.entity.roleId > 10000) this.$message.warning('鐢变簬鏈�変腑鍏蜂綋瑙掕壊锛屾柊澧炵敤鎴峰皢鎴愪负榛樿瑙掕壊')
+      }
     },
     tranListToTreeData(list, rootValue) {
-      const arr = [];
-      list.forEach((item) => {
+      return list.reduce((arr, item) => {
         if (item.parentCompanyId === rootValue) {
           const children = this.tranListToTreeData(list, item.companyId);
           if (children.length) {
@@ -591,8 +624,8 @@
           }
           arr.push(item);
         }
-      });
-      return arr;
+        return arr;
+      }, []);
     },
     searchPerson() {
       let arr = JSON.parse(JSON.stringify(this.personListCopy))
@@ -624,7 +657,7 @@
       }
     },
     nodeOpen0(data, node, el) {
-      this.currentCompaniesList[node.level - nodeOpen01] = data.id
+      // this.currentCompaniesList[node.level - nodeOpen01] = data.id
     },
     filterNode2(value, data) {
       if (!value) return true;
@@ -652,12 +685,13 @@
       addPersonUser({
         company: arr,
         person: this.multipleSelection,
-        roleId: this.componentData.entity.roleId
+        // roleId: this.componentData.entity.roleId
       }).then(res => {
         this.$message.success('鎿嶄綔鎴愬姛')
         this.multipleSelection = []
         this.$refs.personTable.clearSelection()
         this.addLoad = false
+        this.addthirdParty = false
         this.userSearch2 = ''
         this.getList()
       }).catch(e => {

--
Gitblit v1.9.3