| | |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <div style="text-align: left; margin-top: 8px;"> |
| | | <el-form :inline="true" :model="currentOtherForm" class="form-inline" label-width="50px" |
| | | style="text-align: left; display: inline"> |
| | | <el-form-item label="温度:" style="margin-bottom: 0"> |
| | | <div class="template-panel"> |
| | | <el-form :inline="true" :model="currentOtherForm" class="form-inline" size="small" label-width="84px"> |
| | | <el-form-item label="温度:"> |
| | | <el-input v-model="currentOtherForm.temperature" :disabled="state > 1" placeholder="" size="small" |
| | | style="width: 90px" @change="m => subOtherForm(m, 'temperature')"></el-input> |
| | | <span style="margin-left: 4px">℃</span> |
| | | <span class="template-panel__unit">℃</span> |
| | | </el-form-item> |
| | | <el-form-item label="湿度:" style="margin-bottom: 0"> |
| | | <el-form-item label="湿度:"> |
| | | <el-input v-model="currentOtherForm.humidity" :disabled="state > 1" placeholder="" size="small" |
| | | style="width: 90px" @change="m => subOtherForm(m, 'humidity')"></el-input> |
| | | <span style="margin-left: 4px">%RH</span> |
| | | <span class="template-panel__unit">%RH</span> |
| | | </el-form-item> |
| | | <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 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-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable |
| | | size="small" placeholder="请选择设备" style="width: 360px" |
| | | @change="m => subOtherForm(m, 'deviceIds')"> |
| | | <el-option v-for="device in deviceOptions" :key="device.id" :label="device.label" |
| | | :value="device.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | numOptions: [], |
| | | temperatureOptions: [], |
| | | wareTableData: [], |
| | | // 温度、湿度按模板 id 分组:{ [templateId]: { temperature, humidity } } |
| | | // 检测条件按模板 id 分组:{ [templateId]: { temperature, humidity, detectionTime, detectionPlace, deviceIds } } |
| | | otherForm: {}, |
| | | deviceOptions: [], |
| | | equipForm: { |
| | | value0: null, |
| | | code0: null, |
| | |
| | | action() { |
| | | return this.javaApi + "/insOrderPlan/uploadFile"; |
| | | }, |
| | | // 当前模板对应的温度、湿度 |
| | | // 当前模板对应的检测条件 |
| | | currentOtherForm() { |
| | | return this.otherForm[this.currentTable] || { |
| | | temperature: null, |
| | | humidity: null |
| | | humidity: null, |
| | | detectionTime: null, |
| | | detectionPlace: null, |
| | | deviceIds: [] |
| | | } |
| | | } |
| | | }, |
| | |
| | | this.sampleProduct = res.data.sampleProduct |
| | | this.currentSample = this.HaveJson(this.sampleProduct[0]) |
| | | let insProduct = this.HaveJson(this.currentSample.insProduct) |
| | | // 温度、湿度赋值:按模板 id 分组回显 |
| | | // 检测条件赋值:按模板 id 分组回显 |
| | | this.otherForm = {} |
| | | const conditionList = this.insOrder.templateConditions || [] |
| | | conditionList.forEach(item => { |
| | | this.$set(this.otherForm, item.templateId, { |
| | | temperature: item.temperature != null ? item.temperature : null, |
| | | humidity: item.humidity != null ? item.humidity : null |
| | | humidity: item.humidity != null ? item.humidity : null, |
| | | detectionTime: item.detectionTime != null ? item.detectionTime : null, |
| | | detectionPlace: item.detectionPlace != null ? item.detectionPlace : null, |
| | | deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [] |
| | | }) |
| | | }) |
| | | if (this.typeSource == '1') { |
| | | this.retestTag = '1' |
| | | } |
| | | this.getEquipOptions(1) |
| | | if (this.sonLaboratory === '新聚') { |
| | | this.loadDeviceOptions() |
| | | } |
| | | // 获取当前样品的检验项 |
| | | let list = await this.getCurrentProduct(this.currentSample.id, 0) |
| | | if (list === undefined) { |
| | |
| | | }) |
| | | } |
| | | }, |
| | | // 新聚直接绑定模板的单据,设备按模板选择 |
| | | isDirectTemplateOrder() { |
| | | return this.sonLaboratory === '新聚' && this.currentSample && |
| | | (this.currentSample.insProduct || []).some(product => product.templateRowIndex != null) |
| | | }, |
| | | loadDeviceOptions() { |
| | | search({ status: 0 }).then(res => { |
| | | this.deviceOptions = (res.data || []).map(device => ({ |
| | | id: device.id, |
| | | label: `${device.deviceName}--${device.managementNumber}` |
| | | })) |
| | | }).catch(error => { |
| | | console.error(error) |
| | | }) |
| | | }, |
| | | getUserInfo() { |
| | | getUserNow().then(res => { |
| | | this.userId = res.data.id |
| | |
| | | this.$message.error('未输入不通过原因') |
| | | } |
| | | }, |
| | | // 保证模板的温度、湿度槽位存在 |
| | | // 保证模板的检测条件槽位存在 |
| | | ensureOtherForm(templateId) { |
| | | if (templateId == null) return |
| | | if (!this.otherForm[templateId]) { |
| | | this.$set(this.otherForm, templateId, { |
| | | temperature: null, |
| | | humidity: null |
| | | humidity: null, |
| | | detectionTime: null, |
| | | detectionPlace: null, |
| | | deviceIds: [] |
| | | }) |
| | | } |
| | | }, |
| | | // 保存当前模板的温度、湿度 |
| | | // 保存当前模板的检测条件 |
| | | subOtherForm(m, type) { |
| | | write({ |
| | | const payload = { |
| | | id: this.insOrder.id, |
| | | templateId: this.currentTable, |
| | | [type]: Number(m) |
| | | }).then(res => { |
| | | templateId: this.currentTable |
| | | } |
| | | if (type === 'deviceIds') { |
| | | payload.deviceIds = Array.isArray(m) ? [...m] : [] |
| | | } else if (type === 'detectionTime' || type === 'detectionPlace') { |
| | | payload[type] = m === '' || m == null ? null : m |
| | | } else { |
| | | payload[type] = Number(m) |
| | | } |
| | | write(payload).then(res => { |
| | | this.$message.success("保存成功") |
| | | }) |
| | | }, |
| | |
| | | this.$message.error("请指定复核人员") |
| | | return |
| | | } |
| | | const labels = { temperature: "温度", humidity: "湿度" } |
| | | const keys = ["temperature", "humidity"] |
| | | const missing = [] |
| | | this.tableLists.forEach(m => { |
| | | const form = this.otherForm[m.templateId] || {} |
| | | keys.forEach(key => { |
| | | if (!form[key]) missing.push(`「${m.templateName}」的${labels[key]}`) |
| | | }) |
| | | 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}」的设备`) |
| | | } |
| | | }) |
| | | if (missing.length > 0) { |
| | | this.$message.error(`请填写${missing[0]}`) |
| | | this.$message.error(missing[0]) |
| | | return |
| | | } |
| | | this.submitLoading = true; |
| | |
| | | text-align: left; |
| | | } |
| | | |
| | | /* 当前检验模板的检测条件 */ |
| | | .template-panel { |
| | | background-color: #f8f9fb; |
| | | border: 1px solid #ebeef5; |
| | | border-radius: 3px; |
| | | padding: 16px 16px 4px; |
| | | margin-top: 12px; |
| | | text-align: left; |
| | | } |
| | | |
| | | /* form-item 用 inline-flex 保证 label 与控件同行,不依赖行盒宽度推算 */ |
| | | .template-panel>>>.el-form-item { |
| | | display: inline-flex; |
| | | align-items: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .template-panel>>>.el-form-item__label { |
| | | flex: none; |
| | | } |
| | | |
| | | .template-panel__unit { |
| | | margin-left: 4px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .center { |
| | | width: calc(100% - 40px); |
| | | /* max-height: 580px; */ |