gongchunyi
2026-05-14 85a187bcb7d07b39fb561f41b9167bb0f0c83cfc
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>
@@ -51,7 +52,7 @@
</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";
@@ -81,18 +82,12 @@
    minWidth:150,
    align:"center"
   },
   {
      label: "部门",
      prop: "deptName",
      width: 130,
    align:"center"
   },
   {
      label: "安装位置",
      prop: "installationLocation",
      width: 150,
    align:"center"
   },
  {
    label: "计量器具名称",
    prop: "name",
    width: '160px',
    align: "center",
  },
   {
      label: "检定单位",
      prop: "unit",
@@ -130,10 +125,20 @@
    align:"center"
   },
  {
    label: "检定周期(天)",
    prop: "cycle",
    label: "快到期提醒",
    prop: "valid",
    width: 130,
    align:"center"
    align: "center",
    formatData: (cell) => {
      if (!cell) return "";
      const validDate = new Date(cell);
      const now = new Date();
      const diffDays = Math.ceil((validDate - now) / (1000 * 60 * 60 * 24));
      if (diffDays <= 7 && diffDays >= 0) {
        return "⚠️ " + diffDays + "天后到期";
      }
      return "";
    }
  },
  {
    label: "状态",
@@ -207,6 +212,15 @@
   page.current = 1;
   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;