|
@@ -1,14 +1,14 @@
|
|
|
<!--
|
|
|
- * @Author: zk
|
|
|
- * @Date: 2021-11-29 11:26:07
|
|
|
- * @LastEditTime: 2022-01-13 17:19:51
|
|
|
+ * @Author: your name
|
|
|
+ * @Date: 2022-02-10 14:49:20
|
|
|
+ * @LastEditTime: 2022-02-14 14:36:13
|
|
|
* @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">
|
|
|
- <!--新增职员-->
|
|
|
+ <!--编辑职员-->
|
|
|
<div class="addApp-form">
|
|
|
<div class="addApp-form-title flex">
|
|
|
<div class="title">新增职员</div>
|
|
@@ -17,142 +17,83 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content dialog-public-background">
|
|
|
- <el-form
|
|
|
- :inline="true"
|
|
|
- ref="form"
|
|
|
- :rules="rules"
|
|
|
- class="form"
|
|
|
- :model="form"
|
|
|
- >
|
|
|
+ <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-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-input placeholder="请输入职员登录名" maxlength="32" v-model="form.loginName"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- style="margin-right: 16px"
|
|
|
- prop="loginPwd"
|
|
|
- label="登录密码"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- placeholder="请输入登录密码"
|
|
|
- disabled
|
|
|
- maxlength="32"
|
|
|
- v-model="form.loginPwd"
|
|
|
- ></el-input>
|
|
|
+ <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">重置密码</el-button>
|
|
|
+ <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-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"
|
|
|
- @checkChange="lessChecks"
|
|
|
- nodekey="OrganId"
|
|
|
- title="所属组织及所属岗位"
|
|
|
- />
|
|
|
+ <Organization ref="Organization" :defaultProps="defaultProps" :mainData="mainData" :vice="true" :data="data" @getTreeData="getOrgan" @radioChange="radioChange" :checkedKeys="orgCheckedKeys" :radioCheck="radioNum" nodekey="OrganId" title="选择组织" />
|
|
|
</div>
|
|
|
- <!--有角色-->
|
|
|
- <template v-if="openRole">
|
|
|
- <div class="r24 flex1 part">
|
|
|
- <Rolelist
|
|
|
- @checkChange="checkChange"
|
|
|
- @checkClick="checkClick"
|
|
|
- :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% - 376px - 24px)"
|
|
|
- @getCheckedList="getCheckedList"
|
|
|
- />
|
|
|
- </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>
|
|
|
+ <!--开启多对多-->
|
|
|
+ <template v-if="OpenAuthData">
|
|
|
<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)"
|
|
|
- @getCheckedList="getCheckedList"
|
|
|
- />
|
|
|
+ <Rolelist @checkChange="accountChange" :checkBoxList="checkBoxList" :roleType="roleType" :active="true" class="hucRole" :number="4" title="账号列表" />
|
|
|
</div>
|
|
|
</template>
|
|
|
- <!--无角色-->
|
|
|
+ <!--未开启多对多-->
|
|
|
<template v-else>
|
|
|
- <div class="r24 flex1 part">
|
|
|
- <Permissiontree
|
|
|
- :queryType="queryType"
|
|
|
- :queryId="treeId"
|
|
|
- :isMainJob="isMainJob"
|
|
|
- @nodeClick="nodeClick"
|
|
|
- @getTreeData="getTreeData"
|
|
|
- title="权限树"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="flex1 part">
|
|
|
- <Rulesofcompetency
|
|
|
- style="height: 512px"
|
|
|
- class="hucPower"
|
|
|
- @getData="getData"
|
|
|
- title="权限规则"
|
|
|
- />
|
|
|
- <Loginpolicy
|
|
|
- style="margin-top: 24px; height: calc(100% - 512px - 24px)"
|
|
|
- @getCheckedList="getCheckedList"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <!--有账号组 无角色-->
|
|
|
+ <template v-if="OpenGroup && !openRole">
|
|
|
+ <div class="r24 flex1 part">
|
|
|
+ <Usergroup @getTreeData="getUserGroup" :checkedKeys="userGroupKeys" 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="20" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!--有角色 无账号组-->
|
|
|
+ <template v-if="openRole && !OpenGroup">
|
|
|
+ <div class="r24 flex1 part">
|
|
|
+ <Rolelist @checkChange="checkChange" @checkClick="checkClick" :roleType="roleType" :checkBoxList="roleCheckBoxs" :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 @getTreeData="getUserGroup" :checkedKeys="userGroupKeys" title="用户组树" />
|
|
|
+ </div>
|
|
|
+ <div class="r24 flex1 part">
|
|
|
+ <Rolelist @checkChange="checkChange" :GroupIds="GroupIds" @checkClick="checkClick" :roleType="roleType" :checkBoxList="roleCheckBoxs" :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="20" :checkedList="checkedList" @getCheckedList="getCheckedList" title="登录策略" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -165,14 +106,13 @@ 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 {
|
|
|
newstaff,
|
|
|
- postList,
|
|
|
organgitpost,
|
|
|
- jbdetpop,
|
|
|
} from "@/api/postInterface";
|
|
|
import { pwdProduce } from "@/utils/validate";
|
|
|
export default {
|
|
@@ -185,10 +125,11 @@ export default {
|
|
|
Permissionlist,
|
|
|
Rolelist,
|
|
|
Loginpolicy,
|
|
|
+ Usergroup
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
- Status: null,
|
|
|
+ Status: 1,
|
|
|
AppId: null,
|
|
|
form: {
|
|
|
//应用表单
|
|
@@ -212,7 +153,7 @@ export default {
|
|
|
children: "children",
|
|
|
label: "OrganName",
|
|
|
},
|
|
|
- treeId: null, //根据组织获取权限树的组织ID
|
|
|
+ treeId: null, //根据组织获取权限树的组织ID
|
|
|
checkedKeys: [], //上级组织选中
|
|
|
RoleList: [],
|
|
|
checkedBoxs: [],
|
|
@@ -234,12 +175,15 @@ export default {
|
|
|
loginCheckBoxs: [], //登录策略数据
|
|
|
mainData: [], //主岗数据
|
|
|
JobId: "", //选中主岗ID
|
|
|
- DepJobIds:[],//选中副岗ID集合
|
|
|
+ DepJobIds: [],//选中副岗ID集合
|
|
|
lessData: [], //副岗数据
|
|
|
lessCheckBoxs: [], //副岗选中数据联合主岗
|
|
|
lessChecksData: [], //副岗选中数据
|
|
|
queryType: null, //权限树类型
|
|
|
openRole: null,
|
|
|
+ OpenGroup: null,
|
|
|
+ OpenAuthData: null,
|
|
|
+ roleType: '',
|
|
|
dataObj: {}, //上级权限指定树数据
|
|
|
data: [], //上级权限
|
|
|
roleList: [], //角色
|
|
@@ -248,8 +192,10 @@ export default {
|
|
|
rulesObj: {}, //权限规则数据
|
|
|
isMainJob: true, //是否主岗
|
|
|
oldOrganId: "",
|
|
|
- onCheckedArr:[],//当前显示选中权限组
|
|
|
- alljobArr:[],//全部岗位
|
|
|
+ onCheckedArr: [],//当前显示选中权限组
|
|
|
+ alljobArr: [],//全部岗位
|
|
|
+ GroupIds: [], //当前选中的用户组
|
|
|
+ userGroupKeys: [] //当前回调选中的用户组
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -258,142 +204,55 @@ export default {
|
|
|
watch: {
|
|
|
//监听上级组织数据
|
|
|
dataList: {
|
|
|
- handler(val) {
|
|
|
- const arr = [val];
|
|
|
- if (this.OrganId) {
|
|
|
- this.decompose(arr, this.OrganId);
|
|
|
- if (Array.isArray(this.dataObj)) {
|
|
|
- if (this.dataObj.children) {
|
|
|
- delete this.dataObj.children;
|
|
|
- }
|
|
|
- this.data = this.dataObj;
|
|
|
- } else {
|
|
|
- if (this.dataObj.children) {
|
|
|
- delete this.dataObj.children;
|
|
|
- }
|
|
|
- this.data = [this.dataObj];
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.data = arr;
|
|
|
- }
|
|
|
+ handler (val) {
|
|
|
+ this.data = [val];
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
- arrs: {
|
|
|
- handler (arr, old) {
|
|
|
- if(this.DepJobIds.length>0){
|
|
|
- this.authArrs.push(...arr);
|
|
|
- this.authArrs = _.unionBy(this.authArrs,"GroupId");
|
|
|
- }
|
|
|
- else{
|
|
|
- this.authArrs = arr
|
|
|
+ mainData: {
|
|
|
+ handler (arr) {
|
|
|
+ if (this.radioCheck) {
|
|
|
+ let ids = null;
|
|
|
+ arr.forEach((item, index) => {
|
|
|
+ if (item.JobId == this.radioCheck) {
|
|
|
+ ids = index;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.radioNum = ids;
|
|
|
}
|
|
|
- if (this.openRole) {
|
|
|
- this.defaultChecked(arr, 'RoleId')
|
|
|
- } else if (this.OpenGroup) {
|
|
|
- this.defaultChecked(this.authArrs, 'GroupId')
|
|
|
- }
|
|
|
},
|
|
|
- },
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
},
|
|
|
- created() {
|
|
|
- const { OrganId, Status } = this.$route.query;
|
|
|
- const { OpenRole, PwdLengthBegin, PwdLengthEnd, PwdStruc, OpenGroup } =
|
|
|
+ created () {
|
|
|
+ const { OrganId, Status, OfficerId } = this.$route.query;
|
|
|
+ const { OpenRole, PwdLengthBegin, PwdLengthEnd, PwdStruc, OpenGroup, UserOfficerMulti } =
|
|
|
typeof this.systemSet === "string"
|
|
|
? JSON.parse(this.systemSet)
|
|
|
: this.systemSet; //1是请求角色 0是请求用户
|
|
|
- this.form.loginPwd = pwdProduce(PwdLengthBegin, PwdLengthEnd, PwdStruc);
|
|
|
- // this.Status = Status
|
|
|
- this.OrganId = OrganId;
|
|
|
+ // 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";
|
|
|
- }
|
|
|
- }
|
|
|
- if(OrganId){
|
|
|
- this.getGroupByOrgan(OrganId);
|
|
|
+ this.OpenAuthData = UserOfficerMulti;
|
|
|
+ if (OpenGroup || !OpenGroup && !OpenRole) {
|
|
|
+ this.queryType = "all";
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- //循环获取所有可用权限组
|
|
|
- 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) {
|
|
|
+ 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) {
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ getOrgan (arr) {
|
|
|
+ const { OrganId } = arr[0];
|
|
|
+ this.AppId = OrganId;
|
|
|
+ this.getJobListByOrgan(OrganId);
|
|
|
},
|
|
|
//获取指定数据
|
|
|
- decompose(data, id) {
|
|
|
+ decompose (data, id) {
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
if (data[i].OrganId == id) {
|
|
|
this.dataObj = data[i];
|
|
@@ -403,137 +262,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//权限树点击
|
|
|
- nodeClick(obj) {
|
|
|
+ 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) {
|
|
|
+ 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.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);
|
|
|
- }
|
|
|
+ this.radioCheck = null;
|
|
|
},
|
|
|
//根据组织查询岗位列表-主岗
|
|
|
- async getJobListByOrgan(id) {
|
|
|
+ async getJobListByOrgan (id) {
|
|
|
try {
|
|
|
let params = {
|
|
|
OrganId: id,
|
|
@@ -541,11 +282,8 @@ export default {
|
|
|
const res = await organgitpost(params);
|
|
|
if (res.code === 0) {
|
|
|
const datas = res.returnData;
|
|
|
- datas.forEach((item, index) => {
|
|
|
+ datas.forEach((item) => {
|
|
|
item.name = item.JobName;
|
|
|
- if (item.JobId == this.radioCheck) {
|
|
|
- this.radioNum = index;
|
|
|
- }
|
|
|
});
|
|
|
this.mainData = datas;
|
|
|
} else {
|
|
@@ -555,52 +293,27 @@ 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) {
|
|
|
+ checkClick (item) {
|
|
|
this.roleAuths(item.RoleId);
|
|
|
},
|
|
|
+ //用户组选中回调
|
|
|
+ getUserGroup (arr) {
|
|
|
+ const datas = [];
|
|
|
+ arr.forEach(item => {
|
|
|
+ datas.push(item.GroupId);
|
|
|
+ })
|
|
|
+ this.GroupIds = datas;
|
|
|
+ },
|
|
|
//账号组点击回调
|
|
|
- checkGroup(item) {
|
|
|
- this.groupAuths(item.GroupId);
|
|
|
+ checkGroup (item) {
|
|
|
+ this.groupAuths(item.GroupId)
|
|
|
},
|
|
|
//根据角色查看权限列表
|
|
|
- async roleAuths(id) {
|
|
|
+ async roleAuths (id) {
|
|
|
try {
|
|
|
let params = {
|
|
|
- RoleId: id,
|
|
|
+ RoleIds: [id]
|
|
|
};
|
|
|
const res = await RoleAuths(params);
|
|
|
if (res.code === 0) {
|
|
@@ -612,30 +325,25 @@ export default {
|
|
|
console.log("出错了", error);
|
|
|
}
|
|
|
},
|
|
|
+ //账号列表选取
|
|
|
+ accountChange (arr) {
|
|
|
+ this.checkBoxList = arr;
|
|
|
+ },
|
|
|
//角色选取
|
|
|
- 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;
|
|
|
+ checkChange (arr) {
|
|
|
+ this.checkRoles = arr;
|
|
|
+ this.onCheckedArr = arr;
|
|
|
},
|
|
|
//获取权限规则
|
|
|
- getData(obj) {
|
|
|
+ getData (obj) {
|
|
|
this.rulesObj = obj;
|
|
|
},
|
|
|
//获取登录策略回调
|
|
|
- getCheckedList(arr) {
|
|
|
+ getCheckedList (arr) {
|
|
|
this.loginCheckBoxs = arr;
|
|
|
},
|
|
|
//保存
|
|
|
- saveBtn(formName) {
|
|
|
+ saveBtn (formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.saveOrgan();
|
|
@@ -646,37 +354,51 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//组织新增保存
|
|
|
- async saveOrgan() {
|
|
|
+ async saveOrgan () {
|
|
|
try {
|
|
|
- if (!this.AppId) {
|
|
|
- this.$message.error("请选中一个组织后再新增");
|
|
|
- return false;
|
|
|
+ if (this.JobId) {
|
|
|
+ if (!this.AppId) {
|
|
|
+ this.$message.error("请选中一个组织后再新增");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
const datas = [];
|
|
|
const checks = [];
|
|
|
- this.checkTrees.forEach((item) => {
|
|
|
- datas.push(item.AuthList);
|
|
|
- });
|
|
|
- if(this.OpenGroup&&!this.openRole){
|
|
|
- this.checkRoles = this.onCheckedArr;
|
|
|
+ const GroupIds = [];
|
|
|
+ if (this.checkTrees.length) {
|
|
|
+ this.checkTrees.forEach((item) => {
|
|
|
+ datas.push(item.AuthList);
|
|
|
+ });
|
|
|
}
|
|
|
- this.checkRoles.forEach((item) => {
|
|
|
- if (item) {
|
|
|
+ if (this.GroupIds.length) {
|
|
|
+ this.GroupIds.forEach(item => {
|
|
|
+ const obj = {
|
|
|
+ GroupId: item
|
|
|
+ }
|
|
|
+ GroupIds.push(obj);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.checkRoles.length) {
|
|
|
+ this.checkRoles.forEach(item => {
|
|
|
+ item.IsSelected = 1;
|
|
|
checks.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
const res = await newstaff({
|
|
|
OfficerName: this.form.name,
|
|
|
OfficerDesc: this.form.app,
|
|
|
OfficerLoginName: this.form.loginName,
|
|
|
OfficerPwd: this.form.loginPwd,
|
|
|
- RoleList: this.openRole ? checks : [],
|
|
|
- GroupList: this.OpenGroup ? checks : [],
|
|
|
+ RoleList: checks.length ? checks : [],
|
|
|
AuthList: this.openRole ? [] : datas,
|
|
|
TacList: this.loginCheckBoxs,
|
|
|
DepJobList: this.lessChecksData,
|
|
|
+ GroupList: GroupIds.length ? GroupIds : [],
|
|
|
JobId: this.JobId,
|
|
|
+ Status: Number(this.Status),
|
|
|
OrganId: this.AppId,
|
|
|
+ OfficerId: this.OfficerId,
|
|
|
+ UserList: this.OpenAuthData ? this.checkBoxList : []
|
|
|
});
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success(res.message);
|
|
@@ -689,8 +411,15 @@ export default {
|
|
|
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>
|
|
@@ -749,4 +478,4 @@ export default {
|
|
|
height: 750px;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|