Forráskód Böngészése

Merge branch 'master' of http://120.26.64.82:3000/BFFE/Foshan4A4.0

zhaoke 3 éve
szülő
commit
f2164d9690

+ 52 - 5
src/utils/validate.js

@@ -93,17 +93,17 @@ function randomAlp(arr, count) {
 
   let shuffled = arr.slice(0)
   let i = arr.length
-  if(count>i){
+  if (count > i) {
     i = count
   }
   let min = i - count, temp, index;
   while (i-- > min) {
     index = Math.floor((arr.length) * Math.random());
     temp = shuffled[index];
-    if( shuffled[i]){
+    if (shuffled[i]) {
       shuffled[index] = shuffled[i];
     }
-    else{
+    else {
       shuffled[index] = shuffled[index]
     }
     shuffled[i] = temp;
@@ -166,8 +166,8 @@ export function pwdProduce(minLen, maxLen, struc) {
         dis += v[i]
       }
     }
-    let strlong = pwdLen- (passLong * typeLong);
-    if(strlong>0){
+    let strlong = pwdLen - (passLong * typeLong);
+    if (strlong > 0) {
       if (pwdStruc[0] == 1) {
         let arr = alphabet.toLocaleUpperCase().split('');
         let v = randomAlp(arr, strlong);
@@ -224,3 +224,50 @@ export function pwdProduce(minLen, maxLen, struc) {
     return new Error('密码规则转换失败')
   }
 }
+
+//模糊查询
+export function findarrays(ar, feature, v) {
+  var arr = [];
+  for (var i = 0; i < ar.length; i++) {
+    var atxt = ar[i][feature];
+    var btxt = v;
+    var type = 0;
+    if (atxt.match(btxt) == btxt) {
+      type = 1;
+    }
+    if (type == 1) {
+      arr.push(ar[i]);
+    }
+  }
+  // var arr = [];
+  // for (var i = 0; i < ar.length; i++) {
+  //   var atxt = ar[i][feature];
+  //   var btxt = v;
+  //   //		将字符串按某个字符切割成若干个字符串,并以数组形式返回
+  //   var atxtarr = atxt;
+  //   var btxtarr = btxt;
+  //   var type = 0;
+  //   // for (var k = 0; k < atxtarr.length; k++) {
+  //   //   if (btxtarr[0].length >= atxtarr[k].length) {
+  //   //     if (atxtarr[k] == btxtarr[0]) {
+  //   //       type = 1;
+  //   //     }
+  //   //   }
+  //   // }
+  //   if (atxtarr == btxtarr) {
+  //     type = 1;
+  //   } else if (atxtarr.length > btxtarr.length) {
+  //     for (var k = 0; k < atxtarr.length; k++) {
+  //       if (btxtarr[0].length >= atxtarr[k].length) {
+  //         if (atxtarr[k] == btxtarr) {
+  //           type = 1;
+  //         }
+  //       }
+  //     }
+  //   }
+  //   if (type == 1) {
+  //     arr.push(ar[i]);
+  //   }
+  // }
+  return arr;
+}

+ 6 - 4
src/views/accountGroupManagement/components/accountGroupEdit.vue

@@ -211,11 +211,11 @@ export default {
     const { OpenRole } = obj
     this.openRole = OpenRole
     this.accountGroupTreeCheckedTemp = [this.GroupUpId]
-    this.groupIds.push(this.GroupUpId)
     this.queryIds.push(this.GroupUpId)
-    this.doesGroupExist && (this.GroupId = this.$route.query.GroupId)
+    this.doesGroupExist && (this.GroupId = Number(this.$route.query.GroupId))
   },
   mounted() {
+    this.groupIds.push(this.GroupUpId)
     if (this.doesGroupExist) {
       this.getGroupDetails()
     } else {
@@ -277,7 +277,8 @@ export default {
     },
     // 获取当前勾选的岗位
     getAccountGroupChecked(arr) {
-      if (arr && arr.length && arr[0] !== -1) {
+      if (arr && arr.length === 1 && arr[0] !== -1) {
+        console.log(arr)
         const GroupIds = arr.map(item => item.GroupId)
         this.accountGroupTreeCheckedTemp = GroupIds
         this.roleType = 'roleByUpId'
@@ -286,7 +287,8 @@ export default {
         this.queryIds = GroupIds
       } else {
         this.accountGroupTreeCheckedTemp = [-1]
-        this.roleType = 'onlyRole'
+        // this.roleType = 'onlyRole'
+        this.groupIds = []
         this.queryType = 'all'
       }
     },

+ 3 - 2
src/views/accountManagement/components/accountEdit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: Badguy
  * @Date: 2022-02-15 11:37:42
- * @LastEditTime: 2022-03-02 11:09:58
+ * @LastEditTime: 2022-03-10 18:34:30
  * @LastEditors: your name
  * @Description: 编辑账号
  * have a nice day!
@@ -335,7 +335,8 @@ export default {
         this.queryIds = GroupIds
       } else {
         this.accountGroupTreeCheckedTemp = [-1]
-        this.roleType = 'onlyRole'
+        // this.roleType = 'onlyRole'
+        this.groupIds = []
         this.queryType = 'all'
       }
     },

+ 23 - 5
src/views/systemManagement/EditSystem/index.vue

@@ -197,6 +197,7 @@
 <script>
 import { EditTac, GetTacDetails, DeleteTac } from "@/api/systemConfiguration";
 import Dialog from "@/layout/components/Dialog";
+import { findarrays } from "@/utils/validate";
 export default {
   data() {
     return {
@@ -259,14 +260,31 @@ export default {
     this.getDetial(this.editId);
   },
   components: { Dialog },
+  watch: {
+    keyWords() {
+      if (this.keyWords.length == 0) {
+        this.getDetial(this.editId);
+      }
+    },
+  },
   methods: {
     queryData() {
       const search = this.keyWords;
-      const datas = this.FormData.Unuselist;
-      this.FormData.Unuselist = datas.filter(
-        (data) =>
-          !search || data.UserName.toLowerCase().includes(search.toLowerCase())
-      );
+      if (search) {
+        this.FormData.Unuselist = findarrays(
+          this.FormData.Unuselist,
+          "UserName",
+          search
+        );
+      } else {
+        this.getDetial(this.editId);
+        // this.getWarningList();
+      }
+      // const datas = this.FormData.Unuselist;
+      // this.FormData.Unuselist = datas.filter(
+      //   (data) =>
+      //     !search || data.UserName.toLowerCase().includes(search.toLowerCase())
+      // );
     },
     isValidIP: function (ip) {
       let reg =

+ 12 - 9
src/views/systemManagement/LoginPolicy/index.vue

@@ -202,15 +202,18 @@ export default {
                 if (element.LoginDateEnd) {
                   element.LoginDateEnds = element.LoginDateEnd.split("T")[0];
                 }
-                element.LoginTimeBegins =
-                  element.LoginTimeBegin.split(":")[0] +
-                  ":" +
-                  element.LoginTimeBegin.split(":")[1];
-                element.LoginTimeEnds =
-                  element.LoginTimeEnd.split(":")[0] +
-                  ":" +
-                  element.LoginTimeEnd.split(":")[1];
-                console.log(element);
+                if (element.LoginTimeBegin) {
+                  element.LoginTimeBegins =
+                    element.LoginTimeBegin.split(":")[0] +
+                    ":" +
+                    element.LoginTimeBegin.split(":")[1];
+                }
+                if (element.LoginTimeEnd) {
+                  element.LoginTimeEnds =
+                    element.LoginTimeEnd.split(":")[0] +
+                    ":" +
+                    element.LoginTimeEnd.split(":")[1];
+                }
               });
               this.loading = false;
             }

+ 36 - 9
src/views/systemManagement/addSystem/index.vue

@@ -186,6 +186,7 @@
 <script>
 import { GetUserList } from "@/api/apiAuthority";
 import { SaveTac } from "@/api/systemConfiguration";
+import { findarrays } from "@/utils/validate";
 export default {
   data() {
     return {
@@ -259,6 +260,17 @@ export default {
       return this.loading || this.noMore;
     },
   },
+  watch: {
+    keyWords() {
+      if (this.keyWords.length == 0) {
+        this.getUserList({
+          QueryName: this.keyWords,
+          PageSize: this.PageSize,
+          PageIndex: this.pageNum,
+        });
+      }
+    },
+  },
   methods: {
     isValidIP: function (ip) {
       let reg =
@@ -370,15 +382,30 @@ export default {
         PageIndex: this.pageNum,
       });
     },
-    getUserData() {
-      this.arrList = [];
-      this.FormData.Unuselist = [];
-      this.pageNum = 1;
-      this.getUserList({
-        QueryName: this.keyWords,
-        PageSize: this.PageSize,
-        PageIndex: this.pageNum,
-      });
+    getUserData(val) {
+      // this.arrList = [];
+      // this.FormData.Unuselist = [];
+      // this.pageNum = 1;
+      // this.getUserList({
+      //   QueryName: this.keyWords,
+      //   PageSize: this.PageSize,
+      //   PageIndex: this.pageNum,
+      // });
+      const search = this.keyWords;
+      if (search) {
+        this.FormData.Unuselist = findarrays(
+          this.FormData.Unuselist,
+          "UserName",
+          search
+        );
+      } else {
+        this.getUserList({
+          QueryName: this.keyWords,
+          PageSize: this.PageSize,
+          PageIndex: this.pageNum,
+        });
+        // this.getWarningList();
+      }
     },
     clearData() {
       this.arrList = [];