Commit 73a12a59 authored by chenqikuai's avatar chenqikuai

feat: 新增同级操作权限

parent de34a83b
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
> >
<a-select <a-select
class="header-select-item mx-3 my-2" class="header-select-item mx-3 my-2"
@change="value => handleSelectChange(value, index)" @change="(value) => handleSelectChange(value, index)"
:placeholder="item.placeholder" :placeholder="item.placeholder"
:value="item.value" :value="item.value"
:disabled="index + 1 + 1 <= userLevel ? true : item.disable" :disabled="item.disable"
> >
<a-select-option :value="option.ID" :key="option.ID" v-for="option in item.options">{{ <a-select-option :value="option.ID" :key="option.ID" v-for="option in item.options">{{
option.Name option.Name
...@@ -56,7 +56,6 @@ export default Vue.extend({ ...@@ -56,7 +56,6 @@ export default Vue.extend({
const baseList = [...this.fooList] const baseList = [...this.fooList]
baseList[index].value = value baseList[index].value = value
const newList = baseList.map((i, idx) => { const newList = baseList.map((i, idx) => {
idx > index && console.log(i)
return { return {
...i, ...i,
options: idx > index ? [] : i.options, options: idx > index ? [] : i.options,
...@@ -99,7 +98,7 @@ export default Vue.extend({ ...@@ -99,7 +98,7 @@ export default Vue.extend({
this.setFooList(newList) this.setFooList(newList)
}, },
resetList() { resetList() {
const list = this.fooList.map(i => { const list = this.fooList.map((i) => {
return { return {
...i, ...i,
disable: false, disable: false,
......
<template> <template>
<!-- 新增弹窗 --> <!-- 新增弹窗 -->
<a-modal v-model="show" :title="title" :centered="true" footer="" :level="level"> <a-modal
v-model="show"
:title="title"
:centered="true"
footer=""
:level="level"
width="600px"
:after-close="afterClose"
>
<a-form-model <a-form-model
:model="form" :model="form"
:label-col="{ span: 8 }" :label-col="{ span: 8 }"
...@@ -47,8 +55,15 @@ ...@@ -47,8 +55,15 @@
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="岗位角色" v-show="modalMode === eAddManagerModalMode.create"> <a-form-model-item label="岗位角色" v-show="modalMode === eAddManagerModalMode.create">
<span class="text-sm text-black mr-2">{{ theRole }}</span> <span class="text-sm text-black mr-2">{{ theRole }}</span>
<!-- <a-switch @change="onChange" v-show="isManager" /> --> <a-switch
<!-- <span class="ml-2" v-show="isManager">可对同级管理员进行管理调配</span> --> v-model="form.same_level"
v-show="newRole === eNewRoleRelatedToBackEnd.BackAdmin && isManager"
/>
<span
class="ml-2 text-xs whitespace-nowrap"
v-show="newRole === eNewRoleRelatedToBackEnd.BackAdmin && isManager"
>可对同级管理员进行管理调配</span
>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="用户所在机构层级"> <a-form-model-item label="用户所在机构层级">
<span class="text-sm text-black">{{ searchLevel | filterLevel }}</span> <span class="text-sm text-black">{{ searchLevel | filterLevel }}</span>
...@@ -128,6 +143,8 @@ import { fooList } from '@/components/HeaderSelect2/const' ...@@ -128,6 +143,8 @@ import { fooList } from '@/components/HeaderSelect2/const'
import StaffService from '@/service/StaffService' import StaffService from '@/service/StaffService'
import AddressService from '@/service/AddressService' import AddressService from '@/service/AddressService'
import { phonePattern } from '@/const/pattern/index' import { phonePattern } from '@/const/pattern/index'
import { getUserMsg } from '@/utils/userMsg/userMsg'
import { eNewRoleRelatedToBackEnd } from '@/types/role'
Vue.use(Switch) Vue.use(Switch)
...@@ -136,6 +153,9 @@ export default Vue.extend({ ...@@ -136,6 +153,9 @@ export default Vue.extend({
HeaderSelect, HeaderSelect,
}, },
computed: { computed: {
newRole() {
return getUserMsg()?.newRole
},
formRules() { formRules() {
const rules: any = { const rules: any = {
name: [{ required: true, message: '请输入名称', trigger: 'blur' }], name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
...@@ -179,8 +199,6 @@ export default Vue.extend({ ...@@ -179,8 +199,6 @@ export default Vue.extend({
delete rules.tel delete rules.tel
} }
console.log(rules)
return rules return rules
}, },
levelOptions() { levelOptions() {
...@@ -263,11 +281,16 @@ export default Vue.extend({ ...@@ -263,11 +281,16 @@ export default Vue.extend({
fooProp2: undefined as number | undefined, fooProp2: undefined as number | undefined,
fooProp3: undefined as number | undefined, fooProp3: undefined as number | undefined,
level: eLevel.firstLevel_branch, level: eLevel.firstLevel_branch,
same_level: false,
}, },
outletName: '', outletName: '',
eNewRoleRelatedToBackEnd,
} }
}, },
methods: { methods: {
afterClose() {
this.form.same_level = false
},
handleLevelChange(value: any) { handleLevelChange(value: any) {
this.form.level = value this.form.level = value
}, },
...@@ -283,9 +306,11 @@ export default Vue.extend({ ...@@ -283,9 +306,11 @@ export default Vue.extend({
this.fooList = list this.fooList = list
let branchDetailMsg: iBranchDetailMsg = undefined as unknown as iBranchDetailMsg let branchDetailMsg: iBranchDetailMsg = undefined as unknown as iBranchDetailMsg
if (this.modalMode === eAddManagerModalMode.create) { if (this.modalMode === eAddManagerModalMode.create) {
console.log(this.branchDetailMsg, 'show this.branchDetailMsg')
branchDetailMsg = this.branchDetailMsg branchDetailMsg = this.branchDetailMsg
} else if (this.modalMode === eAddManagerModalMode.edit) { } else if (this.modalMode === eAddManagerModalMode.edit) {
branchDetailMsg = this.personalMsg.branchDetailMsg branchDetailMsg = this.personalMsg.branchDetailMsg
console.log(this.personalMsg.branchDetailMsg, 'show this.personalMsg.branchDetailMsg')
this.form.level = this.level this.form.level = this.level
this.form.name = this.personalMsg.name this.form.name = this.personalMsg.name
} }
...@@ -347,9 +372,17 @@ export default Vue.extend({ ...@@ -347,9 +372,17 @@ export default Vue.extend({
if (this.modalMode === eAddManagerModalMode.edit) { if (this.modalMode === eAddManagerModalMode.edit) {
await fetchOptionListForEverySettledBranchEdit(this.fooList) await fetchOptionListForEverySettledBranchEdit(this.fooList)
} }
/* 调配时 设置disable,限制可选的范围*/
if (this.modalMode === eAddManagerModalMode.edit) {
this.fooList.map((foo, index) => {
if (index + 1 + 1 <= this.searchLevel2) {
foo.disable = true
}
})
}
this.fooList = [...this.fooList] this.fooList = [...this.fooList]
await this.fetchNextOptions() await this.fetchNextOptions()
console.log(this.fooList, 'show foolist')
}, },
async fetchNextOptions() { async fetchNextOptions() {
const fooIndex = this.fooList.findIndex((item) => item.value === undefined) const fooIndex = this.fooList.findIndex((item) => item.value === undefined)
...@@ -397,9 +430,9 @@ export default Vue.extend({ ...@@ -397,9 +430,9 @@ export default Vue.extend({
}, },
createManager() { createManager() {
StaffService.getInstance() StaffService.getInstance()
.addNextLevel({ .addManagement({
attr: { attr: {
add_same_level: false, privilege: this.form.same_level || false,
}, },
level: this.searchLevel, level: this.searchLevel,
name: this.form.name, name: this.form.name,
...@@ -417,7 +450,7 @@ export default Vue.extend({ ...@@ -417,7 +450,7 @@ export default Vue.extend({
StaffService.getInstance() StaffService.getInstance()
.addAcm({ .addAcm({
attr: { attr: {
add_same_level: false, privilege: false,
}, },
level: this.searchLevel, level: this.searchLevel,
name: this.form.name, name: this.form.name,
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<a @click="getSecondarySubClientList(record)">查看</a> <a @click="getSecondarySubClientList(record)">查看</a>
</span> </span>
<!-- 操作 --> <!-- 操作 -->
<p slot="action" slot-scope="text, record"> <div slot="action" slot-scope="text, record" class="whitespace-nowrap">
<span <span
v-if=" v-if="
record.status === tableStatus.disable_notOnPosition || record.status === tableStatus.disable_notOnPosition ||
...@@ -107,7 +107,16 @@ ...@@ -107,7 +107,16 @@
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="inJob(record.uuid)">在岗</a> <a @click="inJob(record.uuid)">在岗</a>
</span> </span>
</p> <div v-if="newRole === eNewRoleRelatedToBackEnd.BackAdmin && isManagement(role)">
同级操作权限:
<a-switch
:checked="record.attr.privilege"
checked-children="开"
un-checked-children="关"
@change="sameLevelRoleChange(record.uuid, $event)"
></a-switch>
</div>
</div>
</a-table> </a-table>
<!-- 操作Modal --> <!-- 操作Modal -->
<a-modal <a-modal
...@@ -128,7 +137,7 @@ import Vue, { PropType } from 'vue' ...@@ -128,7 +137,7 @@ import Vue, { PropType } from 'vue'
import { firstLevelManager } from '@/mock/index' import { firstLevelManager } from '@/mock/index'
import { staff, iStaffQueryResItem } from '@/types/staff' import { staff, iStaffQueryResItem } from '@/types/staff'
import { eUserStatusAction, eUserStatus } from '@/types/user' import { eUserStatusAction, eUserStatus } from '@/types/user'
import { eRole, eNewRoleRelatedToBackEnd } from '@/types/role' import { eRole, eNewRoleRelatedToBackEnd, isManagement } from '@/types/role'
import { eLevel } from '@/types/level' import { eLevel } from '@/types/level'
import { getColumns } from '@/const/columns/userManagerCol' import { getColumns } from '@/const/columns/userManagerCol'
import { userModal } from './const' import { userModal } from './const'
...@@ -138,7 +147,7 @@ import { mapActions, mapMutations, mapState } from 'vuex' ...@@ -138,7 +147,7 @@ import { mapActions, mapMutations, mapState } from 'vuex'
import StaffService from '@/service/StaffService' import StaffService from '@/service/StaffService'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { eAddManagerModalMode, eTypeOfOperatedObject } from '@/store/UserManagement/types' import { eAddManagerModalMode, eTypeOfOperatedObject } from '@/store/UserManagement/types'
import LiveService from '@/service/LiveService' import { getUserMsg } from '@/utils/userMsg/userMsg'
const staff = new StaffService() const staff = new StaffService()
...@@ -175,10 +184,14 @@ export default Vue.extend({ ...@@ -175,10 +184,14 @@ export default Vue.extend({
id: '', id: '',
params: {} as any, params: {} as any,
currentRecord: {} as iStaffQueryResItem, currentRecord: {} as iStaffQueryResItem,
eNewRoleRelatedToBackEnd,
eRole,
} }
}, },
computed: { computed: {
newRole() {
return getUserMsg()?.newRole
},
firstLevelManager(): Array<staff> { firstLevelManager(): Array<staff> {
return firstLevelManager return firstLevelManager
}, },
...@@ -192,6 +205,7 @@ export default Vue.extend({ ...@@ -192,6 +205,7 @@ export default Vue.extend({
total: this.$store.state.platformUserManagement.total, total: this.$store.state.platformUserManagement.total,
} }
}, },
dataSource() { dataSource() {
return this.$store.state.platformUserManagement.list return this.$store.state.platformUserManagement.list
}, },
...@@ -206,6 +220,18 @@ export default Vue.extend({ ...@@ -206,6 +220,18 @@ export default Vue.extend({
} as any), } as any),
}, },
methods: { methods: {
isManagement,
async sameLevelRoleChange(uuid: string, checked: boolean) {
// console.log(uuid, checked)
await StaffService.getInstance().switchSameLevelPrivilege({
same_level: checked,
uuid,
})
this.platformSave({
page: 1,
})
this.getLists()
},
...mapMutations('platformUserManagement', { ...mapMutations('platformUserManagement', {
platformSave: 'save', platformSave: 'save',
}), }),
...@@ -275,11 +301,12 @@ export default Vue.extend({ ...@@ -275,11 +301,12 @@ export default Vue.extend({
name: string name: string
value: number value: number
}[] }[]
const role = const role =
this.$route.query.role === eNewRoleRelatedToBackEnd.ACM this.$route.query.role === eNewRoleRelatedToBackEnd.ACM
? eTypeOfOperatedObject.clientManager ? eTypeOfOperatedObject.clientManager
: eTypeOfOperatedObject.manager : eTypeOfOperatedObject.manager
console.log(this.level, 'show level') // console.log(this.level, 'show level')
this.$store.commit('UserManagement/save', { this.$store.commit('UserManagement/save', {
modalMode: eAddManagerModalMode.edit, modalMode: eAddManagerModalMode.edit,
...@@ -287,9 +314,8 @@ export default Vue.extend({ ...@@ -287,9 +314,8 @@ export default Vue.extend({
searchLevel: this.level, searchLevel: this.level,
searchLevel2: rankVal.length, searchLevel2: rankVal.length,
branchDetailMsg: { branchDetailMsg: {
// fb: (rankVal[0] && rankVal[0].name) || undefined,
fb: rankVal[0].name, fb_id: (rankVal[0] && rankVal[0].value) || undefined,
fb_id: rankVal[0].value,
sb: (rankVal[1] && rankVal[1].name) || undefined, sb: (rankVal[1] && rankVal[1].name) || undefined,
sb_id: (rankVal[1] && rankVal[1].value) || undefined, sb_id: (rankVal[1] && rankVal[1].value) || undefined,
fsb: (rankVal[2] && rankVal[2].name) || undefined, fsb: (rankVal[2] && rankVal[2].name) || undefined,
...@@ -380,6 +406,9 @@ export default Vue.extend({ ...@@ -380,6 +406,9 @@ export default Vue.extend({
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
message.success('操作成功') message.success('操作成功')
this.platformSave({
page: 1,
})
this.getLists() this.getLists()
} }
}) })
...@@ -397,6 +426,9 @@ export default Vue.extend({ ...@@ -397,6 +426,9 @@ export default Vue.extend({
StaffService.getInstance() StaffService.getInstance()
.deleteStaff(this.id) .deleteStaff(this.id)
.then(() => { .then(() => {
this.platformSave({
page: 1,
})
this.getLists() this.getLists()
}) })
} }
...@@ -544,8 +576,8 @@ export default Vue.extend({ ...@@ -544,8 +576,8 @@ export default Vue.extend({
// this.$refresh() // this.$refresh()
}, },
tableLoading(n) { tableLoading(n) {
console.log(n, 'loading') // console.log(n, 'loading')
console.log('---------------===============') // console.log('---------------===============')
}, },
}, },
}) })
......
import { eRole } from '@/types/role' import StaffService from '@/service/StaffService'
import { eNewRoleRelatedToBackEnd, eRole } from '@/types/role'
import RouterUtil from '@/utils/router'
import { getOldRoleFromUserMsg } from '@/utils/user' import { getOldRoleFromUserMsg } from '@/utils/user'
import { getUserMsg } from '@/utils/userMsg/userMsg' import { getUserMsg } from '@/utils/userMsg/userMsg'
import { menuList } from '@/views/Root/getMenuList' import { menuList } from '@/views/Root/getMenuList'
...@@ -72,20 +74,20 @@ function getRedirectRouteName() { ...@@ -72,20 +74,20 @@ function getRedirectRouteName() {
} }
} }
router.beforeEach((to, from, next) => { router.beforeEach(async (to, from, next) => {
console.log({ from, to }) // console.log({ from, to })
const redirectRouteName = getRedirectRouteName() const redirectRouteName = getRedirectRouteName()
const usermsg = getUserMsg() const usermsg = getUserMsg()
if (usermsg === undefined) { if (usermsg === undefined) {
/* 没登录 */ /* 没登录 */
if (redirectRouteName === undefined) { if (redirectRouteName === undefined) {
if (to.name == 'adminLogin' || to.name == 'login') { if (to.name == 'adminLogin' || to.name == 'login') {
console.log(1) // console.log(1)
next() next()
} else { } else {
console.log(2) // console.log(2)
next({ next({
name: 'login', name: 'login',
}) })
...@@ -93,7 +95,7 @@ router.beforeEach((to, from, next) => { ...@@ -93,7 +95,7 @@ router.beforeEach((to, from, next) => {
} else { } else {
if (to.name === redirectRouteName) { if (to.name === redirectRouteName) {
next() next()
console.log(1) // console.log(1)
} else { } else {
next({ next({
name: redirectRouteName, name: redirectRouteName,
...@@ -101,28 +103,51 @@ router.beforeEach((to, from, next) => { ...@@ -101,28 +103,51 @@ router.beforeEach((to, from, next) => {
} }
} }
} else { } else {
console.log(3) // console.log(3)
/* 登录 */ /* 登录 */
const roles = (to.meta as { roles?: eRole[] }).roles const roles = (to.meta as { roles?: eRole[] }).roles
const oldRole = getOldRoleFromUserMsg(usermsg) const oldRole = getOldRoleFromUserMsg(usermsg)
console.log(oldRole, roles, oldRole && roles && roles.includes(oldRole)) // console.log(oldRole, roles, oldRole && roles && roles.includes(oldRole))
const userHasRoleInCurPage = const userHasRoleInCurPage =
oldRole !== undefined && roles !== undefined && roles.includes(oldRole) oldRole !== undefined && roles !== undefined && roles.includes(oldRole)
if (userHasRoleInCurPage) { if (userHasRoleInCurPage) {
console.log(4) // console.log(4)
next() next()
} else { } else {
if (oldRole == eRole.platform_management) { const isManagerUser = usermsg.newRole === eNewRoleRelatedToBackEnd.Management
if (getUserMsg()?.phone) { const gotoSeeSameLevel = RouterUtil.getInstance().isGotoSeeSameLevelStaff(
console.log(5) usermsg.level,
next({ name: 'platformUserManagement' }) to.path
)
// console.log(isManagerUser, gotoSeeSameLevel, 'isManagerUser , gotoSeeSameLevel')
const hasSameLevelRole = await (() => {
if (isManagerUser && gotoSeeSameLevel) {
return StaffService.getInstance()
.getAttr()
.then((ret) => ret.code === 200 && !!ret.data.privilege)
} else { } else {
console.log(6) return false
next({ name: 'changePhone' })
} }
})()
// console.log(hasSameLevelRole, 'show hasSameLevelRole')
/* 如果当前用是管理员、而且是去查看同级管理员、并且有同级操作权限,则给用户展示要去的页面 */
if (isManagerUser && gotoSeeSameLevel && hasSameLevelRole) {
next()
} else { } else {
console.log(7) if (oldRole == eRole.platform_management) {
next({ name: 'home' }) if (getUserMsg()?.phone) {
console.log(5)
next({ name: 'platformUserManagement' })
} else {
console.log(6)
next({ name: 'changePhone' })
}
} else {
console.log(7)
next({ name: 'home' })
}
} }
} }
} }
......
...@@ -15,7 +15,7 @@ export default class StaffService { ...@@ -15,7 +15,7 @@ export default class StaffService {
addAcm(data: { addAcm(data: {
attr: { attr: {
add_same_level: boolean privilege: boolean
} }
level: number level: number
name: string name: string
...@@ -30,9 +30,9 @@ export default class StaffService { ...@@ -30,9 +30,9 @@ export default class StaffService {
}) })
} }
addNextLevel(data: { addManagement(data: {
attr: { attr: {
add_same_level: boolean privilege: boolean
} }
level: number level: number
name: string name: string
...@@ -41,24 +41,7 @@ export default class StaffService { ...@@ -41,24 +41,7 @@ export default class StaffService {
second_sub_branch: number second_sub_branch: number
}) { }) {
return baseAxios<{ data: any }>({ return baseAxios<{ data: any }>({
url: '/staff/add/next_level', url: '/staff/add/management',
method: 'post',
data,
})
}
addSameLevel(data: {
attr: {
add_same_level: boolean
}
level: number
name: string
password: string
phone: string
second_sub_branch: number
}) {
return baseAxios<{ data: any }>({
url: '/staff/add/same_level',
method: 'post', method: 'post',
data, data,
}) })
...@@ -196,7 +179,7 @@ export default class StaffService { ...@@ -196,7 +179,7 @@ export default class StaffService {
getAttr() { getAttr() {
return baseAxios<{ return baseAxios<{
add_same_level: boolean privilege: boolean
live_broad: { day_type: number; time_section: string } live_broad: { day_type: number; time_section: string }
role: eNewRoleRelatedToBackEnd role: eNewRoleRelatedToBackEnd
}>({ }>({
...@@ -204,4 +187,12 @@ export default class StaffService { ...@@ -204,4 +187,12 @@ export default class StaffService {
method: 'get', method: 'get',
}) })
} }
switchSameLevelPrivilege(data: { same_level: boolean; uuid: string }) {
return baseAxios({
url: '/staff/switchSameLevelPrivilege',
method: 'post',
data,
})
}
} }
...@@ -10,7 +10,7 @@ const baseAxios = axios.create({ ...@@ -10,7 +10,7 @@ const baseAxios = axios.create({
baseAxios.interceptors.response.use( baseAxios.interceptors.response.use(
(value: AxiosResponse<iRet>) => { (value: AxiosResponse<iRet>) => {
const ret = value.data const ret = value.data
if (ret.code === 3000 || ret.code === 507) { if (ret.code === 3000) {
// 这里是要做什么来着 // 这里是要做什么来着
} else if (ret.code !== undefined && ret.code !== 200) { } else if (ret.code !== undefined && ret.code !== 200) {
if ([504, 503, 1008].includes(ret.code)) { if ([504, 503, 1008].includes(ret.code)) {
......
...@@ -32,11 +32,15 @@ export default <Module<iUserManagementState, unknown>>{ ...@@ -32,11 +32,15 @@ export default <Module<iUserManagementState, unknown>>{
address: '', address: '',
}, },
address: '', address: '',
sameLevelRoleOfManager: false,
}, },
mutations: { mutations: {
save(state, payload) { save(state, payload) {
Object.assign(state, payload) Object.assign(state, payload)
}, },
setSameLevelRoleOfManager(state, have) {
state.sameLevelRoleOfManager = have
},
}, },
actions: { actions: {
async initFooList( async initFooList(
......
...@@ -40,4 +40,5 @@ export interface iUserManagementState { ...@@ -40,4 +40,5 @@ export interface iUserManagementState {
personalMsg: iPersonalMsg /* 调配人员时 该人员的个人信息 */ personalMsg: iPersonalMsg /* 调配人员时 该人员的个人信息 */
address: string /* 新地址 */ address: string /* 新地址 */
refreshMark: number /* 供表格刷新的标记,组件监听refreshMark,若变化,则刷新表格 */ refreshMark: number /* 供表格刷新的标记,组件监听refreshMark,若变化,则刷新表格 */
sameLevelRoleOfManager: boolean /* 管理员是否有同级操作权限 */
} }
...@@ -51,7 +51,7 @@ export default <Module<iPlatformModuleState, unknown>>{ ...@@ -51,7 +51,7 @@ export default <Module<iPlatformModuleState, unknown>>{
}, },
async queryUser({ state, commit }) { async queryUser({ state, commit }) {
state.loading = true state.loading = true
console.log(state) // console.log(state)
StaffService.getInstance() StaffService.getInstance()
.queryStaff({ .queryStaff({
end: state.end, end: state.end,
...@@ -74,6 +74,11 @@ export default <Module<iPlatformModuleState, unknown>>{ ...@@ -74,6 +74,11 @@ export default <Module<iPlatformModuleState, unknown>>{
list: res.data.item, list: res.data.item,
total: res.data.total, total: res.data.total,
}) })
} else {
commit('save', {
list: [],
total: 0,
})
} }
state.loading = false state.loading = false
}) })
......
...@@ -19,9 +19,11 @@ export enum eNewRoleRelatedToBackEnd { ...@@ -19,9 +19,11 @@ export enum eNewRoleRelatedToBackEnd {
PlatformAdmin = '平台管理员', PlatformAdmin = '平台管理员',
} }
// export function getRole(level:number,role:number,userType?:number):eRole{ export function isManagement(role: eRole) {
// let userrole: eRole return (
// if( level == 1 && role == ) role === eRole.firstLevel_branch ||
// return userrole role === eRole.secondary_branch ||
role === eRole.firstLevel_sub_branch ||
// } role === eRole.secondary_sub_branch
)
}
import router from '@/router' import router from '@/router'
import { eLevel } from '@/types/level'
import { eNewRoleRelatedToBackEnd } from '@/types/role' import { eNewRoleRelatedToBackEnd } from '@/types/role'
export default class RouterUtil { export default class RouterUtil {
...@@ -42,4 +43,13 @@ export default class RouterUtil { ...@@ -42,4 +43,13 @@ export default class RouterUtil {
ssb_id: (rankVal[3] && rankVal[3].value && Number(rankVal[3].value)) || undefined, ssb_id: (rankVal[3] && rankVal[3].value && Number(rankVal[3].value)) || undefined,
} }
} }
isGotoSeeSameLevelStaff(level: eLevel, path: string) {
return (
(level === 1 && path === '/backend/user/firstLevel') ||
(level === 2 && path === '/backend/user/secondary') ||
(level === 3 && path === '/backend/user/firstSub') ||
(level === 4 && path === '/backend/user/secondarySub')
)
}
} }
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
<!-- 数据源 --> <!-- 数据源 -->
<span>数据:</span> <span>数据:</span>
<a-radio-group @change="handleChangeSource" v-model="chartType"> <a-radio-group @change="handleChangeSource" v-model="chartType">
<a-radio-button :value="eBarChart.not_login_dau"> <a-radio-button :value="eBarChart.not_login_dau"> 全局日活 </a-radio-button>
全局日活
</a-radio-button>
<a-radio-button :value="eBarChart.login_dau"> 注册日活 </a-radio-button> <a-radio-button :value="eBarChart.login_dau"> 注册日活 </a-radio-button>
</a-radio-group> </a-radio-group>
<!-- 日期范围 --> <!-- 日期范围 -->
...@@ -31,15 +29,7 @@ ...@@ -31,15 +29,7 @@
<div <div
v-show="isEmpty" v-show="isEmpty"
style="width: 1100px; line-height: 384px" style="width: 1100px; line-height: 384px"
class=" class="emptyContainer h-96 mx-auto text-center text-xl font-semibold mb-5 mt-5"
emptyContainer
h-96
mx-auto
text-center text-xl
font-semibold
mb-5
mt-5
"
> >
暂无数据 暂无数据
</div> </div>
...@@ -60,9 +50,7 @@ import * as echarts from 'echarts' ...@@ -60,9 +50,7 @@ import * as echarts from 'echarts'
import { eBarChart } from './const' import { eBarChart } from './const'
import DashboardService from '@/service/DashboardService/index' import DashboardService from '@/service/DashboardService/index'
import { formatDate } from '@/utils/time/transfer' import { formatDate } from '@/utils/time/transfer'
Vue.use(Row) Vue.use(Row).use(Col).use(Radio)
.use(Col)
.use(Radio)
export default Vue.extend({ export default Vue.extend({
components: { components: {
...@@ -166,12 +154,12 @@ export default Vue.extend({ ...@@ -166,12 +154,12 @@ export default Vue.extend({
this.option.xAxis.data = [] this.option.xAxis.data = []
this.isEmpty = ret.data.length == 0 ? true : false this.isEmpty = ret.data.length == 0 ? true : false
if (!this.isEmpty) { if (!this.isEmpty) {
ret.data.map(data => { ret.data.map((data) => {
// 真实数据 // 真实数据
this.option.series[0].data.push(data.value) this.option.series[0].data.push(data.value)
this.option.xAxis.data.push(formatDate(data.time * 1000)) this.option.xAxis.data.push(formatDate(data.time * 1000))
}) })
console.log('y', this.option.series[0].data, 'x', this.option.xAxis.data) // console.log('y', this.option.series[0].data, 'x', this.option.xAxis.data)
} }
} }
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
v-for="(item, index) in fooList" v-for="(item, index) in fooList"
:key="index" :key="index"
class="header-select-item mx-3 my-2" class="header-select-item mx-3 my-2"
@change="value => handleSelectChange(value, index)" @change="(value) => handleSelectChange(value, index)"
:placeholder="item.placeholder" :placeholder="item.placeholder"
:value="item.value" :value="item.value"
:disabled="item.disable" :disabled="item.disable"
...@@ -26,6 +26,7 @@ import { fooList } from './const' ...@@ -26,6 +26,7 @@ import { fooList } from './const'
import Vue, { PropType } from 'vue' import Vue, { PropType } from 'vue'
import { iOutLet } from '@/service/StaffService/types' import { iOutLet } from '@/service/StaffService/types'
import { getUserMsg } from '@/utils/userMsg/userMsg'
export default Vue.extend({ export default Vue.extend({
props: { props: {
...@@ -46,7 +47,7 @@ export default Vue.extend({ ...@@ -46,7 +47,7 @@ export default Vue.extend({
handleSelectChange(value: number, index: number) { handleSelectChange(value: number, index: number) {
this.fooList[index].value = value this.fooList[index].value = value
const newList = this.fooList.map((i, idx) => { const newList = this.fooList.map((i, idx) => {
idx > index && console.log(i) // idx > index && console.log(i)
return { return {
...i, ...i,
options: idx > index ? [] : i.options, options: idx > index ? [] : i.options,
...@@ -87,7 +88,7 @@ export default Vue.extend({ ...@@ -87,7 +88,7 @@ export default Vue.extend({
this.setFooList(newList) this.setFooList(newList)
}, },
resetList() { resetList() {
const list = this.fooList.map(i => { const list = this.fooList.map((i) => {
return { return {
...i, ...i,
disable: false, disable: false,
...@@ -100,17 +101,20 @@ export default Vue.extend({ ...@@ -100,17 +101,20 @@ export default Vue.extend({
async init() { async init() {
const selfOutLet = await getSelfOutLet() const selfOutLet = await getSelfOutLet()
this.resetList() this.resetList()
this.$nextTick(() => { this.$nextTick(async () => {
if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) { if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) {
this.initBackAdmin(selfOutLet) this.initBackAdmin(selfOutLet)
} else if (this.level === eLevel.firstLevel_branch) { } else {
this.init_firstLevel(selfOutLet) const hasSameLevelRole = await this.getRoleOFSameLevel()
} else if (this.level === eLevel.secondary_branch) { if (this.level === eLevel.firstLevel_branch) {
this.init_secondLevel(selfOutLet) this.init_firstLevel(selfOutLet, hasSameLevelRole)
} else if (this.level === eLevel.firstLevel_sub_branch) { } else if (this.level === eLevel.secondary_branch) {
this.init_first_sub_Level(selfOutLet) this.init_secondLevel(selfOutLet, hasSameLevelRole)
} else if (this.level === eLevel.secondary_sub_branch) { } else if (this.level === eLevel.firstLevel_sub_branch) {
this.init_second_sub_Level(selfOutLet) this.init_first_sub_Level(selfOutLet, hasSameLevelRole)
} else if (this.level === eLevel.secondary_sub_branch) {
this.init_second_sub_Level(selfOutLet, hasSameLevelRole)
}
} }
}) })
}, },
...@@ -130,55 +134,78 @@ export default Vue.extend({ ...@@ -130,55 +134,78 @@ export default Vue.extend({
this.setFooList(newList) this.setFooList(newList)
} }
}, },
async init_firstLevel(selfOutLet: iOutLet) { async init_firstLevel(selfOutLet: iOutLet, sameLevelRole: boolean) {
const { fid, first_branch, sid, second_branch } = selfOutLet const { fid, first_branch, sid, second_branch } = selfOutLet
const list = this.initFooListBasicValues(selfOutLet, eLevel.firstLevel_branch) const list = await this.initFooListBasicValues(
selfOutLet,
eLevel.firstLevel_branch,
sameLevelRole
)
this.setFooList(list) this.setFooList(list)
const ret = await StaffService.getInstance().getBranch({ const ret = await StaffService.getInstance().getBranch({
level: eLevel.secondary_branch, level: sameLevelRole ? eLevel.firstLevel_branch : eLevel.secondary_branch,
page_size: 300, page_size: 300,
parent_id: sid, parent_id: sameLevelRole ? undefined : fid,
}) })
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[1].options = ret.data.item this.fooList[sameLevelRole ? 0 : 1].options = ret.data.item
} }
this.setFooList(this.fooList) this.setFooList(this.fooList)
}, },
async init_secondLevel(selfOutLet: iOutLet) { async init_secondLevel(selfOutLet: iOutLet, sameLevelRole: boolean) {
const { fid, first_branch, sid, second_branch } = selfOutLet const { fid, first_branch, sid, second_branch } = selfOutLet
const list = this.initFooListBasicValues(selfOutLet, eLevel.secondary_branch) const list = await this.initFooListBasicValues(
selfOutLet,
eLevel.secondary_branch,
sameLevelRole
)
this.setFooList(list) this.setFooList(list)
const ret = await StaffService.getInstance().getBranch({ const ret = await StaffService.getInstance().getBranch({
level: eLevel.firstLevel_sub_branch, level: sameLevelRole ? eLevel.secondary_branch : eLevel.firstLevel_sub_branch,
page_size: 300, page_size: 300,
parent_id: sid, parent_id: sameLevelRole ? fid : sid,
}) })
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[2].options = ret.data.item this.fooList[sameLevelRole ? 1 : 2].options = ret.data.item
} }
this.setFooList(this.fooList) this.setFooList(this.fooList)
}, },
async init_first_sub_Level(selfOutLet: iOutLet) { async init_first_sub_Level(selfOutLet: iOutLet, sameLevelRole: boolean) {
const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } = selfOutLet const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } = selfOutLet
const list = this.initFooListBasicValues(selfOutLet, eLevel.firstLevel_sub_branch) const list = await this.initFooListBasicValues(
selfOutLet,
eLevel.firstLevel_sub_branch,
sameLevelRole
)
this.setFooList(list) this.setFooList(list)
const ret = await StaffService.getInstance().getBranch({ const ret = await StaffService.getInstance().getBranch({
level: eLevel.secondary_sub_branch, level: sameLevelRole ? eLevel.firstLevel_sub_branch : eLevel.secondary_sub_branch,
page_size: 1000, page_size: 300,
parent_id: fs_id, parent_id: sameLevelRole ? sid : fs_id,
}) })
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[3].options = ret.data.item this.fooList[sameLevelRole ? 2 : 3].options = ret.data.item
} }
this.setFooList(this.fooList) this.setFooList(this.fooList)
}, },
init_second_sub_Level(selfOutLet: iOutLet) { async init_second_sub_Level(selfOutLet: iOutLet, sameLevelRole: boolean) {
this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch) await this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch, sameLevelRole)
this.$nextTick(() => { this.$nextTick(() => {
this.setFooList(this.fooList) this.setFooList(this.fooList)
}) })
}, },
initFooListBasicValues(selfOutLet: iOutLet, level: eLevel) { async getRoleOFSameLevel() {
let hasSameLevelRole = false
if (getUserMsg()?.newRole === eNewRoleRelatedToBackEnd.Management) {
const attrRet = await StaffService.getInstance().getAttr()
if (attrRet.code === 200) {
hasSameLevelRole = attrRet.data.privilege
}
}
this.$store.commit('UserManagement/setSameLevelRoleOfManager', hasSameLevelRole)
return hasSameLevelRole
},
async initFooListBasicValues(selfOutLet: iOutLet, level: eLevel, sameLevelRole: boolean) {
let list = this.fooList let list = this.fooList
const { const {
fid, fid,
...@@ -224,6 +251,10 @@ export default Vue.extend({ ...@@ -224,6 +251,10 @@ export default Vue.extend({
list[3].options = [{ ID: ss_id, Name: second_sub_branch }] list[3].options = [{ ID: ss_id, Name: second_sub_branch }]
list[3].disable = true list[3].disable = true
} }
if (sameLevelRole) {
list[level - 1].disable = false
list[level - 1].value = undefined
}
return list return list
}, },
popupScroll1(e: Event) { popupScroll1(e: Event) {
......
...@@ -50,7 +50,11 @@ ...@@ -50,7 +50,11 @@
:loading="loading" :loading="loading"
>导入</a-button >导入</a-button
> >
<a-button type="primary" style="margin-right: 10px" @click="clickDownloadTemplate" <a-button
type="primary"
v-if="isBackAdmin"
style="margin-right: 10px"
@click="clickDownloadTemplate"
>模板下载</a-button >模板下载</a-button
> >
<input <input
...@@ -145,7 +149,6 @@ export default Vue.extend({ ...@@ -145,7 +149,6 @@ export default Vue.extend({
} }
}, },
mounted() { mounted() {
console.log('foolish', this.fooList)
this.clearPostion() this.clearPostion()
}, },
methods: { methods: {
...@@ -204,7 +207,6 @@ export default Vue.extend({ ...@@ -204,7 +207,6 @@ export default Vue.extend({
}, },
setFooList(v: any[]) { setFooList(v: any[]) {
this.fooList = [...v] this.fooList = [...v]
// this.setLevel(v)
}, },
async getBranchList() { async getBranchList() {
const userLevel = getUserMsg()?.level const userLevel = getUserMsg()?.level
...@@ -215,8 +217,6 @@ export default Vue.extend({ ...@@ -215,8 +217,6 @@ export default Vue.extend({
page: 5, page: 5,
page_size: PAGE_SIZE, page_size: PAGE_SIZE,
}) })
console.log(ret)
}, },
query() { query() {
const levelList = [] const levelList = []
...@@ -233,20 +233,7 @@ export default Vue.extend({ ...@@ -233,20 +233,7 @@ export default Vue.extend({
break break
} }
} }
if (levelList.length == 0) { this.selectTables(levelList)
this.$message.info({
content: '请先选择相应分区',
icon: () => {
return this.$createElement('Icon', {
style: { color: '#3E4FAF' },
props: { type: 'exclamation-circle' },
})
},
})
// this.$message.info({content:"请通过选择或者输入详细地址搜索",icon:()=>{return this.$createElement('Icon',{style:{color:'#3E4FAF'},props:{type:'exclamation-circle'}})}})
} else {
this.selectTables(levelList)
}
}, },
getRoles(path: string) { getRoles(path: string) {
const _path = '/backend/user' + path const _path = '/backend/user' + path
...@@ -259,7 +246,7 @@ export default Vue.extend({ ...@@ -259,7 +246,7 @@ export default Vue.extend({
return roles return roles
}, },
async checkPermission(path: string) { async checkPermission(path: string) {
console.log('in checkPermission') // console.log('in checkPermission')
// 获取跳转路由的权限列表 // 获取跳转路由的权限列表
const roles = this.getRoles(path) const roles = this.getRoles(path)
...@@ -285,7 +272,7 @@ export default Vue.extend({ ...@@ -285,7 +272,7 @@ export default Vue.extend({
this.queryLoading = true this.queryLoading = true
const ret = await StaffService.getInstance().getAttr() const ret = await StaffService.getInstance().getAttr()
this.queryLoading = false this.queryLoading = false
return ret.code === 200 && ret.data.add_same_level return ret.code === 200 && ret.data.privilege
} else { } else {
return false return false
} }
...@@ -297,7 +284,7 @@ export default Vue.extend({ ...@@ -297,7 +284,7 @@ export default Vue.extend({
const basePath = '/backend/user' const basePath = '/backend/user'
// 判断账户权限 // 判断账户权限
const permission = await this.checkPermission(_path) const permission = await this.checkPermission(_path)
console.log(permission, 'show permission') // console.log(permission, 'show permission')
if (!permission) { if (!permission) {
message.error('当前账号无此权限') message.error('当前账号无此权限')
...@@ -306,6 +293,23 @@ export default Vue.extend({ ...@@ -306,6 +293,23 @@ export default Vue.extend({
} }
}, },
async selectTables(arr: Array<{ value: number; name: string }>) { async selectTables(arr: Array<{ value: number; name: string }>) {
if (
arr.length === 0 &&
this.role === eNewRoleRelatedToBackEnd.Management &&
!this.$store.state.UserManagement.sameLevelRoleOfManager
) {
this.$message.info({
content: '请先选择相应分区',
icon: () => {
return this.$createElement('Icon', {
style: { color: '#3E4FAF' },
props: { type: 'exclamation-circle' },
})
},
})
return
}
const query = { const query = {
rankVal: JSON.stringify(arr), rankVal: JSON.stringify(arr),
role: this.search, role: this.search,
...@@ -348,8 +352,8 @@ export default Vue.extend({ ...@@ -348,8 +352,8 @@ export default Vue.extend({
}, },
reset() { reset() {
;(this.$refs.headerSelect as any).init() ;(this.$refs.headerSelect as any).init()
this.search = eNewRoleRelatedToBackEnd.Management this.search = eNewRoleRelatedToBackEnd.ACM
this.type = bank['一级分行'] this.type = bank['二级支行']
}, },
}, },
}) })
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<a-layout-header> <a-layout-header>
<div class="flex justify-between items-center h-full"> <div class="flex justify-between items-center h-full">
<div class="text-center text-lg my-3 flex font-semibold"> <div class="text-center text-lg my-3 flex font-semibold">
<img src="../../assets/org_logo.png" class=" w-7 h-7 mr-2" /> <img src="../../assets/org_logo.png" class="w-7 h-7 mr-2" />
浙江省中小企业协会综合服务平台 浙江省中小企业协会综合服务平台
</div> </div>
<div> <div>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</div> </div>
</a-layout-header> </a-layout-header>
<a-layout> <a-layout>
<a-layout-sider width="240" style="background: white; min-height:100vh"> <a-layout-sider width="240" style="background: white; min-height: 100vh">
<a-menu <a-menu
style="width: 240px" style="width: 240px"
:open-keys.sync="openKeys" :open-keys.sync="openKeys"
...@@ -126,14 +126,14 @@ export default Vue.extend({ ...@@ -126,14 +126,14 @@ export default Vue.extend({
computed: { computed: {
role(): eRole | undefined { role(): eRole | undefined {
const msg = getUserMsg() const msg = getUserMsg()
return ((msg && getOldRoleFromUserMsg(msg)) as unknown) as eRole | undefined return (msg && getOldRoleFromUserMsg(msg)) as unknown as eRole | undefined
}, },
menuList(): iMenuList { menuList(): iMenuList {
// console.log(this.role, "show this.role"); // console.log(this.role, "show this.role");
return (this.role !== undefined && getMenuList(this.role)) || [] return (this.role !== undefined && getMenuList(this.role)) || []
}, },
filteredMenuList(): iMenuList { filteredMenuList(): iMenuList {
return this.menuList.filter(i => !i.hiddeInMenu) return this.menuList.filter((i) => !i.hiddeInMenu)
}, },
selectedKeys(): Array<String> { selectedKeys(): Array<String> {
return [(this.$route.meta as { selectedName: string }).selectedName] return [(this.$route.meta as { selectedName: string }).selectedName]
...@@ -141,7 +141,7 @@ export default Vue.extend({ ...@@ -141,7 +141,7 @@ export default Vue.extend({
phone() { phone() {
// let trip = JSON.parse(window.localStorage.getItem('userName')as any); //取 // let trip = JSON.parse(window.localStorage.getItem('userName')as any); //取
let name = localStorage.getItem('userName') let name = localStorage.getItem('userName')
console.log(name, 'this name') // console.log(name, 'this name')
return name return name
}, },
}, },
...@@ -178,11 +178,11 @@ export default Vue.extend({ ...@@ -178,11 +178,11 @@ export default Vue.extend({
}, },
handleClickMenu(e: { key: string; keyPath: string[] }) { handleClickMenu(e: { key: string; keyPath: string[] }) {
const list: iMenuItem[] = [] const list: iMenuItem[] = []
this.menuList.forEach(item => { this.menuList.forEach((item) => {
const children = item.children const children = item.children
if (children && children.length !== 0) { if (children && children.length !== 0) {
/* 有子菜单 */ /* 有子菜单 */
children?.forEach(i => { children?.forEach((i) => {
list.push(i) list.push(i)
}) })
} else { } else {
...@@ -190,7 +190,7 @@ export default Vue.extend({ ...@@ -190,7 +190,7 @@ export default Vue.extend({
list.push(item) list.push(item)
} }
}) })
const item = list.find(i => i.routeName === e.key) const item = list.find((i) => i.routeName === e.key)
item && item &&
this.$router.push({ this.$router.push({
name: item.routeName, name: item.routeName,
...@@ -200,7 +200,7 @@ export default Vue.extend({ ...@@ -200,7 +200,7 @@ export default Vue.extend({
return menu.children && menu.children.length !== 0 return menu.children && menu.children.length !== 0
}, },
logout() { logout() {
userService.logout().then(res => { userService.logout().then((res) => {
if (res.code === 200) { if (res.code === 200) {
const role = getUserMsg()?.newRole const role = getUserMsg()?.newRole
window.localStorage.clear() window.localStorage.clear()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment