角色管理页面

cyl/dev
wangxia 3 years ago
parent 0738cdb388
commit de03aaf72f

@ -108,3 +108,9 @@ export function getHotStoreApi() {
url: `/yishoudan/store/getHotStore`,
});
}
// 获取筛选分类
export function getClassifyListApi() {
return request({
url: `/yishoudan/labels/type/95`,
});
}

@ -516,6 +516,7 @@ import {
getHotCityApi,
getCityWhichHasJobApi,
getHotStoreApi,
getClassifyListApi,
// getCityApi,
} from '../../api/job'
import $ from 'jquery'
@ -797,6 +798,8 @@ export default {
this.getHotCity()
this.getCityWhichHasJob()
this.getHotStore()
this.getClassifyList()
this.hideFilterContent()
if (isNotEmptyCheck(localStorage.getItem('POSITION_INFO'))) {
let position = JSON.parse(localStorage.getItem('POSITION_INFO'))
@ -1326,6 +1329,17 @@ export default {
// console.log(error);
}
},
async getClassifyList() {
try {
const { data } = await getClassifyListApi()
console.log(data);
if (data.status == 200) {
console.log(data);
}
} catch (error) {
// console.log(error);
}
},
changeCurrentCity(index) {
this.currentCityList = this.hasJobCityList.cityList[index]
// console.log(index);
@ -2954,7 +2968,7 @@ export default {
}
}
}
p{
p {
margin-bottom: 0;
}
</style>

@ -165,6 +165,17 @@
</a-select>
</a-form-model-item>-->
<a-form-model-item ref="policy" label="政策" prop="policy" class="policyContainer" :wrapperCol="{ span: 18 }" :labelCol="{ span: 4 }">
<div class="policy" style="min-height: 30px !important">{{form.policy }}</div>
<div style class="mb20 mt12">
<a-radio-group v-model="currentPolicy" class="fss policyRadios" @change="policyChange($event)">
<div v-for="(item,index) in zhengceTextList" class="mt12">
<a-radio class="fss" :value="item.value">
<!-- {{'政策' + (index + 1)}} -->
<span class="mt12" style="max-width:480px;white-space: pre-line;">{{item.name}}</span>
</a-radio>
</div>
</a-radio-group>
</div>
<!-- <a-input v-model="form.policy" type='textarea'/> -->
<!-- <div style="transform:translateY(8px)" v-if="form.policy.length != 0">
<a-radio-group v-model="currentPolicy" @change="policyChange($event)">
@ -177,11 +188,11 @@
</a-radio-group>
</div>
<div v-else>-</div>-->
<div class="policy" style="min-height: 30px !important">{{ form.policy }}</div>
<!-- <div class="policy" style="min-height: 30px !important">{{ form.policy }}</div>
<div class="openContral" v-if="isContainerShow">
<span v-if="isFold" @click="toFold(1)"></span>
<span v-else @click="toFold(2)"></span>
</div>
</div>-->
</a-form-model-item>
<a-form-model-item ref="desp" style="margin-bottom:12px;" label="备注" prop="desp" :wrapperCol="{ span: 18 }" :labelCol="{ span: 4 }">
@ -224,7 +235,7 @@ import { nationlist } from '../../utils/datalist'
import moment from 'moment'
import { isEmptyCheck, getAgeFromBirthday } from '../../utils/commonUtil'
import timepicker from './components/timepicker.vue'
import { recordBillApi, getProxyInfoApi, getStoreAliasApi, getStoreJobApi, getPolicyByJobIdApi, getPolicyListByJobIdApi } from '@/api/job'
import { recordBillApi, getProxyInfoApi, getStoreAliasApi, getStoreJobApi, getPolicyByJobIdApi, getPolicyListByJobIdApi, getJobDetailApi } from '@/api/job'
import request from '@/utils/request'
import qs from 'qs'
// import axios from "axios";
@ -366,6 +377,8 @@ export default {
proxyinfo: {},
firminfo: {},
zhengceTextList: [],
policyNum: 0, //
}
},
//
@ -393,10 +406,12 @@ export default {
if (this.proxyinfo.roleOfPmd) {
this.isMaster = true
}
console.log(this.proxyinfo);
console.log(this.proxyinfo)
this.getProxyInfo(this.proxyinfo.id)
this.getJob(this.firminfo)
this.getPolicyByJobId(this.firminfo.id)
this.getPolicyByJobId(this.firminfo.id || '').then(() => {
this.getJobDetail(this.firminfo.id || '')
})
// this.getPolicyListByJobId(this.firminfo.id)
},
/**
@ -417,18 +432,18 @@ export default {
let that = this
const policy = document.querySelector('.policy')
// this.$nextTick(()=>{
setTimeout(() => {
console.log(policy.offsetHeight)
console.log(policy.innerHTML)
if (policy.offsetHeight >= 230) {
policy.style.maxHeight = '230px'
policy.style.marginBottom = '24px'
that.isContainerShow = true
} else {
policy.style.minHeight = '230px'
that.isContainerShow = false
}
}, 100)
// setTimeout(() => {
// console.log(policy.offsetHeight)
// console.log(policy.innerHTML)
// if (policy.offsetHeight >= 230) {
// policy.style.maxHeight = '230px'
// policy.style.marginBottom = '24px'
// that.isContainerShow = true
// } else {
// policy.style.minHeight = '230px'
// that.isContainerShow = false
// }
// }, 100)
}
} catch (error) {
console.log(error)
@ -464,17 +479,73 @@ export default {
console.log(error)
}
},
async getPolicyByJobId(value) {
console.log(value)
async getJobDetail(value) {
try {
const { data } = await getPolicyByJobIdApi(value)
const { data } = await getJobDetailApi(value)
console.log(data)
if (data.status === 200) {
this.form.policyNum = data.data.storeJob.policyNum
console.log(this.form.policyNum)
if (this.form.policyNum == '' && this.form.policy != '') {
this.form.policyNum = 1
console.log(this.form.policyNum)
}
let list = []
for (let i = 0; i < this.form.policyNum; i++) {
let pickerStr
if (i <= 9) {
switch (i) {
case 0:
pickerStr = '政策一'
break
case 1:
pickerStr = '政策二'
break
case 2:
pickerStr = '政策三'
break
case 3:
pickerStr = '政策四'
break
case 4:
pickerStr = '政策五'
break
case 5:
pickerStr = '政策六'
break
case 6:
pickerStr = '政策七'
break
case 7:
pickerStr = '政策八'
break
case 8:
pickerStr = '政策九'
break
case 9:
pickerStr = '政策十'
break
default:
pickerStr = '政策' + (index + 1)
break
}
list[i] = { value: i + 1, name: pickerStr }
}
}
console.log(list)
// policy: res.data.data,
// isShowZhedie: true,
this.zhengceTextList = list
}
} catch (error) {}
},
async getPolicyByJobId(value) {
return getPolicyByJobIdApi(value).then(({ data }) => {
console.log(data)
if (data.status === 200) {
this.form.policy = data.data
}
} catch (error) {
console.log(error)
}
})
},
onClose() {
this.form = {
@ -515,7 +586,7 @@ export default {
let dataObj = qs.stringify({
...this.form,
storeJobId: this.firminfo.id,
// storeJobPolicyId: this.currentPolicy,
policyIdx: this.currentPolicy,
// policy: '',
})
console.log(dataObj)
@ -712,8 +783,8 @@ export default {
let _self = this
this.loading = true
var formData = new FormData()
let str = file.file.name.replace(/\s/g, "")
_self.dataObj.key = _self.dataObj.key + str
let str = file.file.name.replace(/\s/g, '')
_self.dataObj.key = _self.dataObj.key + str
//formDataappend
formData.append('key', _self.dataObj.key) //oss
formData.append('OSSAccessKeyId', _self.dataObj.ossaccessKeyId) //accessKeyId
@ -802,8 +873,8 @@ export default {
let _self = this
var formData = new FormData()
let str = file.file.name.replace(/\s/g, "")
_self.dataObj.key = _self.dataObj.key + str
let str = file.file.name.replace(/\s/g, '')
_self.dataObj.key = _self.dataObj.key + str
//formDataappend
formData.append('key', _self.dataObj.key) //oss
formData.append('OSSAccessKeyId', _self.dataObj.ossaccessKeyId) //accessKeyId
@ -939,7 +1010,9 @@ export default {
// this.storeJobList = [];
// if(!isEmptyCheck(this.form.qiyeId)){
// this.getPolicyListByJobId(value.id)
this.getPolicyByJobId(value.id)
this.getPolicyByJobId(value.id).then(() => {
this.getJobDetail(value.id)
})
this.form.storeJobId = value.id
this.jobnameStatus = ''
this.firminfo.jobName = value.jobName
@ -1663,4 +1736,7 @@ export default {
/deep/ .ant-select-selection {
border-radius: 0px !important;
}
.policyRadios{
flex-wrap: wrap;
}
</style>

@ -0,0 +1,462 @@
<template>
<div class="rightContainer">
<a-breadcrumb class="newBreadcrumb mt0 mb16">
<a-breadcrumb-item href>
<router-link :to="{name:'merchantBack'}">
<a-icon type="home" />
</router-link>
</a-breadcrumb-item>
<a-breadcrumb-item>
<span @click="cancelAdd" v-if="secondBreadcrumb" style="cursor:pointer"></span>
<span v-else></span>
</a-breadcrumb-item>
<a-breadcrumb-item v-if="secondBreadcrumb">{{secondBreadcrumb}}</a-breadcrumb-item>
</a-breadcrumb>
<div class="bodyContainer">
<a-form :form="roleForm">
<!-- 角色信息 -->
<div class="fw500 mb16 f16">角色信息</div>
<div class="fss">
<a-form-item class="addItem fss" label="角色名称:">
<a-input placeholder="请输入角色名称" style="width:360px" v-decorator="[ 'roleName', { rules: [{ required: true, message: '' }] }, ]" />
</a-form-item>
<a-form-item class="addItem fss" label="角色描述:" style="margin-left:44px">
<a-input placeholder="请输入角色描述" style="width:360px" v-decorator="[ 'desp', { rules: [{ required: true, message: '' }] }, ]" />
</a-form-item>
</div>
<a-divider class="mt0" />
<!-- 功能权限 -->
<div class="fw500 mb16 f16">功能权限</div>
<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>
<!-- <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>
</div>
</div>-->
</a-select>
</div>
</a-form-item>
<div class="showScope">
<div>数据可见范围</div>
<div>
<a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: '1' },{ label: '部门数据', value: '2' },{ label: '个人数据', value: '3' },]" @change="showScopeChange" />
</div>
</div>
<div class="title fss">
<div class="ml24">可见页面</div>
<div style="margin-left:318px">功能权限</div>
</div>
<a-divider class="mt8 mb32" />
<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>
<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>
</div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" />
<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>
<a-button type="primary" html-type="submit" @click="addSubmit"></a-button>
</a-form-item>
</a-form>
</div>
</div>
</template>
<script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig'
export default {
//
name: 'AddRoleManagement',
//
components: {},
//
props: {},
//
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: [],
// },
},
secondBreadcrumb: '',
roleForm: this.$form.createForm(this),
showScopeType: 1,
roleList: [],
}
},
//
computed: {},
//
watch: {},
//
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
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.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.secondBreadcrumb = '添加角色'
}
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.$emit('setTitle', this.secondBreadcrumb)
},
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
*/
mounted() {},
//
methods: {
cancelAdd() {
this.$router.back()
},
/**
* 添加角色信息表单提交
*/
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()
}
})
}
}
})
},
showScopeChange(e) {
console.log(e)
},
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
} else {
this.authorityList[key].children[index].checked = !this.authorityList[key].children[index].checked
}
console.log(this.authorityList)
},
},
}
</script>
<style scoped lang="less">
.addItem {
width: 438px;
}
.showScope {
display: flex;
justify-content: space-between;
background-color: #eeeeee;
padding: 14px 24px;
min-width: 915px;
margin-bottom: 16px;
}
.subChecked {
display: flex;
justify-content: start;
width: 400px;
> label {
width: 23%;
}
// >label:not(:first-child){
// margin-left: 64px;
// }
}
</style>

