From f49bfd6c085cbf28a25d9404f8dc5b74368b716a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 29 五月 2026 15:54:02 +0800
Subject: [PATCH] 新疆马铃薯 1.代码更新

---
 src/views/equipmentManagement/measurementEquipment/index.vue |  614 +++++++++++++++++++++++++------------------------------
 1 files changed, 279 insertions(+), 335 deletions(-)

diff --git a/src/views/equipmentManagement/measurementEquipment/index.vue b/src/views/equipmentManagement/measurementEquipment/index.vue
index 007eef6..46ca100 100644
--- a/src/views/equipmentManagement/measurementEquipment/index.vue
+++ b/src/views/equipmentManagement/measurementEquipment/index.vue
@@ -1,354 +1,298 @@
 <template>
-  <div class="app-container">
-    <div class="search_form mb20">
-      <div>
-        <span class="search_title">褰曞叆鏃ユ湡锛�</span>
-        <el-date-picker v-model="searchForm.recordDate"
-                        value-format="YYYY-MM-DD"
-                        format="YYYY-MM-DD"
-                        type="date"
-                        placeholder="璇烽�夋嫨"
-                        clearable
-                        style="width: 160px"
-                        @change="handleQuery" />
-        <span class="search_title ml10">璁¢噺鍣ㄥ叿缂栧彿锛�</span>
-        <el-input v-model="searchForm.code"
-                  placeholder="璇疯緭鍏ョ紪鍙�"
-                  clearable
-                  style="width: 240px"
-                  @change="handleQuery" />
-        <span class="search_title ml10">鐘舵�侊細</span>
-        <el-select v-model="searchForm.status"
-                   placeholder="璇烽�夋嫨鐘舵��"
-                   @change="handleQuery"
-                   style="width: 160px"
-                   clearable>
-          <el-option label="鏈夋晥"
-                     :value="1"></el-option>
-          <el-option label="閫炬湡"
-                     :value="2"></el-option>
-        </el-select>
-        <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>
-        <el-button type="danger"
-                   plain
-                   @click="handleDelete">鍒犻櫎</el-button>
-        <el-button @click="handleOut">瀵煎嚭</el-button>
-      </div>
-    </div>
-    <div class="table_list">
-      <PIMTable rowKey="id"
-                :column="tableColumn"
-                :tableData="tableData"
-                :page="page"
-                :isSelection="true"
-                @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>
+	<div class="app-container">
+		<div class="search_form">
+			<div>
+				<span class="search_title">褰曞叆鏃ユ湡锛�</span>
+				<el-date-picker
+					v-model="searchForm.recordDate"
+					value-format="YYYY-MM-DD"
+					format="YYYY-MM-DD"
+					type="date"
+					placeholder="璇烽�夋嫨"
+					clearable
+					style="width: 160px"
+					@change="handleQuery"
+				/>
+				<span class="search_title ml10">璁¢噺鍣ㄥ叿缂栧彿锛�</span>
+				<el-input v-model="searchForm.code" placeholder="璇疯緭鍏ョ紪鍙�" clearable style="width: 240px" @change="handleQuery"/>
+				<span class="search_title ml10">鐘舵�侊細</span>
+				<el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" @change="handleQuery" style="width: 160px" clearable>
+					<el-option label="鏈夋晥" :value="1"></el-option>
+					<el-option label="閫炬湡" :value="2"></el-option>
+				</el-select>
+				<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>
+				<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+				<el-button @click="handleOut">瀵煎嚭</el-button>
+			</div>
+		</div>
+		<div class="table_list">
+			<PIMTable
+				rowKey="id"
+				:column="tableColumn"
+				:tableData="tableData"
+				:page="page"
+				:isSelection="true"
+				@selection-change="handleSelectionChange"
+				:tableLoading="tableLoading"
+				@pagination="pagination"
+        :dbRowClick="dbRowClick"
+			></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>
+	</div>
 </template>
 
 <script setup>
-  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,
-  } from "@/api/equipmentManagement/measurementEquipment.js";
-  import FilesDia from "./filesDia.vue";
-  import rowClickDataForm from "./components/rowClickData.vue";
-  const { proxy } = getCurrentInstance();
-  const userStore = useUserStore();
+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,
+} from "@/api/equipmentManagement/measurementEquipment.js";
+import FilesDia from "./filesDia.vue";
+import rowClickDataForm from "./components/rowClickData.vue"
+const { proxy } = getCurrentInstance();
+const userStore = useUserStore()
 
