From 6ae6ee885f0acb59f4c8b2d2439fb58a0a345701 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 19 十月 2026 16:29:14 +0800
Subject: [PATCH] feat: support formatted inspection values

---
 src/views/CNAS/resourceDemand/device/component/management.vue |  142 ++++++++++++++--------------------------------
 1 files changed, 44 insertions(+), 98 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/management.vue b/src/views/CNAS/resourceDemand/device/component/management.vue
index ee16e8f..0db1429 100644
--- a/src/views/CNAS/resourceDemand/device/component/management.vue
+++ b/src/views/CNAS/resourceDemand/device/component/management.vue
@@ -27,7 +27,7 @@
         </el-form>
       </div>
       <div>
-        <el-button size="small" type="primary" @click="dialogVisible2 = true">鏂板</el-button>
+        <el-button size="small" type="primary" @click="openAddDialog">鏂板</el-button>
         <el-button size="small" type="primary" @click="handleDownOne">瀵煎嚭</el-button>
       </div>
     </div>
@@ -132,7 +132,7 @@
 							:props="props" placeholder="璇烽�夋嫨" size="small" style="width:100%;" :collapse-tags="!isUp" separator=","
 							filterable clearable></el-cascader>
 					</el-form-item>
-					<el-form-item label="璁惧绫诲瀷:">
+					<el-form-item label="璁惧/璁¢噺鍣ㄥ叿:">
 						<el-select :disabled="isUp" v-model="formData.largeCategory" placeholder="璇烽�夋嫨" size="small"
 							style="width:100%">
 							<el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value">
@@ -336,7 +336,7 @@
 							placeholder="璇烽�夋嫨" size="small" style="width:100%" collapse-tags separator="," filterable
 							clearable></el-cascader>
 					</el-form-item>
-					<el-form-item label="璁惧绫诲瀷:">
+					<el-form-item label="璁惧/璁¢噺鍣ㄥ叿:">
 						<el-select v-model="formData2.largeCategory" placeholder="璇烽�夋嫨" size="small" style="width:100%">
 							<el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value">
 							</el-option>
@@ -408,42 +408,6 @@
 				</el-row>
 			</span></template>
 		</el-dialog>
-		<el-dialog title="鏁伴噰閰嶇疆" v-model="dialogVisible3" width="400px">
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>IP锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.ip"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.collectUrl"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍌ㄥ瓨鍦板潃锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.storageUrl"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍙傜収锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.refer"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>X锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.x"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>Y锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.y"></el-input>
-			</div>
-			<div class="search_thing">
-				<div class="search_label">鍏紡锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.formula"></el-input>
-			</div>
-			<template #footer><span  class="dialog-footer">
-				<el-row justify="end">
-					<el-button @click="dialogVisible3 = false">鍙� 娑�</el-button>
-					<el-button type="primary" @click="submitForm3" :loading="upLoad3">纭� 瀹�</el-button>
-				</el-row>
-			</span></template>
-		</el-dialog>
 		<dataAcquisitionConfig v-if="showData" :deviceId="deviceId" />
 	</div>
 </template>
@@ -456,13 +420,14 @@
 	getInsProduction,
 	upDeviceParameter,
 	addDeviceParameter,
-	numberCollect,
 	getDeviceParameter,
 	delDeviceParameter,
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectUserCondition } from "@/api/business/inspectionTask";
 import dayjs from 'dayjs'
+import { formatListDate } from './dateFormat'
 import { selectQualifiedSupplierManagementPage } from '@/api/cnas/externalService/supplierManage/supplierManage'
