diff --git a/src/components/ProcessCommonLayout.vue b/src/components/ProcessCommonLayout.vue index 580cb69..bd8733a 100644 --- a/src/components/ProcessCommonLayout.vue +++ b/src/components/ProcessCommonLayout.vue @@ -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, diff --git a/src/components/SelectUser.vue b/src/components/SelectUser.vue index 3fa1018..fbc5ef2 100644 --- a/src/components/SelectUser.vue +++ b/src/components/SelectUser.vue @@ -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') { diff --git a/src/components/SelectUserByWorkGroup.vue b/src/components/SelectUserByWorkGroup.vue index ae370fe..309c631 100644 --- a/src/components/SelectUserByWorkGroup.vue +++ b/src/components/SelectUserByWorkGroup.vue @@ -64,7 +64,7 @@ stop-propagation :before-close="handleBeforeClose">