|
|
@ -647,13 +647,14 @@ |
|
|
placeholder="请选择计划员(可多选)" |
|
|
placeholder="请选择计划员(可多选)" |
|
|
style="width: 100%" |
|
|
style="width: 100%" |
|
|
multiple |
|
|
multiple |
|
|
clearable |
|
|
|
|
|
|
|
|
@change="handlePlannerSelectionChange" |
|
|
@remove-tag="handlePlannerRemoveTag"> |
|
|
@remove-tag="handlePlannerRemoveTag"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="planner in plannerList" |
|
|
v-for="planner in plannerList" |
|
|
:key="planner.userId" |
|
|
:key="planner.userId" |
|
|
:label="planner.userDisplay || planner.username" |
|
|
:label="planner.userDisplay || planner.username" |
|
|
:value="planner.userId"> |
|
|
|
|
|
|
|
|
:value="planner.userId" |
|
|
|
|
|
:disabled="isLockedPlanner(planner.userId)"> |
|
|
</el-option> |
|
|
</el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
<div style="margin-top: 1px; color: #909399; font-size: 12px"> |
|
|
<div style="margin-top: 1px; color: #909399; font-size: 12px"> |
|
|
@ -1089,8 +1090,7 @@ export default { |
|
|
this.qualityManagerList = data.qualityManagers || [] |
|
|
this.qualityManagerList = data.qualityManagers || [] |
|
|
this.plannerList = data.planners || [] |
|
|
this.plannerList = data.planners || [] |
|
|
// 记录默认计划员郑宇的 userId,用于锁定不可移除 |
|
|
// 记录默认计划员郑宇的 userId,用于锁定不可移除 |
|
|
const joyce = this.plannerList.find(p => p.userDisplay && p.userDisplay.includes('郑宇')) |
|
|
|
|
|
this.lockedPlannerUserId = joyce ? joyce.userId : null |
|
|
|
|
|
|
|
|
this.lockedPlannerUserId = this.getLockedPlannerUserId(this.plannerList) |
|
|
// 根据事业部设置默认生产经理(使用user_display模糊匹配) |
|
|
// 根据事业部设置默认生产经理(使用user_display模糊匹配) |
|
|
const defaultProdManagerIds = [] |
|
|
const defaultProdManagerIds = [] |
|
|
if (row.buDesc === 'RFID') { |
|
|
if (row.buDesc === 'RFID') { |
|
|
@ -1134,11 +1134,8 @@ export default { |
|
|
prodManagerAnyApproved: true, |
|
|
prodManagerAnyApproved: true, |
|
|
qualityManagerAnyApproved: true, |
|
|
qualityManagerAnyApproved: true, |
|
|
plannerIds: (() => { |
|
|
plannerIds: (() => { |
|
|
// 默认选中Joyce(中文名郑宇);若无郑宇则单人列表时默认全选 |
|
|
|
|
|
const joyce = this.plannerList.find(p => |
|
|
|
|
|
p.userDisplay && p.userDisplay.toLowerCase().includes('郑宇') |
|
|
|
|
|
) |
|
|
|
|
|
if (joyce) return [joyce.userId] |
|
|
|
|
|
|
|
|
// 默认选中郑宇;若无郑宇则单人列表时默认全选 |
|
|
|
|
|
if (this.lockedPlannerUserId) return [this.lockedPlannerUserId] |
|
|
return this.plannerList.length === 1 ? [this.plannerList[0].userId] : [] |
|
|
return this.plannerList.length === 1 ? [this.plannerList[0].userId] : [] |
|
|
})() |
|
|
})() |
|
|
} |
|
|
} |
|
|
@ -1154,16 +1151,63 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 计划员移除标签拦截:默认计划员,不允许被移除 |
|
|
|
|
|
|
|
|
* 获取锁定计划员(郑宇)的 userId |
|
|
|
|
|
*/ |
|
|
|
|
|
getLockedPlannerUserId(planners) { |
|
|
|
|
|
const plannerArr = Array.isArray(planners) ? planners : [] |
|
|
|
|
|
const lockedPlanner = plannerArr.find(planner => { |
|
|
|
|
|
const userDisplay = (planner.userDisplay || '').toLowerCase() |
|
|
|
|
|
const username = (planner.username || '').toLowerCase() |
|
|
|
|
|
return userDisplay.includes('郑宇') || |
|
|
|
|
|
userDisplay.includes('joyce') || |
|
|
|
|
|
userDisplay.includes('zhengyu') || |
|
|
|
|
|
username.includes('郑宇') || |
|
|
|
|
|
username.includes('joyce') || |
|
|
|
|
|
username.includes('zhengyu') |
|
|
|
|
|
}) |
|
|
|
|
|
return lockedPlanner ? lockedPlanner.userId : null |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断是否为锁定计划员 |
|
|
|
|
|
*/ |
|
|
|
|
|
isLockedPlanner(userId) { |
|
|
|
|
|
return !!this.lockedPlannerUserId && userId === this.lockedPlannerUserId |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 确保锁定计划员始终被选中 |
|
|
|
|
|
*/ |
|
|
|
|
|
ensureLockedPlannerSelected(selectedIds, showWarning) { |
|
|
|
|
|
if (!this.lockedPlannerUserId) return |
|
|
|
|
|
const currentIds = Array.isArray(selectedIds) |
|
|
|
|
|
? selectedIds |
|
|
|
|
|
: (Array.isArray(this.submitData.plannerIds) ? this.submitData.plannerIds : []) |
|
|
|
|
|
|
|
|
|
|
|
if (!currentIds.includes(this.lockedPlannerUserId)) { |
|
|
|
|
|
const deduplicatedIds = currentIds.filter(id => id !== this.lockedPlannerUserId) |
|
|
|
|
|
this.submitData.plannerIds = [this.lockedPlannerUserId, ...deduplicatedIds] |
|
|
|
|
|
if (showWarning) { |
|
|
|
|
|
this.$message.warning('郑宇为固定计划员,不可取消') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 计划员选择变更拦截:郑宇不可取消 |
|
|
|
|
|
*/ |
|
|
|
|
|
handlePlannerSelectionChange(selectedIds) { |
|
|
|
|
|
this.ensureLockedPlannerSelected(selectedIds, true) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 计划员移除标签拦截:郑宇不可移除 |
|
|
*/ |
|
|
*/ |
|
|
handlePlannerRemoveTag(removedId) { |
|
|
handlePlannerRemoveTag(removedId) { |
|
|
if (this.lockedPlannerUserId && removedId === this.lockedPlannerUserId) { |
|
|
if (this.lockedPlannerUserId && removedId === this.lockedPlannerUserId) { |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
if (!this.submitData.plannerIds.includes(this.lockedPlannerUserId)) { |
|
|
|
|
|
this.submitData.plannerIds = [this.lockedPlannerUserId, ...this.submitData.plannerIds] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.ensureLockedPlannerSelected(this.submitData.plannerIds, false) |
|
|
}) |
|
|
}) |
|
|
this.$message.warning('该计划员不可移除') |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|