cyl/dev
wangxia 3 years ago
parent ce8466a73f
commit 9da3f3bac5

@ -3,6 +3,40 @@ import qs from "qs";
let setqs = function (data) { let setqs = function (data) {
return qs.stringify(data); return qs.stringify(data);
}; };
// 后台侧边栏menu获取
export function getMenuListApi () {
return request({
url: "/yishoudan/getMenus",
method: "get",
});
}
// 数据统计列表获取
export function dataStatisticsListApi (data) {
return request({
url: "/yishoudan/statistics/agency/teamWithGroup",
method: "post",
// headers: { "Content-Type": "multipart/form-data" },
data: setqs(data),
// data,
});
}
// 数据统计工单详情获取
export function dataStatisticsTeamDetailApi (data) {
return request({
url: "/yishoudan/statistics/agency/teamDetail",
method: "post",
// headers: { "Content-Type": "multipart/form-data" },
data: setqs(data),
});
}
/**
* 成员相关
*
*
*/
// 成员管理:获取成员列表 // 成员管理:获取成员列表
export function getMemberListApi (data) { export function getMemberListApi (data) {
return request({ return request({
@ -37,32 +71,6 @@ export function updateMemberApi (data) {
data: setqs(data), data: setqs(data),
}); });
} }
// 数据统计列表获取
export function dataStatisticsListApi (data) {
return request({
url: "/yishoudan/statistics/agency/teamWithGroup",
method: "post",
// headers: { "Content-Type": "multipart/form-data" },
data: setqs(data),
// data,
});
}
// 数据统计工单详情获取
export function dataStatisticsTeamDetailApi (data) {
return request({
url: "/yishoudan/statistics/agency/teamDetail",
method: "post",
// headers: { "Content-Type": "multipart/form-data" },
data: setqs(data),
});
}
/**
* 成员相关
*
*
*/
// 获取成员分组信息 // 获取成员分组信息
export function getMemberGroupApi (data) { export function getMemberGroupApi (data) {
return request({ return request({
@ -154,8 +162,25 @@ export function addRoleApi (data) {
data: setqs(data), data: setqs(data),
}); });
} }
// 新增获取角色权限列表
export function getRolePermissionApi (data) {
return request({
url: "/yishoudan/agency/role/findAllVisibleMenus",
method: "get",
// data: setqs(data),
});
}
// 修改获取角色相关信息
export function getRoleInfoApi (data) {
return request({
url: "/yishoudan/agency/role/detail/" + data,
method: "get",
// data: setqs(data),
});
}
// 修改角色 // 修改角色
export function updateRoleApi (data) { export function updateRoleApi (data) {
return request({ return request({
url: "/yishoudan/agency/role/update", url: "/yishoudan/agency/role/update",
method: "post", method: "post",

@ -259,7 +259,7 @@ export default {
fileListT2: [], fileListT2: [],
// facetimedate: "", // facetimedate: "",
previewVisible: false, previewVisible: false,
currentPolicy: 1, currentPolicy: 0,
proxyStatus: '', // proxyStatus: '', //
storeStatus: '', // storeStatus: '', //
jobnameStatus: '', // jobnameStatus: '', //
@ -310,6 +310,13 @@ export default {
message: '请输入正确的姓名', message: '请输入正确的姓名',
trigger: 'blur', trigger: 'blur',
}, },
],
policy: [
{
required: true,
message: '请选择政策',
trigger: 'submit',
},
], ],
sex: [ sex: [
{ {
@ -449,36 +456,36 @@ export default {
console.log(error) console.log(error)
} }
}, },
async getPolicyListByJobId(value) { // async getPolicyListByJobId(value) {
console.log(value) // console.log(value)
try { // try {
const { data } = await getPolicyListByJobIdApi(value) // const { data } = await getPolicyListByJobIdApi(value)
console.log(data) // console.log(data)
if (data.status === 200) { // if (data.status === 200) {
this.form.policy = data.data // this.form.policy = data.data
// this.form.policy = [ // // this.form.policy = [
// { // // {
// label: '1', // // label: '1',
// content: '', // // content: '',
// id: 1, // // id: 1,
// }, // // },
// { // // {
// label: '1', // // label: '1',
// content: '', // // content: '',
// id: 2, // // id: 2,
// }, // // },
// { // // {
// label: '1', // // label: '1',
// content: '', // // content: '',
// id: 3, // // id: 3,
// // },
// // ]
// this.currentPolicy = this.form.policy[0].id
// }
// } catch (error) {
// console.log(error)
// }
// }, // },
// ]
this.currentPolicy = this.form.policy[0].id
}
} catch (error) {
console.log(error)
}
},
async getJobDetail(value) { async getJobDetail(value) {
try { try {
const { data } = await getJobDetailApi(value) const { data } = await getJobDetailApi(value)
@ -582,7 +589,11 @@ export default {
if (ispass) { if (ispass) {
console.log(this.form) console.log(this.form)
this.form['imgs'] = that.fileListT2.toString() this.form['imgs'] = that.fileListT2.toString()
if (this.currentPolicy == 0) {
this.$message.warning('请选择政策')
this.confirmLoading = false
return
}
let dataObj = qs.stringify({ let dataObj = qs.stringify({
...this.form, ...this.form,
storeJobId: this.firminfo.id, storeJobId: this.firminfo.id,
@ -1736,7 +1747,7 @@ export default {
/deep/ .ant-select-selection { /deep/ .ant-select-selection {
border-radius: 0px !important; border-radius: 0px !important;
} }
.policyRadios{ .policyRadios {
flex-wrap: wrap; flex-wrap: wrap;
} }
</style> </style>

@ -30,8 +30,8 @@
<a-form-item> <a-form-item>
<div class> <div class>
<a-select class="mr8 ml8" style="width:360px" placeholder=" 请在已有的角色选择" v-decorator="['agencyTeamId',{ rules: [{ required: false, message: ' 请在已有的角色选择' }] },]" dropdownClassName="groupSelectDrop"> <a-select class="mr8 ml8" style="width:360px" placeholder=" 请在已有的角色选择" dropdownClassName="groupSelectDrop">
<a-select-option :value="item.roleName" v-for="(item,index) in roleList">{{item.roleName}}</a-select-option> <a-select-option :value="item.roleName" v-for="(item,index) in roleList" @click="setRoleBase(item)">{{item.roleName}}</a-select-option>
<!-- <div slot="dropdownRender" slot-scope="menu"> <!-- <div slot="dropdownRender" slot-scope="menu">
<div v-for="(item,index) in roleList" @click="choiceGroup(item)" class="groupSelectSub fsa" :key="index"> <div v-for="(item,index) in roleList" @click="choiceGroup(item)" class="groupSelectSub fsa" :key="index">
<div>{{item.roleName}}</div> <div>{{item.roleName}}</div>
@ -43,7 +43,7 @@
<div class="showScope"> <div class="showScope">
<div>数据可见范围</div> <div>数据可见范围</div>
<div> <div>
<a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: '1' },{ label: '部门数据', value: '2' },{ label: '个人数据', value: '3' },]" @change="showScopeChange" /> <a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: 1 },{ label: '部门数据', value: 2 },{ label: '个人数据', value: 3 },]" @change="showScopeChange" />
</div> </div>
</div> </div>
<div class="title fss"> <div class="title fss">
@ -54,14 +54,14 @@
<div v-for="(item, key) in authorityList" class> <div v-for="(item, key) in authorityList" class>
<div class="fss"> <div class="fss">
<a-checkbox :checked="item.checked" style="width:88px" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox> <a-checkbox :checked="item.checked" style="width:100px" @change="checkboxChange(item)">{{item.title}}</a-checkbox>
<span class="ml24 subChecked" style="margin-left:288px"> <span class="ml24 subChecked" style="margin-left:276px">
<a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox> <a-checkbox v-for="(subItem, subIndex) in item.tagNamesList" :key="subIndex" :checked="subItem.checked" @change="checkboxChange(item,subItem)">{{subItem.label}}</a-checkbox>
</span> </span>
</div> </div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" /> <a-divider class="mt16 mb32" />
<a-divider class="mt16 mb32" style="background:#ccc" v-else /> <!-- <a-divider class="mt16 mb32" style="background:#ccc" v-else /> -->
</div> </div>
<a-form-item style="transform:translateY(-10px)"> <a-form-item style="transform:translateY(-10px)">
<a-button type class="mr16" @click="cancelAdd"></a-button> <a-button type class="mr16" @click="cancelAdd"></a-button>
@ -73,7 +73,7 @@
</template> </template>
<script> <script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig' import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi, getRolePermissionApi, getRoleInfoApi } from '../../api/merchantConfig'
export default { export default {
// //
@ -85,248 +85,13 @@ export default {
// //
data() { data() {
return { return {
authorityList: { authorityList: [],
dtzw: {
id: 1,
label: '稻田职位',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
wdbm: {
id: 2,
label: '我的报名',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
wdlx: {
id: 3,
label: '我的老乡',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
xx: {
id: 4,
label: '消息',
checked: false,
children: [
{
id: 1,
label: '系统消息',
checked: false,
},
{
id: 2,
label: '团队消息',
checked: false,
},
],
},
ttcy: {
id: 5,
label: '团队成员',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
jsgl: {
id: 6,
label: '角色管理',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
tdsj: {
id: 7,
label: '团队数据',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
],
},
sjdp: {
id: 8,
label: '数据大屏',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
],
},
tzzx: {
id: 9,
label: '通知中心',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
tvpz: {
id: 10,
label: 'TV配置',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
// gzt: {
// id: 7,
// label: '',
// checked: false,
// children: [],
// },
},
secondBreadcrumb: '', secondBreadcrumb: '',
roleForm: this.$form.createForm(this), roleForm: this.$form.createForm(this),
showScopeType: 1, showScopeType: 0, //
roleList: [], roleList: [],
currentRoleId: null,
roleInfo: {},
} }
}, },
// //
@ -340,32 +105,15 @@ export default {
created() { created() {
console.log(this.$route) console.log(this.$route)
if (this.$route.query.item) { if (this.$route.query.item) {
this.roleInfo = JSON.parse(this.$route.query.item) this.currentRoleId = JSON.parse(this.$route.query.item).id
this.roleList = JSON.parse(this.$route.query.roleList) this.showScopeType = JSON.parse(this.$route.query.item).visibleRange
setTimeout(() => {
this.roleForm.setFieldsValue({
roleName: this.roleInfo.roleName,
desp: this.roleInfo.desp,
})
}, 10)
this.secondBreadcrumb = '编辑角色' this.secondBreadcrumb = '编辑角色'
// localStorage.setItem('ROLEINFO', JSON.stringify(this.roleInfo)) this.getRoleInfo(this.currentRoleId)
// localStorage.setItem('ROLELIST', JSON.stringify(this.roleList)) } else {
}
// else if (localStorage.getItem('ROLEINFO')) {
// this.roleInfo = JSON.parse(localStorage.getItem('ROLEINFO'))
// this.roleList = JSON.parse(localStorage.getItem('ROLELIST'))
// setTimeout(() => {
// this.roleForm.setFieldsValue({
// roleName: this.roleInfo.roleName,
// desp: this.roleInfo.desp,
// })
// }, 10)
// this.secondBreadcrumb = ''
// }
else {
this.secondBreadcrumb = '添加角色' this.secondBreadcrumb = '添加角色'
this.getRolePermission()
} }
this.roleList = JSON.parse(this.$route.query.roleList)
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList)) this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.$emit('setTitle', this.secondBreadcrumb) this.$emit('setTitle', this.secondBreadcrumb)
}, },
@ -379,6 +127,73 @@ export default {
cancelAdd() { cancelAdd() {
this.$router.back() this.$router.back()
}, },
getRoleInfo(id, type) {
getRoleInfoApi(id).then(({ data }) => {
if (data.status == 200) {
if (!type) {
this.roleInfo = data.data.role
this.roleForm.setFieldsValue({
roleName: this.roleInfo.roleName,
desp: this.roleInfo.desp,
})
} else {
this.showScopeType = data.data.role.visibleRange
}
this.handlePermission(data.data.menus)
}
})
},
getRolePermission() {
getRolePermissionApi().then(({ data }) => {
console.log(data)
if (data.status == 200) {
this.handlePermission(data.data.menus)
}
})
},
/**
* 处理返回的权限列表
*/
handlePermission(menus) {
console.log(menus)
menus.forEach((item) => {
// console.log(item)
item.checked = false
let tagNamesList = item.tagNames.split(',')
item.tagNamesList = []
tagNamesList.forEach((namieItem, index) => {
let label
if (namieItem == 'addTag') {
label = '新增'
} else if (namieItem == 'updateTag') {
label = '修改'
} else if (namieItem == 'deleteTag') {
label = '删除'
} else if (namieItem == 'queryTag') {
label = '查询'
} else if (namieItem == 'exportTag') {
label = '导出'
} else if (namieItem == 'importTag') {
label = '导入'
}
let checked = false
for (var k in item) {
if (item[namieItem] == 1) {
checked = true
item.checked = true
}
}
item.tagNamesList.push({
id: index,
type: namieItem,
label,
checked,
})
})
})
this.authorityList = menus
},
/** /**
* 添加角色信息表单提交 * 添加角色信息表单提交
*/ */
@ -387,29 +202,55 @@ export default {
console.log(err) console.log(err)
console.log(this.roleForm.getFieldsValue()) console.log(this.roleForm.getFieldsValue())
if (err == null) { if (err == null) {
if (this.showScopeType == 0) {
this.$message.warning('请选择数据可见范围')
return
}
let menus = []
this.authorityList.forEach((item) => {
let obj = {}
item.tagNamesList.forEach((subItem) => {
obj[subItem.type] = item[subItem.type]
obj['menuId'] = item.id
})
console.log(obj)
menus.push(obj)
console.log(menus)
// for (var k in item) {
// if (k == 'addTag' || k == 'deleteTag' || k == 'exportTag' || k == 'importTag' || k == 'queryTag' || k == 'updateTag') {
// obj[k] = item[k]
// } else if (k == 'id') {
// obj.menuId = item[k]
// }
// }
})
let formData = this.roleForm.getFieldsValue() let formData = this.roleForm.getFieldsValue()
delete formData.agencyTeamId
if (this.secondBreadcrumb == '添加角色') { if (this.secondBreadcrumb == '添加角色') {
addRoleApi({ addRoleApi({
...formData, ...formData,
menus: JSON.stringify(menus),
visibleRange: this.showScopeType,
}).then(({ data }) => { }).then(({ data }) => {
console.log(data) console.log(data)
if (data.status == 200) { if (data.status == 200) {
this.secondBreadcrumb = '' this.secondBreadcrumb = ''
this.$message.success('添加成功') this.$message.success('添加成功')
this.getRoleList() this.$router.back()
} }
}) })
} else { } else {
updateRoleApi({ updateRoleApi({
...formData, ...formData,
recordId: currentRole.id, recordId: this.currentRoleId,
menus: JSON.stringify(menus),
visibleRange: this.showScopeType,
}).then(({ data }) => { }).then(({ data }) => {
console.log(data) console.log(data)
if (data.status == 200) { if (data.status == 200) {
this.secondBreadcrumb = '' this.secondBreadcrumb = ''
this.$message.success('修改成功') this.$message.success('修改成功')
this.getRoleList() this.$router.back()
} }
}) })
} }
@ -417,20 +258,54 @@ export default {
}) })
}, },
showScopeChange(e) { showScopeChange(e) {
console.log(e) this.showScopeType = e.target.value
}, },
checkboxChange(e, key, index) { /**
// console.log(e) * 角色权限全选反选
// console.log(key) */
// console.log(index) checkboxChange(item, subItem) {
// console.log(this.authorityList[key]); var value = this.authorityList[this.authorityList.indexOf(item)] //
// console.log(this.authorityList[key][index]); //
if (e.children) { if (!subItem) {
this.authorityList[key].checked = !this.authorityList[key].checked value.checked = !value.checked
value.tagNamesList.forEach((item) => {
item.checked = value.checked
if (item.checked) {
value[item.type] = 1
} else { } else {
this.authorityList[key].children[index].checked = !this.authorityList[key].children[index].checked value[item.type] = 0
} }
console.log(this.authorityList) })
} else {
// debugger
let subInd = value.tagNamesList.indexOf(subItem)
console.log(subInd)
value.tagNamesList[subInd].checked = !value.tagNamesList[subInd].checked
let result = value.tagNamesList.some((item) => {
return item.checked == true
})
if (result) {
value.checked = true
} else {
value.checked = false
}
}
value.tagNamesList.forEach((item) => {
console.log(item)
if (item.checked) {
value[item.type] = 1
} else {
value[item.type] = 0
}
})
console.log(value)
},
/**
* 选区基础角色作为权限
*/
setRoleBase(val) {
console.log(val)
this.getRoleInfo(val.id, 'permission')
}, },
}, },
} }
@ -453,10 +328,13 @@ export default {
justify-content: start; justify-content: start;
width: 400px; width: 400px;
> label { > label {
width: 23%; // width: 23%;
} }
// >label:not(:first-child){ // >label:not(:first-child){
// margin-left: 64px; // margin-left: 64px;
// } // }
} }
.fss {
align-items: flex-start;
}
</style> </style>

@ -16,10 +16,15 @@
<div class="contentbody bodyContainer"> <div class="contentbody bodyContainer">
<div class="fsa pb16" v-if="secondBreadcrumb == ''"> <div class="fsa pb16" v-if="secondBreadcrumb == ''">
<div class="f20 fw500">{{secondBreadcrumb || '角色管理'}}</div> <div class="f20 fw500">{{secondBreadcrumb || '角色管理'}}</div>
<div>
<a-button class="f14 mr16" @click="makeOver()">
转让创建人
</a-button>
<a-button class="addmemeber f14" @click="addRole('add')"> <a-button class="addmemeber f14" @click="addRole('add')">
<i class="iconfont icon-fangda mr4"></i> 添加角色 <i class="iconfont icon-fangda mr4"></i> 添加角色
</a-button> </a-button>
</div> </div>
</div>
<div v-if="secondBreadcrumb == ''"> <div v-if="secondBreadcrumb == ''">
<a-table :columns="columns" :data-source="roleList" :pagination="false" @change="onChange" :loading="{spinning: isspinning,tip: '加载中',wrapperClassName: 'spinstyle'}" :rowKey="(record) => record.id"> <a-table :columns="columns" :data-source="roleList" :pagination="false" @change="onChange" :loading="{spinning: isspinning,tip: '加载中',wrapperClassName: 'spinstyle'}" :rowKey="(record) => record.id">
<!-- <a slot="index" slot-scope="record, text, index">{{ index + 1 }}</a> --> <!-- <a slot="index" slot-scope="record, text, index">{{ index + 1 }}</a> -->
@ -34,6 +39,14 @@
</div> </div>
</div> </div>
</div> </div>
<a-modal :title="makeOverStep == 0 ? '选择创建人':'安全验证'" :visible="showModal">
<div v-if="makeOverStep == 0">123123</div>
<div v-if="makeOverStep == 1">345345</div>
<div slot="footer">
<a-button type @click="choieCreator"></a-button>
<a-button type="primary" @click="makeOverCancel"></a-button>
</div>
</a-modal>
</div> </div>
</template> </template>
@ -61,8 +74,9 @@ export default {
), ),
}, },
secondBreadcrumb: '', secondBreadcrumb: '',
roleList: [1, 2, 3, 4], roleList: [],
makeOverStep: 0,
showModal: false,
pagination: { pagination: {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
@ -222,6 +236,28 @@ export default {
}, },
}) })
}, },
makeOverCancel() {
this.makeOverStep = 0
this.showModal = false
},
/**
* 转让创建人选择创建人
*/
choieCreator(e) {
if (this.makeOverStep == 0) {
this.makeOverStep = 1
} else {
console.log('code')
}
},
/**
* 转让创建人输入验证码
*/
inputCode() {
},
/**
* 添加角色
*/
addRole(type, val) { addRole(type, val) {
let that = this let that = this
this.currentRole = val this.currentRole = val
@ -260,6 +296,15 @@ export default {
} }
this.$forceUpdate() this.$forceUpdate()
}, },
/**
* 转让创建人
*/
makeOver() {
this.showModal = true
},
/**
* 删除角色
*/
delRole(val) { delRole(val) {
let that = this let that = this
that.$confirm({ that.$confirm({
@ -279,6 +324,9 @@ export default {
onCancel() {}, onCancel() {},
}) })
}, },
/**
* 获取角色列表
*/
getRoleList() { getRoleList() {
getRoleListApi().then(({ data }) => { getRoleListApi().then(({ data }) => {
console.log(data) console.log(data)

@ -1,5 +1,5 @@
<template> <template>
<div class="rightContainer" style=" min-width: 915px" > <div class="rightContainer" style=" min-width: 915px">
<a-breadcrumb class="newBreadcrumb mt0 mb16"> <a-breadcrumb class="newBreadcrumb mt0 mb16">
<a-breadcrumb-item href> <a-breadcrumb-item href>
<router-link :to="{name:'merchantBack'}"> <router-link :to="{name:'merchantBack'}">
@ -39,7 +39,7 @@
<div>数据可见范围</div> <div>数据可见范围</div>
<div> <div>
<!-- <a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: '1' },{ label: '部门数据', value: '2' },{ label: '个人数据', value: '3' },]" @change="showScopeChange" /> --> <!-- <a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: '1' },{ label: '部门数据', value: '2' },{ label: '个人数据', value: '3' },]" @change="showScopeChange" /> -->
<span>公司数据</span> <span>{{roleInfo.visibleRangeText || '-'}}</span>
</div> </div>
</div> </div>
<div class="title fss"> <div class="title fss">
@ -48,18 +48,18 @@
</div> </div>
<a-divider class="mt8 mb32" /> <a-divider class="mt8 mb32" />
<div v-for="(item, key) in authorityList" style class="pl24"> <div v-for="(item, key) in authorityList" style class>
<div class="fss"> <div class="fss ml24">
<!-- <a-checkbox :checked="item.checked" style="width:88px" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox> --> <!-- <a-checkbox :checked="item.checked" style="width:88px" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox> -->
<label style="width:88px">{{item.label}}</label> <label style="width:88px">{{item.title}}</label>
<span class="ml24 subChecked" style="margin-left:288px"> <span class="ml24 subChecked" style="margin-left:288px">
<!-- <a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox> --> <!-- <a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox> -->
<label v-for="(subItem, subIndex) in item.children">{{subItem.label}}</label> <label v-for="(subItem, subIndex) in item.tagNamesList" :class="subItem.checked ? '' : 'cccc'">{{subItem.label}}</label>
</span> </span>
</div> </div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" /> <a-divider class="mt16 mb32" />
<a-divider class="mt16 mb32" style="background:#ccc" v-else /> <!-- <a-divider class="mt16 mb32" style="background:#ccc" v-else /> -->
</div> </div>
<!-- <a-form-item style="transform:translateY(-10px)"> <!-- <a-form-item style="transform:translateY(-10px)">
<a-button type class="mr16" @click="cancelAdd"></a-button> <a-button type class="mr16" @click="cancelAdd"></a-button>
@ -71,7 +71,7 @@
</template> </template>
<script> <script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig' import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi, getRoleInfoApi, getRolePermissionApi } from '../../api/merchantConfig'
export default { export default {
// //
@ -83,244 +83,7 @@ export default {
// //
data() { data() {
return { return {
authorityList: { authorityList: [],
dtzw: {
id: 1,
label: '稻田职位',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
wdbm: {
id: 2,
label: '我的报名',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
wdlx: {
id: 3,
label: '我的老乡',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
xx: {
id: 4,
label: '消息',
checked: false,
children: [
{
id: 1,
label: '系统消息',
checked: false,
},
{
id: 2,
label: '团队消息',
checked: false,
},
],
},
ttcy: {
id: 5,
label: '团队成员',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
jsgl: {
id: 6,
label: '角色管理',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
tdsj: {
id: 7,
label: '团队数据',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
],
},
sjdp: {
id: 8,
label: '数据大屏',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
],
},
tzzx: {
id: 9,
label: '通知中心',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
tvpz: {
id: 10,
label: 'TV配置',
checked: false,
children: [
{
id: 1,
label: '查看',
checked: false,
},
{
id: 2,
label: '新建',
checked: false,
},
{
id: 3,
label: '编辑',
checked: false,
},
{
id: 4,
label: '删除',
checked: false,
},
],
},
// gzt: {
// id: 7,
// label: '',
// checked: false,
// children: [],
// },
},
secondBreadcrumb: '', secondBreadcrumb: '',
roleForm: this.$form.createForm(this), roleForm: this.$form.createForm(this),
showScopeType: 1, showScopeType: 1,
@ -338,19 +101,13 @@ export default {
*/ */
created() { created() {
console.log(this.$route) console.log(this.$route)
// console.log(localStorage.getItem('ROLEINFO'))
if (this.$route.query.item) { if (this.$route.query.item) {
this.roleInfo = JSON.parse(this.$route.query.item) this.roleInfo = JSON.parse(this.$route.query.item)
// localStorage.setItem('ROLEINFO', JSON.stringify(this.roleInfo)) this.currentRoleId = JSON.parse(this.$route.query.item).id
} }
// else if (localStorage.getItem('ROLEINFO')) {
// console.log(123)
// this.roleInfo = JSON.parse(localStorage.getItem('ROLEINFO'))
// }
this.secondBreadcrumb = '角色详情' this.secondBreadcrumb = '角色详情'
// this.roleList = this.$route.query.roleList
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.$emit('setTitle', this.secondBreadcrumb) this.$emit('setTitle', this.secondBreadcrumb)
this.getRoleInfo(this.currentRoleId)
}, },
/** /**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子 * el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
@ -362,42 +119,68 @@ export default {
cancelAdd() { cancelAdd() {
this.$router.back() this.$router.back()
}, },
/** getRoleInfo(id, type) {
* 添加角色信息表单提交 getRoleInfoApi(id).then(({ data }) => {
*/
addSubmit() {
this.roleForm.validateFields(async (err) => {
console.log(err)
console.log(this.roleForm.getFieldsValue())
if (err == null) {
let formData = this.roleForm.getFieldsValue()
delete formData.agencyTeamId
if (this.secondBreadcrumb == '添加角色') {
addRoleApi({
...formData,
}).then(({ data }) => {
console.log(data) console.log(data)
if (data.status == 200) { if (data.status == 200) {
this.secondBreadcrumb = '' this.roleInfo = data.data.role
this.$message.success('添加成功') if (this.roleInfo.visibleRange == 1) {
this.getRoleList() this.roleInfo.visibleRangeText = '公司数据'
} else if (this.roleInfo.visibleRange == 2) {
this.roleInfo.visibleRangeText = '部门数据'
} else if (this.roleInfo.visibleRange == 3) {
this.roleInfo.visibleRangeText = '个人数据'
} }
})
} else { // this.roleForm.setFieldsValue({
updateRoleApi({ // roleName: this.roleInfo.roleName,
...formData, // desp: this.roleInfo.desp,
recordId: currentRole.id, // })
}).then(({ data }) => { this.handlePermission(data.data.menus)
console.log(data)
if (data.status == 200) {
this.secondBreadcrumb = ''
this.$message.success('修改成功')
this.getRoleList()
} }
}) })
},
/**
* 处理返回的权限列表
*/
handlePermission(menus) {
console.log(menus)
menus.forEach((item) => {
// console.log(item)
item.checked = false
let tagNamesList = item.tagNames.split(',')
item.tagNamesList = []
tagNamesList.forEach((namieItem, index) => {
let label
if (namieItem == 'addTag') {
label = '新增'
} else if (namieItem == 'updateTag') {
label = '修改'
} else if (namieItem == 'deleteTag') {
label = '删除'
} else if (namieItem == 'queryTag') {
label = '查询'
} else if (namieItem == 'exportTag') {
label = '导出'
} else if (namieItem == 'importTag') {
label = '导入'
}
let checked = false
for (var k in item) {
if (item[namieItem] == 1) {
checked = true
item.checked = true
} }
} }
item.tagNamesList.push({
id: index,
type: namieItem,
label,
checked,
}) })
})
})
this.authorityList = menus
}, },
showScopeChange(e) { showScopeChange(e) {
console.log(e) console.log(e)
@ -436,10 +219,14 @@ export default {
justify-content: start; justify-content: start;
width: 400px; width: 400px;
> label { > label {
width: 23%; padding: 0 24px 0 0;
// width: 23%;
} }
// >label:not(:first-child){ // >label:not(:first-child){
// margin-left: 64px; // margin-left: 64px;
// } // }
} }
.fss {
align-items: flex-start;
}
</style> </style>

@ -113,6 +113,7 @@
<script> <script>
import { logoutApi } from '../api/login' import { logoutApi } from '../api/login'
import { getMenuListApi } from '../api/merchantConfig'
export default { export default {
inject: ['reload'], inject: ['reload'],
@ -555,7 +556,9 @@ export default {
/** /**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在 * 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/ */
created() {}, created() {
this.getMenuList()
},
/** /**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子 * el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内 * 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
@ -576,6 +579,12 @@ export default {
}, },
// //
methods: { methods: {
getMenuList() {
getMenuListApi().then((res) => {
console.log(res)
})
},
onTrigger(a) { onTrigger(a) {
this.collapsed = !this.collapsed this.collapsed = !this.collapsed
if (this.collapsed) { if (this.collapsed) {

Loading…
Cancel
Save