|
@@ -3,17 +3,45 @@
|
|
|
<div class="postmanagementadd_header">
|
|
|
<div class="postmanagementadd_top">
|
|
|
<div class="tltleLeft">{{ pageTitle }}</div>
|
|
|
- <div v-is="['group_btn_edit']" class="btn" style="margin-top: 20px">
|
|
|
- <el-button type="primary" @click="handleClickSave('editForm')">保存</el-button>
|
|
|
+ <div
|
|
|
+ v-is="['group_btn_edit']"
|
|
|
+ class="btn"
|
|
|
+ style="margin-top: 20px"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="handleClickSave('editForm')"
|
|
|
+ >保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content dialog-public-background">
|
|
|
- <el-form ref="editForm" :inline="true" :rules="rules" class="form" :model="editForm">
|
|
|
- <el-form-item prop="name" label="账号组名称">
|
|
|
- <el-input v-model="editForm.name" maxlength="32" placeholder="账号组名称" />
|
|
|
+ <el-form
|
|
|
+ ref="editForm"
|
|
|
+ :inline="true"
|
|
|
+ :rules="rules"
|
|
|
+ class="form"
|
|
|
+ :model="editForm"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ prop="name"
|
|
|
+ label="账号组名称"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="editForm.name"
|
|
|
+ maxlength="32"
|
|
|
+ placeholder="账号组名称"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="描述" style="margin-left: 40px">
|
|
|
- <el-input v-model="editForm.desc" style="width: 640px" placeholder="请输入描述" maxlength="200" />
|
|
|
+ <el-form-item
|
|
|
+ label="描述"
|
|
|
+ style="margin-left: 40px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="editForm.desc"
|
|
|
+ style="width: 640px"
|
|
|
+ placeholder="请输入描述"
|
|
|
+ maxlength="200"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -22,19 +50,43 @@
|
|
|
<el-row :gutter="24">
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <AccountGroupTree title="上级账号组" nodekey="GroupId" :check-disabled="doesGroupExist" :type="true" :defaultProps="defaultProps" :checkedKeys="accountGroupTreeCheckedList" @getTreeData="getAccountGroupChecked" />
|
|
|
+ <AccountGroupTree
|
|
|
+ title="上级账号组"
|
|
|
+ nodekey="GroupId"
|
|
|
+ :check-disabled="doesGroupExist"
|
|
|
+ :type="true"
|
|
|
+ :defaultProps="defaultProps"
|
|
|
+ :checkedKeys="accountGroupTreeCheckedList"
|
|
|
+ @getTreeData="getAccountGroupChecked"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<!-- 开启角色 -->
|
|
|
<template v-if="openRole">
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <RoleList title="角色列表" :roleType="roleType" :GroupIds="groupIds" :checkBoxList="roleListCheckedList" :number="8" :active="true" @checkChange="getRoleListChecked" @checkClick="selectRole" @roleListChange="roleListCheckedChange" />
|
|
|
+ <RoleList
|
|
|
+ title="角色列表"
|
|
|
+ :roleType="roleType"
|
|
|
+ :GroupIds="groupIds"
|
|
|
+ :checkBoxList="roleListCheckedList"
|
|
|
+ :number="8"
|
|
|
+ :active="true"
|
|
|
+ @checkChange="getRoleListChecked"
|
|
|
+ @checkClick="selectRole"
|
|
|
+ @roleListChange="roleListCheckedChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <PermissionList title="权限列表" class="hucPower" :RoleList="checkedRoles" :check="true" @Competen="Competen" />
|
|
|
+ <PermissionList
|
|
|
+ title="权限列表"
|
|
|
+ class="hucPower"
|
|
|
+ :RoleList="checkedRoles"
|
|
|
+ :check="true"
|
|
|
+ @Competen="Competen"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</template>
|
|
@@ -42,12 +94,22 @@
|
|
|
<template v-else>
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <PermissionTree title="权限树" :checkedKeys="permissionTreeChckedKeys" :queryType="queryType" :queryIds="queryIds" @getTreeData="getPermissionTreeChecked" />
|
|
|
+ <PermissionTree
|
|
|
+ title="权限树"
|
|
|
+ :checkedKeys="permissionTreeChckedKeys"
|
|
|
+ :queryType="queryType"
|
|
|
+ :queryIds="queryIds"
|
|
|
+ @getTreeData="getPermissionTreeChecked"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<div class="part">
|
|
|
- <RulesOfCompetency title="权限规则" margin-b="20px" @getData="getRulesOfCompetency" />
|
|
|
+ <RulesOfCompetency
|
|
|
+ title="权限规则"
|
|
|
+ margin-b="20px"
|
|
|
+ @getData="getRulesOfCompetency"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</template>
|
|
@@ -94,7 +156,7 @@ export default {
|
|
|
// Dialog
|
|
|
},
|
|
|
// mixins: [treeData],
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
doesGroupExist: this.$route.meta.doesGroupExist, // 控制账号组新增/编辑
|
|
|
GroupId: 0,
|
|
@@ -121,7 +183,10 @@ export default {
|
|
|
},
|
|
|
rules: {
|
|
|
// 表单验证
|
|
|
- name: [{ required: true, message: '请输入账号组名称', trigger: 'blur' }]
|
|
|
+ name: [
|
|
|
+ { required: true, message: '请输入账号组名称', trigger: 'blur' },
|
|
|
+ { min: 1, max: 32, message: '长度在 1到 32 个字符', trigger: 'blur' }
|
|
|
+ ]
|
|
|
},
|
|
|
defaultProps: {
|
|
|
children: 'children',
|
|
@@ -131,11 +196,12 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['systemSet']),
|
|
|
- pageTitle () {
|
|
|
+ pageTitle() {
|
|
|
return this.doesGroupExist ? '编辑账号组' : '新增账号组'
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
+ // 获取系统配置
|
|
|
let obj
|
|
|
if (typeof this.systemSet === 'string') {
|
|
|
obj = JSON.parse(this.systemSet)
|
|
@@ -149,7 +215,7 @@ export default {
|
|
|
this.groupIds.push(this.GroupUpId)
|
|
|
this.queryIds.push(this.GroupUpId)
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
if (this.doesGroupExist) {
|
|
|
this.GroupId = this.$route.query.GroupId
|
|
|
this.getGroupDetails()
|
|
@@ -160,7 +226,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 账号组详情
|
|
|
- async getGroupDetails () {
|
|
|
+ async getGroupDetails() {
|
|
|
try {
|
|
|
const res = await GetGroupDetails({
|
|
|
GroupId: this.GroupId
|
|
@@ -194,7 +260,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 保存
|
|
|
- handleClickSave (formName) {
|
|
|
+ handleClickSave(formName) {
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
this.handleSaveEdit()
|
|
@@ -205,12 +271,12 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 获取当前权限树勾选项
|
|
|
- getPermissionTreeChecked (arr) {
|
|
|
+ getPermissionTreeChecked(arr) {
|
|
|
// console.log(arr)
|
|
|
this.permissionTreeChckedTemp = arr.map(auth => auth.AuthList)
|
|
|
},
|
|
|
// 获取当前勾选的账号组
|
|
|
- getAccountGroupChecked (arr) {
|
|
|
+ getAccountGroupChecked(arr) {
|
|
|
if (arr && arr.length && arr[0] !== -1) {
|
|
|
const GroupIds = arr.map(item => item.GroupId)
|
|
|
this.accountGroupTreeCheckedTemp = GroupIds
|
|
@@ -225,26 +291,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 角色选取
|
|
|
- getRoleListChecked (arr) {
|
|
|
+ getRoleListChecked(arr) {
|
|
|
this.roleListCheckedTemp = arr
|
|
|
},
|
|
|
- roleListCheckedChange (arr) {
|
|
|
- console.log(arr)
|
|
|
- if (arr && arr.length) {
|
|
|
- this.roleListCheckedTemp = this.roleListCheckedTemp.filter(role =>
|
|
|
- arr.some(data => data.RoleId === role.RoleId)
|
|
|
- )
|
|
|
- } else {
|
|
|
- this.roleListCheckedTemp = []
|
|
|
- }
|
|
|
+ roleListCheckedChange(arr) {
|
|
|
+ this.roleListCheckedTemp = this.roleListCheckedTemp.filter(role => arr.some(data => data.RoleId === role.RoleId))
|
|
|
this.roleListCheckedList = this.roleListCheckedTemp.map(role => role.RoleId)
|
|
|
},
|
|
|
// 获取当前编辑的权限规则
|
|
|
- getRulesOfCompetency (obj) {
|
|
|
+ getRulesOfCompetency(obj) {
|
|
|
this.rulesOfCompetency = obj
|
|
|
},
|
|
|
// 点击角色后显示对应权限列表
|
|
|
- async selectRole (data) {
|
|
|
+ async selectRole(data) {
|
|
|
if (this.currentSelectedRoleId === data.RoleId) return
|
|
|
try {
|
|
|
const params = {
|
|
@@ -283,11 +342,11 @@ export default {
|
|
|
// }
|
|
|
// },
|
|
|
// 修改权限规则
|
|
|
- Competen (data) {
|
|
|
+ Competen(data) {
|
|
|
console.log(data)
|
|
|
},
|
|
|
// 账号组编辑保存
|
|
|
- async handleSaveEdit () {
|
|
|
+ async handleSaveEdit() {
|
|
|
const params = {
|
|
|
AuthList: this.permissionTreeChckedTemp,
|
|
|
GroupName: this.editForm.name,
|
|
@@ -306,7 +365,7 @@ export default {
|
|
|
this.saveAddGroup(params)
|
|
|
}
|
|
|
},
|
|
|
- async saveEditGroup (params) {
|
|
|
+ async saveEditGroup(params) {
|
|
|
try {
|
|
|
const res = await EditGroup(params)
|
|
|
if (res.code === 0) {
|
|
@@ -314,7 +373,7 @@ export default {
|
|
|
setTimeout(() => {
|
|
|
this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
this.$router.push('/accountGroup')
|
|
|
- }, 2000)
|
|
|
+ }, 1000)
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
|
}
|
|
@@ -322,7 +381,7 @@ export default {
|
|
|
console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- async saveAddGroup (params) {
|
|
|
+ async saveAddGroup(params) {
|
|
|
try {
|
|
|
const res = await SaveGroup(params)
|
|
|
if (res.code === 0) {
|
|
@@ -341,6 +400,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.bf-postmanagementadd {
|
|
|
width: 100%;
|