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

@ -3,6 +3,40 @@ import qs from "qs";
let setqs = function (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) {
return request({
@ -37,32 +71,6 @@ export function updateMemberApi (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) {
return request({
@ -154,8 +162,25 @@ export function addRoleApi (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) {
return request({
url: "/yishoudan/agency/role/update",
method: "post",

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

@ -30,8 +30,8 @@
<a-form-item>
<div class>
<a-select class="mr8 ml8" style="width:360px" placeholder=" 请在已有的角色选择" v-decorator="['agencyTeamId',{ rules: [{ required: false, message: ' 请在已有的角色选择' }] },]" dropdownClassName="groupSelectDrop">
<a-select-option :value="item.roleName" v-for="(item,index) in roleList">{{item.roleName}}</a-select-option>
<a-select class="mr8 ml8" style="width:360px" placeholder=" 请在已有的角色选择" dropdownClassName="groupSelectDrop">
<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 v-for="(item,index) in roleList" @click="choiceGroup(item)" class="groupSelectSub fsa" :key="index">
<div>{{item.roleName}}</div>
@ -43,7 +43,7 @@
<div class="showScope">
<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 class="title fss">
@ -54,14 +54,14 @@
<div v-for="(item, key) in authorityList" class>
<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">
<a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox>
<span class="ml24 subChecked" style="margin-left:276px">
<a-checkbox v-for="(subItem, subIndex) in item.tagNamesList" :key="subIndex" :checked="subItem.checked" @change="checkboxChange(item,subItem)">{{subItem.label}}</a-checkbox>
</span>
</div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" />
<a-divider class="mt16 mb32" style="background:#ccc" v-else />
<a-divider class="mt16 mb32" />
<!-- <a-divider class="mt16 mb32" style="background:#ccc" v-else /> -->
</div>
<a-form-item style="transform:translateY(-10px)">
<a-button type class="mr16" @click="cancelAdd"></a-button>
@ -73,7 +73,7 @@
</template>
<script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig'
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi, getRolePermissionApi, getRoleInfoApi } from '../../api/merchantConfig'
export default {
//
@ -85,248 +85,13 @@ export default {
//
data() {
return {
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: [],
// },
},
authorityList: [],
secondBreadcrumb: '',
roleForm: this.$form.createForm(this),
showScopeType: 1,
showScopeType: 0, //
roleList: [],
currentRoleId: null,
roleInfo: {},
}
},
//
@ -340,32 +105,15 @@ export default {
created() {
console.log(this.$route)
if (this.$route.query.item) {
this.roleInfo = JSON.parse(this.$route.query.item)
this.roleList = JSON.parse(this.$route.query.roleList)
setTimeout(() => {
this.roleForm.setFieldsValue({
roleName: this.roleInfo.roleName,
desp: this.roleInfo.desp,
})
}, 10)
this.currentRoleId = JSON.parse(this.$route.query.item).id
this.showScopeType = JSON.parse(this.$route.query.item).visibleRange
this.secondBreadcrumb = '编辑角色'
// localStorage.setItem('ROLEINFO', JSON.stringify(this.roleInfo))
// localStorage.setItem('ROLELIST', JSON.stringify(this.roleList))
}
// 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.getRoleInfo(this.currentRoleId)
} else {
this.secondBreadcrumb = '添加角色'
this.getRolePermission()
}
this.roleList = JSON.parse(this.$route.query.roleList)
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.$emit('setTitle', this.secondBreadcrumb)
},
@ -379,6 +127,73 @@ export default {
cancelAdd() {
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(this.roleForm.getFieldsValue())
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()
delete formData.agencyTeamId
if (this.secondBreadcrumb == '添加角色') {
addRoleApi({
...formData,
menus: JSON.stringify(menus),
visibleRange: this.showScopeType,
}).then(({ data }) => {
console.log(data)
if (data.status == 200) {
this.secondBreadcrumb = ''
this.$message.success('添加成功')
this.getRoleList()
this.$router.back()
}
})
} else {
updateRoleApi({
...formData,
recordId: currentRole.id,
recordId: this.currentRoleId,
menus: JSON.stringify(menus),
visibleRange: this.showScopeType,
}).then(({ data }) => {
console.log(data)
if (data.status == 200) {
this.secondBreadcrumb = ''
this.$message.success('修改成功')
this.getRoleList()
this.$router.back()
}
})
}
@ -417,20 +258,54 @@ export default {
})
},
showScopeChange(e) {
console.log(e)
this.showScopeType = e.target.value
},
checkboxChange(e, key, index) {
// console.log(e)
// console.log(key)
// console.log(index)
// console.log(this.authorityList[key]);
// console.log(this.authorityList[key][index]);
if (e.children) {
this.authorityList[key].checked = !this.authorityList[key].checked
/**
* 角色权限全选反选
*/
checkboxChange(item, subItem) {
var value = this.authorityList[this.authorityList.indexOf(item)] //
//
if (!subItem) {
value.checked = !value.checked
value.tagNamesList.forEach((item) => {
item.checked = value.checked
if (item.checked) {
value[item.type] = 1
} else {
value[item.type] = 0
}
})
} else {
this.authorityList[key].children[index].checked = !this.authorityList[key].children[index].checked
// 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
}
}
console.log(this.authorityList)
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;
width: 400px;
> label {
width: 23%;
// width: 23%;
}
// >label:not(:first-child){
// margin-left: 64px;
// }
}
.fss {
align-items: flex-start;
}
</style>

@ -16,9 +16,14 @@
<div class="contentbody bodyContainer">
<div class="fsa pb16" v-if="secondBreadcrumb == ''">
<div class="f20 fw500">{{secondBreadcrumb || '角色管理'}}</div>
<a-button class="addmemeber f14" @click="addRole('add')">
<i class="iconfont icon-fangda mr4"></i> 添加角色
</a-button>
<div>
<a-button class="f14 mr16" @click="makeOver()">
转让创建人
</a-button>
<a-button class="addmemeber f14" @click="addRole('add')">
<i class="iconfont icon-fangda mr4"></i> 添加角色
</a-button>
</div>
</div>
<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">
@ -34,6 +39,14 @@
</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>
</template>
@ -61,8 +74,9 @@ export default {
),
},
secondBreadcrumb: '',
roleList: [1, 2, 3, 4],
roleList: [],
makeOverStep: 0,
showModal: false,
pagination: {
pageNum: 1,
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) {
let that = this
this.currentRole = val
@ -260,6 +296,15 @@ export default {
}
this.$forceUpdate()
},
/**
* 转让创建人
*/
makeOver() {
this.showModal = true
},
/**
* 删除角色
*/
delRole(val) {
let that = this
that.$confirm({
@ -279,6 +324,9 @@ export default {
onCancel() {},
})
},
/**
* 获取角色列表
*/
getRoleList() {
getRoleListApi().then(({ data }) => {
console.log(data)

@ -1,5 +1,5 @@
<template>
<div class="rightContainer" style=" min-width: 915px" >
<div class="rightContainer" style=" min-width: 915px">
<a-breadcrumb class="newBreadcrumb mt0 mb16">
<a-breadcrumb-item href>
<router-link :to="{name:'merchantBack'}">
@ -39,7 +39,7 @@
<div>数据可见范围</div>
<div>
<!-- <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 class="title fss">
@ -48,18 +48,18 @@
</div>
<a-divider class="mt8 mb32" />
<div v-for="(item, key) in authorityList" style class="pl24">
<div class="fss">
<div v-for="(item, key) in authorityList" style class>
<div class="fss ml24">
<!-- <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">
<!-- <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>
</div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" />
<a-divider class="mt16 mb32" style="background:#ccc" v-else />
<a-divider class="mt16 mb32" />
<!-- <a-divider class="mt16 mb32" style="background:#ccc" v-else /> -->
</div>
<!-- <a-form-item style="transform:translateY(-10px)">
<a-button type class="mr16" @click="cancelAdd"></a-button>
@ -71,7 +71,7 @@
</template>
<script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig'
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi, getRoleInfoApi, getRolePermissionApi } from '../../api/merchantConfig'
export default {
//
@ -83,244 +83,7 @@ export default {
//
data() {
return {
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: [],
// },
},
authorityList: [],
secondBreadcrumb: '',
roleForm: this.$form.createForm(this),
showScopeType: 1,
@ -338,19 +101,13 @@ export default {
*/
created() {
console.log(this.$route)
// console.log(localStorage.getItem('ROLEINFO'))
if (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.roleList = this.$route.query.roleList
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.$emit('setTitle', this.secondBreadcrumb)
this.getRoleInfo(this.currentRoleId)
},
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
@ -362,42 +119,68 @@ export default {
cancelAdd() {
this.$router.back()
},
getRoleInfo(id, type) {
getRoleInfoApi(id).then(({ data }) => {
console.log(data)
if (data.status == 200) {
this.roleInfo = data.data.role
if (this.roleInfo.visibleRange == 1) {
this.roleInfo.visibleRangeText = '公司数据'
} else if (this.roleInfo.visibleRange == 2) {
this.roleInfo.visibleRangeText = '部门数据'
} else if (this.roleInfo.visibleRange == 3) {
this.roleInfo.visibleRangeText = '个人数据'
}
// this.roleForm.setFieldsValue({
// roleName: this.roleInfo.roleName,
// desp: this.roleInfo.desp,
// })
this.handlePermission(data.data.menus)
}
})
},
/**
* 添加角色信息表单提交
* 处理返回的权限列表
*/
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)
if (data.status == 200) {
this.secondBreadcrumb = ''
this.$message.success('添加成功')
this.getRoleList()
}
})
} else {
updateRoleApi({
...formData,
recordId: currentRole.id,
}).then(({ data }) => {
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) {
console.log(e)
@ -436,10 +219,14 @@ export default {
justify-content: start;
width: 400px;
> label {
width: 23%;
padding: 0 24px 0 0;
// width: 23%;
}
// >label:not(:first-child){
// margin-left: 64px;
// }
}
.fss {
align-items: flex-start;
}
</style>

@ -90,7 +90,7 @@
</a-layout-header>
<a-layout-content class="trans" :style="{ margin: '2px 0 0 0', paddingLeft: pLeft, paddingTop: pTop }">
<div style="padding:16px 16px 0">
<router-view @setTitle="setTitle"></router-view>
<router-view @setTitle="setTitle"></router-view>
</div>
</a-layout-content>
<a-layout-footer :style="{ marginLeft: pLeft }" class="tac f12" style="textalign: center">
@ -113,6 +113,7 @@
<script>
import { logoutApi } from '../api/login'
import { getMenuListApi } from '../api/merchantConfig'
export default {
inject: ['reload'],
@ -555,7 +556,9 @@ export default {
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
created() {},
created() {
this.getMenuList()
},
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
@ -576,6 +579,12 @@ export default {
},
//
methods: {
getMenuList() {
getMenuListApi().then((res) => {
console.log(res)
})
},
onTrigger(a) {
this.collapsed = !this.collapsed
if (this.collapsed) {

Loading…
Cancel
Save