-  const data = reactive({
-    searchForm: {
-      recordDate: "",
-      code: "",
-      status: "",
-    },
-  });
-  const { searchForm } = toRefs(data);
+const data = reactive({
+	searchForm: {
+		recordDate: "",
+		code: "",
+		status: "",
+	},
+});
+const { searchForm } = toRefs(data);
 
-  const tableColumn = ref([
-    {
-      label: "鍑哄巶缂栧彿",
-      prop: "code",
-      minWidth: 150,
-      align: "center",
-    },
-    {
-      label: "璁¢噺鍣ㄥ叿鍚嶇О",
-      prop: "name",
-      width: "160px",
-      align: "center",
-    },
-    {
-      label: "妫�瀹氬崟浣�",
-      prop: "unit",
-      width: 200,
-      align: "center",
-    },
-    {
-      label: "璇佷功缂栧彿",
-      prop: "model",
-      width: 200,
-      align: "center",
-    },
-    {
-      label: "鏈�鏂伴壌瀹氭棩鏈�",
-      prop: "mostDate",
-      width: 130,
-      align: "center",
-    },
-    {
-      label: "褰曞叆浜�",
-      prop: "userName",
-      width: 130,
-      align: "center",
-    },
-    {
-      label: "褰曞叆鏃ユ湡",
-      prop: "recordDate",
-      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: "鎿嶄綔",
-      align: "center",
-      width: "130",
-      fixed: "right",
-      operation: [
-        {
-          name: "闄勪欢",
-          type: "text",
-          clickFun: row => {
-            openFilesFormDia(row);
-          },
-        },
-        {
-          name: "缂栬緫",
-          type: "text",
-          clickFun: row => {
-            openCalibrationDia("verifying", row);
-          },
-        },
-      ],
-    },
-  ]);
-  const tableData = ref([]);
-  const tableLoading = ref(false);
-  const rowClickData = ref([]);
-  const filesDia = ref();
-  const page = reactive({
-    current: 1,
-    size: 100,
-    total: 0,
-  });
-  const selectedRows = ref([]);
-
-  // 鎵撳紑闄勪欢寮规
-  const openFilesFormDia = row => {
-    filesDia.value?.openDialog(row, "measuring_instrument_ledger");
-  };
-
-  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";
+const tableColumn = ref([
+	{
+		label: "鍑哄巶缂栧彿",
+		prop: "code",
+    minWidth:150,
+    align:"center"
+	},
+  {
+    label: "璁¢噺鍣ㄥ叿鍚嶇О",
+    prop: "name",
+    width: '160px',
+    align: "center",
+  },
+	{
+		label: "瀹夎浣嶇疆",
+		prop: "instationLocation",
+		width: 150,
+    align:"center"
+	},
+	{
+		label: "妫�瀹氬崟浣�",
+		prop: "unit",
+		width: 200,
+    align:"center"
+	},
+	{
+		label: "璇佷功缂栧彿",
+		prop: "model",
+		width:200,
+    align:"center"
+	},
+	{
+		label: "鏈�鏂伴壌瀹氭棩鏈�",
+		prop: "mostDate",
+		width: 130,
+    align:"center"
+	},
+	{
+		label: "褰曞叆浜�",
+		prop: "userName",
+		width: 130,
+    align:"center"
+	},
+	{
+		label: "褰曞叆鏃ユ湡",
+		prop: "recordDate",
+    align:"center",
+    minWidth: 130
+	},
+	{
+		label: "鏈夋晥鏃ユ湡",
+		prop: "valid",
+		width: 130,
+    align:"center"
+	},
+  {
+    label: "妫�瀹氬懆鏈�(澶�)",
+    prop: "cycle",
+    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;
       }
-    } else {
-      console.log("row missing valid or mostDate:", row.valid, row.mostDate);
     }
-    return "";
-  };
+  },
+	{
+		dataType: "action",
+		label: "鎿嶄綔",
+		align: "center",
+		width: '130',
+		fixed: 'right',
+		operation: [
+      {
+      	name: "闄勪欢",
+      	type: "text",
+      	clickFun: (row) => {
+          openFilesFormDia(row);
+      	},
+      },
+			{
+				name: "鏌ョ湅",
+				type: "text",
+				clickFun: (row) => {
+					openCalibrationDia("verifying", row);
+				},
+			},
+		],
+	},
+]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+const rowClickData = ref([])
+const filesDia = ref()
+const page = reactive({
+	current: 1,
+	size: 100,
+	total: 0,
+});
+const selectedRows = ref([]);
 
-  // 琛ㄦ牸閫夋嫨鏁版嵁
-  const handleSelectionChange = selection => {
-    selectedRows.value = selection;
-  };
-  const formDia = ref();
-  const calibrationDia = ref();
+// 鎵撳紑闄勪欢寮规
+const openFilesFormDia = (row) => {
+    filesDia.value?.openDialog(row,'璁¢噺鍣ㄥ叿鍙拌处')
+};
 
