From 727e9cb845a70cb99ded092f262e0d4712eaa33b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 30 三月 2026 13:49:00 +0800
Subject: [PATCH] 酒泉 1.设备功能迁移

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

diff --git a/src/views/equipmentManagement/amountSummary/index.vue b/src/views/equipmentManagement/amountSummary/index.vue
new file mode 100644
index 0000000..9d6a8bc
--- /dev/null
+++ b/src/views/equipmentManagement/amountSummary/index.vue
@@ -0,0 +1,180 @@
+<template>
+  <div class="app-container">
+    <el-tabs v-model="activeTab">
+      <el-tab-pane label="鎶ヤ慨" name="repair">
+        <el-form :inline="true" :model="filtersRepair">
+          <el-form-item label="鏌ョ湅妯″紡">
+            <el-radio-group v-model="modeRepair" @change="buildColumnsRepair">
+              <el-radio-button :value="'month'">鎸夋湀</el-radio-button>
+              <el-radio-button :value="'year'">鎸夊勾</el-radio-button>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item v-if="modeRepair === 'month' || modeRepair === 'year'" label="骞翠唤">
+            <el-date-picker v-model="yearRepair" type="year" value-format="YYYY" format="YYYY" placeholder="璇烽�夋嫨骞翠唤" @change="refreshRepair" />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="refreshRepair">鏌ヨ</el-button>
+            <el-button @click="resetRepair">閲嶇疆</el-button>
+          </el-form-item>
+        </el-form>
+
+        <div class="table_list">
+          <PIMTable
+            rowKey="deviceId"
+            :column="columnsRepair"
+            :tableData="tableDataRepair"
+            :page="{ current: 1, size: tableDataRepair.length || 10, total: tableDataRepair.length }"
+          />
+        </div>
+      </el-tab-pane>
+
+      <el-tab-pane label="淇濆吇" name="maintain">
+        <el-form :inline="true" :model="filtersMaintain">
+          <el-form-item label="鏌ョ湅妯″紡">
+            <el-radio-group v-model="modeMaintain" @change="buildColumnsMaintain">
+              <el-radio-button :value="'month'">鎸夋湀</el-radio-button>
+              <el-radio-button :value="'year'">鎸夊勾</el-radio-button>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item v-if="modeMaintain === 'month' || modeMaintain === 'year'" label="骞翠唤">
+            <el-date-picker v-model="yearMaintain" type="year" value-format="YYYY" format="YYYY" placeholder="璇烽�夋嫨骞翠唤" @change="refreshMaintain" />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="refreshMaintain">鏌ヨ</el-button>
+            <el-button @click="resetMaintain">閲嶇疆</el-button>
+          </el-form-item>
+        </el-form>
+
+        <div class="table_list">
+          <PIMTable
+            rowKey="deviceId"
+            :column="columnsMaintain"
+            :tableData="tableDataMaintain"
+            :page="{ current: 1, size: tableDataMaintain.length || 10, total: tableDataMaintain.length }"
+          />
+        </div>
+      </el-tab-pane>
+    </el-tabs>
+  </div>
+  </template>
+
+<script setup>
+import { ref } from "vue";
+import { monthlyAmount, yearlyAmount } from "@/api/equipmentManagement/repair";
+import { monthlyAmount as monthlyAmountMaintain, yearlyAmount as yearlyAmountMaintain } from "@/api/equipmentManagement/upkeep";
+
+defineOptions({ name: "閲戦姹囨��" });
+
+const activeTab = ref("repair");
+
+// 鎶ヤ慨
+const modeRepair = ref("month");
+const yearRepair = ref(new Date().getFullYear().toString());
+const filtersRepair = ref({});
+const columnsRepair = ref([]);
+const tableDataRepair = ref([]);
+
+const fetchRepairData = async () => {
+  try {
+    const query = { year: yearRepair.value };
+    const res = modeRepair.value === "month" ? await monthlyAmount(query) : await yearlyAmount(query);
+    const list = res?.records || res?.data || res || [];
+    tableDataRepair.value = Array.isArray(list) ? list : [];
+  } catch (e) {
+    tableDataRepair.value = [];
+  }
+};
+
+const buildColumnsRepair = async () => {
+  const base = [{ label: "璁惧鍚嶇О", align: "center", prop: "deviceName", width: 180 }];
+  if (modeRepair.value === "month") {
+    const monthCols = Array.from({ length: 12 }, (_, i) => ({
+      label: `${i + 1}鏈坄,
+      align: "center",
+      prop: `month${i + 1}`,
+    }));
+    columnsRepair.value = [
+      ...base,
+      ...monthCols,
+      { label: "鎬昏", align: "center", prop: "total" },
+    ];
+  } else {
+    columnsRepair.value = [
+      ...base,
+      { label: "閲戦", align: "center", prop: "totalRepairPrice" },
+    ];
+  }
+  await fetchRepairData();
+};
+
+const refreshRepair = async () => {
+  await buildColumnsRepair();
+};
+
+const resetRepair = () => {
+  modeRepair.value = "month";
+  yearRepair.value = new Date().getFullYear().toString();
+  refreshRepair();
+};
+
+// 淇濆吇
+const modeMaintain = ref("month");
+const yearMaintain = ref(new Date().getFullYear().toString());
+const filtersMaintain = ref({});
+const columnsMaintain = ref([]);
+const tableDataMaintain = ref([]);
+
+const fetchMaintainData = async () => {
+  try {
+    const query = { year: yearMaintain.value };
+    const res = modeMaintain.value === "month" ? await monthlyAmountMaintain(query) : await yearlyAmountMaintain(query);
+    const list = res?.records || res?.data || res || [];
+    tableDataMaintain.value = Array.isArray(list) ? list : [];
+  } catch (e) {
+    tableDataMaintain.value = [];
+  }
+};
+
+const buildColumnsMaintain = async () => {
+  const base = [{ label: "璁惧鍚嶇О", align: "center", prop: "deviceName", width: 180 }];
+  if (modeMaintain.value === "month") {
+    const monthCols = Array.from({ length: 12 }, (_, i) => ({
+      label: `${i + 1}鏈坄,
+      align: "center",
+      prop: `month${i + 1}`,
+    }));
+    columnsMaintain.value = [
+      ...base,
+      ...monthCols,
+      { label: "鎬昏", align: "center", prop: "total" },
+    ];
+  } else {
+    columnsMaintain.value = [
+      ...base,
+      { label: "閲戦", align: "center", prop: "totalRepairPrice" },
+    ];
+  }
+  await fetchMaintainData();
+};
+
+const refreshMaintain = async () => {
+  await buildColumnsMaintain();
+};
+
+const resetMaintain = () => {
+  modeMaintain.value = "month";
+  yearMaintain.value = new Date().getFullYear().toString();
+  refreshMaintain();
+};
+
+buildColumnsRepair();
+refreshRepair();
+buildColumnsMaintain();
+refreshMaintain();
+</script>
+
+<style scoped>
+.table_list {
+  margin-top: 10px;
+}
+</style>

--
Gitblit v1.9.3