@ -53,8 +53,5 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -53,8 +53,5 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -56,9 +56,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -430,9 +430,7 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
.searchbox {
.searchinput {
width: 280px;

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -30,70 +30,7 @@
</div>
</a-table>
<div class="pagecontainer mt16 fss dn">
<a-pagination :current="pagination.pageNum" :default-current="1" :defaultPageSize="20" :show-total="total => `${total}`" :total="pagination.total" @change="onChange" size="small" show-size-changer show-quick-jumper />
</div>
</div>
<div v-else-if="secondBreadcrumb == '' || secondBreadcrumb == ''">
<div>
<a-form :form="roleForm" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
<!-- 角色信息 -->
<div class="fw500 mb16 f16">角色信息</div>
<a-form-item class="addItem" label="角色名称:">
<a-input placeholder="请输入角色名称" v-decorator="[ 'roleName', { rules: [{ required: true, message: '' }] }, ]" />
</a-form-item>
<a-form-item class="addItem" label="角色描述:">
<a-input placeholder="请输入角色描述" v-decorator="[ 'desp', { rules: [{ required: true, message: '' }] }, ]" />
</a-form-item>
<a-divider />
<!-- 功能权限 -->
<div class="fw500 mb16 f16">功能权限</div>
<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>
<!-- <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>
</div>
</div>-->
</a-select>
</div>
</a-form-item>
<div v-for="(item, key) in authorityList">
<a-checkbox :checked="item.checked" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox>
<br />
<div class="ml24 mt16">
<a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox>
</div>
<a-divider />
</div>
<a-form-item>
<a-button type class="mr16" @click="cancelAdd"></a-button>
<a-button type="primary" html-type="submit" @click="addSubmit"></a-button>
</a-form-item>
</a-form>
</div>
</div>
<div v-if="secondBreadcrumb == '角色详情' ">
<div class="f20 fw500 pb16 bb1 mb24">角色详情</div>
<div class="fw500 mb16 f16">角色信息</div>
<div style="margin-bottom:24px" class="f14 fss">
<div class="c6">角色名称</div>
<div>{{ currentRole.roleName }}</div>
</div>
<div style="margin-bottom:24px" class="f14 fss">
<div class="c6">角色描述</div>
<div>{{ currentRole.desp }}</div>
</div>
<div class="fw500 mb16 f16">功能权限</div>
<div v-for="(item, key) in authorityList">
<a-checkbox :checked="item.checked" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox>
<br />
<div class="ml24 mt16">
<a-checkbox v-for="(subItem, subIndex) in item.children" :checked="subItem.checked" :disabled="!item.checked" @change="checkboxChange(subItem,key,subIndex)">{{subItem.label}}</a-checkbox>
</div>
<a-divider />
<a-pagination :current="pagination.pageNum" :default-current="1" :defaultPageSize="20" :show-total="total => `${total}`" :total="pagination.total" @change="onChange" size="small" show-size-changer show-quick-jumper />
</div>
</div>
</div>
@ -124,8 +61,8 @@ export default {
),
},
secondBreadcrumb: '',
roleForm: this.$form.createForm(this),
roleList: [1, 2, 3, 4],
pagination: {
pageNum: 1,
pageSize: 20,
@ -141,181 +78,7 @@ export default {
// searchTag: 1,
},
isspinning: false,
roleList: [
{
roleDesp: '',
roleCreateTime: '2023-10-20 14:27:17',
classify: 0,
aliasName: '',
userNum: 21,
labelId: 672,
pName: '稻田内测备注',
roleId: 145,
roleName: '稻田内测用户',
sort: 1,
roleType: 1,
labelName: '稻田内测用户',
},
{
roleDesp: '',
roleCreateTime: '2023-10-12 09:34:33',
classify: 0,
aliasName: '',
userNum: 2,
labelId: 670,
pName: '稻田内测备注',
roleId: 144,
roleName: '稻田内测用户1',
sort: 2,
roleType: 1,
labelName: '稻田内测用户1',
},
{
roleDesp: '',
roleCreateTime: '2023-10-12 09:34:33',
classify: 0,
aliasName: '',
userNum: 2,
labelId: 670,
pName: '稻田内测备注',
roleId: 144,
roleName: '稻田内测用户2',
sort: 2,
roleType: 1,
labelName: '稻田内测用户2',
},
],
middleauthor: null,
authorityList: {
dtzw: {
id: 1,
label: '稻田职位',
checked: false,
children: [
{
id: 1,
label: '查看职位列表',
checked: false,
},
{
id: 2,
label: '职位详情页',
checked: false,
},
{
id: 3,
label: '报名',
checked: false,
},
],
},
wdbm: {
id: 2,
label: '我的报名',
checked: false,
children: [
{
id: 1,
label: '查看报名信息',
checked: false,
},
{
id: 2,
label: '修改报名详情',
checked: false,
},
],
},
wdlx: {
id: 3,
label: '我的老乡',
checked: false,
children: [
{
id: 1,
label: '查看老乡信息',
checked: false,
},
{
id: 2,
label: '修改老乡详情',
checked: false,
},
],
},
tdsj: {
id: 4,
label: '团队数据',
checked: false,
children: [
{
id: 1,
label: '查看数据',
checked: false,
},
],
},
xx: {
id: 5,
label: '消息',
checked: false,
children: [
{
id: 1,
label: '系统消息',
checked: false,
},
{
id: 2,
label: '团队消息',
checked: false,
},
],
},
sjht: {
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,
},
{
id: 5,
label: '伯才TV',
checked: false,
},
{
id: 6,
label: '数据大屏',
checked: false,
},
],
},
gzt: {
id: 7,
label: '工作台',
checked: false,
children: [],
},
},
roleList: [],
}
},
//
@ -399,7 +162,6 @@ export default {
beforeCreate() {},
created() {
this.$emit('setTitle', '角色管理')
this.middleauthor = JSON.parse(JSON.stringify(this.authorityList))
this.getRoleList()
console.log(this.middleauthor)
},
@ -450,22 +212,51 @@ export default {
}
},
showDetail(val) {
let that = this
this.secondBreadcrumb = '角色详情'
console.log(val)
this.currentRole = val
that.$router.push({
name: 'RoleManagementDetail',
query: {
item: JSON.stringify(val),
},
})
},
addRole(type, val) {
let that = this
this.currentRole = val
if (type == 'add') {
this.secondBreadcrumb = '添加角色'
this.$confirm({
title: '添加角色',
content: '【添加角色】属高敏感权限,基于账户安全考虑,请再次确认是否创建',
onOk() {
that.$router.push({
name: 'AddRoleManagement',
query: {
// item: val,
type: 'add',
roleList: JSON.stringify(that.roleList),
},
})
},
onCancel() {},
})
// this.secondBreadcrumb = ''
} else {
this.secondBreadcrumb = '编辑角色'
setTimeout(() => {
this.roleForm.setFieldsValue({
roleName: val.roleName,
desp: val.desp,
})
}, 10)
this.$router.push({
name: 'AddRoleManagement',
query: {
item: JSON.stringify(val),
roleList: JSON.stringify(this.roleList),
},
})
// this.secondBreadcrumb = ''
// setTimeout(() => {
// this.roleForm.setFieldsValue({
// roleName: val.roleName,
// desp: val.desp,
// })
// }, 10)
}
this.$forceUpdate()
},
@ -496,49 +287,12 @@ export default {
}
})
},
/**
* 添加角色信息表单提交
*/
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()
}
})
}
}
})
},
/**
* 删除角色信息表单提交
*/
delSubmit(val) {
console.log(val);
console.log(val)
delRoleApi(val.id).then(({ data }) => {
console.log(data)
if (data.status == 200) {
@ -547,7 +301,6 @@ export default {
this.getRoleList()
} else {
this.$message.fail('删除失败')
}
})
},
@ -557,16 +310,13 @@ export default {
cancelAdd() {
this.secondBreadcrumb = ''
this.authorityList = JSON.parse(JSON.stringify(this.middleauthor))
// this.authorityList = JSON.parse(JSON.stringify(this.middleauthor))
},
},
}
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
.addmemeber {
border: 0;
padding: 0 12px;
@ -582,9 +332,7 @@ export default {
background: #40a9ff;
}
}
.addItem {
width: 468px;
}
.ant-divider {
margin: 16px 0 22px 0;
}

