|
@@ -596,14 +596,16 @@
|
|
|
this.$set(this.form, 'executeUserId', '');
|
|
this.$set(this.form, 'executeUserId', '');
|
|
|
// 换班组后执行人清空, 重新默认报工人(当前登录用户, 须在新班组成员内)
|
|
// 换班组后执行人清空, 重新默认报工人(当前登录用户, 须在新班组成员内)
|
|
|
this.$set(this.form, 'executeUserIdList', []);
|
|
this.$set(this.form, 'executeUserIdList', []);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', '');
|
|
|
const userInfo = this.$store?.state?.user?.info;
|
|
const userInfo = this.$store?.state?.user?.info;
|
|
|
const reporter = (item.userVOList || []).find(
|
|
const reporter = (item.userVOList || []).find(
|
|
|
(u) => u.id == userInfo?.userId
|
|
(u) => u.id == userInfo?.userId
|
|
|
);
|
|
);
|
|
|
if (reporter) {
|
|
if (reporter) {
|
|
|
- this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
- this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
- this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
|
|
+ // 用候选项自身的 id/name, 保证 el-option 的 value 类型一致, 回显和提交都不出错
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [reporter.id]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', reporter.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(reporter.id));
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
getCode() {
|
|
getCode() {
|
|
@@ -774,11 +776,26 @@
|
|
|
//选择部门(搜索)
|
|
//选择部门(搜索)
|
|
|
searchDeptNodeClick(info, row) {
|
|
searchDeptNodeClick(info, row) {
|
|
|
this.form.executeUserId = '';
|
|
this.form.executeUserId = '';
|
|
|
- this.$set(this.form, 'executeUserName', ' item.name');
|
|
|
|
|
- this.$set(this.form, 'executeUserIdList', '');
|
|
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', '');
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', []);
|
|
|
if (info) {
|
|
if (info) {
|
|
|
const params = { groupId: info };
|
|
const params = { groupId: info };
|
|
|
- this.getUserList(params);
|
|
|
|
|
|
|
+ this.getUserList(params).then(() => {
|
|
|
|
|
+ // 换部门后人员范围变化, 登录人在新部门人员列表内则重新默认执行人
|
|
|
|
|
+ const userInfo = this.$store?.state?.user?.info;
|
|
|
|
|
+ if (!userInfo || !userInfo.userId) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const hit = (this.executorList || []).find(
|
|
|
|
|
+ (u) => u.id == userInfo.userId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (!hit) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [hit.id]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', hit.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(hit.id));
|
|
|
|
|
+ });
|
|
|
this.form.executeDeptName = row.name;
|
|
this.form.executeDeptName = row.name;
|
|
|
} else {
|
|
} else {
|
|
|
this.form.executeDeptId = null;
|
|
this.form.executeDeptId = null;
|
|
@@ -824,9 +841,10 @@
|
|
|
(item) => item.id == userInfo.userId
|
|
(item) => item.id == userInfo.userId
|
|
|
);
|
|
);
|
|
|
if (reporter) {
|
|
if (reporter) {
|
|
|
- this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
- this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
- this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
|
|
+ // 取候选项自身 id/name, 与 el-option 的 value 类型完全一致
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [reporter.id]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', reporter.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(reporter.id));
|
|
|
} else {
|
|
} else {
|
|
|
console.warn(
|
|
console.warn(
|
|
|
'[报工] 当前登录人不在执行班组成员中, 执行人无法默认为报工人',
|
|
'[报工] 当前登录人不在执行班组成员中, 执行人无法默认为报工人',
|
|
@@ -835,9 +853,14 @@
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
- this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
- this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
|
|
+ const matched = (this.executorList || []).find(
|
|
|
|
|
+ (item) => item.id == userInfo.userId
|
|
|
|
|
+ );
|
|
|
|
|
+ const id = matched ? matched.id : userInfo.userId;
|
|
|
|
|
+ const name = matched ? matched.name : userInfo.name;
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [id]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(id));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 执行部门: 未指定时默认当前登录用户所属公司(检验方案模式没有执行部门, 不处理)
|
|
// 执行部门: 未指定时默认当前登录用户所属公司(检验方案模式没有执行部门, 不处理)
|