瀏覽代碼

编辑职员修改

zhaoke 3 年之前
父節點
當前提交
0f65fdbf31

+ 122 - 39
src/components/rolelist/index.vue

@@ -7,36 +7,36 @@
       </div>
       <template v-if="dataList.length">
         <div :class="active ? 'bgActive' : 'bgActivecheckbox'" class="paren_content">
-          <el-scrollbar style="height: 100%">
-            <template v-if="!type">
-              <el-row :gutter="16">
-                <el-checkbox-group @change="checkChange" v-model="checkList">
-                  <el-col :span="number" v-for="(item, index) in dataList" :key="index">
-                    <div @click="handleBg(item, index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
-                      <div class="cide_header">
-                        <p :title="item.name">{{ item.name }}</p>
-                        <el-checkbox :label="index"></el-checkbox>
-                      </div>
+          <template v-if="!type">
+            <el-row v-infinite-scroll="load" :infinite-scroll-distance="20" infinite-scroll-disabled="disabled" class="scCont scrollbar" :gutter="16">
+              <el-checkbox-group @change="checkChange" v-model="checkList">
+                <el-col :span="number" v-for="(item, index) in dataList" :key="index">
+                  <div @click="handleBg(item, index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
+                    <div class="cide_header">
+                      <p :title="item.name">{{ item.name }}</p>
+                      <el-checkbox :label="index"></el-checkbox>
                     </div>
-                  </el-col>
-                </el-checkbox-group>
-              </el-row>
-            </template>
-            <template v-else>
-              <el-row :gutter="16">
-                <el-radio-group style="display: block;" @change="radioChange" v-model="radio">
-                  <el-col :span="number" v-for="(item, index) in dataList" :key="index">
-                    <div @click.stop="handleBg(index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
-                      <div class="cide_header">
-                        <p>{{ item.name }}</p>
-                        <el-radio :label="index"></el-radio>
-                      </div>
+                  </div>
+                </el-col>
+              </el-checkbox-group>
+            </el-row>
+          </template>
+          <template v-else>
+            <el-row :gutter="16">
+              <el-radio-group style="display: block;" @change="radioChange" v-model="radio">
+                <el-col :span="number" v-for="(item, index) in dataList" :key="index">
+                  <div @click.stop="handleBg(index)" :class="active && msg === index ? 'bgColor' : ''" class="cide">
+                    <div class="cide_header">
+                      <p>{{ item.name }}</p>
+                      <el-radio :label="index"></el-radio>
                     </div>
-                  </el-col>
-                </el-radio-group>
-              </el-row>
-            </template>
-          </el-scrollbar>
+                  </div>
+                </el-col>
+              </el-radio-group>
+            </el-row>
+          </template>
+          <p class="center" v-if="loading">加载中...</p>
+          <p class="center" v-if="noMore">没有更多数据了~</p>
         </div>
       </template>
       <template v-else>
@@ -46,7 +46,7 @@
   </div>
 </template>
 <script>
