From 093615ab71eebddeea28a74a6c21898fc929450f Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期一, 04 八月 2025 14:43:22 +0800
Subject: [PATCH] 判断检测项,调整请求
---
src/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue | 85 ++++++++++++++++++++++++++++++++++--------
1 files changed, 69 insertions(+), 16 deletions(-)
diff --git a/src/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue b/src/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue
index 3543847..a236a5b 100644
--- a/src/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue
+++ b/src/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue
@@ -103,6 +103,18 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="12" v-if="editForm.inspectionItemType == 1">
+ <el-form-item label="璁惧缁戝畾锛�" prop="deviceId">
+ <el-select v-model="editForm.deviceId" clearable placeholder="璇烽�夋嫨"
+ size="small" style="width: 100%" multiple filterable>
+ <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.value">
+ {{item.label + ' - ' + item.managementNumber}}
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
<el-col :span="12">
<el-form-item label="妫�楠屽�肩被鍨嬶細" prop="inspectionValueType">
<el-select v-model="editForm.inspectionValueType" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
@@ -110,8 +122,6 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row>
<el-col :span="12">
<el-form-item label="鐗规畩鏍囪瘑锛�" prop="bsm">
<el-select v-model="editForm.bsm" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
@@ -119,6 +129,8 @@
</el-select>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row>
<el-col :span="12">
<el-form-item label="鍘熷璁板綍妯℃澘锛�" prop="templateId">
<el-select v-model="editForm.templateId" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
@@ -126,27 +138,27 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row>
<el-col :span="12">
<el-form-item label="妫�楠岄」鍒嗙被锛�" prop="inspectionItemClass">
<el-input v-model="editForm.inspectionItemClass" clearable size="small"></el-input>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row>
<el-col :span="12">
<el-form-item label="妫�楠岄」鍒嗙被EN锛�" prop="inspectionItemClassEn">
<el-input v-model="editForm.inspectionItemClassEn" clearable size="small"></el-input>
</el-form-item>
</el-col>
- </el-row>
- <el-row>
<el-col :span="12">
<el-form-item label="璇曢獙鏂规硶锛�" prop="method">
<el-select v-model="editForm.method" clearable multiple placeholder="璇烽�夋嫨" size="small" style="width: 100%">
- <el-option v-for="item in methodList" :key="item.value" :label="item.label" :value="item.value"></el-option>
+ <el-option v-for="item in methodList" :key="item.value" :label="item.label" :value="item.label"></el-option>
</el-select>
</el-form-item>
</el-col>
+ </el-row>
+ <el-row>
<el-col :span="12">
<el-form-item label="鏉′欢锛�" prop="radiusList">
<el-select v-model="editForm.radiusList" allow-create default-first-option filterable multiple
@@ -157,11 +169,18 @@
</el-select>
</el-form-item>
</el-col>
- </el-row>
- <el-row>
<el-col :span="12">
<el-form-item label="鏀惰垂鏍囧噯(鍏�/娆�)锛�" prop="rates">
<el-input v-model="editForm.rates" clearable size="small"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="鎶芥绫诲瀷缁戝畾锛�" prop="spotCheckType">
+ <el-select v-model="editForm.spotCheckType" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
+ <el-option v-for="item in dict.type.spot_check_type" :key="item.value" :label="item.label" :value="item.value"></el-option>
+ </el-select>
</el-form-item>
</el-col>
</el-row>
@@ -191,12 +210,13 @@
upItemParameter
} from "@/api/structural/capability";
import {selectStandardMethods} from "@/api/structural/standardMethod";
+import {search} from "@/api/business/inspectionTask";
export default {
name: "EditForm",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
- dicts: ['sys_sub_lab', 'inspection_item_type', 'sys_unit', 'inspection_value_type', 'inspection_bsm'],
+ dicts: ['sys_sub_lab', 'inspection_item_type', 'sys_unit', 'inspection_value_type', 'inspection_bsm', 'spot_check_type'],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -226,7 +246,9 @@
inspectionItemClassEn: '', // 妫�楠岄」鍒嗙被EN
method: '', // 璇曢獙鏂规硶
radiusList: [], // 鏉′欢
- rates: '', // 鏉′欢
+ rates: '', // 鏀惰垂鏍囧噯(鍏�/娆�)
+ spotCheckType: '', // 鎶芥绫诲瀷缁戝畾
+ deviceId: [], // 璁惧
},
sampleList: [], // 妫�楠屽璞′笅鎷夋
laboratoryList: [], // 鍦烘墍涓嬫媺妗�
@@ -262,7 +284,8 @@
{ required: true, message: '璇烽�夋嫨鍘熷璁板綍妯℃澘', trigger: 'change' }
]
},
- operationType: ''
+ operationType: '',
+ equipOptions: []
}
},
// 鏂规硶闆嗗悎
@@ -270,6 +293,7 @@
openDia (type, row) {
this.operationType = type
this.editFormDia = true
+ this.getEquipOptions() // 鑾峰彇鎵�鏈夎澶�
this.obtainItemParameterList() // 鍦烘墍绫诲瀷
this.getStandardTemplate() // 鍘熷璁板綍妯℃澘涓嬫媺妗�
this.getSelectStandardMethods() // 璇曢獙鏂规硶
@@ -299,14 +323,18 @@
inspectionItemClassEn: '', // 妫�楠岄」鍒嗙被EN
method: '', // 璇曢獙鏂规硶
radiusList: [], // 鏉′欢
- rates: '', // 鏉′欢
+ rates: '', // 鏀惰垂鏍囧噯(鍏�/娆�)
+ spotCheckType: '', // 鎶芥绫诲瀷缁戝畾
}
this.resetForm('editForm')
} else {
this.editForm = this.HaveJson(row)
this.editForm.sample = JSON.parse(this.editForm.sample)
- this.editForm.radiusList = JSON.parse(this.editForm.radiusList)
+ this.editForm.radiusList = this.editForm.radiusList && JSON.parse(this.editForm.radiusList)
this.editForm.method = JSON.parse(this.editForm.method)
+ const ids = this.editForm.deviceIds && this.editForm.deviceIds.split(",") || [];
+ const numericIds = ids.map(Number);
+ this.$set(this.editForm, 'deviceId', numericIds);
}
},
// 鎻愪氦缂栬緫
@@ -317,7 +345,16 @@
let obj = this.HaveJson(this.editForm)
obj.method = JSON.stringify(obj.method)
obj.sample = JSON.stringify(obj.sample)
- obj.radiusList = JSON.stringify(obj.radiusList)
+ if (obj.radiusList?.length > 0) {
+ obj.radiusList = JSON.stringify(obj.radiusList)
+ } else {
+ obj.radiusList = null
+ }
+ if (obj.deviceId?.length > 0) {
+ obj.deviceIds = obj.deviceId.join(',')
+ } else {
+ obj.deviceIds = null
+ }
if(obj.id){
// 淇敼
upItemParameter(obj).then(res => {
@@ -387,7 +424,7 @@
res.data.forEach(a => {
data.push({
label: a.code,
- value: a.code
+ value: a.id,
})
})
this.methodList = data
@@ -421,6 +458,22 @@
this.templateIdList = data
})
},
+ // 鑾峰彇鎵�鏈夎澶�
+ getEquipOptions() {
+ this.equipOptions = [];
+ search({ status: 0 }).then((res) => {
+ if (res.code === 200 && res.data) {
+ this.equipOptions = res.data.map((m) => {
+ m.value = m.id;
+ m.label = m.deviceName;
+ m.managementNumber = m.managementNumber;
+ return m;
+ });
+ }
+ }).catch((error) => {
+ console.error(error);
+ });
+ },
},
}
</script>
--
Gitblit v1.9.3