Commit ddcfd196 authored by chenqikuai's avatar chenqikuai

headerSelect组件完成

parent 4531bd54
export enum eRole { export enum eRole {
platform_management, // 平台管理员 platform_management, // 平台管理员 admin admin
superManager, // 超级管理员 也叫 银行管理员 superManager, // 超级管理员 也叫 银行管理员
firstLevel_branch, // 一级分行管理员 firstLevel_branch, // 一级分行管理员
......
...@@ -12,7 +12,7 @@ export async function getSelfOutLet(): Promise<iOutLet> { ...@@ -12,7 +12,7 @@ export async function getSelfOutLet(): Promise<iOutLet> {
const data: iOutLet = ret.data const data: iOutLet = ret.data
localStorage.setItem(OUT_LET, JSON.stringify(data)) localStorage.setItem(OUT_LET, JSON.stringify(data))
} else { } else {
throw new Error('用户网点信息获取失败F') throw new Error('用户网点信息获取失败')
} }
} }
const storage = localStorage.getItem(OUT_LET) const storage = localStorage.getItem(OUT_LET)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<a-select <a-select
v-for="(item, index) in fooList" v-for="(item, index) in fooList"
:key="index" :key="index"
class="header-select-item mx-3" 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"
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
import { eLevel } from "@/types/level"; import { eLevel } from "@/types/level";
import { eNewRoleRelatedToBackEnd } from "@/types/role"; import { eNewRoleRelatedToBackEnd } from "@/types/role";
import { getSelfOutLet } from "@/utils/outlet"; import { getSelfOutLet } from "@/utils/outlet";
import { getUserMsg } from "@/utils/userMsg/userMsg";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import StaffService from "@/service/StaffService"; import StaffService from "@/service/StaffService";
import { fooList } from "./const"; 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";
export default Vue.extend({ export default Vue.extend({
props: { props: {
fooList: { fooList: {
...@@ -89,50 +89,147 @@ export default Vue.extend({ ...@@ -89,50 +89,147 @@ export default Vue.extend({
}); });
this.setFooList(newList); this.setFooList(newList);
}, },
resetList() {
const list = this.fooList.map((i) => {
return {
...i,
disable: false,
value: undefined,
options: [],
};
});
this.setFooList([...list]);
},
async init() { async init() {
const selfOutLet = await getSelfOutLet(); const selfOutLet = await getSelfOutLet();
if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) { this.resetList();
const ret = await StaffService.getInstance().getBranch({ this.$nextTick(() => {
level: eLevel.firstLevel_branch, if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) {
}); this.initBackAdmin(selfOutLet);
if (ret.code === 200) { } else if (this.level === eLevel.firstLevel_branch) {
const options = ret.data.item; this.init_firstLevel(selfOutLet);
this.fooList[0].options = options; } else if (this.level === eLevel.secondary_branch) {
const newList = this.fooList.map((item, i) => { this.init_secondLevel(selfOutLet);
return { } else if (this.level === eLevel.firstLevel_sub_branch) {
...item, this.init_first_sub_Level(selfOutLet);
disable: i >= 1, } else if (this.level === eLevel.secondary_sub_branch) {
}; this.init_second_sub_Level(selfOutLet);
});
this.setFooList(newList);
} }
} else if (this.level === eLevel.firstLevel_branch) { });
this.init_firstLevel(selfOutLet); },
} else if (this.level === eLevel.secondary_branch) { async initBackAdmin(selfOutLet: iOutLet) {
this.init_firstLevel(selfOutLet); const ret = await StaffService.getInstance().getBranch({
// this.setSelectValue([selfOutLet.fid, selfOutLet.sid]); level: eLevel.firstLevel_branch,
} else if (this.level === eLevel.firstLevel_sub_branch) { });
// this. if (ret.code === 200) {
// this.setSelectValue([selfOutLet.fid, selfOutLet.sid, selfOutLet.fs_id]); const options = ret.data.item;
} else if (this.level === eLevel.secondary_sub_branch) { this.fooList[0].options = options;
// this.setSelectValue([ const newList = this.fooList.map((item, i) => {
// selfOutLet.fid, return {
// selfOutLet.sid, ...item,
// selfOutLet.fs_id, disable: i >= 1,
// selfOutLet.ss_id, };
// ]); });
this.setFooList(newList);
} }
}, },
init_firstLevel(selfOutLet: iOutLet) { init_firstLevel(selfOutLet: iOutLet) {
const { fid, first_branch } = selfOutLet; const list = this.initFooListBasicValues(
this.fooList[0].value = fid; selfOutLet,
this.fooList[0].options = [{ ID: fid, Name: first_branch }]; eLevel.firstLevel_branch
this.fooList[0].disable = true; );
this.setFooList(list);
},
async init_secondLevel(selfOutLet: iOutLet) {
const { fid, first_branch, sid, second_branch } = selfOutLet;
const list = this.initFooListBasicValues(
selfOutLet,
eLevel.secondary_branch
);
this.setFooList(list);
const ret = await StaffService.getInstance().getBranch({
level: eLevel.firstLevel_sub_branch,
page_size: 10000,
parent_id: sid,
});
if (ret.code === 200) {
this.fooList[2].options = ret.data.item;
}
this.setFooList(this.fooList); this.setFooList(this.fooList);
}, },
init_secondLevel(selfOutLet: iOutLet) {}, async init_first_sub_Level(selfOutLet: iOutLet) {
init_first_sub_Level(selfOutLet: iOutLet) {}, const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } =
init_second_sub_Level(selfOutLet: iOutLet) {}, selfOutLet;
const list = this.initFooListBasicValues(
selfOutLet,
eLevel.firstLevel_sub_branch
);
this.setFooList(list);
const ret = await StaffService.getInstance().getBranch({
level: eLevel.secondary_sub_branch,
page_size: 1000,
parent_id: fs_id,
});
if (ret.code === 200) {
this.fooList[3].options = ret.data.item;
}
this.setFooList(this.fooList);
},
init_second_sub_Level(selfOutLet: iOutLet) {
this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch);
},
initFooListBasicValues(selfOutLet: iOutLet, level: eLevel) {
let list = this.fooList;
const {
fid,
first_branch,
sid,
second_branch,
fs_id,
first_sub_branch,
ss_id,
second_sub_branch,
} = selfOutLet;
if (
[
eLevel.firstLevel_branch,
eLevel.secondary_branch,
eLevel.firstLevel_sub_branch,
eLevel.secondary_sub_branch,
].includes(level)
) {
list[0].value = fid;
list[0].options = [{ ID: fid, Name: first_branch }];
list[0].disable = true;
}
if (
[
eLevel.secondary_branch,
eLevel.firstLevel_sub_branch,
eLevel.secondary_sub_branch,
].includes(level)
) {
list[1].value = sid;
list[1].options = [{ ID: sid, Name: second_branch }];
list[1].disable = true;
}
if (
[eLevel.firstLevel_sub_branch, eLevel.secondary_sub_branch].includes(
level
)
) {
list[2].value = fs_id;
list[2].options = [{ ID: fs_id, Name: first_sub_branch }];
list[2].disable = true;
}
if ([eLevel.secondary_sub_branch].includes(level)) {
list[3].value = ss_id;
list[3].options = [{ ID: ss_id, Name: second_sub_branch }];
list[3].disable = true;
}
return list;
},
popupScroll1(e: Event) { popupScroll1(e: Event) {
let h = e.target as HTMLElement; let h = e.target as HTMLElement;
if (h.scrollHeight - h.scrollTop <= h.clientHeight) { if (h.scrollHeight - h.scrollTop <= h.clientHeight) {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<p class="text-2xl font-bold mb-5">网点管理</p> <p class="text-2xl font-bold mb-5">网点管理</p>
<div> <div>
<header-select <header-select
ref="headerSelect"
:setFooList="setFooList" :setFooList="setFooList"
:fooList="fooList" :fooList="fooList"
:level="level" :level="level"
...@@ -360,49 +361,9 @@ export default Vue.extend({ ...@@ -360,49 +361,9 @@ export default Vue.extend({
}, },
clickQueryOnSearchPage() {}, clickQueryOnSearchPage() {},
clickReset() { clickReset() {
this.cascaderValue = []; (this.$refs.headerSelect as any).init();
this.addressSearchValue = ""; this.addressSearchValue = "";
}, },
onChange(value: any[]) {
this.cascaderValue = value;
if (this.cascaderValue.length === LEVE_ORG) {
this.$router.push({
query: {
cascaderValue: this.cascaderValue.toString(),
},
});
}
},
loadData(
selectedOptions: {
loading: boolean;
isLeaf: boolean;
value: any;
label: string;
children: any[];
}[]
) {
const targetOption = selectedOptions[selectedOptions.length - 1];
targetOption.loading = true;
// load options lazily
setTimeout(() => {
targetOption.loading = false;
targetOption.children = [
{
label: `${targetOption.label} Dynamic 1`,
value: "dynamic1",
isLeaf: false,
},
{
label: `${targetOption.label} Dynamic 2`,
isLeaf: true,
value: "dynamic2",
},
];
this.options = [...this.options];
}, 10);
},
clickResetOnSearchPage() { clickResetOnSearchPage() {
this.searchPageReqParams.name = ""; this.searchPageReqParams.name = "";
this.searchPageReqParams.phone = ""; this.searchPageReqParams.phone = "";
......
...@@ -50,7 +50,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -50,7 +50,7 @@ export const menuList: iMenuConfigItem[] = [
// getName: () => '理财产品', // getName: () => '理财产品',
// roles: [eRole.superManager], // roles: [eRole.superManager],
// routeName: 'financialManagement', // routeName: 'financialManagement',
// hiddeInMenu: false, // hiddeInMenu: false,
// path: '/backend/product/financialManagement', // path: '/backend/product/financialManagement',
// component: () => import('@/views/Root/Banner/index.vue'), // component: () => import('@/views/Root/Banner/index.vue'),
// onClick: (e: Event) => {}, // onClick: (e: Event) => {},
...@@ -93,7 +93,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -93,7 +93,7 @@ export const menuList: iMenuConfigItem[] = [
eRole.firstLevel_sub_branch, eRole.firstLevel_sub_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
eRole.secondary_sub_clientManager, eRole.secondary_sub_clientManager,
eRole.firstLevel_sub_clientManager eRole.firstLevel_sub_clientManager,
], ],
onClick: (e: Event) => {}, onClick: (e: Event) => {},
}, },
...@@ -103,9 +103,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -103,9 +103,7 @@ export const menuList: iMenuConfigItem[] = [
routeName: 'loanProduct', routeName: 'loanProduct',
path: '/backend/loanProduct', path: '/backend/loanProduct',
component: () => import('@/views/Root/Product/Loan/index.vue'), component: () => import('@/views/Root/Product/Loan/index.vue'),
roles: [ roles: [eRole.superManager],
eRole.superManager,
],
}, },
{ {
getName: () => '发布贷款产品', getName: () => '发布贷款产品',
...@@ -126,7 +124,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -126,7 +124,7 @@ export const menuList: iMenuConfigItem[] = [
belongToMenuName: 'userManage', belongToMenuName: 'userManage',
component: () => import('@/views/Root/User/client.vue'), component: () => import('@/views/Root/User/client.vue'),
roles: [ roles: [
eRole.superManager, eRole.superManager,
eRole.firstLevel_branch, eRole.firstLevel_branch,
eRole.firstLevel_sub_clientManager, eRole.firstLevel_sub_clientManager,
], ],
...@@ -149,10 +147,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -149,10 +147,7 @@ export const menuList: iMenuConfigItem[] = [
hiddeInMenu: true, hiddeInMenu: true,
belongToMenuName: 'userManage', belongToMenuName: 'userManage',
component: () => import('@/views/Root/User/secondary.vue'), component: () => import('@/views/Root/User/secondary.vue'),
roles: [ roles: [eRole.superManager, eRole.firstLevel_branch],
eRole.superManager,
eRole.firstLevel_branch
],
}, },
{ {
getName: () => '一级支行搜索结果', getName: () => '一级支行搜索结果',
...@@ -226,7 +221,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -226,7 +221,7 @@ export const menuList: iMenuConfigItem[] = [
eRole.firstLevel_sub_branch, eRole.firstLevel_sub_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
eRole.firstLevel_sub_clientManager, eRole.firstLevel_sub_clientManager,
eRole.secondary_sub_clientManager eRole.secondary_sub_clientManager,
], ],
}, },
{ {
...@@ -271,8 +266,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -271,8 +266,7 @@ export const menuList: iMenuConfigItem[] = [
routeName: 'activity', routeName: 'activity',
path: '/backend/activity', path: '/backend/activity',
component: () => import('@/views/Root/Activity/index.vue'), component: () => import('@/views/Root/Activity/index.vue'),
roles: [eRole.superManager, roles: [eRole.superManager],
],
}, },
{ {
getName: () => '用户管理', getName: () => '用户管理',
...@@ -280,9 +274,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -280,9 +274,7 @@ export const menuList: iMenuConfigItem[] = [
routeName: 'platformUserManagement', routeName: 'platformUserManagement',
path: '/backend/platformUserManagement', path: '/backend/platformUserManagement',
component: () => import('@/views/Root/Platform_UserManagement/index.vue'), component: () => import('@/views/Root/Platform_UserManagement/index.vue'),
roles: [ roles: [eRole.platform_management],
eRole.platform_management,
],
}, },
{ {
getName: () => '安全设置', getName: () => '安全设置',
...@@ -303,7 +295,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -303,7 +295,7 @@ export const menuList: iMenuConfigItem[] = [
eRole.secondary_branch, eRole.secondary_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
eRole.firstLevel_sub_clientManager, eRole.firstLevel_sub_clientManager,
eRole.secondary_sub_clientManager eRole.secondary_sub_clientManager,
], ],
onClick: (e: Event) => {}, onClick: (e: Event) => {},
}, },
...@@ -321,7 +313,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -321,7 +313,7 @@ export const menuList: iMenuConfigItem[] = [
eRole.secondary_branch, eRole.secondary_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
eRole.firstLevel_sub_clientManager, eRole.firstLevel_sub_clientManager,
eRole.secondary_sub_clientManager eRole.secondary_sub_clientManager,
], ],
}, },
], ],
...@@ -333,7 +325,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -333,7 +325,7 @@ export const menuList: iMenuConfigItem[] = [
eRole.secondary_branch, eRole.secondary_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
eRole.firstLevel_sub_clientManager, eRole.firstLevel_sub_clientManager,
eRole.secondary_sub_clientManager eRole.secondary_sub_clientManager,
], ],
}, },
{ {
......
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