Przeglądaj źródła

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

chenrui  3 lat temu
rodzic
commit
3d17c3e0ea

+ 73 - 15
src/App.vue

@@ -13,14 +13,20 @@
       <div class="dormancy">
         <div class="title">系统休眠,请输入密码解锁</div>
         <div class="content">
-          <el-form ref="form" :rules="rules" :model="form">
+          <el-form @submit.native.prevent ref="form" :rules="rules" :model="form">
             <el-form-item prop="pwd">
-              <el-input show-password placeholder="请输入密码" v-model="form.pwd"></el-input>
+              <el-input show-password placeholder="请输入密码" tabindex="1" @keyup.enter.native="onSubmit('form')" v-model="form.pwd"></el-input>
             </el-form-item>
+            <div v-if="Number(errorNum) >= 2" class="flex-wrap">
+              <el-form-item class="flex1" prop="identify">
+                <el-input ref="identify" v-model.trim="form.identify" @keyup.enter.native="onSubmit('form')" placeholder="请输入验证码" name="identify" tabindex="1" />
+              </el-form-item>
+              <Identify @changeCode="changeCode" :identifyCode="form.CheckCode" :contentHeight="48" style="margin-left: 24px;" />
+            </div>
             <el-form-item>
-              <button class="button-public-shadow onSubmit" @click="onSubmit('form')">
+              <el-button :loading="loading" style="line-height: normal;" type="primary" class="button-public-shadow onSubmit" @click="onSubmit('form')">
                 确定
-              </button>
+              </el-button>
             </el-form-item>
           </el-form>
         </div>
@@ -33,12 +39,15 @@
 
 <script>
 import Dialog from "@/layout/components/Dialog/index.vue";
+import Identify from './views/login/identify.vue';
 import { mapGetters } from "vuex";
 import { SsoLogin } from "@/api/apiHome";
