Selaa lähdekoodia

岗位管理修改

zhongxiaoyu 3 vuotta sitten
vanhempi
commit
2df5c447b4

+ 22 - 8
src/components/usergrouptree/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: zk
  * @Date: 2022-02-09 15:47:09
- * @LastEditTime: 2022-03-02 10:58:29
+ * @LastEditTime: 2022-03-10 17:13:14
  * @LastEditors: your name
  * @Description: 用户组树
  * @FilePath: \Foshan4A4.0\src\components\usergrouptree\index.vue
@@ -51,8 +51,8 @@ export default {
       })
     },
     checkDisabled: {
-      type: Boolean,
-      default: false
+      type: Number,
+      default: 0
     }
   },
   data () {
@@ -97,12 +97,26 @@ export default {
         PageSize: this.pageSize
       })
       const datas = result.returnData
-      if (this.checkDisabled) {
-        datas.forEach(data => {
-          data.disabled = true
-        })
-      }
       const tree = translateDataToTreeAll(datas, 'GroupUpid', 'GroupId')
+      const setDisabled = (tree, key) => {
+        if (key) {
+          tree.find(node => {
+            if (node.GroupId === key) {
+              node.disabled = true
+              node.children?.length && setDisabled(node.children)
+              return node
+            } else if (node.children?.length) {
+              setDisabled(node.children, key)
+            }
+          })
+        } else {
+          tree.forEach(node => {
+            node.disabled = true
+            node.children?.length && setDisabled(node.children)
+          })
+        }
+      }
+      this.checkDisabled && setDisabled(tree, this.checkDisabled)
       const obj = {
         AuthCount: 0,
         GroupId: -1,

+ 90 - 29
src/views/accountGroupManagement/components/accountGroupEdit.vue

@@ -3,17 +3,45 @@
     <div class="postmanagementadd_header">
       <div class="postmanagementadd_top">
         <div class="tltleLeft">{{ pageTitle }}</div>
-        <div v-is="['group_btn_edit']" class="btn" style="margin-top: 20px">
-          <el-button type="primary" @click="handleClickSave('editForm')">保存</el-button>
+        <div
+          v-is="doesGroupExist ? ['group_btn_edit'] : ['group_btn_save']"
+          class="btn"
+          style="margin-top: 20px"
+        >
+          <el-button
+            type="primary"
+            @click="handleClickSave('editForm')"
+          >保存</el-button>
         </div>
       </div>
       <div class="addApp-form-content dialog-public-background">
-        <el-form ref="editForm" :inline="true" :rules="rules" class="form" :model="editForm">
-          <el-form-item prop="name" label="岗位名称">
-            <el-input v-model="editForm.name" maxlength="32" placeholder="岗位名称" />
+        <el-form
+          ref="editForm"
+          :inline="true"
+          :rules="rules"
+          class="form"
+          :model="editForm"
+        >
+          <el-form-item
+            prop="name"
+            label="岗位名称"
+          >
+            <el-input
+              v-model="editForm.name"
+              maxlength="32"
+              placeholder="岗位名称"
+            />
           </el-form-item>
-          <el-form-item label="描述" style="margin-left: 40px">
-            <el-input v-model="editForm.desc" style="width: 640px" placeholder="请输入描述" maxlength="200" />
+          <el-form-item
+            label="描述"
+            style="margin-left: 40px"
+          >
+            <el-input
+              v-model="editForm.desc"
+              style="width: 640px"
+              placeholder="请输入描述"
+              maxlength="200"
+            />
           </el-form-item>
         </el-form>
       </div>
@@ -22,19 +50,42 @@
       <el-row :gutter="24">
         <el-col :span="8">
           <div class="part">
-            <AccountGroupTree title="上级岗位" nodekey="GroupId" :check-disabled="doesGroupExist" :type="true" :defaultProps="defaultProps" :checkedKeys="accountGroupTreeCheckedList" @getTreeData="getAccountGroupChecked" />
+            <AccountGroupTree
+              title="上级岗位"
+              nodekey="GroupId"
+              :check-disabled="GroupId"
+              :type="true"
+              :default-props="defaultProps"
+              :checked-keys="accountGroupTreeCheckedList"
+              @getTreeData="getAccountGroupChecked"
+            />
           </div>
         </el-col>
         <!-- 开启角色 -->
         <template v-if="openRole">
           <el-col :span="8">
             <div class="part">
-              <RoleList title="角色列表" :roleType="roleType" :GroupIds="groupIds" :checkBoxList="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"
+                @checkChange="getRoleListChecked"
+                @checkClick="selectRole"
+                @roleListChange="roleListCheckedChange"
+              />
             </div>
           </el-col>
           <el-col :span="8">
             <div class="part">
-              <PermissionList title="权限列表" :RoleList="checkedRoles" :check="true" @Competen="Competen" />
+              <PermissionList
+                title="权限列表"
+                :role-list="checkedRoles"
+                :check="true"
+                @Competen="Competen"
+              />
             </div>
           </el-col>
         </template>
@@ -42,12 +93,22 @@
         <template v-else>
           <el-col :span="8">
             <div class="part">
-              <PermissionTree title="权限树" :checkedKeys="permissionTreeChckedKeys" :queryType="queryType" :queryIds="queryIds" @getTreeData="getPermissionTreeChecked" />
+              <PermissionTree
+                title="权限树"
+                :checked-keys="permissionTreeChckedKeys"
+                :query-type="queryType"
+                :query-ids="queryIds"
+                @getTreeData="getPermissionTreeChecked"
+              />
             </div>
           </el-col>
           <el-col :span="8">
             <div class="part">
-              <RulesOfCompetency title="权限规则" margin-b="20px" @getData="getRulesOfCompetency" />
+              <RulesOfCompetency
+                title="权限规则"
+                margin-b="20px"
+                @getData="getRulesOfCompetency"
+              />
             </div>
           </el-col>
         </template>
@@ -94,7 +155,7 @@ export default {
     // Dialog
   },
   // mixins: [treeData],
-  data () {
+  data() {
     return {
       doesGroupExist: this.$route.meta.doesGroupExist, // 控制岗位新增/编辑
       GroupId: 0,
@@ -134,11 +195,11 @@ export default {
   },
   computed: {
     ...mapGetters(['systemSet']),
-    pageTitle () {
+    pageTitle() {
       return this.doesGroupExist ? '编辑岗位' : '新增岗位'
     }
   },
-  created () {
+  created() {
     // 获取系统配置
     let obj
     if (typeof this.systemSet === 'string') {
@@ -152,10 +213,10 @@ export default {
     this.accountGroupTreeCheckedTemp = [this.GroupUpId]
     this.groupIds.push(this.GroupUpId)
     this.queryIds.push(this.GroupUpId)
+    this.doesGroupExist && (this.GroupId = this.$route.query.GroupId)
   },
-  mounted () {
+  mounted() {
     if (this.doesGroupExist) {
-      this.GroupId = this.$route.query.GroupId
       this.getGroupDetails()
     } else {
       this.roleType = 'onlyRole'
@@ -165,7 +226,7 @@ export default {
   },
   methods: {
     // 岗位详情
-    async getGroupDetails () {
+    async getGroupDetails() {
       try {
         const res = await GetGroupDetails({
           GroupId: this.GroupId
@@ -199,7 +260,7 @@ export default {
       }
     },
     // 保存
-    handleClickSave (formName) {
+    handleClickSave(formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
           this.handleSaveEdit()
@@ -210,12 +271,12 @@ export default {
       })
     },
     // 获取当前权限树勾选项
-    getPermissionTreeChecked (arr) {
+    getPermissionTreeChecked(arr) {
       // console.log(arr)
       this.permissionTreeChckedTemp = arr.map(auth => auth.AuthList)
     },
     // 获取当前勾选的岗位
-    getAccountGroupChecked (arr) {
+    getAccountGroupChecked(arr) {
       if (arr && arr.length && arr[0] !== -1) {
         const GroupIds = arr.map(item => item.GroupId)
         this.accountGroupTreeCheckedTemp = GroupIds
@@ -230,19 +291,19 @@ export default {
       }
     },
     // 角色选取
-    getRoleListChecked (arr) {
+    getRoleListChecked(arr) {
       this.roleListCheckedTemp = arr
     },
-    roleListCheckedChange (arr) {
+    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) {
+    getRulesOfCompetency(obj) {
       this.rulesOfCompetency = obj
     },
     // 点击角色后显示对应权限列表
-    async selectRole (data) {
+    async selectRole(data) {
       if (this.currentSelectedRoleId === data.RoleId) return
       try {
         const params = {
@@ -281,11 +342,11 @@ export default {
     //   }
     // },
     // 修改权限规则
-    Competen (data) {
+    Competen(data) {
       console.log(data)
     },
     // 岗位编辑保存
-    async handleSaveEdit () {
+    async handleSaveEdit() {
       const params = {
         AuthList: this.permissionTreeChckedTemp,
         GroupName: this.editForm.name,
@@ -304,7 +365,7 @@ export default {
         this.saveAddGroup(params)
       }
     },
-    async saveEditGroup (params) {
+    async saveEditGroup(params) {
       try {
         const res = await EditGroup(params)
         if (res.code === 0) {
@@ -320,7 +381,7 @@ export default {
         console.log('出错了', error)
       }
     },
-    async saveAddGroup (params) {
+    async saveAddGroup(params) {
       try {
         const res = await SaveGroup(params)
         if (res.code === 0) {

+ 300 - 183
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-09 14:45:15
+ * @LastEditTime: 2022-03-10 16:02:46
  * @LastEditors: your name
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -11,28 +11,60 @@
     <!--状态和搜索-->
     <div class="accountGroup-head flex">
       <div class="status flex-wrap"></div>
-      <Search @getSearchData="getSearchData" @clearSearchData="clearSearchData" />
+      <Search
+        @getSearchData="getSearchData"
+        @clearSearchData="clearSearchData"
+      />
     </div>
     <!--账号树-->
     <div class="accountGroup-content">
       <!-- <OrgTree :dataList="dataList" :renderContent="renderContent" /> -->
-      <el-row :gutter="24" class="bodyContent">
-        <el-col :span="6" class="bodyPart">
+      <el-row
+        :gutter="24"
+        class="bodyContent"
+      >
+        <el-col
+          :span="6"
+          class="bodyPart"
+        >
           <div class="grid-content">
             <div class="title">岗位树</div>
             <div class="contentTree">
-              <el-tree ref="tree" :data="dataListTree" :props="defaultProps" node-key="GroupId" :filter-node-method="filterNode" highlight-current :default-expanded-keys="[currentKey]" @node-click="handleNodeClick">
+              <el-tree
+                ref="tree"
+                :data="dataListTree"
+                :props="defaultProps"
+                node-key="GroupId"
+                :filter-node-method="filterNode"
+                highlight-current
+                :default-expanded-keys="[currentKey]"
+                @node-click="handleNodeClick"
+              >
               </el-tree>
             </div>
           </div>
         </el-col>
-        <el-col :span="18" class="bodyPart">
+        <el-col
+          :span="18"
+          class="bodyPart"
+        >
           <div class="grid-contentTop">
-            <div class="title" style="margin-bottom: 15px">当前岗位</div>
+            <div
+              class="title"
+              style="margin-bottom: 15px"
+            >当前岗位</div>
             <div class="content">
-              <el-empty :image-size="100" style="padding: 0" v-if="currDataArr.length < 1"></el-empty>
+              <el-empty
+                :image-size="100"
+                style="padding: 0"
+                v-if="currDataArr.length < 1"
+              ></el-empty>
               <el-row>
-                <el-col :span="8" v-for="data in currDataArr" :key="data.GroupId">
+                <el-col
+                  :span="8"
+                  v-for="data in currDataArr"
+                  :key="data.GroupId"
+                >
                   <div class="itemBox">
                     <el-row :gutter="24">
                       <el-col :span="12">
@@ -41,12 +73,31 @@
                       <el-col :span="12">
                         <div class="flex info">
                           <div class="icon">
-                            <el-tooltip v-is="['grouptree_btn_update_group']" effect="dark" content="编辑岗位" placement="bottom">
-                              <span title="编辑岗位" class="cap cap-edit" @click="renderEdit(data)" v-if="data.GroupId != -1"></span>
+                            <el-tooltip
+                              v-is="['grouptree_btn_update_group']"
+                              effect="dark"
+                              content="编辑岗位"
+                              placement="bottom"
+                            >
+                              <span
+                                title="编辑岗位"
+                                class="cap cap-edit"
+                                @click="renderEdit(data)"
+                                v-if="data.GroupId != -1"
+                              ></span>
                             </el-tooltip>
 
-                            <el-tooltip v-is="['grouptree_btn_add_group']" effect="dark" content="新增岗位" placement="bottom">
-                              <span title="新增岗位" class="cap cap-sub" @click="renderAdd(data)"></span>
+                            <el-tooltip
+                              v-is="['grouptree_btn_add_group']"
+                              effect="dark"
+                              content="新增岗位"
+                              placement="bottom"
+                            >
+                              <span
+                                title="新增岗位"
+                                class="cap cap-sub"
+                                @click="renderAdd(data)"
+                              ></span>
                             </el-tooltip>
                           </div>
                         </div>
@@ -59,7 +110,10 @@
                         <span class="msg">职员:</span>
                         <span>{{ data.OfficerCount }}</span>
                       </el-col> -->
-                      <el-col :span="24" v-if="data.GroupId != -1">
+                      <el-col
+                        :span="24"
+                        v-if="data.GroupId != -1"
+                      >
                         <el-row>
                           <el-col :span="12">
                             <span class="msg">账号数:</span>
@@ -71,13 +125,30 @@
                           </el-col>
                         </el-row>
                       </el-col>
-                      <el-col :span="12" v-if="data.GroupId != -1">
+                      <el-col
+                        :span="12"
+                        v-if="data.GroupId != -1"
+                      >
                         <span class="msg">状态:</span>
-                        <span class="use" v-if="data.Status == '1'">启用</span>
-                        <span class="unUse" v-if="data.Status != '1'">禁用</span>
+                        <span
+                          class="use"
+                          v-if="data.Status == '1'"
+                        >启用</span>
+                        <span
+                          class="unUse"
+                          v-if="data.Status != '1'"
+                        >禁用</span>
                       </el-col>
-                      <el-col v-is="['grouptree_btn_state_swatch']" :span="12" v-if="data.GroupId != -1">
-                        <el-switch active-color="#6F81BC" v-model="data.flag" @change="renderChange(data)"></el-switch>
+                      <el-col
+                        v-is="['grouptree_btn_state_swatch']"
+                        :span="12"
+                        v-if="data.GroupId != -1"
+                      >
+                        <el-switch
+                          active-color="#6F81BC"
+                          v-model="data.flag"
+                          @change="renderChange(data)"
+                        ></el-switch>
                       </el-col>
                     </el-row>
                   </div>
@@ -88,13 +159,27 @@
           <div class="grid-contentBottom">
             <div class="title">下级岗位</div>
             <div class="content">
-              <el-empty :image-size="150" v-if="childrenData.length < 1"></el-empty>
+              <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)">
+                <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)"
+                  >
                     <i class="el-icon-close"></i>
                   </div>
-                  <div class="itemBox" @click.stop="childrenClick(data)">
+                  <div
+                    class="itemBox"
+                    @click.stop="childrenClick(data)"
+                  >
                     <!-- <div class="status" v-if="data.OrganType == 1"></div>
                     <div class="status2" v-if="data.OrganType != 1"></div> -->
                     <el-row>
@@ -130,17 +215,39 @@
                               ></span
                             ></el-tooltip> -->
 
-                            <el-tooltip v-is="['grouptree_btn_update_group']" effect="dark" content="编辑岗位" placement="bottom">
-                              <span title="编辑岗位" class="cap cap-edit" @click.stop="renderEdit(data)" v-if="data.GroupId != -1"></span>
+                            <el-tooltip
+                              v-is="['grouptree_btn_update_group']"
+                              effect="dark"
+                              content="编辑岗位"
+                              placement="bottom"
+                            >
+                              <span
+                                title="编辑岗位"
+                                class="cap cap-edit"
+                                @click.stop="renderEdit(data)"
+                                v-if="data.GroupId != -1"
+                              ></span>
                             </el-tooltip>
 
-                            <el-tooltip v-is="['grouptree_btn_add_group']" effect="dark" content="新增岗位" placement="bottom">
-                              <span title="新增岗位" class="cap cap-sub" @click.stop="renderAdd(data)"></span>
+                            <el-tooltip
+                              v-is="['grouptree_btn_add_group']"
+                              effect="dark"
+                              content="新增岗位"
+                              placement="bottom"
+                            >
+                              <span
+                                title="新增岗位"
+                                class="cap cap-sub"
+                                @click.stop="renderAdd(data)"
+                              ></span>
                             </el-tooltip>
                           </div>
                         </div>
                       </el-col>
-                      <el-col :span="24" v-if="data.GroupId != -1">
+                      <el-col
+                        :span="24"
+                        v-if="data.GroupId != -1"
+                      >
                         <el-row>
                           <el-col :span="12">
                             <span class="msg">账号数:</span>
@@ -152,13 +259,31 @@
                           </el-col>
                         </el-row>
                       </el-col>
-                      <el-col :span="12" v-if="data.GroupId != -1">
+                      <el-col
+                        :span="12"
+                        v-if="data.GroupId != -1"
+                      >
                         <span class="msg">状态:</span>
-                        <span class="use" v-if="data.Status == '1'">启用</span>
-                        <span class="unUse" v-if="data.Status != '1'">禁用</span>
+                        <span
+                          class="use"
+                          v-if="data.Status == '1'"
+                        >启用</span>
+                        <span
+                          class="unUse"
+                          v-if="data.Status != '1'"
+                        >禁用</span>
                       </el-col>
-                      <el-col v-is="['grouptree_btn_state_swatch']" :span="12" v-if="data.GroupId != -1">
-                        <el-switch active-color="#6F81BC" v-model="data.flag" @click.stop.native @change="childrenRenderChange(data, index)"></el-switch>
+                      <el-col
+                        v-is="['grouptree_btn_state_swatch']"
+                        :span="12"
+                        v-if="data.GroupId != -1"
+                      >
+                        <el-switch
+                          active-color="#6F81BC"
+                          v-model="data.flag"
+                          @click.stop.native
+                          @change="childrenRenderChange(data, index)"
+                        ></el-switch>
                       </el-col>
                     </el-row>
                   </div>
@@ -175,8 +300,16 @@
         <div class="title">删除{{ title }}</div>
         <div class="content">是否确认删除{{ title }}?</div>
         <div class="foot right t30">
-          <el-button size="medium" class="r24" @click="remove" type="danger">删除</el-button>
-          <el-button size="medium" @click="flag = false">取消</el-button>
+          <el-button
+            size="medium"
+            class="r24"
+            @click="remove"
+            type="danger"
+          >删除</el-button>
+          <el-button
+            size="medium"
+            @click="flag = false"
+          >取消</el-button>
         </div>
       </div>
     </Dialog>
@@ -185,213 +318,197 @@
 
 <script>
 // import OrgTree from '@/layout/components/OrgTree'
-import Search from "@/layout/components/Search";
-import Dialog from "@/layout/components/Dialog";
-import { DeleteGroup, ChangeGroupStatus } from "@/api/AccountGroup";
-import treeData from "../minixs/treeData";
+import Search from '@/layout/components/Search'
+import Dialog from '@/layout/components/Dialog'
+import { DeleteGroup, ChangeGroupStatus } from '@/api/AccountGroup'
+import treeData from '../minixs/treeData'
 export default {
-  name: "accountGroup",
+  name: 'accountGroup',
   components: { Search, Dialog },
   mixins: [treeData],
-  data () {
+  data() {
     return {
       dataIndex: 1,
       dataNum: 0,
       dataArr: [],
       type: null,
-      title: "", //弹框title
-      flag: false, //弹框开关
-      dataId: null, //tree数据id
+      title: '', // 弹框title
+      flag: false, // 弹框开关
+      dataId: null, // tree数据id
       defaultProps: {
-        children: "children",
-        label: "GroupName",
+        children: 'children',
+        label: 'GroupName'
       },
       currDataArr: [],
       currDataArrId: 0,
       childrenData: [],
       dataListTree: [],
       currentKey: -1,
-      delIndex: 0,
-    };
+      delIndex: 0
+    }
   },
   created: function () {
-    let keyWords = "";
+    let keyWords = ''
     if (this.$route.query.keyWords) {
-      keyWords = this.$route.query.keyWords;
+      keyWords = this.$route.query.keyWords
     }
-    this.getGroupTree(keyWords);
+    this.getGroupTree(keyWords)
   },
   watch: {
     dataList: {
       handler: function (val) {
-        this.dataListTree = [];
-        this.dataListTree.push(_.cloneDeep(val));
+        this.dataListTree = []
+        this.dataListTree.push(_.cloneDeep(val))
       },
-      deep: true,
-    },
+      deep: true
+    }
   },
   methods: {
-    filterNode (value, data) {
-      if (!value) return true;
-      return data.GroupName.indexOf(value) !== -1;
+    filterNode(value, data) {
+      if (!value) return true
+      return data.GroupName.indexOf(value) !== -1
     },
     // 添加组织
-    renderAdd (data) {
+    renderAdd(data) {
       this.$router.push({
-        path: "/accountGroup/Add",
-        query: { GroupUpId: data.GroupId },
-      });
+        path: '/accountGroup/Add',
+        query: { GroupUpId: data.GroupId }
+      })
     },
     // 修改组织
-    renderEdit (data) {
+    renderEdit(data) {
       this.$router.push({
-        path: "/accountGroup/Edit",
-        query: { GroupUpId: data.GroupUpid, GroupId: data.GroupId },
-      });
+        path: '/accountGroup/Edit',
+        query: { GroupUpId: data.GroupUpid, GroupId: data.GroupId }
+      })
     },
     // 新增职员
-    renderMember (data) {
-      this.$message.warning("功能开发中");
+    renderMember(data) {
+      this.$message.warning('功能开发中')
     },
     // 关闭开启
-    renderChange (data) {
-      const { GroupId, flag } = data;
-      const Status = flag ? 1 : 0;
-      this.handleChange(GroupId, Status);
+    renderChange(data) {
+      const { GroupId, flag } = data
+      const Status = flag ? 1 : 0
+      this.handleChange(GroupId, Status)
     },
-    //下级关闭
-    childrenRenderChange (data, index) {
+    // 下级关闭
+    async childrenRenderChange(data, index) {
+      const { GroupId, flag } = data
+      const Status = flag ? 1 : 0
       try {
-        const { GroupId, flag } = data;
-        const Status = flag ? 1 : 0;
-        ChangeGroupStatus({
+        const res = await ChangeGroupStatus({
           GroupId: GroupId,
-          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;
-          }
-        });
+          Status: Status
+        })
+        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;
+        console.log('出错了', error)
+        this.childrenData[index].flag = !flag
       }
     },
-    //删除组织
-    remove () {
-      this.deleteOrg(this.dataId);
+    // 删除组织
+    remove() {
+      this.deleteOrg(this.dataId)
     },
-    //查询
-    getSearchData (val) {
-      this.$refs.tree.filter(val);
+    // 查询
+    getSearchData(val) {
+      this.$refs.tree.filter(val)
     },
-    //清除查询
-    clearSearchData () {
-      this.getGroupTree();
+    // 清除查询
+    clearSearchData() {
+      this.getGroupTree()
     },
-    //节点关闭按钮点击
-    onNodeClick (data, index) {
-      this.delIndex = index;
-      this.flag = true;
-      this.dataId = data.GroupId;
-      this.title = data.GroupName;
+    // 节点关闭按钮点击
+    onNodeClick(data, index) {
+      this.delIndex = index
+      this.flag = true
+      this.dataId = data.GroupId
+      this.title = data.GroupName
     },
-    //获取指定数据
-    decompose (value, key, id) {
-      let data = _.cloneDeep(value);
-      let arr = [];
+    // 获取指定数据
+    decompose(value, key, id) {
+      let data = _.cloneDeep(value)
+      let arr = []
       for (let i = 0; i < data.length; i++) {
         if (data[i][key] == id) {
-          arr.push(data[i]);
+          arr.push(data[i])
         }
       }
-      return arr;
+      return arr
     },
-    //-----------获取数据------------
-    //状态变更
-    async handleChange (id, val) {
+    // -----------获取数据------------
+    // 状态变更
+    async handleChange(id, val) {
       try {
         const res = await ChangeGroupStatus({
           GroupId: id,
-          Status: val,
-        });
+          Status: val
+        })
         if (res.code === 0) {
-          this.$message.success(res.message);
-          this.currDataArr[0].Status = val;
+          this.$message.success(res.message)
+          this.currDataArr[0].Status = val
         } else {
-          this.$message.error(res.message);
-          this.currDataArr[0].flag = !flag;
+          this.$message.error(res.message)
+          this.currDataArr[0].flag = !val
         }
       } catch (error) {
-        console.log("出错了", error);
+        console.log('出错了', error)
+        this.currDataArr[0].flag = !val
       }
     },
-    //删除
-    async deleteOrg (id) {
+    // 删除
+    async deleteOrg(id) {
       try {
         const res = await DeleteGroup({
-          GroupId: id,
-        });
+          GroupId: id
+        })
         if (res.code === 0) {
-          this.$message.success(res.message);
-          this.flag = false;
-          this.getGroupTree();
-          this.childrenData.splice(this.delIndex, 1);
-          this.$refs.tree.setCurrentKey(this.currDataArr[0].GroupId);
-          this.currentKey = this.currDataArr[0].GroupId;
+          this.$message.success(res.message)
+          this.flag = false
+          this.getGroupTree()
+          this.childrenData.splice(this.delIndex, 1)
+          this.$refs.tree.setCurrentKey(this.currDataArr[0].GroupId)
+          this.currentKey = this.currDataArr[0].GroupId
         } else {
-          this.flag = false;
-          this.$message.error(res.message);
+          this.flag = false
+          this.$message.error(res.message)
         }
       } catch (error) {
-        this.flag = false;
-        console.log("DeleteGroup");
-        console.log("error");
+        this.flag = false
+        console.log('DeleteGroup')
+        console.log('error')
       }
     },
-    //树点击
-    handleNodeClick (data) {
-      const dataNew = _.cloneDeep(data);
-      this.currDataArrId = dataNew.GroupId;
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(
-        this.dataArr,
-        "GroupId",
-        dataNew.GroupId
-      );
-      this.childrenData = this.decompose(
-        this.dataArr,
-        "GroupUpid",
-        dataNew.GroupId
-      );
-    },
-    //下级卡片点击
-    childrenClick (data) {
-      const dataNew = _.cloneDeep(data);
-      this.currDataArrId = dataNew.GroupId;
-      this.currDataArr = [];
-      this.childrenData = [];
-      this.currDataArr = this.decompose(
-        this.dataArr,
-        "GroupId",
-        dataNew.GroupId
-      );
-      this.childrenData = this.decompose(
-        this.dataArr,
-        "GroupUpid",
-        dataNew.GroupId
-      );
-      this.$refs.tree.setCurrentKey(dataNew.GroupId);
-      this.currentKey = dataNew.GroupId;
+    // 树点击
+    handleNodeClick(data) {
+      const dataNew = _.cloneDeep(data)
+      this.currDataArrId = dataNew.GroupId
+      this.currDataArr = []
+      this.childrenData = []
+      this.currDataArr = this.decompose(this.dataArr, 'GroupId', dataNew.GroupId)
+      this.childrenData = this.decompose(this.dataArr, 'GroupUpid', dataNew.GroupId)
     },
-  },
-};
+    // 下级卡片点击
+    childrenClick(data) {
+      const dataNew = _.cloneDeep(data)
+      this.currDataArrId = dataNew.GroupId
+      this.currDataArr = []
+      this.childrenData = []
+      this.currDataArr = this.decompose(this.dataArr, 'GroupId', dataNew.GroupId)
+      this.childrenData = this.decompose(this.dataArr, 'GroupUpid', dataNew.GroupId)
+      this.$refs.tree.setCurrentKey(dataNew.GroupId)
+      this.currentKey = dataNew.GroupId
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>
@@ -599,33 +716,33 @@ export default {
           }
         }
         .cap-plus {
-          background-image: url("../../../assets/status/ic_plus.png");
+          background-image: url('../../../assets/status/ic_plus.png');
           &:hover {
-            background-image: url("../../../assets/status/ic_plus_hovar.png");
+            background-image: url('../../../assets/status/ic_plus_hovar.png');
           }
         }
         .cap-edit {
-          background-image: url("../../../assets/status/ic_edit.png");
+          background-image: url('../../../assets/status/ic_edit.png');
           &:hover {
-            background-image: url("../../../assets/status/ic_edit_hovar.png");
+            background-image: url('../../../assets/status/ic_edit_hovar.png');
           }
         }
         .cap-sub {
-          background-image: url("../../../assets/status/ic_subordinate.png");
+          background-image: url('../../../assets/status/ic_subordinate.png');
           &:hover {
-            background-image: url("../../../assets/status/ic_subordinate_hovar.png");
+            background-image: url('../../../assets/status/ic_subordinate_hovar.png');
           }
         }
         .cap-job {
-          background-image: url("../../../assets/status/ic_jobs.png");
+          background-image: url('../../../assets/status/ic_jobs.png');
           &:hover {
-            background-image: url("../../../assets/status/ic_jobs_hovar.png");
+            background-image: url('../../../assets/status/ic_jobs_hovar.png');
           }
         }
         .cap-member {
-          background-image: url("../../../assets/status/ic_member.png");
+          background-image: url('../../../assets/status/ic_member.png');
           &:hover {
-            background-image: url("../../../assets/status/ic_member_hovar.png");
+            background-image: url('../../../assets/status/ic_member_hovar.png');
           }
         }
       }