[update] 修改企标流程保存后回显的bug

This commit is contained in:
lideqin
2024-01-04 15:30:24 +08:00
parent d0e22cd06b
commit ff76fffa2c
11 changed files with 236 additions and 106 deletions
+2 -1
View File
@@ -114,7 +114,7 @@ export default {
}
getPersonInfoList(param).then(res => {
if (res.success) {
console.log(res.result)
console.log('-------------获取人员信息完成', res.result)
// 处理人员信息数据,判断每个节点是否能选人
this.personnelInfoData = res.result.map(item => {
return {
@@ -128,6 +128,7 @@ export default {
},
// 从草稿进来填过的人员需要回显
draftInitPersonInfo (personInfoObj) {
console.log('--------------draftInitPersonInfo 草稿进来回显')
this.personnelInfoData = this.personnelInfoData.map(item => {
return {
...item,
+31 -11
View File
@@ -135,6 +135,7 @@
import ListMixin from '../mixins/ListMixin'
import CustomHeader from '@/components/CustomHeader'
import { queryAllRole, queryDepartTreeList } from '../api/api'
import { getAction } from '@/api/manage'
export default {
name: 'SelectUser',
@@ -167,16 +168,16 @@ export default {
default: 'radio'
}
},
// watch: {
// selectedData: {
// immediate: true,
// deep: true,
// handler (val) {
// console.log(val)
// this.handleCheckedArr()
// }
// }
// },
watch: {
selectedData: {
immediate: true,
handler (val) {
if (val) {
this.getUserListByIds(val)
}
}
}
},
data () {
return {
realname: '', // 搜索框数据
@@ -193,7 +194,8 @@ export default {
pageSize: 10
},
url: {
list: '/sys/user/page'
list: '/sys/user/page',
userListByIds: '/sys/user/queryByIds'
},
checkedArr: [],
selectedDataArr: [],
@@ -231,6 +233,12 @@ export default {
arr.push(i)
}
}
for (const i of this.selectedDataArr) {
if (!arr.find(item => item.id === i.id)) {
// 已加载完的列表里还没有的选中数据,按顺序推入
arr.push(i)
}
}
this.selectedDataArr = arr
} else {
console.log('------------删除了数据------------')
@@ -242,6 +250,18 @@ export default {
}
console.log(this.selectedDataArr)
},
// 根据id获取用户信息,初始化选中数据,不查选中数据的话如果没有划到那一页,名字带不出来
getUserListByIds (ids) {
const params = {}
params.userIds = ids
getAction(this.url.userListByIds, params).then((res) => {
if (res.success) {
this.selectedDataArr = res.result || []
} else {
this.$message(res.message)
}
})
},
handleCheckedArr () {
// 清空选中的数据
if (this.type === 'checkbox') {
+41 -6
View File
@@ -64,7 +64,7 @@
stop-propagation
:before-close="handleBeforeClose">
<div class="item-box">
<van-checkbox :name="item.id" @click="checkboxClick(item)" shape="square" :disabled="readonly"></van-checkbox>
<van-checkbox :name="item.userId" @click="checkboxClick(item)" shape="square" :disabled="readonly"></van-checkbox>
<div class="item-container">
<div class="item-title">
{{ item.realname }}({{ item.username }})
@@ -91,7 +91,7 @@
stop-propagation
:before-close="handleBeforeClose">
<div class="item-box">
<van-radio :name="item.id" @click="checkboxClick(item)" :disabled="readonly"></van-radio>
<van-radio :name="item.userId" @click="checkboxClick(item)" :disabled="readonly"></van-radio>
<div class="item-container">
<div class="item-title">
{{ item.realname }}({{ item.username }})
@@ -134,6 +134,7 @@
import CustomHeader from '@/components/CustomHeader'
import ListMixin from '@/mixins/ListMixin'
import { getWorkGroupTreeList, queryAllRole } from '@/api/api'
import { getAction } from '@/api/manage'
export default {
name: 'SelectUserByWorkGroup',
@@ -166,6 +167,16 @@ export default {
default: 'radio'
}
},
watch: {
selectedData: {
immediate: true,
handler (val) {
if (val) {
this.getUserListByIds(val)
}
}
}
},
data () {
return {
realname: '', // 搜索框数据
@@ -182,7 +193,8 @@ export default {
pageSize: 10
},
url: {
list: '/act/user/workGroupPage'
list: '/act/user/workGroupPage',
userListByIds: '/sys/user/queryByIds'
},
checkedArr: [],
selectedDataArr: [],
@@ -211,12 +223,18 @@ export default {
checkboxClick (item) {
console.log(item)
if (this.type === 'checkbox') {
if (this.checkedArr.includes(item.id)) {
if (this.checkedArr.includes(item.userId)) {
console.log('------------增加了数据------------')
// 说明是增加了数据,为了顺序和列表顺序保持一致,用循环设置
const arr = []
for (const i of this.listData) {
if (this.checkedArr.includes(i.id)) {
if (this.checkedArr.includes(i.userId)) {
arr.push(i)
}
}
for (const i of this.selectedDataArr) {
if (!arr.find(item => item.userId === i.userId)) {
// 已加载完的列表里还没有的选中数据,按顺序推入
arr.push(i)
}
}
@@ -224,13 +242,30 @@ export default {
} else {
console.log('------------删除了数据------------')
// 说明是删除了数据
this.selectedDataArr = this.selectedDataArr.filter(i => i.id !== item.id)
this.selectedDataArr = this.selectedDataArr.filter(i => i.userId !== item.userId)
}
} else {
this.selectedDataArr = [item]
}
console.log(this.selectedDataArr)
},
// 根据id获取用户信息,初始化选中数据,不查选中数据的话如果没有划到那一页,名字带不出来
getUserListByIds (ids) {
const params = {}
params.userIds = ids
getAction(this.url.userListByIds, params).then((res) => {
if (res.success) {
this.selectedDataArr = res.result.map(item => {
return {
...item,
userId: item.id
}
}) || []
} else {
this.$message(res.message)
}
})
},
handleCheckedArr () {
// 清空选中的数据
if (this.type === 'checkbox') {