|
@@ -1,394 +1,556 @@
|
|
|
-<!--
|
|
|
- * @Author: your name
|
|
|
- * @Date: 2021-11-29 11:26:07
|
|
|
- * @LastEditTime: 2022-01-17 13:48:42
|
|
|
- * @LastEditors: Please set LastEditors
|
|
|
- * @Description:编辑权限组
|
|
|
- * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityPower.vue
|
|
|
--->
|
|
|
- <template>
|
|
|
- <div class="pageBody">
|
|
|
- <div class="topPart">
|
|
|
- <div class="title">
|
|
|
- <div class="tltleLeft">编辑权限组</div>
|
|
|
+<template>
|
|
|
+ <div class="bf-postmanagementadd">
|
|
|
+ <div class="postmanagementadd_header">
|
|
|
+ <div class="postmanagementadd_top">
|
|
|
+ <div class="tltleLeft">编辑账号组</div>
|
|
|
<!-- <div class="isUsed">
|
|
|
是否启用
|
|
|
- <el-radio
|
|
|
- v-model="FormData.isUsed"
|
|
|
- v-if="FormData.isUsed == 1 || form.isUsed == 3"
|
|
|
- :label="1"
|
|
|
- >是</el-radio
|
|
|
- >
|
|
|
- <el-radio v-model="FormData.isUsed" v-if="FormData.isUsed == 2" :label="2"
|
|
|
- >是</el-radio
|
|
|
- >
|
|
|
- <el-radio v-model="FormData.isUsed" :label="3">否</el-radio>
|
|
|
+ <el-radio v-model="addFrom.isUsed" :label="1">是</el-radio>
|
|
|
+ <el-radio v-model="addFrom.isUsed" :label="0">否</el-radio>
|
|
|
</div> -->
|
|
|
- <div>
|
|
|
- <!-- <button type="submmit" class="delBtn" @click="delate">删除</button> -->
|
|
|
- <button type="submmit" class="saveBtn" @click="saveGroup()">
|
|
|
- 保存
|
|
|
- </button>
|
|
|
+
|
|
|
+ <div class="btn" style="margin-top: 20px">
|
|
|
+ <!-- <el-button @click="deleteAuth" class="r24" type="danger"
|
|
|
+ >删除</el-button
|
|
|
+ > -->
|
|
|
+ <el-button @click="editAuth" type="primary">保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="titleContent">
|
|
|
- <el-form ref="form" :model="FormData" label-width="90px">
|
|
|
- <el-row :gutter="40">
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item label="权限组名称" prop="name">
|
|
|
- <el-input v-model="FormData.GroupName" maxlength="32" placeholder="请输入权限组名称" size="small"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="10">
|
|
|
- <el-form-item label="描述" prop="diesc">
|
|
|
- <el-input v-model="FormData.GroupDesc" maxlength="128" placeholder="描述内容" size="small"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div class="addApp-form-content dialog-public-background">
|
|
|
+ <el-form
|
|
|
+ :inline="true"
|
|
|
+ ref="addFrom"
|
|
|
+ :rules="rules"
|
|
|
+ class="form"
|
|
|
+ :model="addFrom"
|
|
|
+ >
|
|
|
+ <el-form-item prop="name" label="账号组名称">
|
|
|
+ <el-input
|
|
|
+ maxlength="16"
|
|
|
+ placeholder="账号组名称"
|
|
|
+ v-model="addFrom.name"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="描述" style="margin-left: 40px">
|
|
|
+ <el-input
|
|
|
+ style="width: 640px"
|
|
|
+ placeholder="请输入描述"
|
|
|
+ maxlength="200"
|
|
|
+ v-model="addFrom.textarea2"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
- <el-row :gutter="25">
|
|
|
- <el-col :span="24" v-if="systemSet.UserOfficerMulti != 0">
|
|
|
+ <!-- 开启角色 -->
|
|
|
+ <el-row :gutter="24" v-if="this.openRole != 0">
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <Organization title="上级权限组" :data="dataList" :defaultProps="defaultProps" :nodekey="'GroupId'" @getCheckedData="getOrganTreeData" :checkedKeys="checkedIdList" />
|
|
|
+ <Organization
|
|
|
+ title="所属账号组"
|
|
|
+ :data="dataObj"
|
|
|
+ :defaultProps="defaultProps"
|
|
|
+ :nodekey="'GroupId'"
|
|
|
+ :checkedIdList="checkedIdList"
|
|
|
+ @getCheckedData="getTreeData"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="systemSet.UserOfficerMulti === 0">
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <Organization title="上级权限组" :data="GroupData" :defaultProps="defaultProps" :nodekey="'GroupId'" :checkedKeys="checkedIdList" />
|
|
|
+ <rolelists
|
|
|
+ title="角色列表"
|
|
|
+ @checkChange="checkChange"
|
|
|
+ @radioChanges="radioChanges"
|
|
|
+ :checkBoxList="checkRole"
|
|
|
+ :dataList="roleList"
|
|
|
+ :number="8"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="systemSet.OpenRole === 0 && systemSet.UserOfficerMulti === 0">
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <Permissiontree @getTreeData="getAuthTreeData" :checkedKeys="checkedAuthKeys" :queryType="queryType" :queryId="GroupUpid" title="权限树" />
|
|
|
+ <permissionlist
|
|
|
+ title="权限列表"
|
|
|
+ :RoleList="powerList"
|
|
|
+ :check="true"
|
|
|
+ class="hucPower"
|
|
|
+ @Competen="Competen"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="systemSet.OpenRole === 0 && systemSet.UserOfficerMulti === 0">
|
|
|
+ </el-row>
|
|
|
+ <!-- 无角色 -->
|
|
|
+ <el-row :gutter="24" v-else>
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <Rulesofcompetency title="权限规则" />
|
|
|
+ <Organization
|
|
|
+ title="所属账号组"
|
|
|
+ :data="dataObj"
|
|
|
+ :defaultProps="defaultProps"
|
|
|
+ :nodekey="'GroupId'"
|
|
|
+ :checkedIdList="checkedIdList"
|
|
|
+ @getCheckedData="getTreeData"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="systemSet.OpenRole != 0 && systemSet.UserOfficerMulti === 0">
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <rolelist title="角色列表" @checkChange="checkRoleChange" :dataList="groupRoleList" :checkBoxList="checkedRoleKeys" @checkClick="roleClick" :number="8" />
|
|
|
+ <Permissiontree
|
|
|
+ @nodeClick="nodeClick"
|
|
|
+ :checkedKeys="powerT"
|
|
|
+ @getTreeData="getTreeDatas"
|
|
|
+ :queryType="queryType"
|
|
|
+ :queryId="queryId"
|
|
|
+ title="权限树"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="systemSet.OpenRole != 0 && systemSet.UserOfficerMulti === 0">
|
|
|
+ <el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <permissionlist title="权限列表" :RoleList="powerList" :check="true" class="hucPower" @Competen="Competen" />
|
|
|
+ <Rulesofcompetency title="权限规则" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
+ <Dialog :flag="dialogVisible">
|
|
|
+ <div class="closeDialog">
|
|
|
+ <div class="title">删除账号</div>
|
|
|
+ <div class="content">是否确定要删除该账号?</div>
|
|
|
+ <div class="foot right t30">
|
|
|
+ <el-button size="medium" class="r24">取消</el-button>
|
|
|
+ <el-button size="medium" type="danger">删除</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import Organization from "@/components/organization/index.vue";
|
|
|
import Permissiontree from "@/components/permissiontree/index.vue";
|
|
|
import Rulesofcompetency from "@/components/rulesofcompetency/index.vue";
|
|
|
-import Organization from "@/components/organization/index.vue";
|
|
|
-import rolelist from "@/components/rolelist/index.vue";
|
|
|
+import rolelists from "@/components/rolelist/index.vue";
|
|
|
import permissionlist from "@/components/permissionlist/index.vue";
|
|
|
-
|
|
|
+import Dialog from "@/layout/components/Dialog/index.vue";
|
|
|
+import { QueryRole, RoleAuths } from "@/api/apiAuthority";
|
|
|
+import {
|
|
|
+ GetAccTreeDetails,
|
|
|
+ EditGroupAcc,
|
|
|
+ GetRoleByGroup,
|
|
|
+} from "@/api/AccountGroup.js";
|
|
|
import treeData from "../minixs/treeData";
|
|
|
-import roleData from "../minixs/roleData";
|
|
|
-
|
|
|
-import { GetGroupDetails, EditGroup } from "@/api/AccountGroup";
|
|
|
-import { RoleAuths } from "@/api/apiAuthority";
|
|
|
|
|
|
export default {
|
|
|
- data () {
|
|
|
+ mixins: [treeData],
|
|
|
+ components: {
|
|
|
+ Organization,
|
|
|
+ Permissiontree,
|
|
|
+ Rulesofcompetency,
|
|
|
+ rolelists,
|
|
|
+ permissionlist,
|
|
|
+ Dialog,
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ postList: {
|
|
|
+ type: String,
|
|
|
+ },
|
|
|
+ roleData: {
|
|
|
+ type: Array,
|
|
|
+ default: () => [],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
return {
|
|
|
- queryType: "group",
|
|
|
- GroupId: 0, //当前权限组ID
|
|
|
- systemSet: null, //系统设置
|
|
|
- FormData: {
|
|
|
- GroupName: "",
|
|
|
- AuthList: [],
|
|
|
- GroupDesc: "",
|
|
|
- GroupId: 0,
|
|
|
- GroupUpid: 0,
|
|
|
- RoleList: [],
|
|
|
+ checkedAuthList: [],
|
|
|
+ GroupId: this.$route.query.GroupId,
|
|
|
+ GroupUpid: this.$route.query.GroupUpid,
|
|
|
+ butPreser: "保存",
|
|
|
+ dialogVisible: false,
|
|
|
+ OpenRole: 0,
|
|
|
+ OpenGroup: 0,
|
|
|
+ checkRole: [],
|
|
|
+ powerT: [],
|
|
|
+ data: [], //上级账号组
|
|
|
+ checkedIdList: [],
|
|
|
+ checkTrees: [], //上级权限选中的树数据
|
|
|
+ powerTree: [], //选中的权限树数据
|
|
|
+ rulesObj: {}, //权限规则数据
|
|
|
+ roleList: [], //角色
|
|
|
+ checkRoles: [], //选中的角色
|
|
|
+ powerList: [],
|
|
|
+ addFrom: {
|
|
|
+ name: "",
|
|
|
+ textarea2: "",
|
|
|
+ // isUsed: "",
|
|
|
},
|
|
|
rules: {
|
|
|
- GroupName: [
|
|
|
- { required: true, message: "请输入上级权限组名称", trigger: "blur" },
|
|
|
- {
|
|
|
- min: 1,
|
|
|
- max: 16,
|
|
|
- message: "长度在 1 到 16 个字符",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ //表单验证
|
|
|
+ name: [
|
|
|
+ { required: true, message: "请输入账号组名称", trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
defaultProps: {
|
|
|
children: "children",
|
|
|
label: "GroupName",
|
|
|
},
|
|
|
- listData: [], //上级权限组树
|
|
|
- GroupUpid: "-1", //所属权限组ID
|
|
|
- GroupData: [], //所属权限组详情
|
|
|
- checkedIdList: [], //选中权限组树
|
|
|
- AuthList: [], //选中权限(包含规则组)
|
|
|
- RoleList: [], //选中角色组
|
|
|
- checkedAuthKeys: [],
|
|
|
- checkedRoleKeys: [],
|
|
|
- groupRoleList: [], //所属权限组角色列表
|
|
|
- powerList: [], //角色权限列表
|
|
|
+ treeData1: [],
|
|
|
+ AppId: 0,
|
|
|
+ UpId: 0,
|
|
|
+ dataObj: null,
|
|
|
+ queryId: "",
|
|
|
+ queryType: "group",
|
|
|
+ objID: "",
|
|
|
};
|
|
|
},
|
|
|
- mixins: [treeData, roleData],
|
|
|
- watch: {
|
|
|
- arrs: {
|
|
|
- handler (arr) {
|
|
|
- arr.forEach((item) => {
|
|
|
- item.name = item.RoleName;
|
|
|
- if (this.GroupUpid == -1) {
|
|
|
- if (
|
|
|
- item.IsSelected == 0 &&
|
|
|
- _.indexOf(this.groupRoleList, item) == -1
|
|
|
- ) {
|
|
|
- this.groupRoleList.push(item);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (
|
|
|
- item.IsSelected == 1 &&
|
|
|
- _.indexOf(this.groupRoleList, item) == -1
|
|
|
- ) {
|
|
|
- this.groupRoleList.push(item);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- this.checkedRoleKeys = [];
|
|
|
- this.RoleList.forEach((item) => {
|
|
|
- this.groupRoleList.forEach((value, index) => {
|
|
|
- if (item.RoleId == value.RoleId) {
|
|
|
- this.checkedRoleKeys.push(index);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- deep: true,
|
|
|
- },
|
|
|
- },
|
|
|
- created: function () {
|
|
|
- const systemData = this.$store.state.app.systemSet;
|
|
|
- if (typeof systemData == "string") {
|
|
|
- this.systemSet = JSON.parse(systemData);
|
|
|
+
|
|
|
+ created() {
|
|
|
+ let obj;
|
|
|
+ if (typeof this.$store.state.app.systemSet == "string") {
|
|
|
+ obj = JSON.parse(this.$store.state.app.systemSet);
|
|
|
} else {
|
|
|
- this.systemSet = systemData;
|
|
|
+ obj = this.$store.state.app.systemSet;
|
|
|
}
|
|
|
- this.GroupId = this.$route.query.GroupId;
|
|
|
- this.GroupUpid = this.$route.query.GroupUpid + "";
|
|
|
- if (this.GroupUpid == -1) {
|
|
|
- this.queryType = "all";
|
|
|
+ const { OpenRole, OpenGroup } = obj;
|
|
|
+ this.openRole = OpenRole;
|
|
|
+ this.OpenGroup = OpenGroup;
|
|
|
+ this.getDeaitls();
|
|
|
+ const { GroupUpid } = this.$route.query;
|
|
|
+ this.UpId = GroupUpid;
|
|
|
+ this.queryId = GroupUpid;
|
|
|
+ this.objID = GroupUpid;
|
|
|
+ if (OpenRole) {
|
|
|
+ this.title = "角色";
|
|
|
+ // this.RoleBox();
|
|
|
}
|
|
|
- this.checkedIdList.push(this.GroupUpid);
|
|
|
- this.getGroupDetails();
|
|
|
- this.getGroupUpDetails();
|
|
|
+ // if (this.UpId == -1) {
|
|
|
+ // this.queryId = "";
|
|
|
+ // this.queryType = "all";
|
|
|
+ // this.RoleBox();
|
|
|
+ // } else {
|
|
|
+ // this.queryRole();
|
|
|
+ // }
|
|
|
},
|
|
|
- components: {
|
|
|
- Organization,
|
|
|
- Permissiontree,
|
|
|
- Rulesofcompetency,
|
|
|
- rolelist,
|
|
|
- permissionlist,
|
|
|
+ watch: {
|
|
|
+ dataList: {
|
|
|
+ handler(val) {
|
|
|
+ const arr = [val];
|
|
|
+ this.decompose(arr, this.GroupUpid);
|
|
|
+ if (Array.isArray(val)) {
|
|
|
+ this.data = val;
|
|
|
+ } else {
|
|
|
+ this.data = [val];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
+
|
|
|
methods: {
|
|
|
- //获取权限组详情
|
|
|
- getGroupDetails () {
|
|
|
- try {
|
|
|
- let data = {
|
|
|
- GroupId: this.GroupId,
|
|
|
- };
|
|
|
- GetGroupDetails(data).then((result) => {
|
|
|
- if (result.code === 0) {
|
|
|
- this.FormData = _.cloneDeep(result.returnData);
|
|
|
- this.AuthList = _.cloneDeep(result.returnData.AuthList);
|
|
|
- this.$store.state.auth.authList = _.cloneDeep(
|
|
|
- result.returnData.AuthList
|
|
|
- );
|
|
|
- let list = _.cloneDeep(result.returnData.RoleList);
|
|
|
- if (list) {
|
|
|
- list.forEach((item, index) => {
|
|
|
- if (item.IsSelected == 1) {
|
|
|
- this.RoleList.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- if (this.AuthList) {
|
|
|
- this.AuthList.forEach((item) => {
|
|
|
- this.checkedAuthKeys.push(item.AuthId);
|
|
|
- });
|
|
|
- }
|
|
|
- this.getRoleByGroup(this.GroupUpid);
|
|
|
- }
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- console.log("GetGroupDetails");
|
|
|
- console.log(error);
|
|
|
+ //权限树点击
|
|
|
+ nodeClick(obj) {
|
|
|
+ const arr = this.$store.getters.authArrs;
|
|
|
+ arr.push(obj);
|
|
|
+ this.$store.dispatch("auth/changeAuthArrs", arr);
|
|
|
+ },
|
|
|
+ //获取权限树回调
|
|
|
+ getTreeDatas(arr) {
|
|
|
+ this.checkedAuthList = arr;
|
|
|
+ },
|
|
|
+ //获取选中的树数据
|
|
|
+ getTreeData(arr) {
|
|
|
+ this.checkTrees = arr;
|
|
|
+ this.checkTrees.forEach((item) => {
|
|
|
+ if (item[0]) {
|
|
|
+ item.disabled = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let objArr = arr[arr.length - 1];
|
|
|
+ if (objArr.GroupId != -1) {
|
|
|
+ this.objID = objArr.GroupId + "";
|
|
|
+ this.queryRole();
|
|
|
+ } else {
|
|
|
+ this.RoleBox();
|
|
|
}
|
|
|
},
|
|
|
- //获取所属权限组详情
|
|
|
- getGroupUpDetails () {
|
|
|
+
|
|
|
+ //获取权限规则
|
|
|
+ getData(obj) {
|
|
|
+ this.rulesObj = obj;
|
|
|
+ },
|
|
|
+ //获取指定数据
|
|
|
+ decompose(data, id) {
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ if (data[i].GroupId == id) {
|
|
|
+ this.dataObj = data[i];
|
|
|
+ delete this.dataObj.children;
|
|
|
+ this.dataObj = [this.dataObj];
|
|
|
+ } else if (data[i].children && data[i].children.length > 0) {
|
|
|
+ this.decompose(data[i].children, id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //账号组详情
|
|
|
+ async getDeaitls() {
|
|
|
try {
|
|
|
- if (this.GroupUpid == -1) {
|
|
|
- this.GroupData = [];
|
|
|
- this.GroupData.push(this.dataList);
|
|
|
- } else {
|
|
|
- let data = {
|
|
|
- GroupId: this.GroupUpid,
|
|
|
- };
|
|
|
- GetGroupDetails(data).then((result) => {
|
|
|
- if (result.code == 0) {
|
|
|
- this.GroupData = [];
|
|
|
- this.GroupData.push(result.returnData);
|
|
|
+ const res = await GetAccTreeDetails({
|
|
|
+ GroupId: this.GroupId,
|
|
|
+ });
|
|
|
+ if (res.code === 0) {
|
|
|
+ const { GroupDesc, GroupName, Status, RoleList } = res.returnData;
|
|
|
+ this.addFrom.name = GroupName;
|
|
|
+ this.addFrom.textarea2 = GroupDesc;
|
|
|
+ this.roleList = RoleList;
|
|
|
+ // this.addFrom.isUsed = Status;
|
|
|
+ this.$store.state.auth.authList = res.returnData.AuthList;
|
|
|
+ res.returnData.AuthList.forEach((item) => {
|
|
|
+ this.powerT.push(item.AuthId);
|
|
|
+ });
|
|
|
+ res.returnData.RoleList.forEach((item, index) => {
|
|
|
+ if (item.IsSelected == 1) {
|
|
|
+ this.checkRole.push(item);
|
|
|
}
|
|
|
});
|
|
|
+ this.checkRoles = this.checkRole;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("GetGroupDetails");
|
|
|
- console.log(error);
|
|
|
+ console.log("出错了", error);
|
|
|
}
|
|
|
},
|
|
|
- //获取当权选中权限树
|
|
|
- getAuthTreeData (data) {
|
|
|
- this.checkedAuthTreeList = _.cloneDeep(data);
|
|
|
- },
|
|
|
- //获取权限组树点击
|
|
|
- getOrganTreeData (data) {
|
|
|
- console.log(data);
|
|
|
- },
|
|
|
- //角色选中后
|
|
|
- checkRoleChange (data) {
|
|
|
- this.RoleList = [];
|
|
|
- data.forEach((item) => {
|
|
|
- this.groupRoleList[item].IsSelected = 1;
|
|
|
- this.RoleList.push(this.groupRoleList[item]);
|
|
|
- });
|
|
|
- },
|
|
|
- //点击角色后
|
|
|
- roleClick (data) {
|
|
|
+ async radioChanges(data) {
|
|
|
try {
|
|
|
let params = {
|
|
|
- RoleId: data.RoleId,
|
|
|
+ RoleId: data,
|
|
|
};
|
|
|
- RoleAuths(params).then((result) => {
|
|
|
- this.powerList = result.returnData;
|
|
|
- });
|
|
|
+ const res = await RoleAuths(params);
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.powerList = res.returnData;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
- console.log("RoleAuths");
|
|
|
- console.log(error);
|
|
|
+ console.log("出错了", error);
|
|
|
}
|
|
|
},
|
|
|
- //保存
|
|
|
- saveGroup () {
|
|
|
+ //角色列表
|
|
|
+ async queryRole() {
|
|
|
try {
|
|
|
- let arr = _.cloneDeep(this.checkedAuthTreeList);
|
|
|
- let authArrs = _.cloneDeep(this.$store.state.auth.authArrs);
|
|
|
- if (arr) {
|
|
|
- this.AuthList = [];
|
|
|
+ const res = await GetRoleByGroup({
|
|
|
+ GroupId: this.objID,
|
|
|
+ });
|
|
|
+ if (res.code === 0) {
|
|
|
+ const arr = res.returnData.records;
|
|
|
+ const userArr = [];
|
|
|
arr.forEach((item) => {
|
|
|
- this.AuthList.push(item.AuthList);
|
|
|
- });
|
|
|
- this.AuthList.forEach((item, index) => {
|
|
|
- authArrs.forEach((item2) => {
|
|
|
- if (item.AuthId == item2.AuthId) {
|
|
|
- this.AuthList[index] = item2.AuthList;
|
|
|
- }
|
|
|
- });
|
|
|
+ item.name = item.RoleName;
|
|
|
+ if (item.IsSelected == 1) {
|
|
|
+ userArr.push(item);
|
|
|
+ }
|
|
|
});
|
|
|
+ // this.roleList = userArr;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
}
|
|
|
- this.FormData.AuthList = this.AuthList;
|
|
|
- this.FormData.RoleList = this.RoleList;
|
|
|
- let data = _.cloneDeep(this.FormData);
|
|
|
- EditGroup(data).then((result) => {
|
|
|
- if (result.code == 0) {
|
|
|
- this.$message.success(result.message);
|
|
|
- this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
- this.$router.push("/accountGroup");
|
|
|
- }
|
|
|
+ } catch {
|
|
|
+ console.log("出错了", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //所有角色列表
|
|
|
+ async RoleBox() {
|
|
|
+ try {
|
|
|
+ const res = await QueryRole({
|
|
|
+ QueryName: "",
|
|
|
});
|
|
|
+ if (res.code === 0) {
|
|
|
+ const arr = res.returnData.records;
|
|
|
+ arr.forEach((item) => {
|
|
|
+ item.name = item.RoleName;
|
|
|
+ });
|
|
|
+ // this.roleList = arr;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ console.log("出错了", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //删除账号组
|
|
|
+ // async deleteAuth() {
|
|
|
+ // this.dialogVisible = true;
|
|
|
+ // },
|
|
|
+ // async delAcc() {
|
|
|
+ // try {
|
|
|
+ // const res = await DelAccGroup({
|
|
|
+ // GroupId: this.GroupId,
|
|
|
+ // });
|
|
|
+ // if (res.code === 0) {
|
|
|
+ // this.$message.success(res.message);
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.$router.push("/AccountGroup");
|
|
|
+ // }, 2000);
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(res.message);
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log("出错了", error);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ //获取权限列表
|
|
|
+ async radioChange(data) {
|
|
|
+ try {
|
|
|
+ let params = {
|
|
|
+ RoleId: data,
|
|
|
+ };
|
|
|
+ const res = await RoleAuths(params);
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.RoleList = res.returnData;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
- console.log("EditGroup");
|
|
|
- console.log(error);
|
|
|
+ console.log("出错了", error);
|
|
|
}
|
|
|
},
|
|
|
- //查看权限列表明细
|
|
|
- Competen (data) {
|
|
|
+ Competen(data) {
|
|
|
this.$emit("Competen", data);
|
|
|
},
|
|
|
- //获取指定数据
|
|
|
- decompose (data, id) {
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- if (data[i].GroupId == id) {
|
|
|
- this.dataObj = data[i];
|
|
|
- delete this.dataObj.children;
|
|
|
- this.dataObj = [this.dataObj];
|
|
|
- } else if (data[i].children && data[i].children.length > 0) {
|
|
|
- this.decompose(data[i].children, id);
|
|
|
+ //账号组修改保存
|
|
|
+ async editAuth() {
|
|
|
+ this.checkedAuthList.forEach((item) => {
|
|
|
+ this.treeData1.push(item.AuthList);
|
|
|
+ });
|
|
|
+ this.treeData1.forEach((item, index) => {
|
|
|
+ this.$store.getters.authArrs.forEach((item2) => {
|
|
|
+ if (item.AuthId == item2.AuthId) {
|
|
|
+ this.treeData1[index] = item2.AuthList;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ const res = await EditGroupAcc({
|
|
|
+ GroupName: this.addFrom.name,
|
|
|
+ GroupDesc: this.addFrom.textarea2,
|
|
|
+ GroupId: this.GroupId,
|
|
|
+ GroupUpid: this.GroupUpid,
|
|
|
+ RoleList: this.checkRoles,
|
|
|
+ AuthList: this.treeData1,
|
|
|
+ // Status: this.addFrom.isUsed,
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success(res.message);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$router.push("/AccountGroup");
|
|
|
+ }, 2000);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
}
|
|
|
+ } catch (error) {
|
|
|
+ console.log("出错了", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //角色选取
|
|
|
+ checkChange(arr) {
|
|
|
+ const datas = [];
|
|
|
+ const arrs = [];
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ datas.push(this.roleList[arr[i]]);
|
|
|
}
|
|
|
+ datas.forEach((item) => {
|
|
|
+ const RoleC = {
|
|
|
+ IsSelected: 1,
|
|
|
+ RoleId: item.RoleId,
|
|
|
+ RoleName: item.RoleName,
|
|
|
+ };
|
|
|
+ arrs.push(RoleC);
|
|
|
+ });
|
|
|
+ this.checkRoles = arrs;
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
-<style lang="scss" scoped>
|
|
|
-.pageBody {
|
|
|
+<style lang="scss">
|
|
|
+.bf-postmanagementadd {
|
|
|
width: 100%;
|
|
|
- height: calc(100vh - 178px);
|
|
|
- padding: 32px 64px 0 64px;
|
|
|
- .topPart {
|
|
|
- box-sizing: border-box;
|
|
|
+ padding: 30px 64px;
|
|
|
+ > .postmanagementadd_header {
|
|
|
width: 100%;
|
|
|
height: 184px;
|
|
|
- padding: 32px;
|
|
|
background: #ffffff;
|
|
|
box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
|
|
|
border-radius: 16px;
|
|
|
- .title {
|
|
|
+ padding: 0 32px 0 32px;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ > .postmanagementadd_top {
|
|
|
+ width: 100%;
|
|
|
+ height: 88px;
|
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- flex-direction: row;
|
|
|
position: relative;
|
|
|
- .isUsed {
|
|
|
- position: absolute;
|
|
|
- left: 194px;
|
|
|
- top: 6px;
|
|
|
- }
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 16px;
|
|
|
+
|
|
|
.tltleLeft {
|
|
|
font-size: 24px;
|
|
|
font-weight: bold;
|
|
|
color: #303133;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
- .saveBtn {
|
|
|
- width: 80px;
|
|
|
- height: 40px;
|
|
|
- background: linear-gradient(0deg, #777dba, #6983be);
|
|
|
- border-radius: 6px;
|
|
|
- color: #fff;
|
|
|
- border: none;
|
|
|
+ .isUsed {
|
|
|
+ margin-top: 20px;
|
|
|
+ position: absolute;
|
|
|
+ left: 194px;
|
|
|
+ top: 6px;
|
|
|
}
|
|
|
- .delBtn {
|
|
|
- width: 80px;
|
|
|
+ > .but {
|
|
|
height: 40px;
|
|
|
- background: #f56c6c;
|
|
|
- border-radius: 6px;
|
|
|
- color: #fff;
|
|
|
- border: none;
|
|
|
- margin-right: 24px;
|
|
|
}
|
|
|
}
|
|
|
- .titleContent {
|
|
|
+ > .postmanagementadd_list {
|
|
|
width: 100%;
|
|
|
- padding-top: 35px;
|
|
|
- box-sizing: border-box;
|
|
|
- .resetPass {
|
|
|
- background: #6e81bc;
|
|
|
- color: #fff;
|
|
|
- margin-top: 4px;
|
|
|
- margin-left: -25px;
|
|
|
+ display: flex;
|
|
|
+ > .list_up {
|
|
|
+ display: flex;
|
|
|
+ margin-right: 40px;
|
|
|
+ > p {
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: Microsoft YaHei;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #303133;
|
|
|
+ margin-top: 0;
|
|
|
+ margin-bottom: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 16px;
|
|
|
+ }
|
|
|
+ > .el-input {
|
|
|
+ width: 184px;
|
|
|
+ height: 32px;
|
|
|
+ background: #f9fbff;
|
|
|
+ border-radius: 6px;
|
|
|
+ > .el-input__inner {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background: #f9fbff;
|
|
|
+ border-radius: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ > .el-textarea {
|
|
|
+ width: 640px;
|
|
|
+ height: 33px;
|
|
|
+ border-radius: 4px;
|
|
|
+ .el-textarea__inner {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background: #f9fbff;
|
|
|
+ border: 1px solid #d7dae3;
|
|
|
+ border-radius: 4px;
|
|
|
+ resize: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -397,12 +559,39 @@ export default {
|
|
|
height: calc(100% - 184px);
|
|
|
padding-top: 24px;
|
|
|
box-sizing: border-box;
|
|
|
+ // .el-row {
|
|
|
+ // height: 100%;
|
|
|
+ // .el-col {
|
|
|
+ // height: 100%;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
.part {
|
|
|
width: 100%;
|
|
|
- height: 720px;
|
|
|
+ height: 856px;
|
|
|
+ background: #ffffff;
|
|
|
+ box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
|
|
|
+ border-radius: 16px;
|
|
|
+ }
|
|
|
+ .last {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+ .part2 {
|
|
|
+ width: 100%;
|
|
|
+ height: 512px;
|
|
|
+ background: #ffffff;
|
|
|
+ box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
|
|
|
+ border-radius: 16px;
|
|
|
+ }
|
|
|
+ .part3 {
|
|
|
+ width: 100%;
|
|
|
+ height: 320px;
|
|
|
background: #ffffff;
|
|
|
box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
|
|
|
border-radius: 16px;
|
|
|
+ margin-top: 25px;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
}
|
|
|
}
|