From 04d6024553ac73e67148ce578cb01b541eebd02a Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 18 五月 2026 16:37:56 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev-new_pro_OA

---
 src/views/equipmentManagement/measurementEquipment/index.vue |  186 ++++++++++++++++++++++++++++-----------------
 1 files changed, 115 insertions(+), 71 deletions(-)

diff --git a/src/views/equipmentManagement/measurementEquipment/index.vue b/src/views/equipmentManagement/measurementEquipment/index.vue
index e983a99..d2ec2d7 100644
--- a/src/views/equipmentManagement/measurementEquipment/index.vue
+++ b/src/views/equipmentManagement/measurementEquipment/index.vue
@@ -1,6 +1,6 @@
 <template>
 	<div class="app-container">
-		<div class="search_form">
+		<div class="search_form mb20">
 			<div>
 				<span class="search_title">褰曞叆鏃ユ湡锛�</span>
 				<el-date-picker
@@ -23,6 +23,7 @@
 				<el-button type="primary" @click="handleQuery" style="margin-left: 10px"
 				>鎼滅储</el-button
 				>
+				<el-button @click="handleReset" style="margin-left: 10px">閲嶇疆</el-button>
 			</div>
 			<div>
 				<el-button type="primary" @click="openForm('add')">鏂板璁¢噺鍣ㄥ叿</el-button>
@@ -40,25 +41,29 @@
 				@selection-change="handleSelectionChange"
 				:tableLoading="tableLoading"
 				@pagination="pagination"
+        :dbRowClick="dbRowClick"
+        :rowClassName="rowClassName"
 			></PIMTable>
 		</div>
 		<form-dia ref="formDia" @close="handleQuery"></form-dia>
 		<calibration-dia ref="calibrationDia" @close="handleQuery"></calibration-dia>
     <files-dia ref="filesDia"></files-dia>
+    <rowClickDataForm ref="rowClickData"></rowClickDataForm>
 	</div>
 </template>
 
 <script setup>
-import {onMounted, ref} from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
 import FormDia from "@/views/equipmentManagement/measurementEquipment/components/formDia.vue";
 import {ElMessageBox} from "element-plus";
 import useUserStore from "@/store/modules/user.js";
 import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue";
 import {
-	measuringInstrumentDelete,
-	measuringInstrumentListPage
+  measuringInstrumentDelete,
+  measuringInstrumentListPage,
 } from "@/api/equipmentManagement/measurementEquipment.js";
 import FilesDia from "./filesDia.vue";
+import rowClickDataForm from "./components/rowClickData.vue"
 const { proxy } = getCurrentInstance();
 const userStore = useUserStore()
 
