Commit 5ab4918c authored by chenqikuai's avatar chenqikuai

fix: 调配修改

parent 6e793e1a
......@@ -306,11 +306,9 @@ export default Vue.extend({
this.fooList = list
let branchDetailMsg: iBranchDetailMsg = undefined as unknown as iBranchDetailMsg
if (this.modalMode === eAddManagerModalMode.create) {
console.log(this.branchDetailMsg, 'show this.branchDetailMsg')
branchDetailMsg = this.branchDetailMsg
} else if (this.modalMode === eAddManagerModalMode.edit) {
branchDetailMsg = this.personalMsg.branchDetailMsg
console.log(this.personalMsg.branchDetailMsg, 'show this.personalMsg.branchDetailMsg')
this.form.level = this.level
this.form.name = this.personalMsg.name
}
......@@ -344,9 +342,28 @@ export default Vue.extend({
}
}
/* 调配时 设置disable,限制可选的范围*/
if (this.modalMode === eAddManagerModalMode.edit) {
const user = getUserMsg()
this.fooList.map((foo, index) => {
if (index + 1 + 1 <= (user?.level || 0)) {
foo.disable = true
}
})
/* 如果是管理员,则需要查询同级操作权限 */
if (user?.newRole === eNewRoleRelatedToBackEnd.Management) {
const attrRet = await StaffService.getInstance().getAttr()
if (attrRet.code === 200) {
const privilege = attrRet.data.privilege
/* 设置同级操作权限 */
this.fooList[user.level - 1].disable = !privilege
}
}
}
const fetchOptionListForEverySettledBranchEdit = async (list: typeof fooList) => {
list.forEach(async (item, index) => {
if (index === 0) {
if (index === 0 && !item.disable) {
const ret = await StaffService.getInstance().getBranch({
level: eLevel.firstLevel_branch,
page: 1,
......@@ -356,14 +373,16 @@ export default Vue.extend({
this.fooList[0].options = ret.data.item
}
} else {
const ret = await StaffService.getInstance().getBranch({
level: index + 1,
page: 1,
page_size: 300,
parent_id: this.fooList[index - 1].value,
})
if (ret.code === 200) {
this.fooList[index].options = ret.data.item
if (!item.disable) {
const ret = await StaffService.getInstance().getBranch({
level: index + 1,
page: 1,
page_size: 300,
parent_id: this.fooList[index - 1].value,
})
if (ret.code === 200) {
this.fooList[index].options = ret.data.item
}
}
}
})
......@@ -372,14 +391,7 @@ export default Vue.extend({
if (this.modalMode === eAddManagerModalMode.edit) {
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]
await this.fetchNextOptions()
console.log(this.fooList, 'show foolist')
......
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