周宾
2025-12-09 3b730a25d2afa00a53d5ca83967a99586e9e8695
src/views/equipmentManagement/upkeep/index.vue
@@ -59,6 +59,9 @@
          <el-button type="success" icon="Van" @click="addPlan">
            新增计划
          </el-button>
          <el-button @click="handleOut">
            导出
          </el-button>
          <el-button
            type="danger"
            icon="Delete"
@@ -83,12 +86,13 @@
        @pagination="changePage"
      >
        <template #maintenanceResultRef="{ row }">
          <el-tag v-if="row.maintenanceResult === 1" type="success">
          <div>{{ row.maintenanceResult || '-' }}</div>
          <!-- <el-tag v-if="row.maintenanceResult === 1" type="success">
            完好
          </el-tag>
          <el-tag v-if="row.maintenanceResult === 0" type="danger">
            维修
          </el-tag>
          </el-tag> -->
        </template>
        <template #statusRef="{ row }">
          <el-tag v-if="row.status === 1" type="success">完结</el-tag>
@@ -122,7 +126,7 @@
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
import { getUpkeepPage, delUpkeep } from "@/api/equipmentManagement/upkeep";
import { onMounted } from "vue";
import { onMounted, getCurrentInstance } from "vue";
import PlanModal from "./Modal/PlanModal.vue";
import MaintenanceModal from "./Modal/MaintenanceModal.vue";
import dayjs from "dayjs";
@@ -131,6 +135,8 @@
defineOptions({
  name: "设备保养",
});
const { proxy } = getCurrentInstance();
// 计划弹窗控制器
const planModalRef = ref();
@@ -154,7 +160,12 @@
  getTableData,
  resetFilters,
  onCurrentChange,
} = usePaginationApi(getUpkeepPage, {}, [
} = usePaginationApi(getUpkeepPage, {
  deviceName: undefined,
  maintenancePlanTime: undefined,
  maintenanceActuallyTime: undefined,
  maintenanceActuallyName: undefined,
}, [
  {
    label: "设备名称",
    align: "center",
@@ -176,13 +187,13 @@
    align: "center",
    prop: "createUserName",
  },
  {
    label: "录入日期",
    align: "center",
    prop: "createTime",
    formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
    width: 200,
  },
  // {
  //   label: "录入日期",
  //   align: "center",
  //   prop: "createTime",
  //   formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
  //   width: 200,
  // },
  {
    label: "实际保养人",
    align: "center",
@@ -250,9 +261,10 @@
  planModalRef.value.openEdit(id);
};
const changePage = ({ page }) => {
  pagination.currentPage = page;
  onCurrentChange(page);
const changePage = ({ page, limit }) => {
   pagination.currentPage = page;
   pagination.pageSize = limit;
   onCurrentChange(page);
};
// 单行删除
@@ -270,6 +282,21 @@
  });
};
// 导出
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download("/device/maintenance/export", {}, "设备保养.xlsx");
    })
    .catch(() => {
      ElMessage.info("已取消");
    });
};
onMounted(() => {
  getTableData();
});