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>
<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
class="header-select-item mx-3 my-2"
@change="(value) => handleSelectChange(value, index)"
:placeholder="item.placeholder"
:value="item.value"
:disabled="item.disable"
:disabled="index + 1 <= userLevel ? true : item.disable"
>
<a-select-option
:value="option.ID"
......@@ -21,8 +26,6 @@
<script lang="ts">
import { eLevel } from "@/types/level";
import { eNewRoleRelatedToBackEnd } from "@/types/role";
import { getSelfOutLet } from "@/utils/outlet";
import { message } from "ant-design-vue";
import StaffService from "@/service/StaffService";
import { fooList } from "./const";
......@@ -43,7 +46,7 @@ export default Vue.extend({
},
setFooList: Function,
level: Number,
role: String as PropType<eNewRoleRelatedToBackEnd>,
userLevel: Number,
},
data() {
return {};
......@@ -53,8 +56,9 @@ export default Vue.extend({
},
methods: {
handleSelectChange(value: number, index: number) {
this.fooList[index].value = value;
const newList = this.fooList.map((i, idx) => {
const baseList = [...this.fooList];
baseList[index].value = value;
const newList = baseList.map((i, idx) => {
idx > index && console.log(i);
return {
...i,
......@@ -72,8 +76,9 @@ export default Vue.extend({
parent_id: this.fooList[index - 1].value,
});
if (ret.code === 200) {
this.fooList[index].options = ret.data.item;
this.changeFooList(this.fooList);
const baseList = [...this.fooList];
baseList[index].options = ret.data.item;
this.changeFooList(baseList);
}
},
changeFooList(v: any[]) {
......@@ -93,6 +98,7 @@ export default Vue.extend({
};
}
});
this.setFooList(newList);
},
resetList() {
......@@ -107,20 +113,16 @@ export default Vue.extend({
this.setFooList([...list]);
},
async init() {
const selfOutLet = await getSelfOutLet();
this.resetList();
this.$nextTick(() => {
if (this.role === eNewRoleRelatedToBackEnd.BackAdmin) {
this.initBackAdmin(selfOutLet);
} else if (this.level === eLevel.firstLevel_branch) {
this.init_firstLevel(selfOutLet);
} else if (this.level === eLevel.secondary_branch) {
this.init_secondLevel(selfOutLet);
} else if (this.level === eLevel.firstLevel_sub_branch) {
this.init_first_sub_Level(selfOutLet);
} else if (this.level === eLevel.secondary_sub_branch) {
this.init_second_sub_Level(selfOutLet);
}
// if (this.level === eLevel.firstLevel_branch) {
// this.init_firstLevel(selfOutLet);
// } else if (this.level === eLevel.secondary_branch) {
// this.init_secondLevel(selfOutLet);
// } else if (this.level === eLevel.firstLevel_sub_branch) {
// this.init_first_sub_Level(selfOutLet);
// } else if (this.level === eLevel.secondary_sub_branch) {
// this.init_second_sub_Level(selfOutLet);
// }
});
},
async initBackAdmin(selfOutLet: iOutLet) {
......@@ -129,8 +131,9 @@ export default Vue.extend({
});
if (ret.code === 200) {
const options = ret.data.item;
this.fooList[0].options = options;
const newList = this.fooList.map((item, i) => {
const baseList = [...this.fooList];
baseList[0].options = options;
const newList = baseList.map((item, i) => {
return {
...item,
disable: i >= 1,
......@@ -158,12 +161,14 @@ export default Vue.extend({
page_size: 10000,
parent_id: sid,
});
const baseList = [...this.fooList];
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) {
const baseList = [...this.fooList];
const { fid, first_branch, sid, second_branch, fs_id, first_sub_branch } =
selfOutLet;
const list = this.initFooListBasicValues(
......@@ -177,9 +182,9 @@ export default Vue.extend({
parent_id: fs_id,
});
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) {
this.initFooListBasicValues(selfOutLet, eLevel.secondary_sub_branch);
......
......@@ -33,37 +33,22 @@
</a-form-model-item>
<a-form-model-item label="岗位角色">
<span class="text-sm text-black mr-2">{{ theRole }}</span>
<a-switch @change="onChange" v-if="isManager" />
<span class="ml-2" v-if="isManager">可对同级管理员进行管理调配</span>
<!-- <a-switch @change="onChange" v-if="isManager" /> -->
<!-- <span class="ml-2" v-if="isManager">可对同级管理员进行管理调配</span> -->
</a-form-model-item>
<a-form-model-item label="用户所在机构层级">
<span class="text-sm text-black">{{ searchLevel | filterLevel }}</span>
</a-form-model-item>
<!-- 不可选层级 -->
<!-- <a-form-model-item
v-for="i in level"
:label="'所属' + label[i - 1]"
:key="i"
>
<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> -->
<HeaderSelect
ref="headerSelect"
:setFooList="setFooList"
:fooList="fooList"
:level="level"
:userLevel="searchLevel"
/>
<a-form-model-item label="新地址" :required="true" prop="location">
<a-input
:disabled="true"
v-model="form.location"
placeholder="请输入新地址"
style="width: 200px"
......@@ -78,8 +63,7 @@
</template>
<script lang="ts">
import Vue from "vue";
import { PropType } from "vue";
import Vue, { PropType } from "vue";
import { FormModel, Switch } from "ant-design-vue";
import { eLevel } from "@/types/level";
import { LEVE_ORG } from "@/views/Root/OutletManagement/const";
......@@ -87,8 +71,11 @@ import { mapMutations, mapState } from "vuex";
import {
eAddManagerModalMode,
eTypeOfOperatedObject,
iBranchDetailMsg,
} 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);
......@@ -137,8 +124,8 @@ export default Vue.extend({
modalShow: "modalShow",
modalMode: "modalMode",
searchLevel: "searchLevel",
branchDetailMsg: "branchDetailMsg",
personalMsg: "personalMsg",
branchDetailMsg: "branchDetailMsg",
typeOfOperatedObject: "typeOfOperatedObject",
}),
},
......@@ -161,8 +148,37 @@ export default Vue.extend({
location: [
{ 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 {
fooList,
addrules,
form: {
name: "",
......@@ -170,10 +186,89 @@ export default Vue.extend({
password: "abc123456",
location: "",
privilege: false,
fooProp0: undefined as number | undefined,
fooProp1: undefined as number | undefined,
fooProp2: undefined as number | undefined,
fooProp3: undefined as number | undefined,
},
outletName: "",
};
},
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", {
save: "save",
}),
......@@ -191,6 +286,18 @@ export default Vue.extend({
onConfirm() {
(this.$refs.addForm as FormModel).validate((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);
} else {
return false;
......@@ -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>
......
......@@ -12,8 +12,13 @@ export default <Module<iUserManagementState, {}>>{
modalShow: true,
modalMode: eAddManagerModalMode.create,
typeOfOperatedObject: eTypeOfOperatedObject.manager,
searchLevel: eLevel.firstLevel_branch,
branchDeatilMsg: {},
searchLevel: eLevel.secondary_branch,
branchDetailMsg: {
fb: 'zhejiang',
fb_id: 1,
sb: 'hz',
sb_id: 1,
},
personalMsg: {
name: '',
uid: '',
......
......@@ -37,7 +37,7 @@ export interface iUserManagementState {
modalMode: eAddManagerModalMode
typeOfOperatedObject: eTypeOfOperatedObject | undefined
searchLevel: eLevel | undefined
branchDeatilMsg: Partial<iBranchDetailMsg>
branchDetailMsg: Partial<iBranchDetailMsg>
personalMsg: iPersonalMsg
address: string
}
......@@ -45,8 +45,8 @@ export default Vue.extend({
const level = this.$route.query.level
const params = {
firstBranch: +keys[0] || undefined,
firstSubBranch: +keys[1] || undefined,
secondBranch: +keys[2] || undefined,
firstSubBranch: +keys[2] || undefined,
secondBranch: +keys[1] || undefined,
secondSubBranch: +keys[3] || undefined,
level
}
......
......@@ -170,7 +170,7 @@ export const menuList: iMenuConfigItem[] = [
roles: [
eRole.superManager,
eRole.firstLevel_branch,
eRole.firstLevel_sub_branch,
eRole.secondary_branch,
],
},
{
......@@ -198,6 +198,7 @@ export const menuList: iMenuConfigItem[] = [
roles: [
eRole.superManager,
eRole.firstLevel_branch,
eRole.secondary_branch,
eRole.firstLevel_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