diff --git a/src/views/modules/erf/expApplyList.vue b/src/views/modules/erf/expApplyList.vue
index cc73dbb..af33e01 100644
--- a/src/views/modules/erf/expApplyList.vue
+++ b/src/views/modules/erf/expApplyList.vue
@@ -647,13 +647,14 @@
placeholder="请选择计划员(可多选)"
style="width: 100%"
multiple
- clearable
+ @change="handlePlannerSelectionChange"
@remove-tag="handlePlannerRemoveTag">
+ :value="planner.userId"
+ :disabled="isLockedPlanner(planner.userId)">
@@ -1089,8 +1090,7 @@ export default {
this.qualityManagerList = data.qualityManagers || []
this.plannerList = data.planners || []
// 记录默认计划员郑宇的 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模糊匹配)
const defaultProdManagerIds = []
if (row.buDesc === 'RFID') {
@@ -1134,13 +1134,10 @@ export default {
prodManagerAnyApproved: true,
qualityManagerAnyApproved: true,
plannerIds: (() => {
- // 默认选中Joyce(中文名郑宇);若无郑宇则单人列表时默认全选
- const joyce = this.plannerList.find(p =>
- p.userDisplay && p.userDisplay.toLowerCase().includes('郑宇')
- )
- if (joyce) return [joyce.userId]
- return this.plannerList.length === 1 ? [this.plannerList[0].userId] : []
- })()
+ // 默认选中郑宇;若无郑宇则单人列表时默认全选
+ if (this.lockedPlannerUserId) return [this.lockedPlannerUserId]
+ 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) {
if (this.lockedPlannerUserId && removedId === this.lockedPlannerUserId) {
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('该计划员不可移除')
}
},