| | |
| | | </template> |
| | | <template v-else> |
| | | <el-descriptions-item label="委托编号">{{ insOrder.entrustCode }}</el-descriptions-item> |
| | | <el-descriptions-item label="检测依据">{{ insOrder.sample || '-' }}</el-descriptions-item> |
| | | <el-descriptions-item label="检测依据">{{ standardDisplayName(insOrder.sample) }}</el-descriptions-item> |
| | | <el-descriptions-item label="样品名称">{{ insOrder.sampleView || '-' }}</el-descriptions-item> |
| | | <el-descriptions-item label="样品编号">{{ currentSample.sampleCode }}</el-descriptions-item> |
| | | <el-descriptions-item label="样品数量">{{ insOrder.testQuantity }}</el-descriptions-item> |
| | |
| | | </div> |
| | | <!-- 当前检验模板的检测条件与检验结论 --> |
| | | <div class="template-panel"> |
| | | <el-form v-if="showTemplateConditions" :inline="true" :model="currentOtherForm" class="form-inline" |
| | | <el-form :inline="true" :model="currentOtherForm" class="form-inline" |
| | | size="small" label-width="84px"> |
| | | <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="温度:"> |
| | | <el-input v-model="currentOtherForm.temperature" :disabled="state > 1" placeholder="" size="small" |
| | |
| | | style="width: 90px" @change="(m) => subOtherForm(m, 'humidity')"></el-input> |
| | | <span class="template-panel__unit">%RH</span> |
| | | </el-form-item> |
| | | <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="检测时间:"> |
| | | <el-form-item label="检测时间:"> |
| | | <el-date-picker v-model="currentOtherForm.detectionTime" :disabled="state > 1" type="date" |
| | | value-format="yyyy-MM-dd" placeholder="请选择日期" size="small" style="width: 160px" |
| | | @change="(m) => subOtherForm(m, 'detectionTime')"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item v-if="insOrder.ifsOrderType!=='02wg'" label="检测地点:"> |
| | | <el-form-item label="检测地点:"> |
| | | <el-input v-model="currentOtherForm.detectionPlace" :disabled="state > 1" clearable placeholder="请输入检测地点" |
| | | size="small" style="width: 200px" @change="(m) => subOtherForm(m, 'detectionPlace')"></el-input> |
| | | </el-form-item> |
| | | <el-form-item v-if="isDirectTemplateOrder()" label="设备:"> |
| | | <el-form-item label="设备:"> |
| | | <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable |
| | | size="small" placeholder="请选择设备" style="width: 360px" |
| | | @change="(m) => subOtherForm(m, 'deviceIds')"> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 复核时才能选 --> |
| | | <el-form :inline="true" :model="currentOtherForm" |
| | | :class="['form-inline', { 'template-panel__conclusion--divided': showTemplateConditions }]" |
| | | <el-form :inline="true" :model="currentOtherForm" class="form-inline template-panel__conclusion--divided" |
| | | size="small" label-width="84px"> |
| | | <el-form-item label="检验结论:"> |
| | | <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2" |
| | |
| | | n.v.ps.value === '计算值' && |
| | | state == 1 |
| | | "><span :style="`font-family:${n.v.ff} !important;`">{{ |
| | | toFixed(n.v.v, n.v.ct) |
| | | n.v.v |
| | | }}</span></template> |
| | | <template v-else-if=" |
| | | n.v.ps != undefined && |
| | |
| | | state == 1 |
| | | "> |
| | | <span :style="`font-family:${n.v.ff} !important;`">{{ |
| | | toFixed(n.v.v, n.v.ct) |
| | | n.v.v |
| | | }}</span> |
| | | </template> |
| | | <template v-else-if=" |
| | |
| | | } |
| | | ); |
| | | }, |
| | | // 02wg 单没有温湿度;新聚直接绑定模板的单只有设备 |
| | | showTemplateConditions() { |
| | | return this.insOrder.ifsOrderType !== "02wg" || this.isDirectTemplateOrder(); |
| | | }, |
| | | }, |
| | | created() { |
| | | this.saveQueue = Promise.resolve(); |
| | |
| | | this.stopWorker(); |
| | | }, |
| | | methods: { |
| | | standardDisplayName(value) { |
| | | if (!value) return '-'; |
| | | const separatorIndex = value.indexOf(' - '); |
| | | return separatorIndex > -1 ? value.slice(0, separatorIndex) : value; |
| | | }, |
| | | validateQuality(){ |
| | | let inboundLength = Number(this.calcInbondLength(this.ifsMaterialPropsForm.startMeterMark,this.ifsMaterialPropsForm.endMeterMark)); |
| | | let testQuantity = Number(this.insOrder.testQuantity); |
| | |
| | | this.rawMaterialTag = "1"; |
| | | } |
| | | this.getEquipOptions(1); |
| | | if (this.sonLaboratory === "新聚") { |
| | | this.loadDeviceOptions(); |
| | | } |
| | | this.loadDeviceOptions(); |
| | | // 获取当前样品的检验项 |
| | | let list = await this.getCurrentProduct(this.currentSample.id, 0); |
| | | this.currentSample.insProduct = this.HaveJson(list); |
| | |
| | | payload[type] = Number(m); |
| | | } |
| | | } |
| | | write(payload).then((res) => { |
| | | this.$message.success("保存成功"); |
| | | }); |
| | | const previousSave = this.saveQueue || Promise.resolve(); |
| | | this.saveQueue = previousSave |
| | | .catch(() => undefined) |
| | | .then(() => write(payload)) |
| | | .then(() => { |
| | | this.$message.success("保存成功"); |
| | | }) |
| | | .catch((error) => { |
| | | console.error("检验条件保存失败", error); |
| | | this.$message.error("检验条件保存失败,请重试"); |
| | | }); |
| | | }, |
| | | exportTable(tableId) { |
| | | // 获取table元素 |
| | |
| | | .replace(new RegExp("\n", "g"), "<br/>") |
| | | .replace(new RegExp("@", "g"), "<br/>") |
| | | : ""; |
| | | // 对数据保留小数点进行处理 |
| | | if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) { |
| | | let num = 0; |
| | | let str0 = v.ct.fa.split(".")[1]; |
| | | num = str0.length; |
| | | str = Number(str).toFixed(num); |
| | | } |
| | | if (v.v && typeof v.v == "string" && v.v.includes("@")) { |
| | | str = v.v.replace(new RegExp("@", "g"), "<br/>"); |
| | | } |
| | |
| | | }, |
| | | // 对输入值进行格式校验 |
| | | handleInput(n) { |
| | | // 直绑模板未配置检验值类型时按自由文本处理,允许录入外观等中文结果。 |
| | | const inspectionValueType = this.getInspectionValueType(n.i); |
| | | if (inspectionValueType === undefined || inspectionValueType === null) { |
| | | return; |
| | | } |
| | | try { |
| | | const v = n.v.v; |
| | | // 能力范围已废弃,检验值类型不再作为判断依据。整串只由算式字符组成时才规范化格式, |
| | |
| | | openAddCheck() { |
| | | this.addCheck = true; |
| | | }, |
| | | // 收集模板级检测条件的缺失项(每个模板都要填全) |
| | | getMissingConditions() { |
| | | const missing = []; |
| | | this.tableLists.forEach((m) => { |
| | | const form = this.otherForm[m.templateId] || {}; |
| | | if (this.insOrder.ifsOrderType !== "02wg") { |
| | | if (!form.temperature) missing.push(`请填写「${m.templateName}」的温度`); |
| | | if (!form.humidity) missing.push(`请填写「${m.templateName}」的湿度`); |
| | | } |
| | | if (!form.detectionTime) missing.push(`请选择「${m.templateName}」的检测时间`); |
| | | if (!form.detectionPlace) missing.push(`请填写「${m.templateName}」的检测地点`); |
| | | if (!form.deviceIds || form.deviceIds.length === 0) { |
| | | missing.push(`请选择「${m.templateName}」的设备`); |
| | | } |
| | | }); |
| | | return missing; |
| | | }, |
| | | // 复核 |
| | | upInsReview(e) { |
| | | if (e == 1) { |
| | | // 通过 |
| | | // 每个模板都要有检测条件,缺一不可 |
| | | const missing = this.getMissingConditions(); |
| | | if (missing.length > 0) { |
| | | this.$message.error(missing[0]); |
| | | return; |
| | | } |
| | | // 每个模板都要有结论;全部合格才算整单合格 |
| | | const insResults = this.tableLists.map( |
| | | (m) => (this.otherForm[m.templateId] || {}).insResult |
| | |
| | | this.$message.error("请指定复核人员"); |
| | | return; |
| | | } |
| | | const missing = []; |
| | | this.tableLists.forEach((m) => { |
| | | const form = this.otherForm[m.templateId] || {}; |
| | | if (this.insOrder.ifsOrderType !== "02wg") { |
| | | if (!form.temperature) missing.push(`请填写「${m.templateName}」的温度`); |
| | | if (!form.humidity) missing.push(`请填写「${m.templateName}」的湿度`); |
| | | if (!form.detectionTime) missing.push(`请选择「${m.templateName}」的检测时间`); |
| | | if (!form.detectionPlace) missing.push(`请填写「${m.templateName}」的检测地点`); |
| | | } |
| | | if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) { |
| | | missing.push(`请选择「${m.templateName}」的设备`); |
| | | } |
| | | }); |
| | | const missing = this.getMissingConditions(); |
| | | if (missing.length > 0) { |
| | | this.$message.error(missing[0]); |
| | | return; |
| | |
| | | return; |
| | | } |
| | | await this.waitForPendingSaves(); |
| | | try { |
| | | await Promise.all(this.tableLists.map((template) => { |
| | | const form = this.otherForm[template.templateId] || {}; |
| | | return write({ |
| | | id: this.insOrder.id, |
| | | templateId: template.templateId, |
| | | temperature: form.temperature == null ? null : form.temperature, |
| | | humidity: form.humidity == null ? null : form.humidity, |
| | | detectionTime: form.detectionTime || null, |
| | | detectionPlace: form.detectionPlace || null, |
| | | deviceIds: Array.isArray(form.deviceIds) ? [...form.deviceIds] : [], |
| | | }); |
| | | })); |
| | | } catch (error) { |
| | | console.error("检验条件保存失败", error); |
| | | this.$message.error("检验条件保存失败,请重试"); |
| | | return; |
| | | } |
| | | this.submitLoading = true; |
| | | checkSubmitPlan({ |
| | | orderId: this.orderId, |
| | |
| | | this.saveInsContext(); |
| | | }, |
| | | isDirectTemplateOrder() { |
| | | return this.sonLaboratory === "新聚" && this.currentSample && |
| | | (this.currentSample.insProduct || []).some((product) => product.templateRowIndex != null); |
| | | return this.sonLaboratory === "新聚" && |
| | | Array.isArray(this.insOrder.templateConditions) && |
| | | this.insOrder.templateConditions.length > 0; |
| | | }, |
| | | loadDeviceOptions() { |
| | | search({ status: 0 }).then((devices) => { |
| | |
| | | this.$download.saveAs(res.data.fileUrl, row.fileName) |
| | | }) |
| | | .catch((error) => { }); |
| | | }, |
| | | /** |
| | | * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。 |
| | | * |
| | | * @param v 要格式化的数值 |
| | | * @param ct 包含格式化配置的对象 |
| | | * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数 |
| | | * @returns 格式化后的字符串或原始数值(若配置不符合要求) |
| | | */ |
| | | toFixed(v, ct) { |
| | | if (v && ct && ct.fa) { |
| | | if (ct.fa.includes(".")) { |
| | | let num = ct.fa.slice(4).length; |
| | | return Number(v).toFixed(num); |
| | | } else { |
| | | return v; |
| | | } |
| | | } else { |
| | | return v; |
| | | } |
| | | }, |
| | | async goback() { |
| | | await this.waitForPendingSaves(); |