+import { saveBlobOrShowError } from '@/utils/saveBlob'
 export default {
 	props: {
 		clickNodeVal: {
@@ -510,8 +475,11 @@
 			showData: false, // 鏁伴噰閰嶇疆椤甸潰
 			tableList: [],
 			addDia: true,
-			//璁惧绫诲瀷鍒楄〃
-			equipmentList: [],
+			//璁惧绫诲瀷鍒楄〃锛氫笌宸︿晶鏍戔�滆澶�/璁¢噺鍣ㄥ叿鈥濆垎绫讳繚鎸佷竴鑷�
+			equipmentList: [
+				{ label: '璁惧', value: '璁惧' },
+				{ label: '璁¢噺鍣ㄥ叿', value: '璁¢噺鍣ㄥ叿' }
+			],
 			// 璐熻矗浜哄垪琛�
 			responsiblePersonList: [],
 			// 鎺堟潈浜哄垪琛�
@@ -522,9 +490,6 @@
 			deviceStatusList: [],
 			upLoad: false,
 			upLoad2: false,
-			dialogVisible3: false,
-			upLoad3: false,
-			configForm: {},
 			queryParams: {},
 			tableData: [],
 			column: [
@@ -538,18 +503,18 @@
 				{ label: "鍑哄巶缂栧彿", prop: "factoryNo" },
 				{ label: "绠$悊缂栧彿", prop: "managementNumber" },
 				{ label: "鎶�鏈寚鏍�", prop: "technicalIndicators" },
-				{ label: "璐疆鏃ユ湡", prop: "acquisitionDate" },
-				{ label: "鏍″噯鏈夋晥鏈�", prop: "activationDate" },
+				{ label: "璐疆鏃ユ湡", prop: "acquisitionDate", formatData: (params) => formatListDate(params) },
+				{ label: "鏍″噯鏈夋晥鏈�", prop: "activationDate", formatData: (params) => formatListDate(params) },
 				{ label: "绠$悊浜�", prop: "equipmentManagerUser" },
 				{ label: "瀛樻斁鐐�", prop: "storagePoint" },
 				{ label: "妫�楠岄」鐩�", prop: "insProductItem" },
 				{ label: "鏍″噯鏈嶅姟鏈烘瀯", prop: "calibrationServices" },
-				{ label: "鏈�杩戞牎鍑嗘棩鏈�", prop: "lastCalibrationDateTwo" },
-				{ label: "鏈�杩戞牳鏌ユ棩鏈�", prop: "lastExamineDate" },
-				{ label: "涓嬫鏍″噯鏃ユ湡", prop: "nextCalibrationDateTwo" },
-				{ label: "涓嬫鏍告煡鏃ユ湡", prop: "nextExamineDate" },
-				{ label: "鏈�杩戜繚鍏绘棩鏈�", prop: "lastMaintenanceDate" },
-				{ label: "涓嬫淇濆吇鏃ユ湡", prop: "nextMaintenanceDate" },
+				{ label: "鏈�杩戞牎鍑嗘棩鏈�", prop: "lastCalibrationDateTwo", formatData: (params) => formatListDate(params) },
+				{ label: "鏈�杩戞牳鏌ユ棩鏈�", prop: "lastExamineDate", formatData: (params) => formatListDate(params) },
+				{ label: "涓嬫鏍″噯鏃ユ湡", prop: "nextCalibrationDateTwo", formatData: (params) => formatListDate(params) },
+				{ label: "涓嬫鏍告煡鏃ユ湡", prop: "nextExamineDate", formatData: (params) => formatListDate(params) },
+				{ label: "鏈�杩戜繚鍏绘棩鏈�", prop: "lastMaintenanceDate", formatData: (params) => formatListDate(params) },
+				{ label: "涓嬫淇濆吇鏃ユ湡", prop: "nextMaintenanceDate", formatData: (params) => formatListDate(params) },
 				{
 					label: "璁惧鍒嗙被", prop: "largeCategory", dataType: "tag",
 					formatData: (params) => {
@@ -738,8 +703,9 @@
 			this.outLoading = true
 			exportEquipmentDetails({ ...this.queryParams }).then(res => {
 				this.outLoading = false
-				const blob = new Blob([res], { type: 'application/octet-stream' });
-				this.$download.saveAs(blob, '璁惧浠櫒涓�瑙堣〃.doc')
+				saveBlobOrShowError(res, '璁惧浠櫒涓�瑙堣〃.doc', 'application/msword')
+			}).catch(() => {
+				this.outLoading = false
 			})
 		},
 		// 鑾峰彇瀛楀吀
@@ -747,10 +713,6 @@
 			// 璁惧鐘舵��
 			this.getDicts("device_status").then((response) => {
 				this.deviceStatusList = this.dictToValue(response.data);
-			});
-			// 璁惧鍒嗙被
-			this.getDicts("device_type").then((response) => {
-				this.equipmentList = this.dictToValue(response.data);
 			});
 		},
 		// 鑾峰彇璐熻矗浜哄垪琛�
@@ -852,6 +814,11 @@
 			//澶嶅埗缁檉ormData
 			this.formData = this.HaveJson(row);
 			this.formData.authorizedPerson = this.normalizeAuthorizedPerson(row.authorizedPerson);
+			// 璁惧绫诲瀷涓虹┖鏃讹紝榛樿鍙栧乏渚ф爲褰撳墠鎵�鍦ㄥ垎绫�
+			const treeCategory = this.clickNodeVal && this.clickNodeVal.label
+			if (!this.formData.largeCategory && (treeCategory === '璁惧' || treeCategory === '璁¢噺鍣ㄥ叿')) {
+				this.formData.largeCategory = treeCategory
+			}
 			if (typeof (row.insProductIds) === 'number') {
 				row.insProductIds = row.insProductIds + ''
 			}
@@ -958,6 +925,8 @@
 				this.$message.success('淇敼鎴愬姛')
 				this.upLoad = false
 				this.refreshTable('page')
+				// 绫诲瀷鍙兘鍙樻洿锛屽埛鏂板乏渚ф爲璁╄澶囧綊鍒版柊鐨勫垎绫讳笅
+				this.$emit('refresh-tree')
 				this.dialogVisible = false
 			}).catch(e => {
 				this.$message.error('淇敼澶辫触')
@@ -977,6 +946,10 @@
 			}
 			if (!this.formData2.managementNumber) {
 				this.$message.error('鏈緭鍏ョ鐞嗙紪鍙�')
+				return
+			}
+			if (!this.formData2.largeCategory) {
+				this.$message.error('璇烽�夋嫨璁惧/璁¢噺鍣ㄥ叿')
 				return
 			}
 			if (!this.formData2.activationDate) {
@@ -1001,6 +974,7 @@
 				this.$message.success('鎻愪氦鎴愬姛')
 				this.upLoad2 = false
 				this.refreshTable('page')
+				this.$emit('refresh-tree')
 				this.dialogVisible2 = false
 				this.formData2 = {
 					imageUpload: '',
@@ -1036,44 +1010,6 @@
 			this.clickSidebar(this.clickNodeVal)
 			this.showData = false
 		},
-		submitForm3() {
-			if (!this.configForm.ip) {
-				this.$message.error('璇峰~鍐橧P');
-				return
-			}
-			if (!this.configForm.collectUrl) {
-				this.$message.error('璇峰~鍐欓噰闆嗗湴鍧�');
-				return
-			}
-			if (!this.configForm.storageUrl) {
-				this.$message.error('璇峰~鍐欏偍瀛樺湴鍧�');
-				return
-			}
-			if (!this.configForm.refer) {
-				this.$message.error('璇峰~鍐欏弬鐓�');
-				return
-			}
-			if (!this.configForm.x) {
-				this.$message.error('璇峰~鍐橷');
-				return
-			}
-			if (!this.configForm.y) {
-				this.$message.error('璇峰~鍐橸');
-				return
-			}
-
-			this.upLoad3 = true
-			numberCollect(this.configForm).then(res => {
-				this.upLoad3 = false
-				this.$message.success('鎿嶄綔鎴愬姛')
-				this.refreshTable('page')
-				this.dialogVisible3 = false
-			}).catch(e => {
-				this.$message.error('鎿嶄綔澶辫触')
-				this.dialogVisible3 = false
-				this.upLoad3 = false
-			})
-		},
 		// 鐐瑰嚮渚ц竟鏍忓埛鏂�
 		clickSidebar(clickNodeVal) {
 			// 瀛樺湪value浠h〃閫変腑浜嗚澶囷紝鐢辫澶囪鎯呭睍绀哄鐞�
@@ -1084,6 +1020,14 @@
 				this.refreshTable('page')
 			}
 		},
+		// 鏂板璁惧锛氶粯璁ゅ彇宸︿晶鏍戝綋鍓嶆墍鍦ㄥ垎绫�
+		openAddDialog() {
+			const treeCategory = this.clickNodeVal && this.clickNodeVal.label
+			if (!this.formData2.largeCategory && (treeCategory === '璁惧' || treeCategory === '璁¢噺鍣ㄥ叿')) {
+				this.formData2.largeCategory = treeCategory
+			}
+			this.dialogVisible2 = true
+		},
 		handleDelete(row) {
 			this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
 				confirmButtonText: "纭畾",
@@ -1093,7 +1037,9 @@
 				.then(() => {
 					delDeviceParameter({ id: row.id }).then((res) => {
 						this.$message.success("鍒犻櫎鎴愬姛");
-						this.refresh();
+						this.refreshTable()
+						// 宸插垹闄ょ殑璁惧瑕佷粠宸︿晶鏍戝悓姝ョЩ闄�
+						this.$emit('refresh-tree')
 					});
 				})
 				.catch(() => { });

--
Gitblit v1.9.3