| | |
| | | <template> |
| | | <div> |
| | | <el-dialog title="编辑" v-model="formDia" |
| | | <el-dialog :title="operationType === 'add' ? '新增质控项目' : '编辑质控项目'" v-model="formDia" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | width="80%" @close="closeDia"> |
| | | <el-form :model="form" :rules="rules" ref="form" label-width="140px"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="监控目的" prop="monitorPurpose"> |
| | | <el-input v-model="form.monitorPurpose" size="small" clearable></el-input> |
| | | <el-form-item label="序号" prop="sortNo"> |
| | | <el-input-number v-model="form.sortNo" :min="1" style="width:100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计划开展时间" prop="plannedTime"> |
| | | <el-input v-model="form.plannedTime" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="监控项目" prop="monitorProject"> |
| | | <el-form-item label="质控项目" prop="monitorProject"> |
| | | <el-input v-model="form.monitorProject" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="参加单位(人员)" prop="participant"> |
| | | <el-input v-model="form.participant" size="small" clearable></el-input> |
| | | <el-form-item label="技术标准" prop="technicalStandardText"> |
| | | <el-input v-model="form.technicalStandardText" size="small" clearable placeholder="标准编号及名称;非检测类可填写程序文件或/" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="预算(元)" prop="budget"> |
| | | <el-input v-model="form.budget" size="small" clearable></el-input> |
| | | <el-form-item label="质控方式" prop="monitorWay"> |
| | | <el-input v-model="form.monitorWay" size="small" clearable placeholder="如盲样检测、人员比对、监督检查" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="组织人员" prop="organization"> |
| | | <el-input v-model="form.organization" size="small" clearable></el-input> |
| | | <el-form-item label="完成时限" prop="completionMonth"> |
| | | <el-date-picker v-model="form.completionMonth" type="month" value-format="YYYY-MM" format="YYYY.MM" style="width:100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="监控方式" prop="monitorWay"> |
| | | <el-input v-model="form.monitorWay" size="small" clearable></el-input> |
| | | <el-form-item label="负责人" prop="responsibleUserId"> |
| | | <el-select v-model="form.responsibleUserId" filterable style="width:100%"> |
| | | <el-option v-for="item in userOptions" :key="item.id" :value="item.id" :label="item.name" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="事项类别" prop="itemKind"> |
| | | <el-select v-model="form.itemKind" style="width: 100%"> |
| | | <el-option label="非检测类" value="OTHER" /> |
| | | <el-option label="检测类" value="INSPECTION" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <template v-if="form.itemKind === 'INSPECTION'"> |
| | | <el-col :span="12"><el-form-item label="检测标准" prop="standardMethodId"> |
| | | <el-select v-model="form.standardMethodId" filterable style="width: 100%" placeholder="请选择检测标准" @change="handleStandardChange"> |
| | | <el-option v-for="item in standardOptions" :key="item.id" :value="item.id" :label="`${item.code || ''} ${item.name || ''}`" /> |
| | | </el-select> |
| | | </el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="原始记录模板" prop="templateIds"> |
| | | <el-select v-model="form.templateIds" multiple collapse-tags filterable style="width: 100%" placeholder="可选择多个模板"> |
| | | <el-option v-for="item in templateOptions" :key="item.id" :value="item.id" :label="item.name" /> |
| | | </el-select> |
| | | </el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="样品名称"><el-input v-model="form.sampleName" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="样品规格"><el-input v-model="form.sampleSpec" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="检测员"><el-select v-model="form.inspectorUserId" filterable style="width: 100%"> |
| | | <el-option v-for="item in userOptions" :key="item.id" :value="item.id" :label="item.name" /> |
| | | </el-select></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="评价人"><el-select v-model="form.evaluatorUserId" filterable style="width: 100%"> |
| | | <el-option v-for="item in userOptions" :key="item.id" :value="item.id" :label="item.name" /> |
| | | </el-select></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="任务截止日"> |
| | | <el-date-picker v-model="form.dueDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" /> |
| | | </el-form-item></el-col> |
| | | </template> |
| | | </el-form> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="closeDia">取 消</el-button> |
| | |
| | | addQualityMonitorDetail, |
| | | updateQualityMonitorDetail |
| | | } from "@/api/cnas/process/ensureResults/qualityMonitor"; |
| | | import { selectStandardMethodList } from '@/api/cnas/process/method/standardMethod'; |
| | | import { selectStandardTemplatePageList } from '@/api/standard/model'; |
| | | import { selectUserCondition } from '@/api/performance/class'; |
| | | |
| | | export default { |
| | | name: 'detailFormDialog', |
| | |
| | | formDia: false, |
| | | form: { |
| | | qualityMonitorDetailsId: '', |
| | | sortNo: null, |
| | | technicalStandardText: '', |
| | | completionMonth: '', |
| | | responsibleUserId: null, |
| | | monitorPurpose: '', |
| | | plannedTime: '', |
| | | monitorProject: '', |
| | |
| | | budget: '', |
| | | organization: '', |
| | | monitorWay: '', |
| | | itemKind: 'OTHER', |
| | | standardMethodId: null, |
| | | templateId: null, |
| | | templateIds: [], |
| | | sampleName: '', |
| | | sampleSpec: '', |
| | | inspectorUserId: null, |
| | | evaluatorUserId: null, |
| | | dueDate: null, |
| | | }, |
| | | standardOptions: [], |
| | | templateOptions: [], |
| | | userOptions: [], |
| | | rules: { |
| | | monitorPurpose: [{ required: true, message: '请输入监控目的', trigger: 'blur' }], |
| | | monitorProject: [{ required: true, message: '请输入监控项目', trigger: 'blur' }], |
| | | monitorProject: [{ required: true, message: '请输入质控项目', trigger: 'blur' }], |
| | | technicalStandardText: [{ required: true, message: '请输入技术标准', trigger: 'blur' }], |
| | | monitorWay: [{ required: true, message: '请输入质控方式', trigger: 'blur' }], |
| | | completionMonth: [{ required: true, message: '请选择完成时限', trigger: 'change' }], |
| | | responsibleUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }], |
| | | templateIds: [{ required: true, type: 'array', min: 1, message: '请至少选择一个原始记录模板', trigger: 'change' }], |
| | | }, |
| | | upLoad: false, |
| | | operationType: '', |
| | |
| | | methods: { |
| | | openDia(type, row) { |
| | | this.formDia = true |
| | | selectStandardMethodList({ current: 1, size: 1000 }).then(res => { this.standardOptions = res.data?.records || res.data || [] }) |
| | | selectStandardTemplatePageList({ current: 1, size: 1000 }).then(res => { this.templateOptions = res.data?.records || res.data || [] }) |
| | | selectUserCondition({ type: 1 }).then(res => { this.userOptions = res.data || [] }) |
| | | this.operationType = type |
| | | if (type === 'edit') { |
| | | this.searchInfo(row) |
| | | } |
| | | }, |
| | | searchInfo (row) { |
| | | this.form = {...row} |
| | | const templateIds = row.templateIds |
| | | ? String(row.templateIds).split(',').filter(Boolean).map(id => Number(id)) |
| | | : (row.templateId ? [Number(row.templateId)] : []) |
| | | this.form = {...row, itemKind: row.itemKind || 'OTHER', templateIds} |
| | | }, |
| | | handleStandardChange(id) { |
| | | const standard = this.standardOptions.find(item => Number(item.id) === Number(id)) |
| | | if (standard) this.form.technicalStandardText = `${standard.code || ''} ${standard.name || ''}`.trim() |
| | | this.form.templateIds = [] |
| | | this.form.templateId = null |
| | | }, |
| | | buildEntity () { |
| | | const entity = this.HaveJson(this.form) |
| | | const templateIds = Array.isArray(this.form.templateIds) |
| | | ? this.form.templateIds.map(id => Number(id)).filter(id => Number.isInteger(id) && id > 0) |
| | | : [] |
| | | entity.templateIds = templateIds.join(',') || null |
| | | entity.templateId = templateIds.length ? templateIds[0] : null |
| | | entity.reviewerUserId = null |
| | | return entity |
| | | }, |
| | | // 提交表单 |
| | | submitForm () { |
| | | this.$refs['form'].validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.itemKind === 'INSPECTION') { |
| | | const required = ['standardMethodId','sampleName','inspectorUserId','evaluatorUserId','dueDate'] |
| | | if (required.some(key => !this.form[key])) { |
| | | this.$message.warning('请补齐检测标准、模板、样品、检测员、评价人和任务截止日') |
| | | return |
| | | } |
| | | if (!Array.isArray(this.form.templateIds) || !this.form.templateIds.length) { |
| | | this.$message.warning('请至少选择一个原始记录模板') |
| | | return |
| | | } |
| | | if (this.form.inspectorUserId === this.form.evaluatorUserId) { |
| | | this.$message.warning('检测员不能同时担任评价人') |
| | | return |
| | | } |
| | | if (this.form.dueDate.slice(0, 7) > this.form.completionMonth) { |
| | | this.$message.warning('任务截止日不能晚于计划完成月份') |
| | | return |
| | | } |
| | | } |
| | | if (this.operationType === 'add') { |
| | | this.handleAdd() |
| | | } else { |
| | |
| | | }, |
| | | // 提交新增 |
| | | handleAdd () { |
| | | let entity = this.HaveJson(this.form) |
| | | let entity = this.buildEntity() |
| | | entity.qualityMonitorId = this.qualityMonitorId |
| | | this.upLoad = true |
| | | addQualityMonitorDetail(entity).then(res => { |
| | |
| | | }, |
| | | // 提交修改 |
| | | handleEdit () { |
| | | const entity = this.HaveJson(this.form) |
| | | const entity = this.buildEntity() |
| | | this.upLoad = true |
| | | updateQualityMonitorDetail(entity).then(res => { |
| | | this.upLoad = false |