@@ -73,67 +78,68 @@
 
 const tableColumn = ref([
 	{
-		label: "鐘舵��",
-		prop: "status",
-		dataType: "tag",
-		formatData: (params) => {
-			if (params == 1) {
-				return "鏈夋晥";
-			} else if (params == 2) {
-				return "閫炬湡";
-			} else {
-				return null;
-			}
-		},
-		formatType: (params) => {
-			if (params == 1) {
-				return "success";
-			} else if (params == 2) {
-				return "danger";
-			} else {
-				return null;
-			}
-		},
+		label: "鍑哄巶缂栧彿",
+		prop: "code",
+    minWidth:150,
+    align:"center"
+	},
+  {
+    label: "璁¢噺鍣ㄥ叿鍚嶇О",
+    prop: "name",
+    width: '160px',
+    align: "center",
+  },
+	{
+		label: "妫�瀹氬崟浣�",
+		prop: "unit",
+		width: 200,
+    align:"center"
 	},
 	{
-		label: "鏈�杩戜竴娆℃瀹氭棩鏈�",
+		label: "璇佷功缂栧彿",
+		prop: "model",
+		width:200,
+    align:"center"
+	},
+	{
+		label: "鏈�鏂伴壌瀹氭棩鏈�",
 		prop: "mostDate",
 		width: 130,
-	},
-	{
-		label: "璁¢噺鍣ㄥ叿缂栧彿",
-		prop: "code",
-		width: 150,
-	},
-	{
-		label: "璁¢噺鍣ㄥ叿鍚嶇О",
-		prop: "name",
-		width: 200,
-	},
-	{
-		label: "瑙勬牸鍨嬪彿",
-		prop: "model",
-		width:200
-	},
-	{
-		label: "鏈夋晥鏈�",
-		prop: "valid",
-		width: 130,
-	},
-	{
-		label: "棰勮涓嬫妫�瀹氭棩鏈�",
-		prop: "nextDate",
-		width: 130,
+    align:"center"
 	},
 	{
 		label: "褰曞叆浜�",
 		prop: "userName",
+		width: 130,
+    align:"center"
 	},
 	{
 		label: "褰曞叆鏃ユ湡",
 		prop: "recordDate",
-		width: 130,
+    align:"center",
+    minWidth: 130
 	},
+	{
+		label: "鏈夋晥鏃ユ湡",
+		prop: "valid",
+		width: 130,
+    align:"center"
+	},
+  {
+    label: "鐘舵��",
+    prop: "status",
+    width: 130,
+    align: "center",
+    formatData: (params) => {
+      if (params === 1) {
+        return "鏈夋晥";
+      } else if (params === 2) {
+        return "閫炬湡";
+      } else {
+        return null;
+      }
+    }
+  },
 	{
 		dataType: "action",
 		label: "鎿嶄綔",
@@ -141,18 +147,18 @@
 		width: '130',
 		fixed: 'right',
 		operation: [
+      {
+      	name: "闄勪欢",
+      	type: "text",
+      	clickFun: (row) => {
+          openFilesFormDia(row);
+      	},
+      },
 			{
-				name: "妫�瀹氭牎鍑�",
+				name: "鏌ョ湅",
 				type: "text",
 				clickFun: (row) => {
 					openCalibrationDia("verifying", row);
-				},
-			},
-			{
-				name: "闄勪欢",
-				type: "text",
-				clickFun: (row) => {
-          openFilesFormDia(row);
 				},
 			},
 		],
@@ -160,6 +166,7 @@
 ]);
 const tableData = ref([]);
 const tableLoading = ref(false);
+const rowClickData = ref([])
 const filesDia = ref()
 const page = reactive({
 	current: 1,
@@ -170,11 +177,37 @@
 
 // 鎵撳紑闄勪欢寮规
 const openFilesFormDia = (row) => {
-  console.log(row)
-  nextTick(() => {
-    filesDia.value?.openDialog( row,'璁¢噺鍣ㄥ叿鍙拌处')
-  })
+    filesDia.value?.openDialog(row,'璁¢噺鍣ㄥ叿鍙拌处')
 };
+
+const dbRowClick = (row)=>{
+  rowClickData.value?.openDialog(row)
+}
+
+// 琛屾牱寮忥細蹇埌鏈燂紙7澶╁唴锛夋垨閫炬湡鏍囩孩
+const rowClassName = ({ row }) => {
+  console.log('rowClassName called:', row);
+  // valid 鏄湁鏁堝ぉ鏁帮紝mostDate 鏄渶鏂版瀹氭棩鏈�
+  if (row.valid && row.mostDate) {
+    const mostDate = new Date(row.mostDate);
+    // 璁$畻鍒版湡鏃ユ湡 = 妫�瀹氭棩鏈� + 鏈夋晥澶╂暟
+    const validDays = parseInt(row.valid) || 0;
+    const expireDate = new Date(mostDate);
+    expireDate.setDate(expireDate.getDate() + validDays);
+    
+    const now = new Date();
+    const diffDays = Math.ceil((expireDate - now) / (1000 * 60 * 60 * 24));
+    console.log('row:', row.code, 'validDays:', validDays, 'expireDate:', expireDate, 'diffDays:', diffDays);
+    // 7澶╁唴鍒版湡鎴栧凡閫炬湡閮芥爣绾�
+    if (diffDays <= 7) {
+      console.log('return warning-row');
+      return 'warning-row';
+    }
+  } else {
+    console.log('row missing valid or mostDate:', row.valid, row.mostDate);
+  }
+  return '';
+}
 
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
@@ -186,6 +219,15 @@
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
+	page.current = 1;
+	getList();
+};
+
+// 閲嶇疆鎼滅储鏉′欢
+const handleReset = () => {
+	searchForm.value.recordDate = "";
+	searchForm.value.code = "";
+	searchForm.value.status = "";
 	page.current = 1;
 	getList();
 };
@@ -221,12 +263,6 @@
 const handleDelete = () => {
 	let ids = [];
 	if (selectedRows.value.length > 0) {
-		// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
-		const unauthorizedData = selectedRows.value.filter(item => item.userId !== userStore.id);
-		if (unauthorizedData.length > 0) {
-			proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
-			return;
-		}
 		ids = selectedRows.value.map((item) => item.id);
 	} else {
 		proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
@@ -272,5 +308,13 @@
 </script>
 
 <style scoped>
-
+:deep(.el-table .warning-row) {
+  background-color: #fef0f0 !important;
+}
+:deep(.el-table .warning-row:hover > td) {
+  background-color: #f9d5d5 !important;
+}
+:deep(.el-table .el-table__body tr.warning-row td) {
+  background-color: #fef0f0 !important;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3