|
@@ -594,6 +594,17 @@
|
|
|
changeExecuteJob(item) {
|
|
changeExecuteJob(item) {
|
|
|
this.$set(this.form, 'executeJobName', item.name);
|
|
this.$set(this.form, 'executeJobName', item.name);
|
|
|
this.$set(this.form, 'executeUserId', '');
|
|
this.$set(this.form, 'executeUserId', '');
|
|
|
|
|
+ // 换班组后执行人清空, 重新默认报工人(当前登录用户, 须在新班组成员内)
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', []);
|
|
|
|
|
+ const userInfo = this.$store?.state?.user?.info;
|
|
|
|
|
+ const reporter = (item.userVOList || []).find(
|
|
|
|
|
+ (u) => u.id == userInfo?.userId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (reporter) {
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
getCode() {
|
|
getCode() {
|
|
|
parameterGetByCode({
|
|
parameterGetByCode({
|
|
@@ -786,14 +797,14 @@
|
|
|
this.executorList = (res && res.list) || [];
|
|
this.executorList = (res && res.list) || [];
|
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
|
},
|
|
},
|
|
|
- /* 默认执行部门=当前登录用户所属公司, 默认执行人=当前登录用户 */
|
|
|
|
|
|
|
+ /* 默认执行部门=当前登录用户所属公司, 默认执行人=当前登录用户(报工人) */
|
|
|
async setDefaultExecuteInfo() {
|
|
async setDefaultExecuteInfo() {
|
|
|
const userInfo = this.$store?.state?.user?.info;
|
|
const userInfo = this.$store?.state?.user?.info;
|
|
|
if (!userInfo || !userInfo.userId) {
|
|
if (!userInfo || !userInfo.userId) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- // 班组模式下执行人由班组决定, 检验方案模式下没有执行部门, 均不处理
|
|
|
|
|
- if (this.form.assignType == 1 || this.form.qualityType == 2) {
|
|
|
|
|
|
|
+ // 指定班组模式(assignType==1)执行人是禁用回显字段, 不做默认
|
|
|
|
|
+ if (this.form.assignType == 1) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
// 执行人: 未指定时默认当前登录用户
|
|
// 执行人: 未指定时默认当前登录用户
|
|
@@ -802,12 +813,35 @@
|
|
|
!this.form.executeUserIdList ||
|
|
!this.form.executeUserIdList ||
|
|
|
!this.form.executeUserIdList.length
|
|
!this.form.executeUserIdList.length
|
|
|
) {
|
|
) {
|
|
|
- this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
- this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
- this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
|
|
+ if (this.form.qualityType == 2) {
|
|
|
|
|
+ /* 检验方案模式: 执行人候选项 = 所选执行班组的成员,
|
|
|
|
|
+ 默认人必须在班组成员列表里, 否则多选框回显不出来 */
|
|
|
|
|
+ const job = (this.form.jobList || []).find(
|
|
|
|
|
+ (item) => item.id == this.form.executeJobId
|
|
|
|
|
+ );
|
|
|
|
|
+ const teamUsers = (job && job.userVOList) || [];
|
|
|
|
|
+ const reporter = teamUsers.find(
|
|
|
|
|
+ (item) => item.id == userInfo.userId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (reporter) {
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.warn(
|
|
|
|
|
+ '[报工] 当前登录人不在执行班组成员中, 执行人无法默认为报工人',
|
|
|
|
|
+ '执行班组:', job && job.name,
|
|
|
|
|
+ '班组成员:', teamUsers.map((i) => ({ id: i.id, name: i.name }))
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$set(this.form, 'executeUserIdList', [userInfo.userId]);
|
|
|
|
|
+ this.$set(this.form, 'executeUserName', userInfo.name);
|
|
|
|
|
+ this.$set(this.form, 'executeUserId', String(userInfo.userId));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- // 执行部门: 未指定时默认当前登录用户所属公司
|
|
|
|
|
- if (!this.form.executeDeptId) {
|
|
|
|
|
|
|
+ // 执行部门: 未指定时默认当前登录用户所属公司(检验方案模式没有执行部门, 不处理)
|
|
|
|
|
+ if (this.form.qualityType != 2 && !this.form.executeDeptId) {
|
|
|
let company = null;
|
|
let company = null;
|
|
|
try {
|
|
try {
|
|
|
company = await getCurrentUserCompany(userInfo);
|
|
company = await getCurrentUserCompany(userInfo);
|