| | |
| | | :closable="false"/> |
| | | <el-alert v-if="!canEdit" :title="editNotice" :type="loaded ? 'warning' : 'info'" |
| | | :closable="false" style="margin-top:8px"/> |
| | | <el-form :model="form" label-width="110px" style="margin-top: 16px"> |
| | | <div class="role-hint">监督员默认为计划中指定的评价人,被监督人员为计划中指定的检测员。</div> |
| | | <el-form :model="form" label-width="150px" style="margin-top: 16px"> |
| | | <el-row :gutter="12"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测项目"> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="监督员"> |
| | | <el-form-item label="监督员(评价人)"> |
| | | <el-select v-model="form.supervisorUserId" filterable style="width: 100%" :disabled="!canEdit"> |
| | | <el-option v-for="person in supervisorOptions" :key="person.id" :value="person.id" :label="person.name"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="被监督人员"> |
| | | <el-form-item label="被监督人员(检测员)"> |
| | | <el-input :model-value="supervisedPersonName" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | }, |
| | | supervisedPersonName() { |
| | | const id = this.form.inspectorUserId || this.row?.inspectorUserId |
| | | return this.people.find(person => Number(person.id) === Number(id))?.name || '' |
| | | return this.people.find(person => Number(person.id) === Number(id))?.name |
| | | || this.form.inspectorName || this.row?.inspectorName || '' |
| | | }, |
| | | supervisorOptions() { |
| | | const inspectorId = Number(this.form.inspectorUserId || this.row?.inspectorUserId) |
| | | const evaluatorId = Number(this.row?.evaluatorUserId) |
| | | return this.people.filter(person => Number(person.id) !== inspectorId && Number(person.id) !== evaluatorId) |
| | | // 监督员默认就是计划中的评价人,因此这里不能把评价人排除掉;只排除被监督的检测员 |
| | | const options = this.people.filter(person => Number(person.id) !== inspectorId) |
| | | // 已保存的监督员如果不在人员下拉列表中(被角色/状态过滤或已停用),补一条选项保证能反显 |
| | | const savedId = this.form.supervisorUserId |
| | | if (savedId && !options.some(person => Number(person.id) === Number(savedId))) { |
| | | const saved = this.people.find(person => Number(person.id) === Number(savedId)) |
| | | options.unshift({ |
| | | id: savedId, |
| | | name: saved?.name || this.form.supervisorName || `用户 ${savedId}` |
| | | }) |
| | | } |
| | | return options |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | this.people = res.data || [] |
| | | }) |
| | | getInspectionEvaluation(row.qualityMonitorDetailsId).then(res => { |
| | | if (res.data) this.form = {...res.data, resultRows: res.data.resultRows || [], measurementConfirmed: false} |
| | | if (res.data) { |
| | | this.form = {...res.data, resultRows: res.data.resultRows || [], measurementConfirmed: false} |
| | | // 兜底:历史评价记录没有监督员时,默认带出计划评价人 |
| | | if (!this.form.supervisorUserId && this.row?.evaluatorUserId) { |
| | | this.form.supervisorUserId = this.row.evaluatorUserId |
| | | this.form.supervisorName = this.people.find(person => Number(person.id) === Number(this.row.evaluatorUserId))?.name || '' |
| | | } |
| | | } |
| | | }).catch(() => { |
| | | this.loadError = '评价记录读取失败,请刷新后重试' |
| | | }).finally(() => { |
| | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .role-hint { |
| | | margin-top: 8px; |
| | | font-size: 12px; |
| | | line-height: 18px; |
| | | color: var(--el-text-color-secondary); |
| | | } |
| | | </style> |