-  // 鏌ヨ鍒楄〃
-  /** 鎼滅储鎸夐挳鎿嶄綔 */
-  const handleQuery = () => {
-    page.current = 1;
-    getList();
-  };
+const dbRowClick = (row)=>{
+  rowClickData.value?.openDialog(row)
+}
 
-  // 閲嶇疆鎼滅储鏉′欢
-  const handleReset = () => {
-    searchForm.value.recordDate = "";
-    searchForm.value.code = "";
-    searchForm.value.status = "";
-    page.current = 1;
-    getList();
-  };
-  const pagination = obj => {
-    page.current = obj.page;
-    page.size = obj.limit;
-    getList();
-  };
-  const getList = () => {
-    tableLoading.value = true;
-    measuringInstrumentListPage({ ...searchForm.value, ...page })
-      .then(res => {
-        tableLoading.value = false;
-        tableData.value = res.data.records;
-        page.total = res.data.total;
-      })
-      .catch(err => {
-        tableLoading.value = false;
-      });
-  };
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+	selectedRows.value = selection;
+};
+const formDia = ref()
+const calibrationDia = ref()
 
-  // 鎵撳紑寮规
-  const openForm = (type, row) => {
-    nextTick(() => {
-      formDia.value?.openDialog(type, row);
-    });
-  };
-  // 鎵撳紑妫�瀹氭牎鍑嗗脊妗�
-  const openCalibrationDia = (type, row) => {
-    nextTick(() => {
-      calibrationDia.value?.openDialog(type, row);
-    });
-  };
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+	page.current = 1;
+	getList();
+};
 
-  const handleDelete = () => {
-    let ids = [];
-    if (selectedRows.value.length > 0) {
-      ids = selectedRows.value.map(item => item.id);
-    } else {
-      proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
-      return;
-    }
-    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
-      confirmButtonText: "纭",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-    })
-      .then(() => {
-        tableLoading.value = true;
-        measuringInstrumentDelete(ids)
-          .then(res => {
-            proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-            getList();
-          })
-          .finally(() => {
-            tableLoading.value = false;
-          });
-      })
-      .catch(() => {
-        proxy.$modal.msg("宸插彇娑�");
-      });
-  };
-  // 瀵煎嚭
-  const handleOut = () => {
-    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
-      confirmButtonText: "纭",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-    })
-      .then(() => {
-        proxy.download(
-          "/measuringInstrumentLedger/export",
-          {},
-          "璁¢噺鍣ㄥ叿鍙拌处.xlsx"
-        );
-      })
-      .catch(() => {
-        proxy.$modal.msg("宸插彇娑�");
-      });
-  };
-  onMounted(() => {
-    getList();
-  });
+// 閲嶇疆鎼滅储鏉′欢
+const handleReset = () => {
+	searchForm.value.recordDate = "";
+	searchForm.value.code = "";
+	searchForm.value.status = "";
+	page.current = 1;
+	getList();
+};
+const pagination = (obj) => {
+	page.current = obj.page;
+	page.size = obj.limit;
+	getList();
+};
+const getList = () => {
+	tableLoading.value = true;
+	measuringInstrumentListPage({ ...searchForm.value, ...page }).then((res) => {
+		tableLoading.value = false;
+		tableData.value = res.data.records;
+		page.total = res.data.total;
+	}).catch((err) => {
+		tableLoading.value = false;
+	})
+};
+
+// 鎵撳紑寮规
+const openForm = (type, row) => {
+	nextTick(() => {
+		formDia.value?.openDialog(type, row)
+	})
+};
+// 鎵撳紑妫�瀹氭牎鍑嗗脊妗�
+const openCalibrationDia = (type, row) => {
+	nextTick(() => {
+		calibrationDia.value?.openDialog(type, row)
+	})
+}
+
+const handleDelete = () => {
+	let ids = [];
+	if (selectedRows.value.length > 0) {
+		ids = selectedRows.value.map((item) => item.id);
+	} else {
+		proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+		return;
+	}
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			tableLoading.value = true;
+			measuringInstrumentDelete(ids)
+				.then((res) => {
+					proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+					getList();
+				})
+				.finally(() => {
+					tableLoading.value = false;
+				});
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+// 瀵煎嚭
+const handleOut = () => {
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			proxy.download("/measuringInstrumentLedger/export", {}, "璁¢噺鍣ㄥ叿鍙拌处.xlsx");
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+onMounted(() => {
+	getList();
+});
 </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