+import { GetSSOCheckCode } from '@/api/login';
 export default {
   name: "App",
   components: {
     Dialog,
+    Identify
   },
   data () {
     return {
@@ -50,15 +59,19 @@ export default {
       form: {
         //表单数据
         pwd: "",
+        identify: "",
+        CheckCode: ""
       },
       rules: {
         //表单验证
         pwd: [{ required: true, message: "请输入密码", trigger: "blur" }],
       },
+      flag: false,
+      loading: false
     };
   },
   computed: {
-    ...mapGetters(["dialog", "token", "name", "systemSet", "roles"]),
+    ...mapGetters(["dialog", "token", "name", "systemSet", "roles", "errorNum"]),
   },
   watch: {
     "$store.state.user.token": {
@@ -82,6 +95,11 @@ export default {
     },
   },
   mounted () {
+    const num = Number(this.errorNum);
+    if (this.dialog && num >= 2) {
+      // this.flag = true;
+      this.getCheckCode();
+    }
     this.beforeUnload();
   },
   beforeDestroy () {
@@ -146,6 +164,7 @@ export default {
             if (result[result.length - 2] === result[result.length - 1]) {
               // 相同时 结束倒计时
               this.$store.dispatch("app/toggleDialog", true);
+              this.getCheckCode();
               this.clearAll();
             } else {
               this.time = this.desc;
@@ -202,17 +221,56 @@ export default {
     },
     //锁屏验证
     async ssoLogin () {
-      const res = await SsoLogin({
-        LoginName: this.name,
-        LoginPwd: this.form.pwd,
-      });
+      try {
+        this.loading = true;
+        const obj = {
+          LoginName: this.name,
+          LoginPwd: this.form.pwd,
+        }
+        if (Number(this.errorNum) >= 2) {
+          obj.CheckCode = this.form.identify;
+        }
+        const res = await SsoLogin(obj);
+        if (res.code === 0) {
+          this.$store.dispatch("app/toggleDialog", false);
+          this.$store.dispatch("app/getErrorNum", 0);
+          this.arr = [];
+          this.arrLen = [];
+          this.time = this.desc;
+          this.form.pwd = "";
+          this.form.identify = "";
+          this.form.CheckCode = "";
+          this.handleTimer();
+          this.loading = false;
+        } else {
+          const num = Number(res.returnData);
+          this.$store.dispatch("app/getErrorNum", num);
+          if (num >= 2) {
+            this.getCheckCode();
+          }
+          if (num >= 5) {
+            await this.$store.dispatch('user/logout')
+            this.clearAll()
+            this.$store.dispatch("app/toggleDialog", false)
+            this.$router.push(`/login?redirect=${this.$route.fullPath}`)
+          }
+          this.$message.error(res.message);
+          this.loading = false;
+        }
+      } catch (error) {
+        console.log(error);
+        this.loading = false;
+      }
+    },
+    //验证码重新获取
+    changeCode () {
+      this.getCheckCode()
+    },
+    //获取动态验证码
+    async getCheckCode () {
+      const res = await GetSSOCheckCode();
       if (res.code === 0) {
-        this.$store.dispatch("app/toggleDialog", false);
-        this.arr = [];
-        this.arrLen = [];
-        this.time = this.desc;
-        this.form.pwd = "";
-        this.handleTimer();
+        this.form.CheckCode = res.returnData;
       } else {
         this.$message.error(res.message);
       }

+ 10 - 1
src/api/login.js

@@ -5,7 +5,16 @@ export function GetCheckCode (params) {
     return request({
         url: '/api/fs4a/GetCheckCode/v1',
         method: 'post',
-        islogin: true
+        islogin: true,
+        data: params
+    })
+}
+
+//获取动态验证码
+export function GetSSOCheckCode () {
+    return request({
+        url: '/api/fs4a/GetSSOCheckCode/v1',
+        method: 'post'
         // data: params
     })
 }

+ 1 - 0
src/store/getters.js

@@ -23,6 +23,7 @@ const getters = {
   visitedViews: state => state.tagsView.visitedViews,
   cachedViews: state => state.tagsView.cachedViews,
   systemSet: state => state.app.systemSet,
+  errorNum: state => state.app.errorNum,
   authArrs: state => state.auth.authArrs,
   authList: state => state.auth.authList,
   authId: state => state.auth.authId,

+ 9 - 1
src/store/modules/app.js

@@ -19,6 +19,7 @@ const state = {
   outflag: false,
   outcheck: false,
   systemSet: Cookies.get('systemSet') != null ? Cookies.get('systemSet') : null,
+  errorNum: Cookies.get('errorNum') ? Cookies.get('errorNum') : 0,
 }
 const mutations = {
   TOGGLE_SIDEBAR: state => {
@@ -54,6 +55,10 @@ const mutations = {
   SYSTEM_SET: (state, systemSet) => {
     state.systemSet = systemSet
     Cookies.set('systemSet', systemSet)
+  },
+  ERROR_NUM: (state, systemSet) => {
+    state.errorNum = systemSet
+    Cookies.set('errorNum', systemSet)
   }
 }
 
@@ -79,8 +84,11 @@ const actions = {
   toggleOutcheck ({ commit }, outcheck) {
     commit('TOGGLE_OUTCHECK', outcheck)
   },
-  getSystemSet({ commit }, systemSet) {
+  getSystemSet ({ commit }, systemSet) {
     commit('SYSTEM_SET', systemSet)
+  },
+  getErrorNum ({ commit }, systemSet) {
+    commit('ERROR_NUM', systemSet)
   }
 }
 

+ 28 - 18
src/store/modules/user.js

@@ -51,24 +51,28 @@ const actions = {
   // user login
   login ({ commit }, userInfo) {
     return new Promise((resolve, reject) => {
-      login(userInfo).then(response => {
-        const { returnData } = response
-        commit('SET_TOKEN', returnData.Token)
-        commit('SET_UserType', returnData.UserType)
-        commit('SET_UserId', returnData.UserId)
-        commit('SET_LOGIN', returnData.FirstLogin)
-        sessionStorage.setItem("userName", userInfo.LoginName);
-        sessionStorage.setItem("token", returnData.Token);
-        setToken(TokenKey, returnData.Token);
-        setToken('FirstLogin', returnData.FirstLogin);
-        setUserId(returnData.UserId)
-        let nowDate = new Date();
-        let oldDate = new Date(returnData.ValidTime);
-        let diffTime = oldDate - nowDate;
-        setTimeout(function () {
-          resetToken()
-        }, diffTime)
-        resolve()
+      login(userInfo).then(res => {
+        if (res.code == 0) {
+          const { returnData } = res
+          commit('SET_TOKEN', returnData.Token)
+          commit('SET_UserType', returnData.UserType)
+          commit('SET_UserId', returnData.UserId)
+          commit('SET_LOGIN', returnData.FirstLogin)
+          sessionStorage.setItem("userName", userInfo.LoginName);
+          sessionStorage.setItem("token", returnData.Token);
+          setToken(TokenKey, returnData.Token);
+          setToken('FirstLogin', returnData.FirstLogin);
+          setUserId(returnData.UserId)
+          let nowDate = new Date();
+          let oldDate = new Date(returnData.ValidTime);
+          let diffTime = oldDate - nowDate;
+          setTimeout(function () {
+            resetToken()
+          }, diffTime)
+          resolve()
+        } else {
+          reject(res)
+        }
       }).catch(error => {
         reject(error)
       })
@@ -107,6 +111,12 @@ const actions = {
         sessionStorage.removeItem("User_Id");
         sessionStorage.removeItem("token");
         sessionStorage.removeItem("userAuthList");
+        sessionStorage.removeItem('authExpandedKeys')
+        sessionStorage.removeItem('authCurrentKey')
+        sessionStorage.removeItem('accountGroupExpandedKeys')
+        sessionStorage.removeItem('accountGroupCurrentKey')
+        sessionStorage.removeItem('orgExpandedKeys')
+        sessionStorage.removeItem('orgCurrentKey')
         removeToken(); // must remove  token  first
         removeToken('codeToken');
         removeToken('systemSet');

+ 32 - 16
src/utils/request.js

@@ -64,18 +64,10 @@ service.interceptors.response.use(
    */
   response => {
     const res = response.data
-
-    // if the custom code is not 20000, it is judged as an error.
-    if (res.code != 0) {
-      Message({
-        message: res.message || 'Error',
-        type: 'error',
-        duration: 5 * 1000
-      })
-
-      // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
+    if (res.code == 0 || res.code == -1) {
+      return res
+    } else {
       if (res.code == 500) {
-        // to re-login
         Message({
           message: '身份令牌过期或失效,即将重新登录',
           type: 'error',
@@ -88,12 +80,36 @@ service.interceptors.response.use(
           }
         })
       }
-      // loadingInstance.close()
-      return Promise.reject(new Error(res.message || 'Error'))
-    } else {
-      // loadingInstance.close()
-      return res
     }
+    // if the custom code is not 20000, it is judged as an error.
+    // if (res.code != 0 || res.code == -1) {
+    //   Message({
+    //     message: res.message || 'Error',
+    //     type: 'error',
+    //     duration: 5 * 1000
+    //   })
+
+    //   // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
+    //   if (res.code == 500) {
+    //     // to re-login
+    //     Message({
+    //       message: '身份令牌过期或失效,即将重新登录',
+    //       type: 'error',
+    //       duration: 5 * 1000,
+    //       onClose: () => {
+    //         store.dispatch('tagsView/delAllViews').then(() => { })
+    //         store.dispatch('user/resetToken').then(() => {
+    //           location.reload()
+    //         })
+    //       }
+    //     })
+    //   }
+    //   // loadingInstance.close()
+    //   return Promise.reject(new Error(res.message || 'Error'))
+    // } else {
+    //   // loadingInstance.close()
+    //   return res
+    // }
   },
   error => {
     // console.log('err', error) // for debug

+ 26 - 2
src/utils/validate.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-13 09:43:22
- * @LastEditTime: 2022-03-17 09:41:18
+ * @LastEditTime: 2022-03-23 18:20:39
  * @LastEditors: your name
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \Foshan4A2.0\src\utils\validate.js
@@ -317,9 +317,33 @@ export function lengthValidator(rule, value, callback) {
   }
 }
 
+// 表单正整数验证
+export function positiveIntegerValidator(rule, value, callback) {
+  const min = rule.min ?? 1
+  const max = rule.max ?? 2147483647
+  value = value ?? ''
+  if (value.length === 0) {
+    callback()
+  } else if (/^[1-9][0-9]*$/.test(value)) {
+    value = parseInt(value)
+    if (value < min) {
+      rule.message = `不能小于${min}`
+      callback(new Error('Size Error'))
+    } else if (value > max) {
+      rule.message = `不能大于${max}`
+      callback(new Error('Size Error'))
+    } else {
+      callback()
+    }
+  } else {
+    rule.message = '请输入正整数'
+    callback(new Error('Type Error'))
+  }
+}
+
 // 表单验证输入内容验证
 export const regular = {
   integer: /^[0-9]*$/,
   name: /^(?!_)(?!.*?_$)[a-zA-Z0-9_\u4e00-\u9fa5]+$/,
-  nameMessage: '只能包含中文、英文、数字和下划线切不能以下划线开头'
+  nameMessage: '只能包含中文、英文、数字和下划线不能以下划线开头'
 }

+ 96 - 78
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-21 03:17:37
+ * @LastEditTime: 2022-03-23 16:00:26
  * @LastEditors: your name
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -21,7 +21,7 @@
           <div class="grid-content">
             <div class="title">{{ accountGroupType }}树</div>
             <div class="contentTree">
-              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="GroupId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" :current-node-key="currentKey" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
+              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="GroupId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
               </el-tree>
             </div>
           </div>
@@ -91,7 +91,7 @@
               <el-empty :image-size="150" v-if="childrenData.length < 1"></el-empty>
               <el-row :gutter="24">
                 <el-col :span="6" v-for="(data, index) in childrenData" :key="data.GroupId">
-                  <div v-is="['grouptree_btn_del_group']" class="info-close" @click="onNodeClick(data, index)">
+                  <div v-is="['grouptree_btn_del_group']" class="info-close" @click="onNodeClick(data)">
                     <i class="el-icon-close"></i>
                   </div>
                   <div class="itemBox" @click.stop="childrenClick(data)">
@@ -202,6 +202,7 @@ export default {
       title: '', // 弹框title
       flag: false, // 弹框开关
       dataId: null, // tree数据id
+      dataUpId: null,
       defaultProps: {
         children: 'children',
         label: 'GroupName'
@@ -209,14 +210,14 @@ export default {
       currDataArr: [],
       childrenData: [],
       dataListTree: [],
-      currentKey: -1,
+      currentKey: null,
       expandedKeys: [-1],
-      delIndex: 0
+      initCurrentKeyStep: [false, false]
     }
   },
   created () {
     let keyWords = ''
-    const treeEx = sessionStorage.getItem('accountTreeDatas');
+    const treeEx = sessionStorage.getItem('accountGroupExpandedKeys');
     if (this.$route.query.keyWords) {
       keyWords = this.$route.query.keyWords
     }
@@ -226,9 +227,7 @@ export default {
     this.getGroupTree(keyWords)
   },
   mounted () {
-    setTimeout(() => {
-      this.$refs.tree.setCurrentKey(this.expandedKeys[this.expandedKeys.length - 1]);
-    }, 500);
+    this.initCurrentKeyStep.splice(1, 1, true)
   },
   watch: {
     dataList: {
@@ -240,13 +239,66 @@ export default {
     },
     currentKey: {
       handler (val) {
+        if (typeof val !== 'number') {
+          return
+        }
         this.$nextTick(() => {
           this.$refs.tree.setCurrentKey(val)
+          sessionStorage.setItem('accountGroupCurrentKey', val)
+          this.setCards()
         })
       }
+    },
+    expandedKeys: {
+      handler(arr) {
+        sessionStorage.setItem('accountGroupExpandedKeys', JSON.stringify(arr))
+      },
+      deep: true
+    },
+    initCurrentKeyStep: {
+      handler(arr) {
+        if (arr.every(item => item)) {
+          this.currentKey = parseInt(sessionStorage.getItem('accountGroupCurrentKey') ?? -1)
+        }
+      },
+      deep: true
     }
   },
   methods: {
+    // 树点击
+    handleNodeClick (data) {
+      this.currentKey = data.GroupId
+    },
+    // 下级卡片点击
+    childrenClick (data) {
+      this.currentKey = data.GroupId
+      if (!this.expandedKeys.includes(this.currentKey)) {
+        this.expandedKeys.push(this.currentKey)
+      }
+    },
+    // 根据选中节点获取卡片
+    setCards() {
+      this.currDataArr = this.decompose(this.dataArr, "GroupId", this.currentKey);
+      this.childrenData = this.decompose(this.dataArr, "GroupUpid", this.currentKey);
+    },
+    // 节点展开
+    handleExpand (obj) {
+      this.expandedKeys.push(obj.GroupId)
+    },
+    // 节点收起
+    handleCollapse (obj) {
+      const { GroupId, children } = obj
+      children.length && this.collapseChilren(children)
+      this.expandedKeys = this.expandedKeys.filter(key => key !== GroupId)
+    },
+    // 收起子节点
+    collapseChilren (children) {
+      children.forEach(child => {
+        const { GroupId, children } = child
+        children.length && this.collapseChilren(children)
+        this.expandedKeys = this.expandedKeys.filter(key => key !== GroupId)
+      })
+    },
     filterNode (value, data) {
       if (!value) return true
       return data.GroupName.indexOf(value) !== -1
@@ -271,12 +323,14 @@ export default {
     },
     // 切换状态
     renderChange (data) {
-      const { GroupId, flag } = data
+      const { GroupId, flag, GroupUpid } = data
+      this.dataUpId = GroupUpid
       this.handleChange(GroupId, flag)
     },
     // 下级切换状态
-    async childrenRenderChange (data, index) {
-      const { GroupId, flag } = data
+    childrenRenderChange (data, index) {
+      const { GroupId, flag, GroupUpid } = data
+      this.dataUpId = GroupUpid
       const isChildren = true
       this.handleChange(GroupId, flag, index, isChildren)
       // try {
@@ -334,10 +388,10 @@ export default {
       this.getGroupTree()
     },
     // 节点关闭按钮点击
-    onNodeClick (data, index) {
-      this.delIndex = index
+    onNodeClick (data) {
       this.flag = true
       this.dataId = data.GroupId
+      this.dataUpId = data.GroupUpid
       this.title = data.GroupName
     },
     // 获取指定数据
@@ -372,25 +426,28 @@ export default {
         })
         if (res.code === 0) {
           this.$message.success(res.message)
-          if (!isChildren) {
-            this.currDataArr[0].Status = Status
-          } else {
-            this.childrenData[index].Status = Status
-          }
-          this.dataArr.find(data => {
-            if (data.GroupId === id) {
-              data.Status = Status
-              data.flag = flag
-              return true
-            }
-          })
-          if (!isChildren) {
-            this.childrenData.forEach(data => {
-              data.Status = Status
-              data.flag = flag
-            })
-          }
-          this.setChildrenStatus(id, flag)
+          // if (!isChildren) {
+          //   this.currDataArr[0].Status = Status
+          // } else {
+          //   this.childrenData[index].Status = Status
+          // }
+          // this.dataArr.find(data => {
+          //   if (data.GroupId === id) {
+          //     data.Status = Status
+          //     data.flag = flag
+          //     return true
+          //   }
+          // })
+          // if (!isChildren) {
+          //   this.childrenData.forEach(data => {
+          //     data.Status = Status
+          //     data.flag = flag
+          //   })
+          // }
+          // this.setChildrenStatus(id, flag)
+          this.initCurrentKeyStep.splice(0, 1, false)
+          this.currentKey = null
+          this.getGroupTree()
         } else {
           this.$message.error(res.message)
           if (!isChildren) {
@@ -407,9 +464,6 @@ export default {
           this.childrenData[index].flag = !flag
         }
       }
-      this.$nextTick(() => {
-        this.$refs.tree.setCurrentKey(this.currentKey)
-      })
     },
     // 删除
     async deleteOrg (id) {
@@ -420,8 +474,13 @@ export default {
         if (res.code === 0) {
           this.$message.success(res.message)
           this.flag = false
+          this.initCurrentKeyStep.splice(0, 1, false)
+          if (this.currentKey === id) {
+            sessionStorage.setItem('accountGroupCurrentKey', this.dataUpId)
+          } else {
+            this.currentKey = null
+          }
           this.getGroupTree()
-          this.childrenData.splice(this.delIndex, 1)
         } else {
           this.flag = false
           this.$message.error(res.message)
@@ -431,47 +490,6 @@ export default {
         console.log('DeleteGroup')
         console.log('error')
       }
-    },
-    // 树点击
-    handleNodeClick (data) {
-      const dataNew = _.cloneDeep(data)
-      this.currentKey = dataNew.GroupId
-      this.currDataArr = []
-      this.childrenData = []
-      this.currDataArr = this.decompose(this.dataArr, 'GroupId', this.currentKey)
-      this.childrenData = this.decompose(this.dataArr, 'GroupUpid', this.currentKey)
-    },
-    // 下级卡片点击
-    childrenClick (data) {
-      const dataNew = _.cloneDeep(data)
-      this.currentKey = dataNew.GroupId
-      this.currDataArr = []
-      this.childrenData = []
-      this.currDataArr = this.decompose(this.dataArr, 'GroupId', this.currentKey)
-      this.childrenData = this.decompose(this.dataArr, 'GroupUpid', this.currentKey)
-      if (!this.expandedKeys.includes(this.currentKey)) {
-        this.expandedKeys.push(this.currentKey)
-      }
-    },
-    // 节点展开
-    handleExpand (obj) {
-      this.expandedKeys.push(obj.GroupId)
-      sessionStorage.setItem('accountTreeDatas', JSON.stringify(this.expandedKeys))
-    },
-    // 节点收起
-    handleCollapse (obj) {
-      const { GroupId, children } = obj
-      children.length && this.collapseChilren(children)
-      this.expandedKeys = this.expandedKeys.filter(key => key !== GroupId)
-      sessionStorage.setItem('accountTreeDatas', JSON.stringify(this.expandedKeys))
-    },
-    // 收起子节点
-    collapseChilren (children) {
-      children.forEach(child => {
-        const { GroupId, children } = child
-        children.length && this.collapseChilren(children)
-        this.expandedKeys = this.expandedKeys.filter(key => key !== GroupId)
-      })
     }
   }
 }

+ 6 - 10
src/views/accountGroupManagement/mixins/treeData.js

@@ -1,10 +1,9 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-21 03:27:01
+ * @LastEditTime: 2022-03-23 15:22:31
  * @LastEditors: your name
- * @Description: 获取权限树
- * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
+ * @Description: 获取用户组树
  */
 import { translateDataToTreeAll } from '@/utils/validate'
 import { GetGroupTree } from '@/api/AccountGroup'
@@ -72,17 +71,14 @@ export default {
           }
           this.dataList = obj
           this.dataArr.push(obj)
+          typeof this.currentKey !== 'undefined' && sessionStorage.setItem('accountGroupCurrentKey', -1)
         }
-        this.currDataArr = this.decompose(this.dataArr, 'GroupId', this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, 'GroupUpid', this.currentKey)
+        this.initCurrentKeyStep?.splice(0, 1, true)
       } catch (error) {
         console.log('出错了', error)
-        this.currDataArr = this.decompose(this.dataArr, 'GroupId', this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, 'GroupUpid', this.currentKey)
+        typeof this.currentKey !== 'undefined' && sessionStorage.setItem('accountGroupCurrentKey', -1)
+        this.initCurrentKeyStep?.splice(0, 1, true)
       }
-      this.$nextTick(() => {
-        this.$refs.tree?.setCurrentKey(this.currentKey)
-      })
     }
   }
 }

+ 1 - 1
src/views/authorityManagement/components/authorityAppEdit.vue

@@ -187,7 +187,7 @@ export default {
           this.form.desc = AppDesc;
           this.form.url = AppUrl;
           this.dynamicValidateForm.domains = Inputs;
-          this.typeFlag = this.form.id;
+          this.typeFlag = this.form.id ? true : false;
         } else {
           this.$message.error(res.message);
         }

+ 83 - 56
src/views/authorityManagement/components/authorityHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:27:43
- * @LastEditTime: 2022-03-21 03:21:52
+ * @LastEditTime: 2022-03-23 15:59:27
  * @LastEditors: your name
  * @Description: 权限管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
@@ -27,7 +27,7 @@
           <div class="grid-content">
             <div class="title">权限树</div>
             <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" class="contentTree">
-              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="AuthId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" :current-node-key="currentKey" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
+              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="AuthId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
               </el-tree>
             </div>
           </div>
@@ -38,7 +38,7 @@
             <div class="content">
               <template v-if="currDataArr.length">
                 <el-row>
-                  <el-col :span="6" v-for="(data,index) in currDataArr" :key="data.AuthId">
+                  <el-col :span="6" v-for="data in currDataArr" :key="data.AuthId">
                     <div class="account-left-content-teams">
                       <div class="team">
                         <div class="bg" :class="data.Type == 1 || data.Type == 0 ? 'status1' : 'status2'"></div>
@@ -66,7 +66,7 @@
                           <div v-if="data.Type > 0" class="flex details">
                             <div class="details-msg">状态:<span :class="data.Status === 1 ? 'success' : 'error'">{{data.Status === 1 ? '启用' : '禁用'}}</span></div>
                             <div v-is="['authtree_btn_state_swatch']" class="details-info">
-                              <el-switch v-model="data.flag" @change="renderChange(data,index)" active-color="#6F81BC">
+                              <el-switch v-model="data.flag" @change="renderChange(data)" active-color="#6F81BC">
                               </el-switch>
                             </div>
                           </div>
@@ -178,6 +178,7 @@ export default {
       title: '', //弹框title
       flag: false, //弹框开关
       dataId: null, //tree数据id
+      dataUpId: null,
       currDataArr: [],
       childrenData: [],
       dataListTree: [],
@@ -185,13 +186,14 @@ export default {
         children: "children",
         label: "AuthName",
       },
-      currentKey: -1,
-      expandedKeys: [-1]
+      currentKey: null,
+      expandedKeys: [-1],
+      initCurrentKeyStep: [false, false]
     }
   },
   created () {
     let keyWords = "";
-    const treeEx = sessionStorage.getItem('authTreeDatas');
+    const treeEx = sessionStorage.getItem('authExpandedKeys');
     if (this.$route.query.keyWords) {
       keyWords = this.$route.query.keyWords;
     }
@@ -201,9 +203,7 @@ export default {
     this.getAuthTree(keyWords);
   },
   mounted () {
-    setTimeout(() => {
-      this.$refs.tree.setCurrentKey(this.expandedKeys[this.expandedKeys.length - 1]);
-    }, 500);
+    this.initCurrentKeyStep.splice(1, 1, true)
   },
   watch: {
     dataList: {
@@ -215,45 +215,58 @@ export default {
     },
     currentKey: {
       handler (val) {
+        if (typeof val !== 'number') {
+          return
+        }
         this.$nextTick(() => {
           this.$refs.tree.setCurrentKey(val)
+          sessionStorage.setItem('authCurrentKey', val)
+          this.setCards()
         })
       }
+    },
+    expandedKeys: {
+      handler(arr) {
+        sessionStorage.setItem('authExpandedKeys', JSON.stringify(arr))
+      },
+      deep: true
+    },
+    initCurrentKeyStep: {
+      handler(arr) {
+        if (arr.every(item => item)) {
+          this.currentKey = parseInt(sessionStorage.getItem('authCurrentKey') ?? -1)
+        }
+      },
+      deep: true
     }
   },
   methods: {
     //树点击
     handleNodeClick (data) {
-      const dataNew = _.cloneDeep(data)
-      this.currentKey = dataNew.AuthId
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(this.dataArr, "AuthId", this.currentKey);
-      this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey);
+      this.currentKey = data.AuthId
     },
     //下级卡片点击
     childrenClick (data) {
-      const dataNew = _.cloneDeep(data)
-      this.currentKey = dataNew.AuthId
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(this.dataArr, "AuthId", this.currentKey);
-      this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey);
+      this.currentKey = data.AuthId
       if (!this.expandedKeys.includes(this.currentKey)) {
         this.expandedKeys.push(this.currentKey)
       }
+      // this.setCards()
+    },
+    // 根据选中节点获取卡片
+    setCards() {
+      this.currDataArr = this.decompose(this.dataArr, "AuthId", this.currentKey);
+      this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey);
     },
     // 节点展开
     handleExpand (obj) {
       this.expandedKeys.push(obj.AuthId)
-      sessionStorage.setItem('authTreeDatas', JSON.stringify(this.expandedKeys))
     },
     // 节点收起
     handleCollapse (obj) {
       const { AuthId, children } = obj
       children.length && this.collapseChilren(children)
       this.expandedKeys = this.expandedKeys.filter(key => key !== AuthId)
-      sessionStorage.setItem('authTreeDatas', JSON.stringify(this.expandedKeys))
     },
     // 收起子节点
     collapseChilren (children) {
@@ -265,7 +278,8 @@ export default {
     },
     //下级切换状态
     childrenRenderChange (data, index) {
-      const { AuthId, flag, Type } = data
+      const { AuthId, flag, Type, UpAuthId } = data
+      this.dataUpId = UpAuthId
       const isChildren = true
       this.handleChange(AuthId, flag, Type, index, isChildren)
     },
@@ -290,9 +304,10 @@ export default {
       this.$router.push({ path: '/authority/addPower', query: { AuthId: data.AuthId, Status: data.Status, UpAuthId: data.UpAuthId } })
     },
     // 关闭开启
-    renderChange (data, index) {
-      const { AuthId, flag, Type } = data
-      this.handleChange(AuthId, flag, Type, index)
+    renderChange (data) {
+      const { AuthId, flag, Type, UpAuthId } = data
+      this.dataUpId = UpAuthId
+      this.handleChange(AuthId, flag, Type)
     },
     //删除
     remove () {
@@ -321,6 +336,7 @@ export default {
     onNodeClick (data) {
       this.flag = true
       this.dataId = data.AuthId
+      this.dataUpId = data.UpAuthId
       this.title = data.AuthName
       this.type = data.Type
     },
@@ -379,7 +395,7 @@ export default {
     // },
     //-----------获取数据------------
     //应用状态变更
-    async handleChange (id, flag, type, index, isChildren = false) {
+    async handleChange (id, flag, type, index = 0, isChildren = false) {
       const Status = flag ? 1 : 0
       try {
         let res = null
@@ -396,32 +412,34 @@ export default {
         }
         if (res.code === 0) {
           this.$message.success(res.message)
-          if (!isChildren) {
-            this.currDataArr[0].Status = Status
-          } else {
-            this.childrenData[index].Status = Status
-          }
-          this.dataArr.find(data => {
-            if (data.AuthId === id) {
-              data.Status = Status
-              data.flag = flag
-              return true
-            }
-          })
-          if (type !== 1) {
-            if (!isChildren) {
-              this.childrenData.forEach(data => {
-                data.Status = Status
-                data.flag = flag
-              })
-            }
-            this.setChildrenStatus(id, flag)
-          }
-          //this.getAuthTree()
+          // if (!isChildren) {
+          //   this.currDataArr[0].Status = Status
+          // } else {
+          //   this.childrenData[index].Status = Status
+          // }
+          // this.dataArr.find(data => {
+          //   if (data.AuthId === id) {
+          //     data.Status = Status
+          //     data.flag = flag
+          //     return true
+          //   }
+          // })
+          // if (type !== 1) {
+          //   if (!isChildren) {
+          //     this.childrenData.forEach(data => {
+          //       data.Status = Status
+          //       data.flag = flag
+          //     })
+          //   }
+          //   this.setChildrenStatus(id, flag)
+          // }
+          this.initCurrentKeyStep.splice(0, 1, false)
+          this.currentKey = null
+          this.getAuthTree()
         } else {
           this.$message.error(res.message)
           if (!isChildren) {
-            this.currDataArr[0].flag = !flag;
+            this.currDataArr[index].flag = !flag;
           } else {
             this.childrenData[index].flag = !flag;
           }
@@ -429,14 +447,11 @@ export default {
       } catch (error) {
         console.log('出错了', error)
         if (!isChildren) {
-          this.currDataArr[0].flag = !flag;
+          this.currDataArr[index].flag = !flag;
         } else {
           this.childrenData[index].flag = !flag;
         }
       }
-      this.$nextTick(() => {
-        this.$refs.tree.setCurrentKey(this.currentKey)
-      })
     },
     //应用删除
     async deleteApp (id) {
@@ -447,6 +462,12 @@ export default {
         if (res.code === 0) {
           this.$message.success(res.message)
           this.flag = false
+          this.initCurrentKeyStep.splice(0, 1, false)
+          if (this.currentKey === id) {
+            sessionStorage.setItem('authCurrentKey', this.dataUpId)
+          } else {
+            this.currentKey = null
+          }
           this.getAuthTree()
         } else {
           this.flag = false
@@ -465,6 +486,12 @@ export default {
         if (res.code === 0) {
           this.$message.success(res.message || '成功')
           this.flag = false
+          this.initCurrentKeyStep.splice(0, 1, false)
+          if (this.currentKey === id) {
+            sessionStorage.setItem('authCurrentKey', this.dataUpId)
+          } else {
+            this.currentKey = null
+          }
           this.getAuthTree()
         } else {
           this.flag = false

+ 8 - 11
src/views/authorityManagement/minixs/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-21 03:26:52
+ * @LastEditTime: 2022-03-23 15:19:36
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -35,7 +35,7 @@ export default {
             AuthName: "所有权限",
             QueryTarget: 0,
             Status: 0,
-            UpAuthId: -1,
+            UpAuthId: -2,
             Type: 0,
             disabled: true,
             children: translateDataToTreeAll(result.returnData, 'UpAuthId', 'AuthId')
@@ -65,7 +65,7 @@ export default {
             children: []
           }
           this.dataList = obj
-          this.dataArr.push({
+          this.dataArr?.push({
             AuthId: -1,
             AuthName: "所有权限",
             QueryTarget: 0,
@@ -75,10 +75,10 @@ export default {
             disabled: true,
             children: []
           })
+          typeof this.currentKey !== 'undefined' && sessionStorage.setItem('authCurrentKey', -1)
         }
-        this.currDataArr = this.decompose(this.dataArr, "AuthId", this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey)
         this.loading = false
+        this.initCurrentKeyStep?.splice(0, 1, true)
       } catch (error) {
         const obj = {
           AuthId: -1,
@@ -91,7 +91,7 @@ export default {
           children: []
         }
         this.dataList = obj
-        this.dataArr.push({
+        this.dataArr?.push({
           AuthId: -1,
           AuthName: "所有权限",
           QueryTarget: 0,
@@ -101,13 +101,10 @@ export default {
           disabled: true,
           children: []
         })
-        this.currDataArr = this.decompose(this.dataArr, "AuthId", this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey)
+        typeof this.currentKey !== 'undefined' && sessionStorage.setItem('authCurrentKey', -1)
         this.loading = false
+        this.initCurrentKeyStep?.splice(0, 1, true)
       }
-      this.$nextTick(() => {
-        this.$refs.tree?.setCurrentKey(this.currentKey)
-      })
     }
   }
 }

+ 1 - 1
src/views/dashboard/components/analysis.vue

@@ -447,7 +447,7 @@ export default {
             data: [
               { value: 2780, name: '正常登录' },
               { value: 735, name: '异常登录' },
-              { value: 165, name: '登失败' }
+              { value: 165, name: '登失败' }
             ]
           }
         ]

+ 1 - 1
src/views/dashboard/index.vue

@@ -35,7 +35,7 @@
           <el-select :style="inputFlag ? 'width:150px;':'width:200px;'" @change="handleChange" v-model="select" placeholder="功能菜单">
             <el-option v-for="(item,index) in routes" :key="index" :label="item.meta.title" :value="item.path"></el-option>
           </el-select>
-          <el-input v-show="inputFlag" :style="inputFlag ? 'width:330px;':'width:280px;'" placeholder="如需搜索,请输入" v-model.trim="input" class="input-with-select">
+          <el-input v-show="inputFlag" :style="inputFlag ? 'width:330px;':'width:280px;'" @keyup.enter.native="searchByLink" placeholder="如需搜索,请输入" v-model.trim="input" class="input-with-select">
           </el-input>
           <!-- <el-select v-model="select" slot="prepend" placeholder="功能菜单">
             <el-option v-for="(item,index) in selectArr" :key="index" :label="item.name" :value="item.value"></el-option>

+ 10 - 4
src/views/login/index.vue

@@ -59,7 +59,7 @@ import Identify from './identify.vue';
 import Dialog from "@/layout/components/Dialog/index.vue";
 import { GetCheckCode, getToken } from '@/api/login';
 import { GetSystemSet } from "@/api/systemConfiguration";
-import { setCodeToken, setToken } from '@/utils/auth';
+import { setCodeToken, getCodeToken } from '@/utils/auth';
 import { getAuthListByUser } from '@/api/Account';
 export default {
   name: 'Login',
@@ -132,7 +132,8 @@ export default {
           const params = {
             LoginName: this.loginForm.username,
             LoginPwd: this.loginForm.password,
-            CheckCode: this.loginForm.identify
+            CheckCode: this.loginForm.identify,
+            token: getCodeToken()
           }
           this.$store
             .dispatch("user/login", params)
@@ -178,7 +179,10 @@ export default {
               }, 100);
               this.loading = false;
             })
-            .catch(() => {
+            .catch((res) => {
+              if (res.message) {
+                this.$message.error(res.message);
+              }
               this.getCheckCode();
               this.loginForm.password = '';
               this.loginForm.identify = '';
@@ -198,7 +202,9 @@ export default {
     },
     //获取动态验证码
     async getCheckCode () {
-      const res = await GetCheckCode({});
+      const res = await GetCheckCode({
+        token: getCodeToken()
+      });
       if (res.code === 0) {
         this.loginForm.CheckCode = res.returnData;
       } else {

+ 61 - 68
src/views/organizationManagement/components/organizationHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:27:43
- * @LastEditTime: 2022-03-21 03:28:09
+ * @LastEditTime: 2022-03-23 16:31:35
  * @LastEditors: your name
  * @Description: 权限管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
@@ -24,7 +24,7 @@
           <div class="grid-content">
             <div class="title">组织树</div>
             <div class="contentTree">
-              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="OrganId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" :current-node-key="currentKey" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
+              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="OrganId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="expandedKeys" @node-expand="handleExpand" @node-collapse="handleCollapse" @node-click="handleNodeClick">
               </el-tree>
             </div>
           </div>
@@ -110,7 +110,7 @@
               <el-empty :image-size="150" v-if="childrenData.length<1"></el-empty>
               <el-row :gutter="24">
                 <el-col :span="8" v-for="(data, index) in childrenData" :key="data.OrganId">
-                  <div v-is="['organtree_btn_del_organ']" class="info-close" @click="onNodeClick(data,index)">
+                  <div v-is="['organtree_btn_del_organ']" class="info-close" @click="onNodeClick(data)">
                     <i class="el-icon-close"></i>
                   </div>
                   <div class="itemBox" @click.stop="childrenClick(data)">
@@ -216,6 +216,7 @@ export default {
       title: "", //弹框title
       flag: false, //弹框开关
       dataId: null, //tree数据id
+      dataUpId: null,
       defaultProps: {
         children: "children",
         label: "OrganName",
@@ -224,14 +225,14 @@ export default {
       currDataArrId: 0,
       childrenData: [],
       dataListTree: [],
-      currentKey: -1,
+      currentKey: null,
       expandedKeys: [-1],
-      delIndex: 0
+      initCurrentKeyStep: [false, false]
     };
   },
   created () {
     let keyWords = "";
-    const treeEx = sessionStorage.getItem('orgTreeDatas');
+    const treeEx = sessionStorage.getItem('orgExpandedKeys');
     if (this.$route.query.keyWords) {
       keyWords = this.$route.query.keyWords;
     }
@@ -241,9 +242,8 @@ export default {
     this.getOrganTree(keyWords);
   },
   mounted () {
-    setTimeout(() => {
-      this.$refs.tree.setCurrentKey(this.expandedKeys[this.expandedKeys.length - 1]);
-    }, 500);
+    this.initCurrentKeyStep.splice(1, 1, true)
+    
   },
   watch: {
     dataList: {
@@ -255,10 +255,29 @@ export default {
     },
     currentKey: {
       handler (val) {
+        if (typeof val !== 'number') {
+          return
+        }
         this.$nextTick(() => {
           this.$refs.tree.setCurrentKey(val)
+          sessionStorage.setItem('orgCurrentKey', val)
+          this.setCards()
         })
       }
+    },
+    expandedKeys: {
+      handler(arr) {
+        sessionStorage.setItem('orgExpandedKeys', JSON.stringify(arr))
+      },
+      deep: true
+    },
+    initCurrentKeyStep: {
+      handler(arr) {
+        if (arr.every(item => item)) {
+          this.currentKey = parseInt(sessionStorage.getItem('orgCurrentKey') ?? -1)
+        }
+      },
+      deep: true
     }
   },
   methods: {
@@ -303,31 +322,15 @@ export default {
     },
     // 关闭开启
     renderChange (data) {
-      const { OrganId, flag } = data;
+      const { OrganId, flag, OrganUpid } = data;
+      this.dataUpId = OrganUpid
       this.handleChange(OrganId, flag);
     },
     //下级关闭
     childrenRenderChange (data, index) {
-      const { OrganId, flag } = data;
-      const Status = flag ? 1 : 0;
-      try {
-        tissueTreeStart({
-          OrganId: OrganId,
-          Status: Status,
-        }).then((res) => {
-          if (res.code === 0) {
-            this.$message.success(res.message);
-            this.childrenData[index].Status = Status;
-            // this.getOrganTree();
-          } else {
-            this.$message.error(res.message);
-            this.childrenData[index].flag = !flag;
-          }
-        });
-      } catch (error) {
-        console.log("出错了", error);
-        this.childrenData[index].flag = !flag;
-      }
+      const { OrganId, flag, OrganUpid } = data;
+      this.dataUpId = OrganUpid
+      this.handleChange(OrganId, flag, index)
     },
     //删除组织
     remove () {
@@ -348,8 +351,7 @@ export default {
       this.getOrganTree();
     },
     //节点关闭按钮点击
-    onNodeClick (data, index) {
-      this.delIndex = index
+    onNodeClick (data) {
       this.flag = true;
       this.dataId = data.OrganId;
       this.title = data.OrganName;
@@ -369,7 +371,7 @@ export default {
 
     //-----------获取数据------------
     //应用状态变更
-    async handleChange (id, flag) {
+    async handleChange (id, flag, index = 0, isChildren = false) {
       const Status = flag ? 1 : 0
       try {
         const res = await tissueTreeStart({
@@ -378,15 +380,28 @@ export default {
         });
         if (res.code === 0) {
           this.$message.success(res.message);
-          this.currDataArr[0].Status = Status
-          // this.getOrganTree();
+          this.initCurrentKeyStep.splice(0, 1, false)
+          if (this.currentKey === id) {
+            sessionStorage.setItem('orgCurrentKey', this.dataUpId)
+          } else {
+            this.currentKey = null
+          }
+          this.getOrganTree()
         } else {
           this.$message.error(res.message);
-          this.currDataArr[0].flag = !flag;
+          if (!isChildren) {
+            this.currDataArr[index].flag = !flag;
+          } else {
+            this.childrenData[index].flag = !flag
+          }
         }
       } catch (error) {
         console.log("出错了", error);
-        this.currDataArr[0].flag = !flag;
+        if (!isChildren) {
+            this.currDataArr[index].flag = !flag;
+          } else {
+            this.childrenData[index].flag = !flag
+          }
       }
     },
     //组织删除
@@ -398,8 +413,9 @@ export default {
         if (res.code === 0) {
           this.$message.success(res.message);
           this.flag = false;
+          this.initCurrentKeyStep.splice(0, 1, false)
+          this.currentKey = null
           this.getOrganTree();
-          this.childrenData.splice(this.delIndex, 1);
         } else {
           this.flag = false;
           this.$message.error(res.message);
@@ -410,52 +426,29 @@ export default {
     },
     //树点击
     handleNodeClick (data) {
-      const dataNew = _.cloneDeep(data);
-      this.currentKey = dataNew.OrganId;
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(
-        this.dataArr,
-        "OrganId",
-        this.currentKey
-      );
-      this.childrenData = this.decompose(
-        this.dataArr,
-        "OrganUpid",
-        this.currentKey
-      );
+      this.currentKey = data.OrganId;
     },
     //下级卡片点击
     childrenClick (data) {
-      const dataNew = _.cloneDeep(data);
-      this.currentKey = dataNew.OrganId;
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(
-        this.dataArr,
-        "OrganId",
-        this.currentKey
-      );
-      this.childrenData = this.decompose(
-        this.dataArr,
-        "OrganUpid",
-        this.currentKey
-      );
+      this.currentKey = data.OrganId;
       if (!this.expandedKeys.includes(this.currentKey)) {
         this.expandedKeys.push(this.currentKey)
       }
     },
+    // 根据选中节点获取卡片
+    setCards() {
+      this.currDataArr = this.decompose(this.dataArr, "OrganId", this.currentKey);
+      this.childrenData = this.decompose(this.dataArr, "OrganUpid", this.currentKey);
+    },
     // 节点展开
     handleExpand (obj) {
       this.expandedKeys.push(obj.OrganId)
-      sessionStorage.setItem('orgTreeDatas', JSON.stringify(this.expandedKeys))
     },
     // 节点收起
     handleCollapse (obj) {
       const { OrganId, children } = obj
       children.length && this.collapseChilren(children)
       this.expandedKeys = this.expandedKeys.filter(key => key !== OrganId)
-      sessionStorage.setItem('orgTreeDatas', JSON.stringify(this.expandedKeys))
     },
     // 收起子节点
     collapseChilren (children) {

+ 7 - 12
src/views/organizationManagement/minixs/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-21 03:29:33
+ * @LastEditTime: 2022-03-23 15:52:22
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -64,8 +64,7 @@ export default {
             QueryTarget: "0",
             Type: 0,
             disabled: true,
-          }
-          )
+          })
         } else {
           const obj = {
             AuthCount: 0,
@@ -90,19 +89,15 @@ export default {
             QueryTarget: "0",
             Type: 0,
             disabled: true,
-          }
-          )
+          })
+          typeof this.currentKey !== 'undefined' && sessionStorage.setItem('orgCurrentKey', -1)
         }
-        this.currDataArr = this.decompose(this.dataArr, 'OrganId', this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, 'OrganUpid', this.currentKey)
+        this.initCurrentKeyStep?.splice(0, 1, true)
       } catch (error) {
         console.log('出错了', error)
-        this.currDataArr = this.decompose(this.dataArr, 'OrganId', this.currentKey)
-        this.childrenData = this.decompose(this.dataArr, 'OrganUpid', this.currentKey)
+        typeof this.currentKey !== 'undefined' && sessionStorage.setItem('orgCurrentKey', -1)
+        this.initCurrentKeyStep?.splice(0, 1, true)
       }
-      this.$nextTick(() => {
-        this.$refs.tree?.setCurrentKey(this.currentKey)
-      })
     }
   }
 }

+ 19 - 13
src/views/systemManagement/EditSystem/index.vue

@@ -99,15 +99,15 @@
               v-model.trim="keyWordsUp"
               @keyup.enter.native="queryDatas"
             ></el-input>
-            <el-button @click="queryDatas()">搜索</el-button>
+            <el-button @click="queryDatas">搜索</el-button>
           </div>
         </div>
         <div class="center-box fpBox">
           <el-row class="scCont" :gutter="16">
             <el-col
               :span="4"
-              v-for="(item, index) in FormData.UseList"
-              :key="index"
+              v-for="item in FormData.UseList"
+              :key="item.UserId"
             >
               <el-card class="box-card">
                 <div class="lineTop"></div>
@@ -130,7 +130,7 @@
             </el-col>
           </el-row>
           <el-empty
-            v-if="FormData.UseList.length == 0"
+            v-if="FormData.UseList && FormData.UseList.length == 0"
             description="没有选取"
             style="margin: 0 auto"
           ></el-empty>
@@ -147,7 +147,7 @@
               v-model.trim="keyWords"
               @keyup.enter.native="queryData"
             ></el-input>
-            <el-button @click="queryData()">搜索</el-button>
+            <el-button @click="queryData">搜索</el-button>
           </div>
         </div>
         <div class="center-box">
@@ -178,7 +178,7 @@
             </el-col>
           </el-row>
           <el-empty
-            v-if="FormData.Unuselist.length == 0"
+            v-if="FormData.Unuselist && FormData.Unuselist.length == 0"
             description="没有内容"
             style="margin: 0 auto"
           ></el-empty>
@@ -289,14 +289,19 @@ export default {
   },
   components: { Dialog },
   watch: {
-    keyWords(val) {
-      if (this.keyWords.length == 0) {
-        this.FormData.Unuselist = this.FormData.Unuselists;
+    keyWords: {
+      handler(val) {
+        if (val.length == 0) {
+          this.FormData.Unuselist = this.FormData.Unuselists;
+        }
       }
     },
-    keyWordsUp() {
-      if (this.keyWordsUp.length == 0) {
-        this.FormData.UseList = this.FormData.UseLists;
+    keyWordsUp: {
+      handler(val) {
+        if (val.length == 0) {
+          console.log(this.FormData)
+          this.FormData.UseList = this.FormData.UseLists;
+        }
       }
     },
   },
@@ -426,6 +431,7 @@ export default {
               that.FormData.Unuselist.forEach((res, index) => {
                 res.indexname = index;
               });
+              that.FormData.UseLists = that.FormData.UseList;
               that.FormData.Unuselists = that.FormData.Unuselist;
               that.Unuselist = that.FormData.Unuselist;
               that.boxArr = _.cloneDeep(that.FormData.Unuselist);
@@ -461,7 +467,7 @@ export default {
       this.FormData.UseList.splice(index, 1);
       // this.FormData.UseLists.splice(index, 1);
       this.FormData.UseLists = this.FormData.UseLists.filter(
-        (i) => i.UserName !== val.UserName
+        (i) => i.UserId !== val.UserId
       );
     },
     dataChange: function (data) {

+ 1 - 1
src/views/systemManagement/LoginPolicy/index.vue

@@ -100,7 +100,7 @@
 
     <div class="asideBox">
       <el-button @click="gotoSystem">系统基础设置</el-button>
-      <el-button type="primary">登策略</el-button>
+      <el-button type="primary">登策略</el-button>
     </div>
     <!--删除弹框-->
     <Dialog :flag="flag">

+ 15 - 3
src/views/systemManagement/addSystem/index.vue

@@ -97,7 +97,7 @@
               v-model.trim="keyWordsUp"
               @keyup.enter.native="queryDatas"
             ></el-input>
-            <el-button @click="queryDatas()">搜索</el-button>
+            <el-button @click="queryDatas">搜索</el-button>
           </div>
         </div>
         <div class="center-box fpBox">
@@ -148,7 +148,7 @@
             <el-button @click="getUserData">搜索</el-button>
           </div>
         </div>
-        <div class="center-box">
+        <div class="center-box scrollbar" v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled">
           <el-row class="scCont" :gutter="16">
             <el-col
               :span="6"
@@ -175,6 +175,10 @@
               </el-card>
             </el-col>
           </el-row>
+          <template v-if="total > 1">
+            <p class="center" v-if="loading">加载中...</p>
+            <p class="center" v-if="noMore">没有更多数据了~</p>
+          </template>
           <el-empty
             v-if="FormData.Unuselist.length == 0"
             description="没有内容"
@@ -707,7 +711,7 @@ export default {
   box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
   border-radius: 16px;
   margin-left: 40px;
-  overflow: auto;
+  // overflow: auto;
   // position: relative;
   .searchBox {
     display: flex;
@@ -726,6 +730,14 @@ export default {
   .searchBox {
     display: flex;
   }
+  > .scrollbar {
+    height: calc(100% - 91px);
+    overflow-y: auto;
+    overflow-x: hidden;
+    > p {
+      margin: 12px 0 0;
+    }
+  }
 }
 ::v-deep .leftB {
   .el-input__inner {

+ 70 - 82
src/views/systemManagement/index.vue

@@ -1,13 +1,7 @@
 <template>
   <div class="Box">
     <div class="centerBox">
-      <el-form
-        :model="FormData"
-        :rules="rules"
-        ref="systemForm"
-        label-width="0"
-        class="demo-ruleForm"
-      >
+      <el-form :model="FormData" :rules="rules" ref="systemForm" label-width="0" class="demo-ruleForm">
         <div class="centerTitle">
           <span class="TitleStyle">系统基础设置</span>
           <el-button v-is="['system_btn_save']" @click="save()">保存</el-button>
@@ -23,12 +17,8 @@
         <div class="boxList">
           <span class="ListName">是否允许职员关联多账号</span>
           <div class="riaStyle">
-            <el-radio disabled v-model="FormData.UserOfficerMulti" :label="1"
-              >是</el-radio
-            >
-            <el-radio disabled v-model="FormData.UserOfficerMulti" :label="0"
-              >否</el-radio
-            >
+            <el-radio disabled v-model="FormData.UserOfficerMulti" :label="1">是</el-radio>
+            <el-radio disabled v-model="FormData.UserOfficerMulti" :label="0">否</el-radio>
           </div>
           <div class="lineStyle"></div>
         </div>
@@ -43,12 +33,8 @@
         <div class="boxList">
           <span class="ListName">是否开启严格数据权限</span>
           <div class="riaStyle">
-            <el-radio v-model="FormData.OpenAuthData" :label="1" disabled
-              >是</el-radio
-            >
-            <el-radio v-model="FormData.OpenAuthData" :label="0" disabled
-              >否</el-radio
-            >
+            <el-radio v-model="FormData.OpenAuthData" :label="1" disabled>是</el-radio>
+            <el-radio v-model="FormData.OpenAuthData" :label="0" disabled>否</el-radio>
           </div>
           <div class="lineStyle"></div>
         </div>
@@ -56,10 +42,7 @@
           <span class="ListName">账号变更为闲置状态的不登录时间(天)</span>
           <div class="riaStyle">
             <el-form-item prop="UserIdledays">
-              <el-input
-                v-model.trim="FormData.UserIdledays"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model.trim="FormData.UserIdledays" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -68,10 +51,7 @@
           <span class="ListName">登录后锁定系统的不操作时间(分钟)</span>
           <div class="riaStyle">
             <el-form-item prop="LockMins">
-              <el-input
-                v-model.trim="FormData.LockMins"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model.trim="FormData.LockMins" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -81,11 +61,7 @@
           <div class="riaStyle1">
             <div>
               <el-form-item prop="PwdLengthBegin">
-                <el-input
-                  class="ipt1"
-                  v-model.trim="FormData.PwdLengthBegin"
-                  placeholder="最少位数"
-                ></el-input>
+                <el-input class="ipt1" v-model.trim="FormData.PwdLengthBegin" placeholder="最少位数"></el-input>
               </el-form-item>
               <div class="lineStyle1"></div>
             </div>
@@ -93,11 +69,7 @@
             <span class="zhi">至</span>
             <div>
               <el-form-item prop="PwdLengthEnd">
-                <el-input
-                  class="ipt2"
-                  v-model.trim="FormData.PwdLengthEnd"
-                  placeholder="最多位数"
-                ></el-input>
+                <el-input class="ipt2" v-model.trim="FormData.PwdLengthEnd" placeholder="最多位数"></el-input>
               </el-form-item>
               <div class="lineStyle2"></div>
             </div>
@@ -106,18 +78,8 @@
         <div class="boxList">
           <span class="ListName">密码组成结构</span>
           <div class="riaStyle">
-            <el-checkbox-group
-              v-model="checkedList"
-              @change="PwdStrucChange"
-              :min="1"
-            >
-              <el-checkbox
-                v-for="(item, index) in PwdStrucList"
-                :label="item.id"
-                :key="index"
-                :checked="item.isChecked"
-                >{{ item.name }}</el-checkbox
-              >
+            <el-checkbox-group v-model="checkedList" @change="PwdStrucChange" :min="1">
+              <el-checkbox v-for="(item, index) in PwdStrucList" :label="item.id" :key="index" :checked="item.isChecked">{{ item.name }}</el-checkbox>
             </el-checkbox-group>
           </div>
           <div class="lineStyle"></div>
@@ -134,10 +96,7 @@
           <span class="ListName">密码有效时长(天)</span>
           <div class="riaStyle">
             <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model.trim="FormData.PwdValidtime"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model.trim="FormData.PwdValidtime" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -145,11 +104,8 @@
         <div class="boxList">
           <span class="ListName">允许试错次数(次数)</span>
           <div class="riaStyle">
-            <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model.trim="FormData.LoginError"
-                placeholder="请输入"
-              ></el-input>
+            <el-form-item prop="LoginError">
+              <el-input v-model.trim="FormData.LoginError" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -158,10 +114,7 @@
           <span class="ListName">密码找回联系方式</span>
           <div class="riaStyle">
             <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model.trim="FormData.PwdMessage"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model.trim="FormData.PwdMessage" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -169,32 +122,25 @@
         <div class="boxList">
           <span class="ListName">是否启用简易验证码</span>
           <div class="riaStyle">
-            <el-radio v-model="FormData.SimpleValidCodeMode" :label="1"
-              >是</el-radio
-            >
-            <el-radio v-model="FormData.SimpleValidCodeMode" :label="0"
-              >否</el-radio
-            >
+            <el-radio v-model="FormData.SimpleValidCodeMode" :label="1">是</el-radio>
+            <el-radio v-model="FormData.SimpleValidCodeMode" :label="0">否</el-radio>
           </div>
           <div class="lineStyle" style="margin-bottom: 70px"></div>
         </div>
       </el-form>
     </div>
     <div class="asideBox">
-      <el-button v-is="['system_basic_page']" type="primary"
-        >系统基础设置</el-button
-      >
-      <el-button v-is="['system_logintac_page']" @click="gotoLogin"
-        >登陆策略</el-button
-      >
+      <el-button v-is="['system_basic_page']" type="primary">系统基础设置</el-button>
+      <el-button v-is="['system_logintac_page']" @click="gotoLogin">登录策略</el-button>
     </div>
   </div>
 </template>
 
 <script>
 import { GetSystemSet, SaveSystemSet } from "@/api/systemConfiguration";
+import { positiveIntegerValidator } from '@/utils/validate'
 export default {
-  data() {
+  data () {
     return {
       isShow: false,
       FormData: {
@@ -220,6 +166,11 @@ export default {
             message: "请输入账号变更为闲置状态的不登录时间(天)",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            max: 999999999,
+            trigger: ['change', 'blur']
+          }
         ],
         LockMins: [
           {
@@ -227,6 +178,11 @@ export default {
             message: "请输入登录后锁定系统的不操作时间(分钟)",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            max: 999999999,
+            trigger: ['change', 'blur']
+          }
         ],
         PwdLengthBegin: [
           {
@@ -234,6 +190,11 @@ export default {
             message: "请输入密码长度范围最少位数",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            min: 6,
+            trigger: ['change', 'blur']
+          }
         ],
         PwdLengthEnd: [
           {
@@ -241,6 +202,11 @@ export default {
             message: "请输入密码长度范围最多位数",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            max: 22,
+            trigger: ['change', 'blur']
+          }
         ],
         PwdValidtime: [
           {
@@ -248,6 +214,11 @@ export default {
             message: "请输入密码有效时长(天)",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            max: 999999999,
+            trigger: ['change', 'blur']
+          }
         ],
         LoginError: [
           {
@@ -255,6 +226,11 @@ export default {
             message: "请输入允许试错次数(次数)",
             trigger: "blur",
           },
+          {
+            validator: positiveIntegerValidator,
+            max: 999999999,
+            trigger: ['change', 'blur']
+          }
         ],
         PwdMessage: [
           {
@@ -276,7 +252,7 @@ export default {
   },
   watch: {
     FormData: {
-      handler(val) {
+      handler (val) {
         if (
           JSON.stringify(val) != this.oldFormData &&
           this.oldFormData != null
@@ -288,8 +264,20 @@ export default {
       },
       deep: true,
     },
+    // 'FormData.PwdLengthEnd': {
+    //   handler(val) {
+    //     this.rules.PwdLengthBegin[1].max = parseInt(val)
+    //     this.$refs["systemForm"].validateField('PwdLengthBegin')
+    //   }
+    // },
+    // 'FormData.PwdLengthBegin': {
+    //   handler(val) {
+    //     this.rules.PwdLengthEnd[1].min = parseInt(val)
+    //     this.$refs["systemForm"].validateField('PwdLengthEnd')
+    //   }
+    // }
   },
-  created() {
+  created () {
     this.getSystemSet();
     // let SystemSetInfo = JSON.parse(this.$store.state.app.systemSet);
     // if (SystemSetInfo) {
@@ -302,10 +290,10 @@ export default {
     // }
   },
   methods: {
-    gotoLogin() {
+    gotoLogin () {
       this.$router.push("/LoginPolicy");
     },
-    getSystemSet() {
+    getSystemSet () {
       GetSystemSet({})
         .then((response) => {
           const { returnData } = response;
@@ -319,7 +307,7 @@ export default {
           reject(error);
         });
     },
-    PwdStrucChange(data) {
+    PwdStrucChange (data) {
       let count = 0;
       for (let i = 0; i < data.length; i++) {
         count = count + Number(data[i]);
@@ -327,7 +315,7 @@ export default {
       }
       console.log(this.FormData);
     },
-    getPwdStruc(data) {
+    getPwdStruc (data) {
       let dataList = data.split("");
       if (dataList[0] == 1) {
         this.checkedList.push("1000");
@@ -342,7 +330,7 @@ export default {
         this.checkedList.push("0001");
       }
     },
-    save() {
+    save () {
       if (this.FormData.PwdStruc == 11) {
         this.FormData.PwdStruc = "0011";
       } else if (this.FormData.PwdStruc == 101) {