Commit 2f73c0e2 authored by xhx's avatar xhx

Merge branch 'dev' of https://gitlab.33.cn/CassiniatSaturn/fns_backend into dev

parents e428d0a4 62a2bff0
<template> <template>
<div class="header-select"> <div class="header-select">
<FormModelItem v-for="(item, index) in fooList" :key="index" :label="item.label"> <FormModelItem
v-for="(item, index) in fooList"
:prop="`fooProp${index}`"
:key="index"
:label="item.label"
>
<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="item.disable" :disabled="index + 1 <= userLevel ? true : item.disable"
> >
<a-select-option <a-select-option
:value="option.ID" :value="option.ID"
...@@ -21,8 +26,6 @@ ...@@ -21,8 +26,6 @@
<script lang="ts"> <script lang="ts">
import { eLevel } from "@/types/level"; import { eLevel } from "@/types/level";
import { eNewRoleRelatedToBackEnd } from "@/types/role";
import { getSelfOutLet } from "@/utils/outlet";
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";
...@@ -43,7 +46,7 @@ export default Vue.extend({ ...@@ -43,7 +46,7 @@ export default Vue.extend({
}, },
setFooList: Function, setFooList: Function,
level: Number, level: Number,
role: String as PropType<eNewRoleRelatedToBackEnd>, userLevel: Number,
}, },
data() { data() {
return {}; return {};
...@@ -53,8 +56,9 @@ export default Vue.extend({ ...@@ -53,8 +56,9 @@ export default Vue.extend({
}, },
methods: { methods: {
handleSelectChange(value: number, index: number) { handleSelectChange(value: number, index: number) {
this.fooList[index].value = value; const baseList = [...this.fooList];
const newList = this.fooList.map((i, idx) => { baseList[index].value = value;
const newList = baseList.map((i, idx) => {
idx > index && console.log(i); idx > index && console.log(i);
return { return {
...i, ...i,
...@@ -72,8 +76,9 @@ export default Vue.extend({ ...@@ -72,8 +76,9 @@ export default Vue.extend({
parent_id: this.fooList[index - 1].value, parent_id: this.fooList[index - 1].value,
}); });
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[index].options = ret.data.item; const baseList = [...this.fooList];
this.changeFooList(this.fooList); baseList[index].options = ret.data.item;
this.changeFooList(baseList);
} }
}, },
changeFooList(v: any[]) { changeFooList(v: any[]) {
...@@ -93,6 +98,7 @@ export default Vue.extend({ ...@@ -93,6 +98,7 @@ export default Vue.extend({
}; };
} }
}); });
this.setFooList(newList); this.setFooList(newList);
}, },
resetList() { resetList() {
...@@ -107,20 +113,16 @@ export default Vue.extend({ ...@@ -107,20 +113,16 @@ export default Vue.extend({
this.setFooList([...list]); this.setFooList([...list]);
}, },
async init() { async init() {
const selfOutLet = await getSelfOutLet();
this.resetList();
this.$nextTick(() => { this.$nextTick(() => {
if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) { // if (this.level === eLevel.firstLevel_branch) {
this.initBackAdmin(selfOutLet); // this.init_firstLevel(selfOutLet);
} else if (this.level === eLevel.firstLevel_branch) { // } else if (this.level === eLevel.secondary_branch) {
this.init_firstLevel(selfOutLet); // this.init_secondLevel(selfOutLet);
} else if (this.level === eLevel.secondary_branch) { // } else if (this.level === eLevel.firstLevel_sub_branch) {
this.init_secondLevel(selfOutLet); // this.init_first_sub_Level(selfOutLet);
} else if (this.level === eLevel.firstLevel_sub_branch) { // } else if (this.level === eLevel.secondary_sub_branch) {
this.init_first_sub_Level(selfOutLet); // this.init_second_sub_Level(selfOutLet);
} else if (this.level === eLevel.secondary_sub_branch) { // }
this.init_second_sub_Level(selfOutLet);
}
}); });
}, },
async initBackAdmin(selfOutLet: iOutLet) { async initBackAdmin(selfOutLet: iOutLet) {
...@@ -129,8 +131,9 @@ export default Vue.extend({ ...@@ -129,8 +131,9 @@ export default Vue.extend({
}); });
if (ret.code === 200) { if (ret.code === 200) {
const options = ret.data.item; const options = ret.data.item;
this.fooList[0].options = options; const baseList = [...this.fooList];
const newList = this.fooList.map((item, i) => { baseList[0].options = options;
const newList = baseList.map((item, i) => {
return { return {
...item, ...item,
disable: i >= 1, disable: i >= 1,
...@@ -158,12 +161,14 @@ export default Vue.extend({ ...@@ -158,12 +161,14 @@ export default Vue.extend({
page_size: 10000, page_size: 10000,
parent_id: sid, parent_id: sid,
}); });
const baseList = [...this.fooList];
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[2].options = ret.data.item; baseList[2].options = ret.data.item;
} }
this.setFooList(this.fooList); this.setFooList(baseList);
}, },
async init_first_sub_Level(selfOutLet: iOutLet) { async init_first_sub_Level(selfOutLet: iOutLet) {
const baseList = [...this.fooList];
const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } = const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } =
selfOutLet; selfOutLet;
const list = this.initFooListBasicValues( const list = this.initFooListBasicValues(
...@@ -177,9 +182,9 @@ export default Vue.extend({ ...@@ -177,9 +182,9 @@ export default Vue.extend({
parent_id: fs_id, parent_id: fs_id,
}); });
if (ret.code === 200) { if (ret.code === 200) {
this.fooList[3].options = ret.data.item; baseList[3].options = ret.data.item;
} }
this.setFooList(this.fooList); this.setFooList(baseList);
}, },
init_second_sub_Level(selfOutLet: iOutLet) { init_second_sub_Level(selfOutLet: iOutLet) {
this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch); this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch);
......
...@@ -33,37 +33,22 @@ ...@@ -33,37 +33,22 @@
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="岗位角色"> <a-form-model-item label="岗位角色">
<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-if="isManager" /> <!-- <a-switch @change="onChange" v-if="isManager" /> -->
<span class="ml-2" v-if="isManager">可对同级管理员进行管理调配</span> <!-- <span class="ml-2" v-if="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>
</a-form-model-item> </a-form-model-item>
<!-- 不可选层级 --> <HeaderSelect
<!-- <a-form-model-item ref="headerSelect"
v-for="i in level" :setFooList="setFooList"
:label="'所属' + label[i - 1]" :fooList="fooList"
:key="i" :level="level"
> :userLevel="searchLevel"
<span class="text-sm text-black">fjhb</span> />
</a-form-model-item> -->
<!-- 可选层级 -->
<!-- <a-form-model-item
v-for="n in level_org - level"
:label="'所属' + labelList[n - 1]"
:key="n"
>
<a-select
:placeholder="'选择所属' + labelList[n - 1]"
style="width: 200px; margin-right: 10px"
>
<a-select-option v-for="bank in bankList" :key="bank">{{
bank
}}</a-select-option>
</a-select>
</a-form-model-item> -->
<a-form-model-item label="新地址" :required="true" prop="location"> <a-form-model-item label="新地址" :required="true" prop="location">
<a-input <a-input
:disabled="true"
v-model="form.location" v-model="form.location"
placeholder="请输入新地址" placeholder="请输入新地址"
style="width: 200px" style="width: 200px"
...@@ -78,8 +63,7 @@ ...@@ -78,8 +63,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from "vue"; import Vue, { PropType } from "vue";
import { PropType } from "vue";
import { FormModel, Switch } from "ant-design-vue"; import { FormModel, Switch } from "ant-design-vue";
import { eLevel } from "@/types/level"; import { eLevel } from "@/types/level";
import { LEVE_ORG } from "@/views/Root/OutletManagement/const"; import { LEVE_ORG } from "@/views/Root/OutletManagement/const";
...@@ -87,8 +71,11 @@ import { mapMutations, mapState } from "vuex"; ...@@ -87,8 +71,11 @@ import { mapMutations, mapState } from "vuex";
import { import {
eAddManagerModalMode, eAddManagerModalMode,
eTypeOfOperatedObject, eTypeOfOperatedObject,
iBranchDetailMsg,
} from "@/store/UserManagement/types"; } from "@/store/UserManagement/types";
import HeaderSelect from "@/views/Root/OutletManagement/components/HeaderSelect2/index.vue"; import HeaderSelect from "@/components/HeaderSelect2/index.vue";
import { fooList } from "@/components/HeaderSelect2/const";
import StaffService from "@/service/StaffService";
Vue.use(Switch); Vue.use(Switch);
...@@ -137,8 +124,8 @@ export default Vue.extend({ ...@@ -137,8 +124,8 @@ export default Vue.extend({
modalShow: "modalShow", modalShow: "modalShow",
modalMode: "modalMode", modalMode: "modalMode",
searchLevel: "searchLevel", searchLevel: "searchLevel",
branchDetailMsg: "branchDetailMsg",
personalMsg: "personalMsg", personalMsg: "personalMsg",
branchDetailMsg: "branchDetailMsg",
typeOfOperatedObject: "typeOfOperatedObject", typeOfOperatedObject: "typeOfOperatedObject",
}), }),
}, },
...@@ -161,8 +148,37 @@ export default Vue.extend({ ...@@ -161,8 +148,37 @@ export default Vue.extend({
location: [ location: [
{ required: true, message: "请输入详细地址", trigger: "blur" }, { required: true, message: "请输入详细地址", trigger: "blur" },
], ],
fooProp0: [
{
required: true,
message: "请选择一级分行",
trigger: "blur",
},
],
fooProp1: [
{
required: true,
message: "请选择二级分行",
trigger: "blur",
},
],
fooProp2: [
{
required: true,
message: "请选择一级支行",
trigger: "blur",
},
],
fooProp3: [
{
required: true,
message: "请选择二级支行",
trigger: "blur",
},
],
}; };
return { return {
fooList,
addrules, addrules,
form: { form: {
name: "", name: "",
...@@ -170,10 +186,89 @@ export default Vue.extend({ ...@@ -170,10 +186,89 @@ export default Vue.extend({
password: "abc123456", password: "abc123456",
location: "", location: "",
privilege: false, privilege: false,
fooProp0: undefined as number | undefined,
fooProp1: undefined as number | undefined,
fooProp2: undefined as number | undefined,
fooProp3: undefined as number | undefined,
}, },
outletName: "",
}; };
}, },
methods: { methods: {
initFooList() {
const list = this.fooList.map((i) => {
return {
...i,
disable: false,
value: undefined,
options: [],
};
});
this.fooList = list;
const branchDetailMsg = this.branchDetailMsg as iBranchDetailMsg;
if (branchDetailMsg.fb !== undefined) {
this.fooList[0].options = [
{ Name: branchDetailMsg.fb, ID: branchDetailMsg.fb_id },
];
this.fooList[0].value = branchDetailMsg.fb_id;
this.fooList[0].disable = true;
}
if (branchDetailMsg.sb !== undefined) {
this.fooList[1].options = [
{ Name: branchDetailMsg.sb, ID: branchDetailMsg.sb_id },
];
this.fooList[1].value = branchDetailMsg.sb_id;
this.fooList[1].disable = true;
}
if (branchDetailMsg.fsb !== undefined) {
this.fooList[2].options = [
{ Name: branchDetailMsg.fsb, ID: branchDetailMsg.fsb_id },
];
this.fooList[2].value = branchDetailMsg.fsb_id;
this.fooList[2].disable = true;
}
if (branchDetailMsg.ssb !== undefined) {
this.fooList[3].options = [
{ Name: branchDetailMsg.ssb, ID: branchDetailMsg.ssb_id },
];
this.fooList[3].value = branchDetailMsg.ssb_id;
this.fooList[3].disable = true;
}
this.fooList = [...this.fooList];
this.fetchNextOptions();
},
async fetchNextOptions() {
const fooIndex = this.fooList.findIndex(
(item) => item.value === undefined
);
if (fooIndex === -1) {
} else {
if (fooIndex === 0) {
/* 银行管理员添加 一级分行管理员 */
const ret = await StaffService.getInstance().getBranch({
level: eLevel.firstLevel_branch,
page: 1,
page_size: 10000,
});
if (ret.code === 200) {
this.fooList[0].options = ret.data.item;
}
} else {
const ret = await StaffService.getInstance().getBranch({
level: fooIndex + 1,
page: 1,
page_size: 10000,
parent_id: this.fooList[fooIndex - 1].value,
});
if (ret.code === 200) {
this.fooList[fooIndex].options = ret.data.item;
}
}
}
},
setFooList(v: any[]) {
this.fooList = [...v];
},
...mapMutations("UserManagement", { ...mapMutations("UserManagement", {
save: "save", save: "save",
}), }),
...@@ -191,6 +286,18 @@ export default Vue.extend({ ...@@ -191,6 +286,18 @@ export default Vue.extend({
onConfirm() { onConfirm() {
(this.$refs.addForm as FormModel).validate((valid) => { (this.$refs.addForm as FormModel).validate((valid) => {
if (valid) { if (valid) {
if (this.modalMode === eAddManagerModalMode.create) {
StaffService.getInstance().addNextLevel({
attr: {
add_same_level: false,
},
level: this.searchLevel,
name: this.form.name,
password: this.form.password,
phone: this.form.tel,
second_sub_branch: this.form.fooProp3 as number,
});
}
this.setModal(false); this.setModal(false);
} else { } else {
return false; return false;
...@@ -198,6 +305,26 @@ export default Vue.extend({ ...@@ -198,6 +305,26 @@ export default Vue.extend({
}); });
}, },
}, },
watch: {
show(newV) {
if (newV === true) {
this.initFooList();
} else {
const form = this.$refs.addForm as FormModel;
form.resetFields();
}
},
fooList(newV: typeof fooList, oldV: typeof fooList) {
newV.forEach((item, index) => {
(this.form as any)[`fooProp${index}`] = item.value;
});
if (newV[3].options.length !== 0)
this.outletName = newV[3].options[0].Name;
},
outletName(newV, oldV) {
console.log(newV);
},
},
}); });
</script> </script>
......
...@@ -12,8 +12,13 @@ export default <Module<iUserManagementState, {}>>{ ...@@ -12,8 +12,13 @@ export default <Module<iUserManagementState, {}>>{
modalShow: true, modalShow: true,
modalMode: eAddManagerModalMode.create, modalMode: eAddManagerModalMode.create,
typeOfOperatedObject: eTypeOfOperatedObject.manager, typeOfOperatedObject: eTypeOfOperatedObject.manager,
searchLevel: eLevel.firstLevel_branch, searchLevel: eLevel.secondary_branch,
branchDeatilMsg: {}, branchDetailMsg: {
fb: 'zhejiang',
fb_id: 1,
sb: 'hz',
sb_id: 1,
},
personalMsg: { personalMsg: {
name: '', name: '',
uid: '', uid: '',
......
...@@ -37,7 +37,7 @@ export interface iUserManagementState { ...@@ -37,7 +37,7 @@ export interface iUserManagementState {
modalMode: eAddManagerModalMode modalMode: eAddManagerModalMode
typeOfOperatedObject: eTypeOfOperatedObject | undefined typeOfOperatedObject: eTypeOfOperatedObject | undefined
searchLevel: eLevel | undefined searchLevel: eLevel | undefined
branchDeatilMsg: Partial<iBranchDetailMsg> branchDetailMsg: Partial<iBranchDetailMsg>
personalMsg: iPersonalMsg personalMsg: iPersonalMsg
address: string address: string
} }
...@@ -45,8 +45,8 @@ export default Vue.extend({ ...@@ -45,8 +45,8 @@ export default Vue.extend({
const level = this.$route.query.level const level = this.$route.query.level
const params = { const params = {
firstBranch: +keys[0] || undefined, firstBranch: +keys[0] || undefined,
firstSubBranch: +keys[1] || undefined, firstSubBranch: +keys[2] || undefined,
secondBranch: +keys[2] || undefined, secondBranch: +keys[1] || undefined,
secondSubBranch: +keys[3] || undefined, secondSubBranch: +keys[3] || undefined,
level level
} }
......
...@@ -170,7 +170,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -170,7 +170,7 @@ export const menuList: iMenuConfigItem[] = [
roles: [ roles: [
eRole.superManager, eRole.superManager,
eRole.firstLevel_branch, eRole.firstLevel_branch,
eRole.firstLevel_sub_branch, eRole.secondary_branch,
], ],
}, },
{ {
...@@ -198,6 +198,7 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -198,6 +198,7 @@ export const menuList: iMenuConfigItem[] = [
roles: [ roles: [
eRole.superManager, eRole.superManager,
eRole.firstLevel_branch, eRole.firstLevel_branch,
eRole.secondary_branch,
eRole.firstLevel_sub_branch, eRole.firstLevel_sub_branch,
eRole.secondary_sub_branch, eRole.secondary_sub_branch,
], ],
......
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