From f36f2f20bfb06dc3ca1b69c8a6d260d09d7d70ba Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期五, 27 六月 2025 17:29:13 +0800
Subject: [PATCH] feat: 新增设备报修模块。

---
 src/views/equipmentManagement/repair/index.vue |  207 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 207 insertions(+), 0 deletions(-)

diff --git a/src/views/equipmentManagement/repair/index.vue b/src/views/equipmentManagement/repair/index.vue
new file mode 100644
index 0000000..96fb91b
--- /dev/null
+++ b/src/views/equipmentManagement/repair/index.vue
@@ -0,0 +1,207 @@
+<template>
+  <div class="app-container">
+    <div class="table_list">
+      <div class="actions">
+        <el-text class="mx-1" size="large">璁惧鎶ヤ慨</el-text>
+        <div>
+          <el-button
+            type="primary"
+            icon="Plus"
+            :disabled="multipleList.length !== 1"
+            @click="addMaintain"
+          >
+            鏂板缁翠慨
+          </el-button>
+          <el-button type="success" icon="Van" @click="addRepair">
+            鏂板鎶ヤ慨
+          </el-button>
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="multipleList.length <= 0"
+            @click="delRepairByIds(multipleList.map((item) => item.id))"
+          >
+            鎵归噺鍒犻櫎
+          </el-button>
+        </div>
+      </div>
+      <PIMTable
+        rowKey="id"
+        isSelection
+        :column="columns"
+        :tableData="dataList"
+        :page="{
+          current: pagination.currentPage,
+          size: pagination.pageSize,
+          total: pagination.total,
+        }"
+        @selection-change="handleSelectionChange"
+      >
+        <template #statusRef="{ row }">
+          <el-tag v-if="row.status === 1" type="success">瀹岀粨</el-tag>
+          <el-tag v-if="row.status === 0" type="error">寰呯淮淇�</el-tag>
+        </template>
+        <template #operation="{ row }">
+          <el-button
+            type="primary"
+            text
+            icon="editPen"
+            @click="editRepair(row.id)"
+          >
+            缂栬緫
+          </el-button>
+          <el-button
+            type="danger"
+            text
+            icon="delete"
+            @click="delRepairByIds(row.id)"
+          >
+            鍒犻櫎
+          </el-button>
+        </template>
+      </PIMTable>
+    </div>
+    <RepairModal ref="repairModalRef" @ok="getTableData" />
+    <MaintainModal ref="maintainModalRef" @ok="getTableData" />
+  </div>
+</template>
+
+<script setup>
+import { usePaginationApi } from "@/hooks/usePaginationApi";
+import { getRepairPage, delRepair } from "@/api/equipmentManagement/repair";
+import { onMounted } from "vue";
+import RepairModal from "./Modal/RepairModal.vue";
+import { ElMessageBox, ElMessage } from "element-plus";
+import dayjs from "dayjs";
+import MaintainModal from "./Modal/MaintainModal.vue";
+
+defineOptions({
+  name: "璁惧鎶ヤ慨",
+});
+
+// 妯℃�佹瀹炰緥
+const repairModalRef = ref();
+const maintainModalRef = ref();
+
+// 琛ㄦ牸澶氶�夋閫変腑椤�
+const multipleList = ref([]);
+
+// 琛ㄦ牸閽╁瓙
+const { filters, columns, dataList, pagination, getTableData, resetFilters } =
+  usePaginationApi(
+    getRepairPage,
+    {
+      searchText: undefined,
+    },
+    [
+      {
+        label: "璁惧鍚嶇О",
+        align: "center",
+        prop: "deviceName",
+      },
+      {
+        label: "瑙勬牸鍨嬪彿",
+        align: "center",
+        prop: "deviceModel",
+      },
+      {
+        label: "鎶ヤ慨鏃ユ湡",
+        align: "center",
+        prop: "repairTime",
+        formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
+      },
+      {
+        label: "鎶ヤ慨浜�",
+        align: "center",
+        prop: "repairName",
+      },
+      {
+        label: "鏁呴殰鐜拌薄",
+        align: "center",
+        prop: "remark",
+      },
+      {
+        label: "缁翠慨浜�",
+        align: "center",
+        prop: "maintenanceName",
+      },
+      {
+        label: "缁翠慨缁撴灉",
+        align: "center",
+        prop: "maintenanceResult",
+      },
+      {
+        label: "缁翠慨鏃ユ湡",
+        align: "center",
+        prop: "maintenanceTime",
+        formatData: (cell) => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
+      },
+      {
+        label: "鐘舵��",
+        align: "center",
+        prop: "status",
+        dataType: "slot",
+        slot: "statusRef",
+      },
+      {
+        fixed: "right",
+        label: "鎿嶄綔",
+        dataType: "slot",
+        slot: "operation",
+        align: "center",
+        width: "200px",
+      },
+    ]
+  );
+
+// 澶氶�夊悗鍋氫粈涔�
+const handleSelectionChange = (selectionList) => {
+  multipleList.value = selectionList;
+};
+
+// 鏂板鎶ヤ慨
+const addRepair = () => {
+  repairModalRef.value.openModal();
+};
+
+// 缂栬緫鎶ヤ慨
+const editRepair = (id) => {
+  repairModalRef.value.openEdit(id);
+};
+
+// 鏂板缁翠慨
+const addMaintain = () => {
+  const row = multipleList.value[0];
+  maintainModalRef.value.open(row.id, row);
+};
+
+// 鍗曡鍒犻櫎
+const delRepairByIds = async (ids) => {
+  ElMessageBox.confirm("纭鍒犻櫎鎶ヤ慨鏁版嵁, 姝ゆ搷浣滀笉鍙��?", "璀﹀憡", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(async () => {
+    const { code } = await delRepair(ids);
+    if (code === 200) {
+      ElMessage.success("鍒犻櫎鎴愬姛");
+      getTableData();
+    }
+  });
+};
+
+onMounted(() => {
+  getTableData();
+});
+</script>
+
+<style lang="scss" scoped>
+.table_list {
+  margin-top: unset;
+}
+.actions {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+</style>

--
Gitblit v1.9.3