|
@@ -3,374 +3,306 @@
|
|
|
<div class="postmanagementadd_header">
|
|
|
<div class="postmanagementadd_top">
|
|
|
<div class="tltleLeft">编辑账号组</div>
|
|
|
- <div class="btn" style="margin-top: 20px">
|
|
|
- <el-button @click="editAuth" type="primary">保存</el-button>
|
|
|
+ <div
|
|
|
+ class="btn"
|
|
|
+ style="margin-top: 20px"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="handleClickSave('editForm')"
|
|
|
+ >保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content dialog-public-background">
|
|
|
<el-form
|
|
|
+ ref="editForm"
|
|
|
:inline="true"
|
|
|
- ref="addFrom"
|
|
|
:rules="rules"
|
|
|
class="form"
|
|
|
- :model="addFrom"
|
|
|
+ :model="editForm"
|
|
|
>
|
|
|
- <el-form-item prop="name" label="账号组名称">
|
|
|
+ <el-form-item
|
|
|
+ prop="name"
|
|
|
+ label="账号组名称"
|
|
|
+ >
|
|
|
<el-input
|
|
|
- maxlength="16"
|
|
|
+ v-model="editForm.name"
|
|
|
+ maxlength="32"
|
|
|
placeholder="账号组名称"
|
|
|
- v-model="addFrom.name"
|
|
|
- ></el-input>
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="描述" style="margin-left: 40px">
|
|
|
+ <el-form-item
|
|
|
+ label="描述"
|
|
|
+ style="margin-left: 40px"
|
|
|
+ >
|
|
|
<el-input
|
|
|
+ v-model="editForm.desc"
|
|
|
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="24" v-if="this.openRole != 0">
|
|
|
+ <el-row :gutter="24">
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <Organization
|
|
|
- title="所属账号组"
|
|
|
- :data="data"
|
|
|
- :defaultProps="defaultProps"
|
|
|
- :checkedKeys="[GroupUpid]"
|
|
|
- :nodekey="'GroupId'"
|
|
|
- :checkedIdList="checkedIdList"
|
|
|
- @getTreeData="getTreeData"
|
|
|
+ <AccountGroupTree
|
|
|
+ title="上级账号组"
|
|
|
+ nodekey="GroupId"
|
|
|
:type="true"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <div class="part">
|
|
|
- <rolelists
|
|
|
- title="角色列表"
|
|
|
- @checkChange="checkChange"
|
|
|
- @checkClick="radioChanges"
|
|
|
- :checkBoxList="checkRole"
|
|
|
- :dataList="roleList"
|
|
|
- :roleType="roleType"
|
|
|
- :GroupIds="GroupIds"
|
|
|
- :number="8"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <div class="part">
|
|
|
- <permissionlist
|
|
|
- title="权限列表"
|
|
|
- :RoleList="powerList"
|
|
|
- :check="true"
|
|
|
- class="hucPower"
|
|
|
- @Competen="Competen"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <!-- 无角色 -->
|
|
|
- <el-row :gutter="24" v-else>
|
|
|
- <el-col :span="8">
|
|
|
- <div class="part">
|
|
|
- <Organization
|
|
|
- title="所属账号组"
|
|
|
- :data="dataObj"
|
|
|
:defaultProps="defaultProps"
|
|
|
- :nodekey="'GroupId'"
|
|
|
- :checkedKeys="[GroupUpid]"
|
|
|
- :checkedIdList="checkedIdList"
|
|
|
- @getTreeData="getTreeData"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <div class="part">
|
|
|
- <Permissiontree
|
|
|
- @nodeClick="nodeClick"
|
|
|
- :checkedKeys="powerT"
|
|
|
- @getTreeData="getTreeDatas"
|
|
|
- :queryType="queryType"
|
|
|
- :queryId="queryId"
|
|
|
- title="权限树"
|
|
|
+ :checkedKeys="[GroupUpId]"
|
|
|
+ @getTreeData="getAccountGroupChecked"
|
|
|
/>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <div class="part">
|
|
|
- <Rulesofcompetency title="权限规则" />
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
+ <!-- 开启角色 -->
|
|
|
+ <template v-if="openRole">
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="part">
|
|
|
+ <RoleList
|
|
|
+ title="角色列表"
|
|
|
+ :checkBoxList="roleListCheckedList"
|
|
|
+ :roleType="roleType"
|
|
|
+ :GroupIds="GroupIds"
|
|
|
+ :number="8"
|
|
|
+ :active="true"
|
|
|
+ @checkChange="getRoleListChecked"
|
|
|
+ @checkClick="selectRole"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="part">
|
|
|
+ <PermissionList
|
|
|
+ title="权限列表"
|
|
|
+ class="hucPower"
|
|
|
+ :RoleList="selectedRoles"
|
|
|
+ :check="true"
|
|
|
+ @Competen="Competen"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ <!-- 无角色 -->
|
|
|
+ <template v-else>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="part">
|
|
|
+ <PermissionTree
|
|
|
+ title="权限树"
|
|
|
+ :checkedKeys="permissionTreeChckedKeys"
|
|
|
+ :queryType="queryType"
|
|
|
+ :queryIds="accountGroupTreeCheckedTemp"
|
|
|
+ @getTreeData="getPermissionTreeChecked"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="part">
|
|
|
+ <RulesOfCompetency
|
|
|
+ title="权限规则"
|
|
|
+ margin-b="20px"
|
|
|
+ :auth-list="authList"
|
|
|
+ :auth-to="authTo"
|
|
|
+ @getData="getRulesOfCompetency"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <Dialog :flag="dialogVisible">
|
|
|
+ <!-- <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>
|
|
|
+ <el-button
|
|
|
+ size="medium"
|
|
|
+ class="r24"
|
|
|
+ >取消</el-button>
|
|
|
+ <el-button
|
|
|
+ size="medium"
|
|
|
+ type="danger"
|
|
|
+ >删除</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </Dialog>
|
|
|
+ </Dialog> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import Organization from "@/components/usergrouptree/index.vue";
|
|
|
-import Permissiontree from "@/components/permissiontree/index.vue";
|
|
|
-import Rulesofcompetency from "@/components/rulesofcompetency/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 {
|
|
|
- GetGroupDetails,
|
|
|
- EditGroupAcc,
|
|
|
- GetRoleByGroup,
|
|
|
-} from "@/api/AccountGroup.js";
|
|
|
-import treeData from "../minixs/treeData";
|
|
|
+import AccountGroupTree from '@/components/usergrouptree/index.vue'
|
|
|
+import PermissionTree from '@/components/permissiontree/index.vue'
|
|
|
+import RulesOfCompetency from '@/components/rulesofcompetency/index.vue'
|
|
|
+import RoleList from '@/components/rolelist/index.vue'
|
|
|
+import PermissionList from '@/components/permissionlist/index.vue'
|
|
|
+// import Dialog from '@/layout/components/Dialog/index.vue'
|
|
|
+
|
|
|
+import { RoleAuths } from '@/api/apiAuthority'
|
|
|
+import { GetGroupDetails, EditGroupAcc, SaveGroup } from '@/api/AccountGroup.js'
|
|
|
+// import treeData from '../minixs/treeData'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
|
|
|
export default {
|
|
|
- mixins: [treeData],
|
|
|
components: {
|
|
|
- Organization,
|
|
|
- Permissiontree,
|
|
|
- Rulesofcompetency,
|
|
|
- rolelists,
|
|
|
- permissionlist,
|
|
|
- Dialog,
|
|
|
- },
|
|
|
- props: {
|
|
|
- postList: {
|
|
|
- type: String,
|
|
|
- },
|
|
|
- roleData: {
|
|
|
- type: Array,
|
|
|
- default: () => [],
|
|
|
- },
|
|
|
+ AccountGroupTree,
|
|
|
+ PermissionTree,
|
|
|
+ RulesOfCompetency,
|
|
|
+ RoleList,
|
|
|
+ PermissionList
|
|
|
+ // Dialog
|
|
|
},
|
|
|
+ // mixins: [treeData],
|
|
|
data() {
|
|
|
return {
|
|
|
- roleType:"",
|
|
|
- checkedAuthList: [],
|
|
|
- GroupId: this.$route.query.GroupId,
|
|
|
- GroupUpid: this.$route.query.GroupUpid,
|
|
|
- butPreser: "保存",
|
|
|
- dialogVisible: false,
|
|
|
+ doesGroupExist: this.$route.meta.doesGroupExist, // 控制账号组新增/编辑
|
|
|
+ GroupId: 0,
|
|
|
+ GroupUpId: this.$route.query.GroupUpId,
|
|
|
+ // dialogVisible: false,
|
|
|
OpenRole: 0,
|
|
|
- OpenGroup: 0,
|
|
|
- checkRole: [],
|
|
|
- powerT: [],
|
|
|
- data: [], //上级账号组
|
|
|
- checkedIdList: [],
|
|
|
- checkTrees: [], //上级权限选中的树数据
|
|
|
- powerTree: [], //选中的权限树数据
|
|
|
- rulesObj: {}, //权限规则数据
|
|
|
- roleList: [], //角色
|
|
|
- checkRoles: [], //选中的角色
|
|
|
- powerList: [],
|
|
|
- addFrom: {
|
|
|
- name: "",
|
|
|
- textarea2: "",
|
|
|
- // isUsed: "",
|
|
|
+ authTo: {},
|
|
|
+ authList: [],
|
|
|
+ accountGroupTreeCheckedTemp: [], // 账号组书当前勾选项
|
|
|
+ roleListCheckedList: [], // 角色列表初始勾选项
|
|
|
+ roleListCheckedTemp: [], // 角色列表当前勾选项
|
|
|
+ permissionTreeChckedKeys: [], // 权限树初始勾选项
|
|
|
+ permissionTreeChckedTemp: [], // 权限树当前勾选项
|
|
|
+ rulesOfCompetency: null, // 当前编辑的权限规则
|
|
|
+ queryType: '',
|
|
|
+ roleType: '',
|
|
|
+ currentSelectedRoleId: 0,
|
|
|
+ selectedRoles: [],
|
|
|
+ editForm: {
|
|
|
+ name: '',
|
|
|
+ desc: '',
|
|
|
+ isUsed: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- //表单验证
|
|
|
- name: [
|
|
|
- { required: true, message: "请输入账号组名称", trigger: "blur" },
|
|
|
- ],
|
|
|
+ // 表单验证
|
|
|
+ name: [{ required: true, message: '请输入账号组名称', trigger: 'blur' }]
|
|
|
},
|
|
|
defaultProps: {
|
|
|
- children: "children",
|
|
|
- label: "GroupName",
|
|
|
- },
|
|
|
- treeData1: [],
|
|
|
- AppId: 0,
|
|
|
- UpId: 0,
|
|
|
- dataObj: null,
|
|
|
- queryId: "",
|
|
|
- queryType: "group",
|
|
|
- objID: "",
|
|
|
- GroupIds:[],
|
|
|
- };
|
|
|
+ children: 'children',
|
|
|
+ label: 'GroupName'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['systemSet', 'authArrs']),
|
|
|
+ pageTitle() {
|
|
|
+ return this.doesGroupExist ? '编辑账号组' : '新增账号组'
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
created() {
|
|
|
- let obj;
|
|
|
- if (typeof this.$store.state.app.systemSet == "string") {
|
|
|
- obj = JSON.parse(this.$store.state.app.systemSet);
|
|
|
+ let obj
|
|
|
+ if (typeof this.systemSet === 'string') {
|
|
|
+ obj = JSON.parse(this.systemSet)
|
|
|
} else {
|
|
|
- obj = this.$store.state.app.systemSet;
|
|
|
- }
|
|
|
- const { OpenRole, OpenGroup } = obj;
|
|
|
- this.openRole = OpenRole;
|
|
|
- this.OpenGroup = OpenGroup;
|
|
|
- this.getDeaitls();
|
|
|
- this.getGroupTree();
|
|
|
- const { GroupUpid } = this.$route.query;
|
|
|
- this.UpId = GroupUpid;
|
|
|
- this.queryId = GroupUpid;
|
|
|
- this.objID = GroupUpid;
|
|
|
- if (OpenRole) {
|
|
|
- this.title = "角色";
|
|
|
- this.GroupIds = [GroupUpid];
|
|
|
- // this.RoleBox();
|
|
|
+ obj = this.systemSet
|
|
|
}
|
|
|
- // if (this.UpId == -1) {
|
|
|
- // this.queryId = "";
|
|
|
- // this.queryType = "all";
|
|
|
- // this.RoleBox();
|
|
|
- // } else {
|
|
|
- // this.queryRole();
|
|
|
- // }
|
|
|
+ const { OpenRole } = obj
|
|
|
+ this.openRole = OpenRole
|
|
|
+ this.accountGroupTreeCheckedTemp.push(this.GroupUpId)
|
|
|
+ this.queryType = this.GroupUpId === -1 ? 'all' : 'group'
|
|
|
},
|
|
|
- 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,
|
|
|
- },
|
|
|
+ mounted() {
|
|
|
+ this.roleType = 'roleByUpId'
|
|
|
+ if (this.doesGroupExist) {
|
|
|
+ this.GroupId = this.$route.query.GroupId
|
|
|
+ this.getGroupDetails()
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
- //权限树点击
|
|
|
- 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;
|
|
|
- if(this.checkTrees.length==1){
|
|
|
- let id = arr[0].GroupId
|
|
|
- console.log(id)
|
|
|
- this.GroupIds = [id]
|
|
|
- // this.GroupIds = [arr[0].GroupId]
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- //获取权限规则
|
|
|
- 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() {
|
|
|
+ // 账号组详情
|
|
|
+ async getGroupDetails() {
|
|
|
try {
|
|
|
const res = await GetGroupDetails({
|
|
|
- GroupId: this.GroupId,
|
|
|
- });
|
|
|
+ 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;
|
|
|
+ const { GroupDesc, GroupName, Status, AuthList, RoleList } = res.returnData
|
|
|
+ this.editForm.name = GroupName
|
|
|
+ this.editForm.desc = GroupDesc
|
|
|
+ this.editForm.isUsed = Status
|
|
|
+ this.$store.dispatch('auth/changeAuthList', AuthList)
|
|
|
+
|
|
|
+ RoleList &&
|
|
|
+ RoleList.length &&
|
|
|
+ RoleList.forEach(role => {
|
|
|
+ role.IsSelected && this.roleListCheckedList.push(role.RoleId)
|
|
|
+ })
|
|
|
+ this.roleListCheckedTemp = RoleList
|
|
|
+ AuthList &&
|
|
|
+ AuthList.length &&
|
|
|
+ (AuthList.forEach(auth => {
|
|
|
+ this.permissionTreeChckedKeys.push(auth.AuthId)
|
|
|
+ }),
|
|
|
+ (this.authTo = AuthList[0]),
|
|
|
+ (this.authList = this._.cloneDeep(AuthList)))
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- async radioChanges(data) {
|
|
|
- try {
|
|
|
- let params = {
|
|
|
- RoleIds: [data.RoleId],
|
|
|
- };
|
|
|
- const res = await RoleAuths(params);
|
|
|
- if (res.code === 0) {
|
|
|
- this.powerList = res.returnData;
|
|
|
+ // 保存
|
|
|
+ handleClickSave(formName) {
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.handleSaveEdit()
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
- }
|
|
|
+ })
|
|
|
},
|
|
|
- //角色列表
|
|
|
- async queryRole() {
|
|
|
- try {
|
|
|
- const res = await GetRoleByGroup({
|
|
|
- GroupId: this.objID,
|
|
|
- });
|
|
|
- if (res.code === 0) {
|
|
|
- const arr = res.returnData.records;
|
|
|
- const userArr = [];
|
|
|
- arr.forEach((item) => {
|
|
|
- item.name = item.RoleName;
|
|
|
- if (item.IsSelected == 1) {
|
|
|
- userArr.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- // this.roleList = userArr;
|
|
|
- } else {
|
|
|
- this.$message.error(res.message);
|
|
|
- }
|
|
|
- } catch {
|
|
|
- console.log("出错了", error);
|
|
|
+ // 获取当前权限树勾选项
|
|
|
+ getPermissionTreeChecked(arr) {
|
|
|
+ this.permissionTreeChckedTemp = arr
|
|
|
+ },
|
|
|
+ // 获取当前勾选的账号组
|
|
|
+ getAccountGroupChecked(arr) {
|
|
|
+ console.log(arr)
|
|
|
+ this.accountGroupTreeCheckedTemp.length = 0
|
|
|
+ if (arr && arr.length && arr[0] !== -1) {
|
|
|
+ this.queryType = 'group'
|
|
|
+ const GroupUpId = arr[0]
|
|
|
+ this.accountGroupTreeCheckedTemp.push(GroupUpId)
|
|
|
+ } else {
|
|
|
+ this.queryType = 'all'
|
|
|
+ this.accountGroupTreeCheckedTemp.push(-1)
|
|
|
}
|
|
|
},
|
|
|
- //所有角色列表
|
|
|
- async RoleBox() {
|
|
|
+ // 角色选取
|
|
|
+ getRoleListChecked(arr) {
|
|
|
+ this.roleListCheckedTemp = arr
|
|
|
+ },
|
|
|
+ // 获取当前编辑的权限规则
|
|
|
+ getRulesOfCompetency(obj) {
|
|
|
+ this.rulesOfCompetency = obj
|
|
|
+ },
|
|
|
+ // 点击角色后显示对应权限列表
|
|
|
+ async selectRole(data) {
|
|
|
+ if (this.currentSelectedRoleId === data.RoleId) return
|
|
|
try {
|
|
|
- const res = await QueryRole({
|
|
|
- QueryName: "",
|
|
|
- });
|
|
|
+ const params = {
|
|
|
+ RoleId: data.RoleId
|
|
|
+ }
|
|
|
+ const res = await RoleAuths(params)
|
|
|
if (res.code === 0) {
|
|
|
- const arr = res.returnData.records;
|
|
|
- arr.forEach((item) => {
|
|
|
- item.name = item.RoleName;
|
|
|
- });
|
|
|
- // this.roleList = arr;
|
|
|
+ this.selectedRoles = res.returnData
|
|
|
+ this.currentSelectedRoleId = data.RoleId
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
- } catch {
|
|
|
- console.log("出错了", error);
|
|
|
+ } catch (error) {
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- //删除账号组
|
|
|
+ // 删除账号组
|
|
|
// async deleteAuth() {
|
|
|
// this.dialogVisible = true;
|
|
|
// },
|
|
@@ -391,82 +323,73 @@ export default {
|
|
|
// console.log("出错了", error);
|
|
|
// }
|
|
|
// },
|
|
|
- //获取权限列表
|
|
|
- async radioChange(data) {
|
|
|
+ // 修改权限规则
|
|
|
+ Competen(data) {
|
|
|
+ console.log(data)
|
|
|
+ },
|
|
|
+ // 账号组编辑保存
|
|
|
+ async handleSaveEdit() {
|
|
|
+ const AuthList = []
|
|
|
+ this.permissionTreeChckedTemp.forEach(item => {
|
|
|
+ AuthList.push(item.AuthList)
|
|
|
+ })
|
|
|
+ AuthList.forEach((item, index) => {
|
|
|
+ this.authArrs.forEach(item2 => {
|
|
|
+ if (item.AuthId === item2.AuthId) {
|
|
|
+ AuthList[index] = item2.AuthList
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ const params = {
|
|
|
+ AuthList,
|
|
|
+ GroupName: this.editForm.name,
|
|
|
+ GroupDesc: this.editForm.desc,
|
|
|
+ GroupUpId: this.accountGroupTreeCheckedTemp[0],
|
|
|
+ RoleList: this.roleListCheckedTemp
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.doesGroupExist) {
|
|
|
+ this.saveEditGroup({
|
|
|
+ ...params,
|
|
|
+ GroupId: this.GroupId,
|
|
|
+ Status: this.editForm.isUsed
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.saveAddGroup(params)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async saveEditGroup(params) {
|
|
|
try {
|
|
|
- let params = {
|
|
|
- RoleId: data,
|
|
|
- };
|
|
|
- const res = await RoleAuths(params);
|
|
|
+ const res = await EditGroupAcc(params)
|
|
|
if (res.code === 0) {
|
|
|
- this.RoleList = res.returnData;
|
|
|
+ this.$message.success(res.message)
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$router.push('/accountGroup')
|
|
|
+ }, 2000)
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- Competen(data) {
|
|
|
- this.$emit("Competen", data);
|
|
|
- },
|
|
|
- //账号组修改保存
|
|
|
- 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;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ async saveAddGroup(params) {
|
|
|
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,
|
|
|
- });
|
|
|
-
|
|
|
+ const res = await SaveGroup(params)
|
|
|
if (res.code === 0) {
|
|
|
- this.$message.success(res.message);
|
|
|
+ this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
|
- this.$router.push("/AccountGroup");
|
|
|
- }, 2000);
|
|
|
+ this.$router.push('/accountGroup')
|
|
|
+ }, 2000)
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", 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;
|
|
|
- },
|
|
|
- },
|
|
|
- mounted(){
|
|
|
- this.roleType = "roleByUpId"
|
|
|
+ }
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.bf-postmanagementadd {
|