-import "./rolelist.scss";
+import { GetAccountList } from "@/api/Account";
 export default {
   props: {
     title: {
@@ -65,10 +65,6 @@ export default {
       type: Boolean,
       default: false,
     },
-    dataList: {
-      type: Array,
-      default: () => [],
-    },
     checkBoxList: {
       type: Array,
       default: () => [],
@@ -76,28 +72,56 @@ export default {
     radioCheck: {
       type: Number,
       default: 0,
+    },
+    roleType: {
+      type: String,
+      default: "",
     }
   },
   data () {
     return {
       radio: null,
       checkList: [],
+      dataList: [],
+      arrsList: [],
       msg: null,
+      pageSize: 100,
+      pageNum: 1,
+      total: '',
+      loading: false
     };
   },
   watch: {
-    checkBoxList: {
-      handler (arr) {
-        this.checkList = arr;
-      },
-      deep: true,
-    },
     radioCheck: {
       handler (num) {
         this.radio = num;
       },
       deep: true,
     },
+    roleType: {
+      handler (msg) {
+        if (msg == 'account') {
+          this.getRoleData('UserId');
+        }
+      },
+      deep: true,
+    },
+    dataList: {
+      handler (arr) {
+        if (this.roleType == 'account') {
+          this.checkBoxs(arr, 'UserId');
+        }
+      },
+      deep: true,
+    }
+  },
+  computed: {
+    noMore () {
+      return this.pageNum >= this.total;
+    },
+    disabled () {
+      return this.loading || this.noMore;
+    }
   },
   methods: {
     // 选中
@@ -113,11 +137,65 @@ export default {
     radioChange (val) {
       this.$emit("radioChange", val);
     },
+    //多选框默认选中
+    checkBoxs (arr, ids) {
+      const datas = []
+      arr.forEach((item, index) => {
+        this.checkBoxList.forEach(p => {
+          if (item[ids] == p) {
+            datas.push(index);
+          }
+        })
+      })
+      this.checkList = datas;
+    },
+    //获取列表
+    async getRoleData (ids) {
+      try {
+        this.loading = true;
+        const obj = {
+          QueryName: '',
+          PageIndex: this.pageNum,
+          PageSize: this.pageSize,
+        };
+        let result = null;
+        if (this.roleType == 'account') {
+          result = await GetAccountList(obj);
+        }
+        if (result.code === 0) {
+          const datas = result.returnData.records;
+          const num = result.returnData.pages;
+          this.arrsList.push(datas);
+          const arrs = this.arrsList.flat();
+          const msgs = _.unionBy(arrs, ids);
+          msgs.forEach(item => {
+            item.name = item.UserName
+          });
+          this.dataList = msgs;
+          this.total = num;
+          this.loading = false;
+        } else {
+          this.$message.error(result.message);
+          this.loading = false;
+        }
+      } catch (error) {
+        console.log("出错了", error);
+        this.loading = false;
+      }
+    },
+    //滚动加载数据
+    load () {
+      this.pageNum += 1;
+      if (this.roleType == 'account') {
+        this.getRoleData('UserId');
+      }
+    }
   },
 };
 </script>
 
 <style lang="scss" scoped>
+@import "./rolelist.scss";
 .paren_content {
   ::v-deep .el-radio__label {
     display: none;
@@ -125,5 +203,10 @@ export default {
   ::v-deep .el-checkbox__label {
     display: none;
   }
+  .scCont {
+    height: 65vh;
+    overflow-x: hidden;
+    overflow-y: auto;
+  }
 }
 </style>

+ 40 - 54
src/components/rolelist/rolelist.scss

@@ -25,67 +25,53 @@
     .paren_content {
       width: 100%;
       height: 83%;
-      > .el-scrollbar {
-        > .el-scrollbar__wrap {
-          overflow-x: hidden;
-          > .el-scrollbar__view {
-            padding-top: 10px;
-            .el-row {
-              width: 100%;
-            }
-            .cide {
-              height: 80px;
-              background: #f5f7fa;
-              box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
-              border-radius: 8px;
-              margin-bottom: 16px;
-              padding: 16px 16px 0 16px;
-              cursor: pointer;
-              > .cide_header {
-                display: flex;
-                align-items: center;
-                justify-content: space-between;
-                > p {
-                  font-size: 16px;
-                  font-family: Microsoft YaHei;
-                  font-weight: 400;
-                  color: #303133;
-                  margin-top: 0;
-                  margin-bottom: 0;
-                  text-overflow: -o-ellipsis-lastline;
-                  overflow: hidden;
-                  text-overflow: ellipsis;
-                  display: -webkit-box;
-                  -webkit-line-clamp: 2;
-                  line-clamp: 2;
-                  -webkit-box-orient: vertical;
-                }
-              }
-            }
+      .el-row {
+        width: 100%;
+      }
+      .cide {
+        height: 80px;
+        background: #f5f7fa;
+        box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
+        border-radius: 8px;
+        margin-bottom: 16px;
+        padding: 16px 16px 0 16px;
+        cursor: pointer;
+        > .cide_header {
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          > p {
+            font-size: 16px;
+            font-family: Microsoft YaHei;
+            font-weight: 400;
+            color: #303133;
+            margin-top: 0;
+            margin-bottom: 0;
+            text-overflow: -o-ellipsis-lastline;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            display: -webkit-box;
+            -webkit-line-clamp: 2;
+            line-clamp: 2;
+            -webkit-box-orient: vertical;
           }
         }
       }
     }
     .bgActive {
-      > .el-scrollbar {
-        > .el-scrollbar__wrap {
-          > .el-scrollbar__view {
-            .cide {
-              height: 64px;
-            }
-            .bgColor {
-              background: #6e81bc;
-              > .cide_header {
-                > p {
-                  color: #f5f7fa;
-                }
-              }
-              .el-radio__input.is-checked .el-radio__inner {
-                border-color: #f5f7fa;
-              }
-            }
+      .cide {
+        height: 64px;
+      }
+      .bgColor {
+        background: #6e81bc;
+        > .cide_header {
+          > p {
+            color: #f5f7fa;
           }
         }
+        .el-radio__input.is-checked .el-radio__inner {
+          border-color: #f5f7fa;
+        }
       }
     }
     .bgActivecheckbox {

+ 87 - 257
src/views/staffManagement/compontents/staffEdit.vue

@@ -1,10 +1,10 @@
 <!--
- * @Author: zk
- * @Date: 2021-11-29 11:26:07
- * @LastEditTime: 2022-02-09 16:15:26
+ * @Author: your name
+ * @Date: 2022-02-10 14:49:20
+ * @LastEditTime: 2022-02-10 17:18:44
  * @LastEditors: Please set LastEditors
- * @Description:编辑职员
- * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityPower.vue
+ * @Description: 编辑职员
+ * @FilePath: \Foshan4A4.0\src\views\staffManagement\compontents\staffEdit.vue
 -->
 <template>
   <div class="authorityPower">
@@ -38,40 +38,62 @@
     </div>
     <div class="power-content flex-wrap">
       <div class="r24 flex1 part">
-        <Organization ref="Organization" :defaultProps="defaultProps" :lessData="lessData" :mainData="mainData" :vice="true" :data="data" @getTreeData="getOrgan" @getTreeindex="getTreeindex" @radioChange="radioChange" :checkedKeys="orgCheckedKeys" :checkBoxList="checkBoxList" :radioCheck="radioNum" @checkChange="lessChecks" nodekey="OrganId" title="所属组织及所属岗位" />
+        <Organization ref="Organization" :defaultProps="defaultProps" :mainData="mainData" :vice="true" :data="data" @getTreeData="getOrgan" @getTreeindex="getTreeindex" @radioChange="radioChange" :checkedKeys="orgCheckedKeys" :checkBoxList="checkBoxList" :radioCheck="radioNum" nodekey="OrganId" title="选择组织" />
       </div>
-      <div class="r24 flex1 part">
-        <Usergroup title="用户组树" />
-      </div>
-      <!--有角色-->
-      <template v-if="openRole">
-        <div class="r24 flex1 part">
-          <Rolelist @checkChange="checkChange" @checkClick="checkClick" :checkBoxList="roleCheckBoxs" :dataList="arrs" :active="true" class="hucRole" :number="8" title="角色列表" />
-        </div>
+      <!--开启多对多-->
+      <template v-if="OpenAuthData">
         <div class="flex1 part">
-          <Permissionlist style="height: 376" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
-          <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 376px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+          <Rolelist @checkChange="checkChange" :checkBoxList="roleCheckBoxs" :roleType="roleType" :active="true" class="hucRole" :number="4" title="账号列表" />
         </div>
       </template>
-      <!--有权限组列表-->
-      <template v-else-if="OpenGroup">
-        <div class="r24 flex1 part">
-          <Rolelist @checkChange="checkChange" @checkClick="checkGroup" :checkBoxList="groupCheckBoxs" :dataList="authArrs" :active="true" class="hucRole" :number="8" title="权限组列表" />
-        </div>
-        <div class="flex1 part">
-          <Permissionlist style="height:376px;" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
-          <Loginpolicy style="margin-top:24px;height:calc(100% - 376px - 24px);" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
-        </div>
-      </template>
-      <!--无角色-->
+      <!--未开启多对多-->
       <template v-else>
-        <div class="r24 flex1 part">
-          <Permissiontree ref="Permissiontree" :queryType="queryType" :queryId="treeId" :checkedKeys="checkedBoxs" :isMainJob="isMainJob" @nodeClick="nodeClick" @getTreeData="getTreeData" title="权限树" />
-        </div>
-        <div class="flex1 part">
-          <Rulesofcompetency style="height: 512px" class="hucPower" :authList="authList" :authTo="authTo" @getData="getData" title="权限规则" />
-          <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 512px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
-        </div>
+        <!--有账号组 无角色-->
+        <template v-if="OpenGroup && !openRole">
+          <div class="r24 flex1 part">
+            <Usergroup title="用户组树" />
+          </div>
+          <div class="r24 flex1 part">
+            <Permissiontree ref="Permissiontree" :queryType="queryType" :queryId="treeId" :checkedKeys="checkedBoxs" :isMainJob="isMainJob" @nodeClick="nodeClick" @getTreeData="getTreeData" title="权限树" />
+          </div>
+          <div class="flex1 part">
+            <Rulesofcompetency style="height: 512px" class="hucPower" :authList="authList" :authTo="authTo" @getData="getData" title="权限规则" />
+            <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 512px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+          </div>
+        </template>
+        <!--有角色 无账号组-->
+        <template v-if="openRole && !OpenGroup">
+          <div class="r24 flex1 part">
+            <Rolelist @checkChange="checkChange" @checkClick="checkClick" :checkBoxList="roleCheckBoxs" :dataList="arrs" :active="true" class="hucRole" :number="8" title="角色列表" />
+          </div>
+          <div class="flex1 part">
+            <Permissionlist style="height: 376px" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
+            <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 376px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+          </div>
+        </template>
+        <!--有角色 有账号组-->
+        <template v-if="openRole && OpenGroup">
+          <div class="r24 flex1 part">
+            <Usergroup title="用户组树" />
+          </div>
+          <div class="r24 flex1 part">
+            <Rolelist @checkChange="checkChange" @checkClick="checkClick" :checkBoxList="roleCheckBoxs" :dataList="arrs" :active="true" class="hucRole" :number="8" title="角色列表" />
+          </div>
+          <div class="flex1 part">
+            <Permissionlist style="height: 376px" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
+            <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 376px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+          </div>
+        </template>
+        <!--无账号组 无角色-->
+        <template v-if="!OpenGroup && !openRole">
+          <div class="r24 flex1 part">
+            <Permissiontree ref="Permissiontree" :queryType="queryType" :queryId="treeId" :checkedKeys="checkedBoxs" :isMainJob="isMainJob" @nodeClick="nodeClick" @getTreeData="getTreeData" title="权限树" />
+          </div>
+          <div class="flex1 part">
+            <Rulesofcompetency style="height: 512px" class="hucPower" :authList="authList" :authTo="authTo" @getData="getData" title="权限规则" />
+            <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 512px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+          </div>
+        </template>
       </template>
     </div>
   </div>
@@ -162,6 +184,9 @@ export default {
       lessChecksData: [], //副岗选中数据
       queryType: null, //权限树类型
       openRole: null,
+      OpenGroup: null,
+      OpenAuthData: null,
+      roleType: '',
       dataObj: {}, //上级权限指定树数据
       data: [], //上级权限
       roleList: [], //角色
@@ -185,27 +210,10 @@ export default {
       },
       deep: true,
     },
-    arrs: {
-      handler (arr, old) {
-        // this.orgTypes.push(old)
-        if (this.DepJobIds.length > 0) {
-          this.authArrs.push(...arr);
-          this.authArrs = _.unionBy(this.authArrs, "GroupId");
-        }
-        else {
-          this.authArrs = arr
-        }
-        if (this.openRole) {
-          this.defaultChecked(arr, 'RoleId')
-        } else if (this.OpenGroup) {
-          this.defaultChecked(this.authArrs, 'GroupId')
-        }
-      },
-    },
   },
   created () {
     const { OrganId, Status, OfficerId } = this.$route.query;
-    const { OpenRole, PwdLengthBegin, PwdLengthEnd, PwdStruc, OpenGroup } =
+    const { OpenRole, PwdLengthBegin, PwdLengthEnd, PwdStruc, OpenGroup, UserOfficerMulti } =
       typeof this.systemSet === "string"
         ? JSON.parse(this.systemSet)
         : this.systemSet; //1是请求角色 0是请求用户
@@ -214,13 +222,14 @@ export default {
     this.OfficerId = OfficerId;
     this.openRole = OpenRole;
     this.OpenGroup = OpenGroup;
-    if (!OpenRole) {
-      if (OrganId == -1) {
-        this.queryType = "all";
-      } else {
-        this.queryType = "origin";
-      }
-    }
+    this.OpenAuthData = UserOfficerMulti;
+    // if (!OpenRole) {
+    //   if (OrganId == -1) {
+    //     this.queryType = "all";
+    //   } else {
+    //     this.queryType = "origin";
+    //   }
+    // }
     this.getOfficerDetails(OfficerId);
   },
   methods: {
@@ -243,7 +252,8 @@ export default {
             OfficerName,
             RoleList,
             TacList,
-            GroupList
+            GroupList,
+            UserList
           } = obj;
           this.form.name = OfficerName;
           this.form.loginName = OfficerLoginName;
@@ -255,33 +265,10 @@ export default {
           this.JobId = JobId;
           this.lessChecksData = DepJobList;
           this.isMainJob = false;
-          let IDs = [];
-          if (JobId && JobId != "") {
-            if (!this.openRole && !this.OpenGroup) {
-              this.queryType = "job";
-              this.$refs.Permissiontree.MainJobId = JobId;
-            }
-            else {
-              if (DepJobList.length > 0) {
-                DepJobList.forEach((item) => {
-                  this.DepJobIds.push(item.JobId)
-                  IDs.push(item.JobId);
-                });
-              }
-              this.treeId = IDs.toString();
-              if (_.indexOf(this.DepJobIds, this.JobId)) {
-                this.DepJobIds.push(this.JobId)
-              }
-              if (this.OpenGroup) {
-                this.getAllAuthGroup();
-              }
-            }
-          } else {
-            this.queryType = "origin";
-            this.treeId = OrganId + "";
-            this.getGroupByOrgan(OrganId)
+          this.getJobListByOrgan(OrganId);
+          if (this.OpenAuthData) {
+            this.roleType = 'account';
           }
-
           if (AuthList && AuthList.length) {
             AuthList.forEach((item) => {
               this.authId.push(item.AuthId);
@@ -316,6 +303,13 @@ export default {
               this.groupAuths(GroupList[0].GroupId);
             }
           }
+          if (UserList && UserList.length) {
+            const datas = [];
+            UserList.forEach(item => {
+              datas.push(item.UserId);
+            })
+            this.roleCheckBoxs = datas;
+          }
           this.checkedList = TacList;
           this.loginCheckBoxs = TacList;
         } else {
@@ -325,23 +319,6 @@ export default {
         console.log("出错了", error);
       }
     },
-    //循环获取所有可用权限组
-    getAllAuthGroup () {
-      try {
-        if (this.DepJobIds.length > 0) {
-          this.authArrs = [];
-          this.DepJobIds.forEach(item => {
-            this.getGroupByJob(item)
-          })
-        }
-        else {
-          this.authArrs = [];
-          this.getGroupByOrgan(this.oldOrganId)
-        }
-      } catch (error) {
-
-      }
-    },
     //获取选中的树数据
     getTreeData (arr) {
       this.checkTrees = arr;
@@ -366,38 +343,8 @@ export default {
     },
     //获取组织选中的数据
     getOrgan (arr) {
-      this.orgTypes.push(arr);
-      if (arr.length) {
-        this.checkedKeys = arr;
-        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
-        this.AppId = OrganId;
-        if (!this.openRole && !this.OpenGroup) {
-          if (this.oldOrganId != OrganId) {
-            this.queryType = "origin";
-            this.treeId = OrganId;
-            this.oldOrganId = OrganId
-          } else {
-            this.oldOrganId = "";
-          }
-        } else if (this.openRole) {
-          this.getRoleByOrgan(OrganId);
-        } else if (this.OpenGroup) {
-          if (this.oldOrganId != OrganId) {
-            if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) != -1) {
-              this.DepJobIds.splice(_.indexOf(this.DepJobIds, this.JobId), 1)
-            }
-            this.mainData = [];
-            this.radioNum = null;
-            this.JobId = "";
-            this.authArrs = [];
-            this.oldOrganId = OrganId
-            this.getGroupByOrgan(OrganId)
-            if (this.DepJobIds.length > 0) {
-              this.getAllAuthGroup();
-            }
-          }
-        }
-      }
+      const { OrganId } = arr[0];
+      this.getJobListByOrgan(OrganId);
     },
     //获取指定数据
     decompose (data, id) {
@@ -417,95 +364,11 @@ export default {
     },
     //岗位选择
     getTreeindex (index) {
-      if (index == 1 && !this.checkedKeys.length) {
-        this.$refs.Organization.active = 0;
-        this.$message.error("请先确认组织后再选择主岗");
-        return false;
-      } else if (index == 1 && this.checkedKeys.length) {
-        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
-        this.getJobListByOrgan(OrganId);
-      } else if (index == 2 && !this.mainData.length) {
-        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
-        this.getJobListByOrgan(OrganId);
-        this.$refs.Organization.active = 1;
-        this.$message.error("请先确认主岗后再选择副岗");
-        return false;
-      } else if (index == 2 && this.mainData.length) {
-        if (this.alljobArr.length < 1) {
-          this.getJobList();
-        }
-      }
+      console.log(index)
     },
     //根据主岗查询角色
     radioChange (val) {
-      const { JobId } = this.mainData[val];
-      if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) != -1) {
-        this.DepJobIds.splice(_.indexOf(this.DepJobIds, this.JobId), 1)
-      }
-      this.radioCheck = JobId;
-      this.JobId = JobId;
-      this.queryType = "job";
-      this.treeId = JobId + "";
-      this.isMainJob = true;
-      if (this.openRole) {
-        this.getRoleByJob(JobId, 1)
-      } else if (this.OpenGroup) {
-        this.lessData.forEach((item, index) => {
-          if (item.JobId == JobId) {
-            if (_.indexOf(this.checkBoxList, index) > -1) {
-              this.checkBoxList.splice(_.indexOf(this.checkBoxList, index), 1)
-              this.lessChecksData.forEach((item1, index1) => {
-                if (item1.JobId == JobId) {
-                  this.lessChecksData.splice(index1, 1)
-                }
-              })
-            }
-          }
-        })
-        this.lessData = _.cloneDeep(this.alljobArr);
-        this.lessData.forEach((item, index) => {
-          if (item.JobId == JobId) {
-            this.lessData.splice(index, 1)
-          }
-        })
-        if (_.indexOf(this.DepJobIds, JobId) == -1) {
-          this.DepJobIds.push(JobId);
-        }
-        this.getAllAuthGroup()
-      }
-      // }
-    },
-    //副岗选中回调
-    lessChecks (arr) {
-      this.isMainJob = false;
-      const datas = [];
-      let IDS = [];
-      this.DepJobIds = []
-      this.checkBoxList = arr;
-      this.lessData.forEach((item, index) => {
-        arr.forEach((p) => {
-          if (p === index) {
-            datas.push(item);
-            IDS.push(item.JobId);
-            this.DepJobIds.push(item.JobId);
-          }
-        });
-      });
-      this.queryType = "job";
-      this.treeId = IDS.toString();
-      this.lessChecksData = datas;
-      if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) == -1) {
-        this.DepJobIds.push(this.JobId)
-      }
-      if (datas.length) {
-        const { JobId } = datas[datas.length - 1];
-        if (this.openRole) {
-          this.getRoleByJob(JobId, 2)
-        }
-      }
-      if (this.OpenGroup) {
-        this.getAllAuthGroup()
-      }
+      console.log(val)
     },
     //根据岗位获取角色
     async getRoleByJob (id, index) {
@@ -571,39 +434,6 @@ export default {
         console.log("出错了", error);
       }
     },
-    //岗位列表查询-副岗
-    async getJobList (name = "") {
-      try {
-        let params = {
-          QueryName: name,
-        };
-        const res = await postList(params);
-        if (res.code === 0) {
-          const datas = res.returnData;
-          const nums = [];
-          datas.forEach((item, index) => {
-            item.name = item.JobName;
-            this.lessChecksData.forEach((p) => {
-              if (item.JobId == p.JobId) {
-                nums.push(index);
-              }
-            });
-          });
-          this.alljobArr = _.cloneDeep(datas);
-          datas.forEach((item, index) => {
-            if (item.JobId == this.JobId) {
-              datas.splice(index, 1)
-            }
-          })
-          this.lessData = _.cloneDeep(datas);
-          this.checkBoxList = nums;
-        } else {
-          this.$message.error(res.message);
-        }
-      } catch (error) {
-        console.log("出错了", error);
-      }
-    },
     //角色点击回调
     checkClick (item) {
       this.roleAuths(item.RoleId);
@@ -722,8 +552,8 @@ export default {
           : this.systemSet; //1是请求角色 0是请求用户
       this.form.loginPwd = pwdProduce(PwdLengthBegin, PwdLengthEnd, PwdStruc);
     },
-  },
-};
+  }
+}
 </script>
 
 <style lang="scss" scoped>
@@ -782,4 +612,4 @@ export default {
     height: 750px;
   }
 }
-</style>
+</style>

+ 785 - 0
src/views/staffManagement/compontents/staffEdit_copy.vue

@@ -0,0 +1,785 @@
+<!--
+ * @Author: zk
+ * @Date: 2021-11-29 11:26:07
+ * @LastEditTime: 2022-02-10 14:57:56
+ * @LastEditors: Please set LastEditors
+ * @Description:编辑职员
+ * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityPower.vue
+-->
+<template>
+  <div class="authorityPower">
+    <!--编辑职员-->
+    <div class="addApp-form">
+      <div class="addApp-form-title flex">
+        <div class="title">编辑职员</div>
+        <div class="btn">
+          <el-button @click="saveBtn('form')" type="primary">保存</el-button>
+        </div>
+      </div>
+      <div class="addApp-form-content dialog-public-background">
+        <el-form :inline="true" ref="form" :rules="rules" class="form" :model="form">
+          <el-form-item prop="name" label="职员名称">
+            <el-input placeholder="请输入职员名称" maxlength="32" v-model="form.name"></el-input>
+          </el-form-item>
+          <el-form-item prop="loginName" label="职员登录名">
+            <el-input placeholder="请输入职员登录名" maxlength="32" v-model="form.loginName"></el-input>
+          </el-form-item>
+          <el-form-item style="margin-right: 16px" label="登录密码">
+            <el-input placeholder="*******" disabled maxlength="32" v-model="form.loginPwd"></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button size="small" type="primary" @click="reSetPassWord">重置密码</el-button>
+          </el-form-item>
+          <el-form-item label="描述">
+            <el-input style="width: 25.65vw" maxlength="200" placeholder="请输入描述" v-model="form.app"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+    <div class="power-content flex-wrap">
+      <div class="r24 flex1 part">
+        <Organization ref="Organization" :defaultProps="defaultProps" :lessData="lessData" :mainData="mainData" :vice="true" :data="data" @getTreeData="getOrgan" @getTreeindex="getTreeindex" @radioChange="radioChange" :checkedKeys="orgCheckedKeys" :checkBoxList="checkBoxList" :radioCheck="radioNum" @checkChange="lessChecks" nodekey="OrganId" title="所属组织及所属岗位" />
+      </div>
+      <div class="r24 flex1 part">
+        <Usergroup title="用户组树" />
+      </div>
+      <!--有角色-->
+      <template v-if="openRole">
+        <div class="r24 flex1 part">
+          <Rolelist @checkChange="checkChange" @checkClick="checkClick" :checkBoxList="roleCheckBoxs" :dataList="arrs" :active="true" class="hucRole" :number="8" title="角色列表" />
+        </div>
+        <div class="flex1 part">
+          <Permissionlist style="height: 376" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
+          <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 376px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+        </div>
+      </template>
+      <!--有权限组列表-->
+      <template v-else-if="OpenGroup">
+        <div class="r24 flex1 part">
+          <Rolelist @checkChange="checkChange" @checkClick="checkGroup" :checkBoxList="groupCheckBoxs" :dataList="authArrs" :active="true" class="hucRole" :number="8" title="权限组列表" />
+        </div>
+        <div class="flex1 part">
+          <Permissionlist style="height:376px;" :imageSize="120" :RoleList="RoleList" :check="true" class="hucPower" title="权限列表" />
+          <Loginpolicy style="margin-top:24px;height:calc(100% - 376px - 24px);" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+        </div>
+      </template>
+      <!--无角色-->
+      <template v-else>
+        <div class="r24 flex1 part">
+          <Permissiontree ref="Permissiontree" :queryType="queryType" :queryId="treeId" :checkedKeys="checkedBoxs" :isMainJob="isMainJob" @nodeClick="nodeClick" @getTreeData="getTreeData" title="权限树" />
+        </div>
+        <div class="flex1 part">
+          <Rulesofcompetency style="height: 512px" class="hucPower" :authList="authList" :authTo="authTo" @getData="getData" title="权限规则" />
+          <Loginpolicy style="margin-top: 24px; height: calc(100% - 24px - 512px)" :imageSize="120" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
+        </div>
+      </template>
+    </div>
+  </div>
+</template>
+
+<script>
+import Permissiontree from "@/components/permissiontree";
+import Rulesofcompetency from "@/components/rulesofcompetency";
+import Organization from "@/components/organization";
+import Permissionlist from "@/components/permissionlist";
+import Rolelist from "@/components/rolelist";
+import Loginpolicy from "@/components/loginpolicy";
+import Usergroup from "@/components/usergrouptree";
+import treeData from "../minixs/treeData";
+import { mapGetters } from "vuex";
+import { RoleAuths } from "@/api/apiAuthority";
+import {
+  newstaffmod,
+  postList,
+  organgitpost,
+  jbdetpop,
+  Staffdetails,
+} from "@/api/postInterface";
+import { pwdProduce } from "@/utils/validate";
+export default {
+  name: "AuthorityPower",
+  mixins: [treeData],
+  components: {
+    Rulesofcompetency,
+    Organization,
+    Permissiontree,
+    Permissionlist,
+    Rolelist,
+    Loginpolicy,
+    Usergroup
+  },
+  data () {
+    return {
+      Status: null,
+      AppId: null,
+      form: {
+        //应用表单
+        name: "",
+        loginName: "",
+        loginPwd: "",
+        app: "",
+      },
+      title: "角色",
+      rules: {
+        //表单验证
+        name: [{ required: true, message: "请输入职员名称", trigger: "blur" }],
+        loginName: [
+          { required: true, message: "请输入职员登录名", trigger: "blur" },
+        ],
+        loginPwd: [
+          { required: true, message: "请输入职员登录密码", trigger: "blur" },
+        ],
+      },
+      defaultProps: {
+        children: "children",
+        label: "OrganName",
+      },
+      treeId: null, //根据组织获取权限树的组织ID
+      checkedKeys: [], //上级组织选中
+      RoleList: [],
+      checkedBoxs: [],
+      arrs: [],
+      authArrs: [],//
+      OfficerId: null,
+      authId: [], //权限树默认选中ID
+      authList: [],
+      authTo: {},
+      orgTypes: [],
+      checkBoxList: [], //副岗默认选中
+      checkedList: [], //登录策略默认选中的数据
+      radioCheck: null, //主岗默认选中
+      radioNum: null, //主岗已选中
+      roleDatas: [], //接口详情返回的角色列表数据
+      roleCheckBoxs: [], //角色列表默认选中数据
+      groupCheckBoxs: [], //权限组列表默认选中数据
+      orgCheckedKeys: [], //组织树默认选中
+      loginCheckBoxs: [], //登录策略数据
+      mainData: [], //主岗数据
+      JobId: "", //选中主岗ID
+      DepJobIds: [],//选中副岗ID集合
+      lessData: [], //副岗数据
+      lessCheckBoxs: [], //副岗选中数据联合主岗
+      lessChecksData: [], //副岗选中数据
+      queryType: null, //权限树类型
+      openRole: null,
+      dataObj: {}, //上级权限指定树数据
+      data: [], //上级权限
+      roleList: [], //角色
+      checkRoles: [], //选中的角色
+      checkTrees: [], //上级权限选中树数据
+      rulesObj: {}, //权限规则数据
+      isMainJob: true, //是否主岗
+      oldOrganId: "",
+      onCheckedArr: [],//当前显示选中权限组
+      alljobArr: [],//全部岗位
+    };
+  },
+  computed: {
+    ...mapGetters(["systemSet"]),
+  },
+  watch: {
+    //监听上级组织数据
+    dataList: {
+      handler (val) {
+        this.data = [val];
+      },
+      deep: true,
+    },
+    arrs: {
+      handler (arr, old) {
+        // this.orgTypes.push(old)
+        if (this.DepJobIds.length > 0) {
+          this.authArrs.push(...arr);
+          this.authArrs = _.unionBy(this.authArrs, "GroupId");
+        }
+        else {
+          this.authArrs = arr
+        }
+        if (this.openRole) {
+          this.defaultChecked(arr, 'RoleId')
+        } else if (this.OpenGroup) {
+          this.defaultChecked(this.authArrs, 'GroupId')
+        }
+      },
+    },
+  },
+  created () {
+    const { OrganId, Status, OfficerId } = this.$route.query;
+    const { OpenRole, PwdLengthBegin, PwdLengthEnd, PwdStruc, OpenGroup } =
+      typeof this.systemSet === "string"
+        ? JSON.parse(this.systemSet)
+        : this.systemSet; //1是请求角色 0是请求用户
+    // this.form.loginPwd = pwdProduce(PwdLengthBegin, PwdLengthEnd, PwdStruc);
+    this.Status = Status;
+    this.OfficerId = OfficerId;
+    this.openRole = OpenRole;
+    this.OpenGroup = OpenGroup;
+    if (!OpenRole) {
+      if (OrganId == -1) {
+        this.queryType = "all";
+      } else {
+        this.queryType = "origin";
+      }
+    }
+    this.getOfficerDetails(OfficerId);
+  },
+  methods: {
+    //职员详情查询
+    async getOfficerDetails (id) {
+      try {
+        let params = {
+          OfficerId: id,
+        };
+        const res = await Staffdetails(params);
+        if (res.code === 0) {
+          const obj = res.returnData;
+          const {
+            AuthList,
+            DepJobList,
+            JobId,
+            OrganId,
+            OfficerDesc,
+            OfficerLoginName,
+            OfficerName,
+            RoleList,
+            TacList,
+            GroupList
+          } = obj;
+          this.form.name = OfficerName;
+          this.form.loginName = OfficerLoginName;
+          this.form.app = OfficerDesc;
+          this.orgCheckedKeys = [OrganId];
+          this.oldOrganId = OrganId;
+          this.roleDatas = RoleList;
+          this.radioCheck = JobId;
+          this.JobId = JobId;
+          this.lessChecksData = DepJobList;
+          this.isMainJob = false;
+          let IDs = [];
+          if (JobId && JobId != "") {
+            if (!this.openRole && !this.OpenGroup) {
+              this.queryType = "job";
+              this.$refs.Permissiontree.MainJobId = JobId;
+            }
+            else {
+              if (DepJobList.length > 0) {
+                DepJobList.forEach((item) => {
+                  this.DepJobIds.push(item.JobId)
+                  IDs.push(item.JobId);
+                });
+              }
+              this.treeId = IDs.toString();
+              if (_.indexOf(this.DepJobIds, this.JobId)) {
+                this.DepJobIds.push(this.JobId)
+              }
+              if (this.OpenGroup) {
+                this.getAllAuthGroup();
+              }
+            }
+          } else {
+            this.queryType = "origin";
+            this.treeId = OrganId + "";
+            this.getGroupByOrgan(OrganId)
+          }
+
+          if (AuthList && AuthList.length) {
+            AuthList.forEach((item) => {
+              this.authId.push(item.AuthId);
+            });
+            this.authList = _.cloneDeep(AuthList);
+            this.authTo = AuthList[0];
+            this.checkedBoxs = this.authId;
+          }
+          if (RoleList && RoleList.length) {
+            const [checkRoles, checkBoxs] = [[], []];
+            RoleList.forEach((item, index) => {
+              if (item.IsSelected == 1) {
+                checkRoles.push(item);
+                checkBoxs.push(index);
+              }
+            });
+            if (checkRoles.length && checkBoxs.length) {
+              this.checkRoles = checkRoles;
+              this.roleAuths(RoleList[0].RoleId);
+            }
+          }
+          if (GroupList && GroupList.length) {
+            const [checkRoles, checkBoxs] = [[], []];
+            GroupList.forEach((item, index) => {
+              if (item.IsSelected == 1) {
+                checkRoles.push(item);
+                checkBoxs.push(index);
+              }
+            });
+            if (checkRoles.length && checkBoxs.length) {
+              this.checkRoles = checkRoles;
+              this.groupAuths(GroupList[0].GroupId);
+            }
+          }
+          this.checkedList = TacList;
+          this.loginCheckBoxs = TacList;
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //循环获取所有可用权限组
+    getAllAuthGroup () {
+      try {
+        if (this.DepJobIds.length > 0) {
+          this.authArrs = [];
+          this.DepJobIds.forEach(item => {
+            this.getGroupByJob(item)
+          })
+        }
+        else {
+          this.authArrs = [];
+          this.getGroupByOrgan(this.oldOrganId)
+        }
+      } catch (error) {
+
+      }
+    },
+    //获取选中的树数据
+    getTreeData (arr) {
+      this.checkTrees = arr;
+    },
+    // 默认选中
+    defaultChecked (arr, id) {
+      const datas = []
+      this.onCheckedArr = [];
+      arr.forEach((item, index) => {
+        this.checkRoles.forEach(p => {
+          if (item[id] == p[id]) {
+            datas.push(index)
+            this.onCheckedArr.push(item);
+          }
+        })
+      })
+      if (this.openRole) {
+        this.roleCheckBoxs = datas;
+      } else if (this.OpenGroup) {
+        this.groupCheckBoxs = datas;
+      }
+    },
+    //获取组织选中的数据
+    getOrgan (arr) {
+      this.orgTypes.push(arr);
+      if (arr.length) {
+        this.checkedKeys = arr;
+        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
+        this.AppId = OrganId;
+        if (!this.openRole && !this.OpenGroup) {
+          if (this.oldOrganId != OrganId) {
+            this.queryType = "origin";
+            this.treeId = OrganId;
+            this.oldOrganId = OrganId
+          } else {
+            this.oldOrganId = "";
+          }
+        } else if (this.openRole) {
+          this.getRoleByOrgan(OrganId);
+        } else if (this.OpenGroup) {
+          if (this.oldOrganId != OrganId) {
+            if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) != -1) {
+              this.DepJobIds.splice(_.indexOf(this.DepJobIds, this.JobId), 1)
+            }
+            this.mainData = [];
+            this.radioNum = null;
+            this.JobId = "";
+            this.authArrs = [];
+            this.oldOrganId = OrganId
+            this.getGroupByOrgan(OrganId)
+            if (this.DepJobIds.length > 0) {
+              this.getAllAuthGroup();
+            }
+          }
+        }
+      }
+    },
+    //获取指定数据
+    decompose (data, id) {
+      for (let i = 0; i < data.length; i++) {
+        if (data[i].OrganId == id) {
+          this.dataObj = data[i];
+        } else if (data[i].children && data[i].children.length > 0) {
+          this.decompose(data[i].children, id);
+        }
+      }
+    },
+    //权限树点击
+    nodeClick (obj) {
+      const arr = this.$store.getters.authArrs;
+      arr.push(obj);
+      this.$store.dispatch("auth/changeAuthArrs", arr);
+    },
+    //岗位选择
+    getTreeindex (index) {
+      if (index == 1 && !this.checkedKeys.length) {
+        this.$refs.Organization.active = 0;
+        this.$message.error("请先确认组织后再选择主岗");
+        return false;
+      } else if (index == 1 && this.checkedKeys.length) {
+        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
+        this.getJobListByOrgan(OrganId);
+      } else if (index == 2 && !this.mainData.length) {
+        const { OrganId } = this.checkedKeys[this.checkedKeys.length - 1];
+        this.getJobListByOrgan(OrganId);
+        this.$refs.Organization.active = 1;
+        this.$message.error("请先确认主岗后再选择副岗");
+        return false;
+      } else if (index == 2 && this.mainData.length) {
+        if (this.alljobArr.length < 1) {
+          this.getJobList();
+        }
+      }
+    },
+    //根据主岗查询角色
+    radioChange (val) {
+      const { JobId } = this.mainData[val];
+      if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) != -1) {
+        this.DepJobIds.splice(_.indexOf(this.DepJobIds, this.JobId), 1)
+      }
+      this.radioCheck = JobId;
+      this.JobId = JobId;
+      this.queryType = "job";
+      this.treeId = JobId + "";
+      this.isMainJob = true;
+      if (this.openRole) {
+        this.getRoleByJob(JobId, 1)
+      } else if (this.OpenGroup) {
+        this.lessData.forEach((item, index) => {
+          if (item.JobId == JobId) {
+            if (_.indexOf(this.checkBoxList, index) > -1) {
+              this.checkBoxList.splice(_.indexOf(this.checkBoxList, index), 1)
+              this.lessChecksData.forEach((item1, index1) => {
+                if (item1.JobId == JobId) {
+                  this.lessChecksData.splice(index1, 1)
+                }
+              })
+            }
+          }
+        })
+        this.lessData = _.cloneDeep(this.alljobArr);
+        this.lessData.forEach((item, index) => {
+          if (item.JobId == JobId) {
+            this.lessData.splice(index, 1)
+          }
+        })
+        if (_.indexOf(this.DepJobIds, JobId) == -1) {
+          this.DepJobIds.push(JobId);
+        }
+        this.getAllAuthGroup()
+      }
+      // }
+    },
+    //副岗选中回调
+    lessChecks (arr) {
+      this.isMainJob = false;
+      const datas = [];
+      let IDS = [];
+      this.DepJobIds = []
+      this.checkBoxList = arr;
+      this.lessData.forEach((item, index) => {
+        arr.forEach((p) => {
+          if (p === index) {
+            datas.push(item);
+            IDS.push(item.JobId);
+            this.DepJobIds.push(item.JobId);
+          }
+        });
+      });
+      this.queryType = "job";
+      this.treeId = IDS.toString();
+      this.lessChecksData = datas;
+      if (this.JobId != "" && _.indexOf(this.DepJobIds, this.JobId) == -1) {
+        this.DepJobIds.push(this.JobId)
+      }
+      if (datas.length) {
+        const { JobId } = datas[datas.length - 1];
+        if (this.openRole) {
+          this.getRoleByJob(JobId, 2)
+        }
+      }
+      if (this.OpenGroup) {
+        this.getAllAuthGroup()
+      }
+    },
+    //根据岗位获取角色
+    async getRoleByJob (id, index) {
+      try {
+        let params = {
+          JobId: id,
+        };
+        const res = await jbdetpop(params);
+        if (res.code === 0) {
+          const datas = res.returnData;
+          const arrs = [];
+          datas.forEach((item) => {
+            item.name = item.RoleName;
+            if (item.IsSelected == 1) {
+              arrs.push(item);
+            }
+          });
+          if (index == 1) {
+            this.arrs = arrs;
+            this.lessCheckBoxs.push(arrs);
+          } else if (index == 2) {
+            if (arrs.length) {
+              this.lessCheckBoxs.push(arrs);
+              const msgs = this.lessCheckBoxs.flat();
+              const uninqMsgs = _.unionBy(msgs, "RoleId");
+              this.arrs = uninqMsgs;
+            }
+          }
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //根据组织查询岗位列表-主岗
+    async getJobListByOrgan (id) {
+      try {
+        let params = {
+          OrganId: id,
+        };
+        const res = await organgitpost(params);
+        if (res.code === 0) {
+          const datas = res.returnData;
+          if (this.orgTypes.length < 2) {
+            datas.forEach((item, index) => {
+              item.name = item.JobName;
+              if (item.JobId == this.radioCheck) {
+                this.radioNum = index;
+              }
+            });
+          } else {
+            this.radioCheck = null;
+            datas.forEach((item) => {
+              item.name = item.JobName;
+            });
+          }
+          this.mainData = datas;
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //岗位列表查询-副岗
+    async getJobList (name = "") {
+      try {
+        let params = {
+          QueryName: name,
+        };
+        const res = await postList(params);
+        if (res.code === 0) {
+          const datas = res.returnData;
+          const nums = [];
+          datas.forEach((item, index) => {
+            item.name = item.JobName;
+            this.lessChecksData.forEach((p) => {
+              if (item.JobId == p.JobId) {
+                nums.push(index);
+              }
+            });
+          });
+          this.alljobArr = _.cloneDeep(datas);
+          datas.forEach((item, index) => {
+            if (item.JobId == this.JobId) {
+              datas.splice(index, 1)
+            }
+          })
+          this.lessData = _.cloneDeep(datas);
+          this.checkBoxList = nums;
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //角色点击回调
+    checkClick (item) {
+      this.roleAuths(item.RoleId);
+    },
+    //账号组点击回调
+    checkGroup (item) {
+      this.groupAuths(item.GroupId)
+    },
+    //根据角色查看权限列表
+    async roleAuths (id) {
+      try {
+        let params = {
+          RoleId: id,
+        };
+        const res = await RoleAuths(params);
+        if (res.code === 0) {
+          this.RoleList = res.returnData;
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    //角色选取
+    checkChange (arr) {
+      const datas = [];
+      for (let i = 0; i < arr.length; i++) {
+        if (this.openRole) {
+          datas.push(this.arrs[arr[i]]);
+        }
+        else {
+          datas.push(this.authArrs[arr[i]]);
+        }
+      }
+      this.checkRoles = datas;
+      this.onCheckedArr = datas;
+    },
+    //获取权限规则
+    getData (obj) {
+      this.rulesObj = obj;
+    },
+    //获取登录策略回调
+    getCheckedList (arr) {
+      this.loginCheckBoxs = arr;
+    },
+    //保存
+    saveBtn (formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.saveOrgan();
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    //组织新增保存
+    async saveOrgan () {
+      try {
+        if (this.JobId) {
+          if (!this.AppId) {
+            this.$message.error("请选中一个组织后再新增");
+            return false;
+          }
+          if (!this.radioCheck && this.lessChecksData.length > 1) {
+            this.$message.error("已选择副岗,请选中一个主岗后再新增");
+            return false;
+          }
+        } else {
+          this.AppId = this.oldOrganId
+        }
+        const datas = [];
+        const checks = [];
+        this.checkTrees.forEach((item) => {
+          datas.push(item.AuthList);
+        });
+        if (this.OpenGroup && !this.openRole) {
+          this.checkRoles = this.onCheckedArr;
+        }
+        this.checkRoles.forEach(item => {
+          if (item) {
+            checks.push(item);
+          }
+        });
+        const res = await newstaffmod({
+          OfficerName: this.form.name,
+          OfficerDesc: this.form.app,
+          OfficerLoginName: this.form.loginName,
+          OfficerPwd: this.form.loginPwd,
+          RoleList: this.openRole ? checks : [],
+          AuthList: this.openRole ? [] : datas,
+          TacList: this.loginCheckBoxs,
+          DepJobList: this.lessChecksData,
+          GroupList: this.OpenGroup ? checks : [],
+          JobId: this.JobId,
+          Status: Number(this.Status),
+          OrganId: this.AppId,
+          OfficerId: this.OfficerId,
+        });
+        if (res.code === 0) {
+          this.$message.success(res.message);
+          this.$store.dispatch("tagsView/delView", this.$route);
+          this.$router.push("/staff");
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        console.log("出错了", error);
+      }
+    },
+    reSetPassWord () {
+      const { PwdLengthBegin, PwdLengthEnd, PwdStruc } =
+        typeof this.systemSet === "string"
+          ? JSON.parse(this.systemSet)
+          : this.systemSet; //1是请求角色 0是请求用户
+      this.form.loginPwd = pwdProduce(PwdLengthBegin, PwdLengthEnd, PwdStruc);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.authorityPower {
+  padding: 0 64px;
+  padding-top: 32px;
+}
+.addApp-form {
+  background: #ffffff;
+  box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
+  border-radius: 16px;
+  padding: 32px 32px 40px 32px;
+  .title {
+    font-size: 24px;
+    font-family: Microsoft YaHei;
+    font-weight: bold;
+    color: #303133;
+    .isqy {
+      span {
+        font-weight: 400;
+        font-size: 14px;
+        margin: 0 28px 0 42px;
+      }
+    }
+  }
+  .addApp-form-content {
+    margin-top: 40px;
+    ::v-deep .form {
+      .el-form-item {
+        margin-bottom: 0;
+        margin-right: 40px;
+        &:last-child {
+          margin-right: 0;
+        }
+      }
+      .el-input__inner {
+        height: 32px;
+        line-height: 32px;
+        min-width: 184px;
+      }
+      .content {
+        .el-form-item__content {
+          flex: 1;
+        }
+        .el-form-item__label {
+          margin-left: 27px;
+        }
+      }
+    }
+  }
+}
+.power-content {
+  margin-top: 24px;
+  min-height: 68vh;
+  .part {
+    height: 750px;
+  }
+}
+</style>

+ 24 - 63
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-show="isShow" @click="save()">保存</el-button>
@@ -23,12 +17,8 @@
         <div class="boxList">
           <span class="ListName">是否允许职员关联多账号</span>
           <div class="riaStyle">
-            <el-radio v-model="FormData.UserOfficerMulti" :label="1" disabled
-              >是</el-radio
-            >
-            <el-radio v-model="FormData.UserOfficerMulti" :label="0" disabled
-              >否</el-radio
-            >
+            <el-radio v-model="FormData.UserOfficerMulti" :label="1">是</el-radio>
+            <el-radio v-model="FormData.UserOfficerMulti" :label="0">否</el-radio>
           </div>
           <div class="lineStyle"></div>
         </div>
@@ -52,10 +42,7 @@
           <span class="ListName">账号变更为闲置状态的不登录时间(天)</span>
           <div class="riaStyle">
             <el-form-item prop="UserIdledays">
-              <el-input
-                v-model="FormData.UserIdledays"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="FormData.UserIdledays" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -64,10 +51,7 @@
           <span class="ListName">登录后锁定系统的不操作时间(分钟)</span>
           <div class="riaStyle">
             <el-form-item prop="LockMins">
-              <el-input
-                v-model="FormData.LockMins"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="FormData.LockMins" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -77,11 +61,7 @@
           <div class="riaStyle1">
             <div>
               <el-form-item prop="PwdLengthBegin">
-                <el-input
-                  class="ipt1"
-                  v-model="FormData.PwdLengthBegin"
-                  placeholder="最少位数"
-                ></el-input>
+                <el-input class="ipt1" v-model="FormData.PwdLengthBegin" placeholder="最少位数"></el-input>
               </el-form-item>
               <div class="lineStyle1"></div>
             </div>
@@ -89,11 +69,7 @@
             <span class="zhi">至</span>
             <div>
               <el-form-item prop="PwdLengthEnd">
-                <el-input
-                  class="ipt2"
-                  v-model="FormData.PwdLengthEnd"
-                  placeholder="最多位数"
-                ></el-input>
+                <el-input class="ipt2" v-model="FormData.PwdLengthEnd" placeholder="最多位数"></el-input>
               </el-form-item>
               <div class="lineStyle2"></div>
             </div>
@@ -103,13 +79,7 @@
           <span class="ListName">密码组成结构</span>
           <div class="riaStyle">
             <el-checkbox-group v-model="checkedList" @change="PwdStrucChange">
-              <el-checkbox
-                v-for="(item, index) in PwdStrucList"
-                :label="item.id"
-                :key="index"
-                :checked="item.isChecked"
-                >{{ item.name }}</el-checkbox
-              >
+              <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>
@@ -126,10 +96,7 @@
           <span class="ListName">密码有效时长(天)</span>
           <div class="riaStyle">
             <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model="FormData.PwdValidtime"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="FormData.PwdValidtime" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -138,10 +105,7 @@
           <span class="ListName">允许试错次数(次数)</span>
           <div class="riaStyle">
             <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model="FormData.LoginError"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="FormData.LoginError" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle"></div>
@@ -150,10 +114,7 @@
           <span class="ListName">密码找回联系方式</span>
           <div class="riaStyle">
             <el-form-item prop="PwdValidtime">
-              <el-input
-                v-model="FormData.PwdMessage"
-                placeholder="请输入"
-              ></el-input>
+              <el-input v-model="FormData.PwdMessage" placeholder="请输入"></el-input>
             </el-form-item>
           </div>
           <div class="lineStyle" style="margin-bottom: 70px"></div>
@@ -170,7 +131,7 @@
 <script>
 import { GetSystemSet, SaveSystemSet } from "@/api/systemConfiguration";
 export default {
-  data() {
+  data () {
     return {
       isShow: false,
       FormData: {
@@ -251,7 +212,7 @@ export default {
   },
   watch: {
     FormData: {
-      handler(val) {
+      handler (val) {
         if (
           JSON.stringify(val) != this.oldFormData &&
           this.oldFormData != null
@@ -264,7 +225,7 @@ export default {
       deep: true,
     },
   },
-  created() {
+  created () {
     this.getSystemSet();
     // let SystemSetInfo = JSON.parse(this.$store.state.app.systemSet);
     // if (SystemSetInfo) {
@@ -277,10 +238,10 @@ export default {
     // }
   },
   methods: {
-    gotoLogin() {
+    gotoLogin () {
       this.$router.push("/LoginPolicy");
     },
-    getSystemSet() {
+    getSystemSet () {
       GetSystemSet({})
         .then((response) => {
           const { returnData } = response;
@@ -294,7 +255,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]);
@@ -302,7 +263,7 @@ export default {
       }
       console.log(this.FormData);
     },
-    getPwdStruc(data) {
+    getPwdStruc (data) {
       let dataList = data.split("");
       if (dataList[0] == 1) {
         this.checkedList.push("1000");
@@ -317,21 +278,21 @@ export default {
         this.checkedList.push("0001");
       }
     },
-    save() {
+    save () {
       console.log(this.FormData.PwdStruc)
-      if(this.FormData.PwdStruc == 11){
+      if (this.FormData.PwdStruc == 11) {
         this.FormData.PwdStruc = "0011"
       }
-      else if(this.FormData.PwdStruc == 101){
+      else if (this.FormData.PwdStruc == 101) {
         this.FormData.PwdStruc = "0101"
       }
-      else if(this.FormData.PwdStruc == 1){
+      else if (this.FormData.PwdStruc == 1) {
         this.FormData.PwdStruc = "0001"
       }
-      else if(this.FormData.PwdStruc == 100){
+      else if (this.FormData.PwdStruc == 100) {
         this.FormData.PwdStruc = "0100"
       }
-      else if(this.FormData.PwdStruc == 0){
+      else if (this.FormData.PwdStruc == 0) {
         this.FormData.PwdStruc = "0000"
       }
       this.$refs["systemForm"].validate((valid) => {