@ -0,0 +1,445 @@
<template>
<div class="rightContainer" style=" min-width: 915px" >
<a-breadcrumb class="newBreadcrumb mt0 mb16">
<a-breadcrumb-item href>
<router-link :to="{name:'merchantBack'}">
<a-icon type="home" />
</router-link>
</a-breadcrumb-item>
<a-breadcrumb-item>
<span @click="cancelAdd" v-if="secondBreadcrumb" style="cursor:pointer"></span>
<span v-else></span>
</a-breadcrumb-item>
<a-breadcrumb-item v-if="secondBreadcrumb">{{secondBreadcrumb}}</a-breadcrumb-item>
</a-breadcrumb>
<div class="bodyContainer">
<a-form :form="roleForm">
<!-- 角色信息 -->
<div class="fw500 mb16 f16">角色信息</div>
<div class="fss">
<a-form-item class="addItem fss" label="角色名称:">
<span>{{roleInfo.roleName || '-'}}</span>
</a-form-item>
<a-form-item class="addItem fss" label="角色描述:" style="margin-left:44px">
<span>{{roleInfo.desp || '-'}}</span>
</a-form-item>
</div>
<a-divider class="mt0" />
<!-- 功能权限 -->
<div class="fw500 mb16 f16">功能权限</div>
<!-- <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>
</div>
</a-form-item>-->
<div class="showScope">
<div>数据可见范围</div>
<div>
<!-- <a-radio-group v-model="showScopeType" :options="[{ label: '公司数据', value: '1' },{ label: '部门数据', value: '2' },{ label: '个人数据', value: '3' },]" @change="showScopeChange" /> -->
<span>公司数据</span>
</div>
</div>
<div class="title fss">
<div class="ml24">可见页面</div>
<div style="margin-left:318px">功能权限</div>
</div>
<a-divider class="mt8 mb32" />
<div v-for="(item, key) in authorityList" style class="pl24">
<div class="fss">
<!-- <a-checkbox :checked="item.checked" style="width:88px" @change="checkboxChange(item,key)">{{item.label}}</a-checkbox> -->
<label style="width:88px">{{item.label}}</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>
</span>
</div>
<a-divider class="mt16 mb32" v-if="key != 'tzzx'" />
<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>
<a-button type="primary" html-type="submit" @click="addSubmit"></a-button>
</a-form-item>-->
</a-form>
</div>
</div>
</template>
<script>
import { getRoleListApi, addRoleApi, updateRoleApi, delRoleApi } from '../../api/merchantConfig'
export default {
//
name: 'AddRoleManagement',
//
components: {},
//
props: {},
//
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: [],
// },
},
secondBreadcrumb: '',
roleForm: this.$form.createForm(this),
showScopeType: 1,
roleList: [],
roleInfo: {},
}
},
//
computed: {},
//
watch: {},
//
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
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))
}
// 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)
},
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
*/
mounted() {},
//
methods: {
cancelAdd() {
this.$router.back()
},
/**
* 添加角色信息表单提交
*/
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()
}
})
}
}
})
},
showScopeChange(e) {
console.log(e)
},
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
} else {
this.authorityList[key].children[index].checked = !this.authorityList[key].children[index].checked
}
console.log(this.authorityList)
},
},
}
</script>
<style scoped lang="less">
.addItem {
width: 438px;
}
.showScope {
display: flex;
justify-content: space-between;
background-color: #eeeeee;
padding: 14px 24px;
min-width: 915px;
margin-bottom: 16px;
}
.subChecked {
display: flex;
justify-content: start;
width: 400px;
> label {
width: 23%;
}
// >label:not(:first-child){
// margin-left: 64px;
// }
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -55,9 +55,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -39,9 +39,6 @@ export default {
</script>
<style scoped lang="less">
.rightContainer {
padding: 16px;
}
</style>

@ -60,7 +60,7 @@
</a-input>
</a-form-item>
<a-form-item style="text-align: left">
<a-button type="primary sureBtn" html-type="submit">确定</a-button>
<a-button type="primary " class="sureBtn" :loading="btnLoading" html-type="submit">确定</a-button>
</a-form-item>
<!-- <div class="username">
<div>用户名</div>
@ -104,6 +104,7 @@ export default {
inputStatus: 0,
form: this.$form.createForm(this),
loginShow: false,
btnLoading: false,
}
},
//
@ -136,30 +137,53 @@ export default {
userhandleSubmit(e) {
//
e.preventDefault()
let params
let params = new FormData()
this.form.validateFields(async (err, values) => {
console.log(values)
if (!err) {
} else {
}
})
},
async submit() {
if (this.password === null || this.password.length === 0) {
this.$message.warning('请输入密码')
} else {
try {
const { data } = await setUserPswApi({ password: this.password })
console.log(data)
if (data.status === 200) {
this.$message.success('密码修改成功')
this.btnLoading = true
params.repassword = values.repassword
params.newpassword = values.newpassword
params.password = values.password
try {
const { data } = await setUserPswApi(params)
console.log(data)
if (data.status === 200) {
setTimeout(() => {
this.$message.success('密码修改成功')
this.btnLoading = false
this.form.resetFields()
// this.reload()
}, 1000)
} else {
this.$message.warning(data.msg)
this.btnLoading = false
}
} catch (error) {
this.btnLoading = false
console.log(error)
}
} catch (error) {
console.log(error)
}
}
console.log(this.password)
})
},
// async submit() {
// if (this.password === null || this.password.length === 0) {
// this.$message.warning('')
// } else {
// try {
// const { data } = await setUserPswApi({ password: this.password })
// console.log(data)
// if (data.status === 200) {
// this.$message.success('')
// }
// } catch (error) {
// console.log(error)
// }
// }
// console.log(this.password)
// },
changeStatus(e) {
// console.log(e);
let pas = document.querySelector('.passwordInp')
@ -251,7 +275,8 @@ export default {
text-decoration: underline;
}
.ant-btn-primary {
width: 64px;
// width: 64px;
padding: 0 16px;
height: 32px;
// margin-top: 21px;
background: #ff4400;

@ -886,7 +886,7 @@ export default {
// min-height: 802px;
margin-top: 16px;
// border-radius: 4px;
padding: 1px 10px;
// padding: 1px 10px;
background-color: #fff;
font-size: 16px;

@ -336,6 +336,18 @@ const routes = [
name: "RoleManagement",
component: () => import("../components/merchantManagement/roleManagement.vue"),
},
// 添加角色
{
path: "addRoleManagement",
name: "AddRoleManagement",
component: () => import("../components/merchantManagement/addRoleManagement.vue"),
},
// 角色详情
{
path: "roleManagementDetail",
name: "RoleManagementDetail",
component: () => import("../components/merchantManagement/roleManagementDetail.vue"),
},
// 工作台
{
path: "workBench",

@ -89,9 +89,9 @@
</div>
</a-layout-header>
<a-layout-content class="trans" :style="{ margin: '2px 0 0 0', paddingLeft: pLeft, paddingTop: pTop }">
<!-- <div id="littleUse" style="margin-top: 48px"> -->
<div style="padding:16px 16px 0">
<router-view @setTitle="setTitle"></router-view>
<!-- </div> -->
</div>
</a-layout-content>
<a-layout-footer :style="{ marginLeft: pLeft }" class="tac f12" style="textalign: center">
<span>

Loading…
Cancel
Save