zhongxiaoyu 3 жил өмнө
parent
commit
d50d692c17

+ 1 - 1
src/components/permissiontree/index.vue

@@ -226,7 +226,7 @@ export default {
           GetAuthTreeByGroup({ GroupIds: [this.searchId] }).then((result) => {
             this.setUnDisabledData(result.returnData);
           });
-        } else if (this.queryIds.length) {
+        } else if (this.queryIds.length && this.queryIds[0] !== -1) {
           GetAuthTreeByGroup({ GroupIds: this.queryIds }).then((result) => {
             this.setUnDisabledData(result.returnData)
           })

+ 15 - 14
src/views/accountGroupManagement/components/accountGroupEdit.vue

@@ -188,9 +188,7 @@ export default {
           { required: true, message: `请输入${this.accountGroupType}名称`, trigger: 'blur' },
           { validator: lengthValidator, max: 32, message: '长度在 1 到 32 个字符', trigger: ['change', 'blur'] }
         ],
-        desc: [
-          { validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }
-        ]
+        desc: [{ validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }]
       },
       defaultProps: {
         children: 'children',
@@ -216,16 +214,19 @@ export default {
     const { OpenRole } = obj
     this.openRole = OpenRole
     this.accountGroupTreeCheckedTemp = [this.GroupUpId]
-    this.queryIds = [this.GroupUpId]
     this.doesGroupExist && (this.GroupId = parseInt(this.$route.query.GroupId))
   },
   mounted() {
     if (this.GroupUpId !== -1) {
-      this.groupIds = [this.GroupUpId]
       this.roleType = 'group'
-      } else {
-        this.groupIds = [-1]
-        this.roleType = 'onlyRole'
+      this.groupIds = [this.GroupUpId]
+      this.queryType = 'group'
+      this.queryIds = [this.GroupUpId]
+    } else {
+      this.groupIds = [-1]
+      this.roleType = 'onlyRole'
+      this.queryIds = [-1]
+      this.queryType = 'all'
     }
     if (this.doesGroupExist) {
       this.getGroupDetails()
@@ -284,11 +285,14 @@ export default {
     },
     // 获取当前勾选的岗位
     getAccountGroupChecked(arr) {
-      if (arr.length === 1) {
+      if (arr?.length === 0) {
+        this.accountGroupTreeCheckedList = [-1]
+      } else if (arr?.length === 1) {
         if (arr[0].GroupId === -1) {
-          this.groupIds = [-1]
           this.accountGroupTreeCheckedTemp = [-1]
+          this.groupIds = [-1]
           this.roleType = 'onlyRole'
+          this.queryIds = [-1]
           this.queryType = 'all'
         } else {
           const GroupIds = arr.map(item => item.GroupId)
@@ -297,10 +301,7 @@ export default {
           this.groupIds = GroupIds
           this.queryType = 'group'
           this.queryIds = GroupIds
-          }
-      } else if (arr.length === 0) {
-        this.accountGroupTreeCheckedList = [-1]
-        
+        }
       }
     },
     // 角色选取

+ 4 - 4
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-16 11:57:19
+ * @LastEditTime: 2022-03-16 21:06:14
  * @LastEditors: your name
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -391,14 +391,14 @@ export default {
     renderChange(data) {
       const { GroupId, flag } = data
       const Status = flag ? 1 : 0
-      this.handleChange(GroupId, Status)
+      this.handleChange(GroupId, Status, index)
     },
     // 下级切换状态
     async childrenRenderChange(data, index) {
       const { GroupId, flag } = data
       const Status = flag ? 1 : 0
       const isChildren = true
-      this.handleChange(GroupId, Status, isChildren, index)
+      this.handleChange(GroupId, Status, index, isChildren)
       // try {
       //   const res = await ChangeGroupStatus({
       //     GroupId: GroupId,
@@ -477,7 +477,7 @@ export default {
     },
     // -----------获取数据------------
     // 状态变更
-    async handleChange(id, val, isChildren = false, index) {
+    async handleChange(id, val, index, isChildren = false) {
       try {
         const res = await ChangeGroupStatus({
           GroupId: id,

+ 256 - 88
src/views/accountManagement/components/accountEdit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: Badguy
  * @Date: 2022-02-15 11:37:42
- * @LastEditTime: 2022-03-16 16:36:49
+ * @LastEditTime: 2022-03-16 20:44:15
  * @LastEditors: your name
  * @Description: 编辑账号
  * have a nice day!
@@ -27,28 +27,66 @@
         </div> -->
         <div v-is="['userupdate_btn_save']">
           <!-- <button type="submmit" class="btn-delete" @click="delate">删除</button> -->
-          <button type="submmit" class="btn-save" @click="handleClickSave('accountForm')">保存</button>
+          <button
+            type="submmit"
+            class="btn-save"
+            @click="handleClickSave('accountForm')"
+          >保存</button>
         </div>
       </div>
       <div class="title-content">
-        <el-form ref="accountForm" label-width="80px" :inline="true" :model="accountForm" :rules="formRules">
+        <el-form
+          ref="accountForm"
+          label-width="80px"
+          :inline="true"
+          :model="accountForm"
+          :rules="formRules"
+        >
           <el-row :gutter="40">
             <el-col :span="5">
-              <el-form-item label="账号名称" prop="name">
-                <el-input v-model.trim="accountForm.name" placeholder="请输入名称" size="small" />
+              <el-form-item
+                label="账号名称"
+                prop="name"
+              >
+                <el-input
+                  v-model.trim="accountForm.name"
+                  placeholder="请输入名称"
+                  size="small"
+                />
               </el-form-item>
             </el-col>
             <el-col :span="5">
-              <el-form-item label="登录密码" prop="pwd">
-                <el-input v-model="accountForm.pwd" placeholder="*******" size="small" disabled />
+              <el-form-item
+                label="登录密码"
+                prop="pwd"
+              >
+                <el-input
+                  v-model="accountForm.pwd"
+                  placeholder="*******"
+                  size="small"
+                  disabled
+                />
               </el-form-item>
             </el-col>
-            <el-col v-is="['userupdate_btn_re_pwd']" :span="2">
-              <button class="btn-reset-pwd" @click="resetPwd">重置密码</button>
+            <el-col
+              v-is="['userupdate_btn_re_pwd']"
+              :span="2"
+            >
+              <button
+                class="btn-reset-pwd"
+                @click="resetPwd"
+              >重置密码</button>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="描述" prop="desc">
-                <el-input v-model.trim="accountForm.desc" placeholder="请输入描述" size="small" />
+              <el-form-item
+                label="描述"
+                prop="desc"
+              >
+                <el-input
+                  v-model.trim="accountForm.desc"
+                  placeholder="请输入描述"
+                  size="small"
+                />
               </el-form-item>
             </el-col>
           </el-row>
@@ -58,80 +96,191 @@
 
     <div class="content">
       <!-- 用户组和角色未开启 -->
-      <el-row v-if="!openGroup && !openRole" :gutter="24">
+      <el-row
+        v-if="!openGroup && !openRole"
+        :gutter="24"
+      >
         <el-col :span="8">
           <div class="content-card content-card-lg">
-            <PermissionTree title="权限树" :query-type="queryType" :checked-keys="permissionTreeChckedKeys" @getTreeData="getPermissionTreeChecked" />
+            <PermissionTree
+              title="权限树"
+              :query-type="queryType"
+              :checked-keys="permissionTreeChckedKeys"
+              @getTreeData="getPermissionTreeChecked"
+            />
           </div>
         </el-col>
         <el-col :span="8">
           <div class="content-card content-card-lg">
-            <RulesOfCompetency title="权限规则" margin-b="20px" @getData="getRulesOfCompetency" />
+            <RulesOfCompetency
+              title="权限规则"
+              margin-b="20px"
+              @getData="getRulesOfCompetency"
+            />
           </div>
         </el-col>
-        <el-col v-is="['account_edit_login_setting']" :span="8">
+        <el-col
+          v-is="['account_edit_login_setting']"
+          :span="8"
+        >
           <div class="content-card content-card-lg">
-            <LoginPolicy :checked-list="loginPolicyCheckedList" @getCheckedList="getLoginPolicyChecked" />
+            <LoginPolicy
+              :checked-list="loginPolicyCheckedList"
+              @getCheckedList="getLoginPolicyChecked"
+            />
           </div>
         </el-col>
       </el-row>
       <!-- 角色和用户组都开启 -->
-      <el-row v-if="openGroup && openRole" :gutter="24">
+      <el-row
+        v-if="openGroup && openRole"
+        :gutter="24"
+      >
         <el-col :span="8">
           <div class="content-card content-card-xl">
-            <AccountGroupTree :title="`所属${accountGroupType}`" nodekey="GroupId" :default-props="accountGroupTreeProps" :checked-keys="accountGroupTreeCheckedList" @getTreeData="getAccountGroupChecked" />
+            <AccountGroupTree
+              :title="`所属${accountGroupType}`"
+              nodekey="GroupId"
+              :default-props="accountGroupTreeProps"
+              :checked-keys="accountGroupTreeCheckedList"
+              @getTreeData="getAccountGroupChecked"
+            />
           </div>
         </el-col>
-        <el-col v-is="['account_edit_role_list']" :span="8">
+        <el-col
+          v-is="['account_edit_role_list']"
+          :span="8"
+        >
           <div class="content-card content-card-xl">
-            <RoleList title="角色列表" :role-type="roleType" :group-ids="groupIds" :check-box-list="roleListCheckedList" :number="8" :active="true" @checkChange="getRoleListChecked" @checkClick="selectRole" @roleListChange="roleListCheckedChange" />
+            <RoleList
+              title="角色列表"
+              :role-type="roleType"
+              :group-ids="groupIds"
+              :check-box-list="roleListCheckedList"
+              :number="8"
+              :active="true"
+              :selected-role-id="currentSelectedRoleId"
+              @checkChange="getRoleListChecked"
+              @checkClick="selectRole"
+              @role-list-change="roleListCheckedFilter"
+            />
           </div>
         </el-col>
-        <el-col v-is="['account_edit_auth_list']" :span="8">
+        <el-col
+          v-is="['account_edit_auth_list']"
+          :span="8"
+        >
           <div class="content-card content-card-sm">
-            <PermissionList title="权限列表" class="permission-list" :role-list="checkedRoles" :check="true" @Competen="Competen" />
+            <PermissionList
+              title="权限列表"
+              class="permission-list"
+              :role-list="checkedRoles"
+              :check="true"
+              @Competen="Competen"
+            />
           </div>
-          <div v-is="['account_edit_login_setting']" class="content-card content-card-xs">
-            <LoginPolicy :checked-list="loginPolicyCheckedList" @getCheckedList="getLoginPolicyChecked" />
+          <div
+            v-is="['account_edit_login_setting']"
+            class="content-card content-card-xs"
+          >
+            <LoginPolicy
+              :checked-list="loginPolicyCheckedList"
+              @getCheckedList="getLoginPolicyChecked"
+            />
           </div>
         </el-col>
       </el-row>
       <!-- 只开启用户组 -->
-      <el-row v-if="openGroup && !openRole" :gutter="24">
+      <el-row
+        v-if="openGroup && !openRole"
+        :gutter="24"
+      >
         <el-col :span="8">
           <div class="content-card content-card-xxl">
-            <AccountGroupTree :title="`所属${accountGroupType}`" nodekey="GroupId" :default-props="accountGroupTreeProps" :checked-keys="accountGroupTreeCheckedList" @getTreeData="getAccountGroupChecked" />
+            <AccountGroupTree
+              :title="`所属${accountGroupType}`"
+              nodekey="GroupId"
+              :default-props="accountGroupTreeProps"
+              :checked-keys="accountGroupTreeCheckedList"
+              @getTreeData="getAccountGroupChecked"
+            />
           </div>
         </el-col>
         <el-col :span="8">
           <div class="content-card content-card-xxl">
-            <PermissionTree title="权限树" :query-type="queryType" :query-ids="queryIds" :checked-keys="permissionTreeChckedKeys" @getTreeData="getPermissionTreeChecked" />
+            <PermissionTree
+              title="权限树"
+              :query-type="queryType"
+              :query-ids="queryIds"
+              :checked-keys="permissionTreeChckedKeys"
+              @getTreeData="getPermissionTreeChecked"
+            />
           </div>
         </el-col>
         <el-col :span="8">
           <div class="content-card content-card-md">
-            <RulesOfCompetency title="权限规则" margin-b="20px" @getData="getRulesOfCompetency" />
+            <RulesOfCompetency
+              title="权限规则"
+              margin-b="20px"
+              @getData="getRulesOfCompetency"
+            />
           </div>
-          <div v-is="['account_edit_login_setting']" class="content-card content-card-xs">
-            <LoginPolicy :checked-list="loginPolicyCheckedList" @getCheckedList="getLoginPolicyChecked" />
+          <div
+            v-is="['account_edit_login_setting']"
+            class="content-card content-card-xs"
+          >
+            <LoginPolicy
+              :checked-list="loginPolicyCheckedList"
+              @getCheckedList="getLoginPolicyChecked"
+            />
           </div>
         </el-col>
       </el-row>
       <!-- 只开启角色 -->
-      <el-row v-if="!openGroup && openRole" :gutter="24">
-        <el-col v-is="['account_edit_role_list']" :span="8">
+      <el-row
+        v-if="!openGroup && openRole"
+        :gutter="24"
+      >
+        <el-col
+          v-is="['account_edit_role_list']"
+          :span="8"
+        >
           <div class="content-card content-card-lg">
-            <RoleList title="角色列表" :role-type="roleType" :check-box-list="roleListCheckedList" :number="8" :active="true" @checkChange="getRoleListChecked" @checkClick="selectRole" />
+            <RoleList
+              title="角色列表"
+              :role-type="roleType"
+              :check-box-list="roleListCheckedList"
+              :selected-role-id="currentSelectedRoleId"
+              :number="8"
+              :active="true"
+              @checkChange="getRoleListChecked"
+              @checkClick="selectRole"
+            />
           </div>
         </el-col>
-        <el-col v-is="['account_edit_auth_list']" :span="8">
+        <el-col
+          v-is="['account_edit_auth_list']"
+          :span="8"
+        >
           <div class="content-card content-card-lg">
-            <PermissionList title="权限列表" :role-list="checkedRoles" :check="true" class="permission-list" @Competen="Competen" />
+            <PermissionList
+              title="权限列表"
+              :role-list="checkedRoles"
+              :check="true"
+              class="permission-list"
+              @Competen="Competen"
+            />
           </div>
         </el-col>
-        <el-col v-is="['account_edit_login_setting']" :span="8">
+        <el-col
+          v-is="['account_edit_login_setting']"
+          :span="8"
+        >
           <div class="content-card content-card-lg">
-            <LoginPolicy :checked-list="loginPolicyCheckedList" @getCheckedList="getLoginPolicyChecked" />
+            <LoginPolicy
+              :checked-list="loginPolicyCheckedList"
+              @getCheckedList="getLoginPolicyChecked"
+            />
           </div>
         </el-col>
       </el-row>
@@ -178,7 +327,7 @@ export default {
     PermissionList
     // Dialog
   },
-  data () {
+  data() {
     return {
       doesAccountExist: this.$route.meta.doesAccountExist, // 控制账号新增/编辑
       userId: '',
@@ -195,13 +344,14 @@ export default {
       accountGroupTreeCheckedList: [], // 岗位树初始勾选项
       accountGroupTreeCheckedTemp: [], // 岗位树当前勾选项
       roleListCheckedList: [], // 角色列表初始勾选项
+      roleListCheckedCopy: [],
       roleListCheckedTemp: [], // 角色列表当前勾选项
       roleType: '',
       queryType: '',
       checkedRoles: [],
-      currentSelectedRoleId: 0,
-      groupIds: [],
-      queryIds: [],
+      currentSelectedRoleId: -1,
+      groupIds: [-1],
+      queryIds: [-1],
       // dialogVisible: false,
       formRules: {
         name: [
@@ -224,11 +374,11 @@ export default {
   },
   computed: {
     ...mapGetters(['systemSet']),
-    pageTitle () {
+    pageTitle() {
       return this.doesAccountExist ? '编辑账号' : '新增账号'
     }
   },
-  created () {
+  created() {
     // 获取系统配置
     let obj
     if (typeof this.systemSet === 'string') {
@@ -238,25 +388,27 @@ export default {
     }
     // console.log(obj)
     const { OpenRole, OpenGroup, PwdStruc, PwdLengthBegin, PwdLengthEnd } = obj
-    this.openRole = OpenRole
     this.openGroup = OpenGroup
+    this.openRole = OpenRole
     this.pwdStruc = PwdStruc
     this.pwdLengthBegin = PwdLengthBegin
     this.pwdLengthEnd = PwdLengthEnd
   },
-  mounted () {
+  mounted() {
     if (this.doesAccountExist) {
       this.userId = this.$route.query.userId
       this.getAccountInfo()
     } else {
       this.resetPwd()
+      this.accountGroupTreeCheckedTemp = [-1]
+      this.accountGroupTreeCheckedList = [-1]
       this.roleType = 'onlyRole'
       this.queryType = 'all'
     }
   },
   methods: {
     // 获取当前账号信息
-    async getAccountInfo () {
+    async getAccountInfo() {
       try {
         const res = await getAccountDetails({
           UserId: this.userId
@@ -268,15 +420,8 @@ export default {
           this.accountForm.desc = UserDesc
           this.accountForm.status = Status
 
-          AuthList &&
-            AuthList.length &&
-            AuthList.forEach(auth => {
-              this.permissionTreeChckedKeys.push(auth.AuthId)
-              this.permissionTreeChckedTemp.push(auth)
-            })
-
           if (GroupList && GroupList.length && GroupList[0] !== -1) {
-            this.roleType = this.openGroup ? 'roleByUpId' : 'onlyRole'
+            this.roleType = this.openGroup ? 'group' : 'onlyRole'
             this.queryType = this.openGroup ? 'group' : 'all'
             GroupList.forEach(group => {
               this.accountGroupTreeCheckedList.push(group.GroupId)
@@ -285,15 +430,26 @@ export default {
               this.queryIds.push(group.GroupId)
             })
           } else {
+            this.accountGroupTreeCheckedList = [-1]
+            this.accountGroupTreeCheckedTemp = [-1]
             this.roleType = 'onlyRole'
             this.queryType = 'all'
-            this.accountGroupTreeCheckedTemp.push(-1)
           }
 
           RoleList &&
             RoleList.length &&
             RoleList.forEach(role => {
-              role.IsSelected && this.roleListCheckedTemp.push(role)
+              role.IsSelected &&
+                (this.roleListCheckedTemp.push(role),
+                this.roleListCheckedCopy.push(role),
+                this.roleListCheckedList.push(role.RoleId))
+            })
+
+          AuthList &&
+            AuthList.length &&
+            AuthList.forEach(auth => {
+              this.permissionTreeChckedKeys.push(auth.AuthId)
+              this.permissionTreeChckedTemp.push(auth)
             })
 
           TacList &&
@@ -310,47 +466,59 @@ export default {
       }
     },
     // 随机生成密码
-    resetPwd () {
+    resetPwd() {
       this.accountForm.pwd = pwdProduce(this.pwdLengthBegin, this.pwdLengthEnd, this.pwdStruc)
     },
-    // 获取当前权限树勾选项
-    getPermissionTreeChecked (arr) {
-      this.permissionTreeChckedTemp = arr.map(auth => auth.AuthList)
-    },
-    // 获取当前编辑的权限规则
-    getRulesOfCompetency (obj) {
-      this.rulesOfCompetency = obj
-    },
     // 获取当前勾选的登录策略
-    getLoginPolicyChecked (arr) {
+    getLoginPolicyChecked(arr) {
       this.loginPolicyCheckedTemp = arr
     },
     // 获取当前勾选的岗位
-    getAccountGroupChecked (arr) {
-      if (arr && arr.length && arr[0] !== -1) {
-        const GroupIds = arr.map(item => item.GroupId)
-        this.accountGroupTreeCheckedTemp = GroupIds
-        this.roleType = 'roleByUpId'
-        this.groupIds = GroupIds
-        this.queryType = 'group'
-        this.queryIds = GroupIds
+    getAccountGroupChecked(arr) {
+      if (arr?.length === 0) {
+        this.accountGroupTreeCheckedList = [-1]
       } else {
-        this.accountGroupTreeCheckedTemp = [-1]
-        // this.roleType = 'onlyRole'
-        this.groupIds = []
-        this.queryType = 'all'
+        if (arr?.length === 1 && arr[0].groupId === -1) {
+          this.accountGroupTreeCheckedTemp = [-1]
+          this.groupIds = [-1]
+          this.roleType = 'onlyRole'
+          this.queryIds = [-1]
+          this.queryType = 'all'
+        } else {
+          const GroupIds = arr.map(item => item.GroupId)
+          this.accountGroupTreeCheckedTemp = GroupIds
+          this.roleType = 'group'
+          this.groupIds = GroupIds
+          this.queryType = 'group'
+          this.queryIds = GroupIds
+        }
       }
     },
     // 获取当前勾选的角色列表
-    getRoleListChecked (arr) {
+    getRoleListChecked(arr) {
       this.roleListCheckedTemp = arr
+      this.roleListCheckedCopy = arr
+    },
+    roleListCheckedFilter(arr) {
+      this.roleListCheckedTemp = this.roleListCheckedCopy.filter(
+        role => arr.findIndex(item => item.RoleId === role.RoleId) > -1
+      )
+      this.roleListCheckedList = this.roleListCheckedCopy.map(role => role.RoleId)
+      if (arr.findIndex(item => item.RoleId === this.currentSelectedRoleId) === -1) {
+        this.checkedRoles = []
+        this.currentSelectedRoleId = -1
+      }
+    },
+    // 获取当前权限树勾选项
+    getPermissionTreeChecked(arr) {
+      this.permissionTreeChckedTemp = arr.map(auth => auth.AuthList)
     },
-    roleListCheckedChange (arr) {
-      this.roleListCheckedTemp = this.roleListCheckedTemp.filter(role => arr.some(data => data.RoleId === role.RoleId))
-      this.roleListCheckedList = this.roleListCheckedTemp.map(role => role.RoleId)
+    // 获取当前编辑的权限规则
+    getRulesOfCompetency(obj) {
+      this.rulesOfCompetency = obj
     },
     // 点击角色后显示对应权限列表
-    async selectRole (data) {
+    async selectRole(data) {
       if (this.currentSelectedRoleId === data.RoleId) return
       try {
         const params = {
@@ -368,11 +536,11 @@ export default {
       }
     },
     // 修改权限规则
-    Competen (data) {
+    Competen(data) {
       console.log(data)
     },
     // 账号编辑保存
-    handleClickSave (formName) {
+    handleClickSave(formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
           this.handleSaveEdit()
@@ -382,7 +550,7 @@ export default {
         }
       })
     },
-    handleSaveEdit () {
+    handleSaveEdit() {
       const params = {
         AuthList: this.permissionTreeChckedTemp,
         GroupList: this.accountGroupTreeCheckedTemp.map(groupId => ({ GroupId: groupId })),
@@ -403,7 +571,7 @@ export default {
       }
     },
     // 编辑账号
-    async saveEditAccount (params) {
+    async saveEditAccount(params) {
       try {
         const res = await editAccount(params)
         if (res.code === 0) {
@@ -420,7 +588,7 @@ export default {
       }
     },
     // 新增账号
-    async saveAddAccount (params) {
+    async saveAddAccount(params) {
       try {
         const res = await addAccount(params)
         if (res.code === 0) {

+ 2 - 2
src/views/authorityManagement/components/authorityAppAdd.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:18:04
- * @LastEditTime: 2022-03-16 15:17:14
+ * @LastEditTime: 2022-03-16 20:58:21
  * @LastEditors: your name
  * @Description: 新增/编辑应用
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\addApp.vue
@@ -113,7 +113,7 @@ export default {
         ],
         url: [{ validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }],
         desc: [
-          { required: true, message: "请输入描述", trigger: "blur" },
+          // { required: true, message: "请输入描述", trigger: "blur" },
           { validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }
         ],
       },

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

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:18:04
- * @LastEditTime: 2022-03-16 15:18:03
+ * @LastEditTime: 2022-03-16 20:58:20
  * @LastEditors: your name
  * @Description: 新增/编辑应用
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\addApp.vue
@@ -124,7 +124,7 @@ export default {
         ],
         url: [{ validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }],
         desc: [
-          { required: true, message: "请输入描述", trigger: "blur" },
+          // { required: true, message: "请输入描述", trigger: "blur" },
           { validator: lengthValidator, max: 128, message: '长度在 1到 128 个字符', trigger: ['change', 'blur'] }
         ],
       },

+ 14 - 12
src/views/authorityManagement/components/authorityHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:27:43
- * @LastEditTime: 2022-03-16 16:01:54
+ * @LastEditTime: 2022-03-16 21:20:12
  * @LastEditors: your name
  * @Description: 权限管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
@@ -226,7 +226,7 @@ export default {
       // this.$refs.tree.setCurrentKey(dataNew.AuthId);
       this.currentKey = dataNew.AuthId;
     },
-    //下级关闭
+    //下级切换状态
     childrenRenderChange (data, index) {
       const { AuthId, flag, Type } = data
       const Status = flag ? 1 : 0
@@ -375,29 +375,31 @@ export default {
                 return true
               }
             })
-            if (!isChildren) {
-              this.childrenData.forEach(data => {
-                data.Status = 0
-                data.flag = false
-              })
+            if (type === 2) {
+              if (!isChildren) {
+                this.childrenData.forEach(data => {
+                  data.Status = 0
+                  data.flag = false
+                })
+              }
+              this.setChildrenDisabled(id)
             }
-            this.setChildrenDisabled(id)
           }
           //this.getAuthTree()
         } else {
           this.$message.error(res.message)
           if (!isChildren) {
-            this.currDataArr[0].flag = !flag;
+            this.currDataArr[0].flag = !val;
           } else {
-            this.childrenData[index].flag = !flag;
+            this.childrenData[index].flag = !val;
           }
         }
       } catch (error) {
         console.log('出错了', error)
         if (!isChildren) {
-          this.currDataArr[0].flag = !flag;
+          this.currDataArr[0].flag = !val;
         } else {
-          this.childrenData[index].flag = !flag;
+          this.childrenData[index].flag = !val;
         }
       }
     },