From 633568cff8a45c9f92aec1ec5edb5a09a3b0d8a4 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期六, 14 三月 2026 13:26:38 +0800
Subject: [PATCH] fix: 隐患地点需要拍照而不是文字描述,需要可预览。

---
 src/pages/equipmentManagement/upkeepTask/index.vue |  454 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 454 insertions(+), 0 deletions(-)

diff --git a/src/pages/equipmentManagement/upkeepTask/index.vue b/src/pages/equipmentManagement/upkeepTask/index.vue
new file mode 100644
index 0000000..7bec24e
--- /dev/null
+++ b/src/pages/equipmentManagement/upkeepTask/index.vue
@@ -0,0 +1,454 @@
+<template>
+  <view class="upkeep-task-page">
+    <PageHeader title="瀹氭椂浠诲姟绠$悊"
+                @back="goBack" />
+    <view class="toolbar">
+      <view class="search-section">
+        <view class="search-bar">
+          <view class="search-input">
+            <up-input class="search-text"
+                      placeholder="璇疯緭鍏ヤ繚鍏讳换鍔″悕绉�"
+                      v-model="queryParams.taskName"
+                      clearable />
+          </view>
+          <view class="search-button"
+                @click="handleQuery">
+            <up-icon name="search"
+                     size="24"
+                     color="#999"></up-icon>
+          </view>
+        </view>
+      </view>
+      <view class="meta-bar">
+        <text class="meta-text">鍏� {{ total }} 鏉�</text>
+      </view>
+    </view>
+    <view class="list-section">
+      <uni-swipe-action>
+        <uni-swipe-action-item v-for="item in tableData"
+                               :key="item.id"
+                               :right-options="swipeOptions"
+                               @click="onSwipeActionClick($event, item)">
+          <view class="ledger-item">
+            <view class="item-header">
+              <view class="item-left">
+                <view class="document-icon">
+                  <up-icon name="file-text"
+                           size="14"
+                           color="#ffffff"></up-icon>
+                </view>
+                <text class="item-id">{{ item.taskName || "--" }}</text>
+              </view>
+              <view class="item-right">
+                <u-tag :type="getFrequencyTagType(item.frequencyType)"
+                       :text="formatFrequency(item.frequencyType) || '鏈煡棰戞'" />
+              </view>
+            </view>
+            <up-divider></up-divider>
+            <view class="item-details">
+              <view class="detail-row">
+                <text class="detail-label">浠诲姟缂栧彿</text>
+                <text class="detail-value">{{ item.id || "--" }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">璁惧</text>
+                <text class="detail-value">{{ item.deviceName || "--" }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">寮�濮嬫棩鏈熶笌鏃堕棿</text>
+                <text class="detail-value highlight">{{ formatFrequencyDetail(item.frequencyDetail) }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">鐧昏浜�</text>
+                <text class="detail-value">{{ item.registrant || "--" }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">鐧昏鏃ユ湡</text>
+                <text class="detail-value">{{ item.registrationDate || item.createTime || "--" }}</text>
+              </view>
+              <view class="detail-row">
+                <text class="detail-label">澶囨敞</text>
+                <text class="detail-value">{{ item.remarks || "鏃�" }}</text>
+              </view>
+              <up-divider></up-divider>
+              <view class="card-actions">
+                <u-button type="primary"
+                          size="small"
+                          class="action-btn"
+                          @click.stop="handleAdd(item)">缂栬緫</u-button>
+                <u-button type="error"
+                          size="small"
+                          plain
+                          class="action-btn"
+                          @click.stop="deleteOne(item)">鍒犻櫎</u-button>
+              </view>
+            </view>
+          </view>
+        </uni-swipe-action-item>
+      </uni-swipe-action>
+      <uni-load-more :status="loadMoreStatus"></uni-load-more>
+      <view v-if="!loading && tableData.length === 0"
+            class="no-data">
+        <text>鏆傛棤鏁版嵁</text>
+      </view>
+    </view>
+    <view class="fab-button"
+          @click="handleAdd()">
+      <up-icon name="plus"
+               size="24"
+               color="#ffffff"></up-icon>
+    </view>
+    <form-dia ref="formDia"
+              @closeDia="handleQuery" />
+  </view>
+</template>
+
+<script setup>
+  import { ref, reactive, computed, nextTick } from "vue";
+  import { onShow, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import FormDia from "@/pages/equipmentManagement/upkeepTask/components/formDia.vue";
+  import {
+    deviceMaintenanceTaskDel,
+    deviceMaintenanceTaskList,
+  } from "@/api/equipmentManagement/upkeep.js";
+
+  const formDia = ref();
+  const queryParams = reactive({
+    taskName: "",
+  });
+  const pageParams = reactive({
+    current: 1,
+    size: 10,
+  });
+  const total = ref(0);
+  const loading = ref(false);
+  const tableData = ref([]);
+  const swipeOptions = [
+    {
+      text: "鍒犻櫎",
+      style: {
+        backgroundColor: "#ee0a24",
+      },
+    },
+  ];
+
+  const noMore = computed(() => tableData.value.length >= total.value);
+  const loadMoreStatus = computed(() => {
+    if (loading.value) return "loading";
+    if (noMore.value) return "noMore";
+    return "more";
+  });
+
+  const goBack = () => {
+    uni.navigateBack();
+  };
+
+  const formatFrequency = value => {
+    if (value === "DAILY") return "姣忔棩";
+    if (value === "WEEKLY") return "姣忓懆";
+    if (value === "MONTHLY") return "姣忔湀";
+    if (value === "QUARTERLY") return "瀛e害";
+    return "";
+  };
+
+  const getFrequencyTagType = value => {
+    if (value === "DAILY") return "success";
+    if (value === "WEEKLY") return "primary";
+    if (value === "MONTHLY") return "warning";
+    return "info";
+  };
+
+  const formatFrequencyDetail = value => {
+    if (!value || typeof value !== "string") return "--";
+    return value.replace(
+      /MON|TUE|WED|THU|FRI|SAT|SUN/g,
+      item =>
+        ({
+          MON: "鍛ㄤ竴",
+          TUE: "鍛ㄤ簩",
+          WED: "鍛ㄤ笁",
+          THU: "鍛ㄥ洓",
+          FRI: "鍛ㄤ簲",
+          SAT: "鍛ㄥ叚",
+          SUN: "鍛ㄦ棩",
+        })[item] || item
+    );
+  };
+
+  const getList = async () => {
+    if (loading.value) return;
+    loading.value = true;
+    try {
+      const params = {
+        ...queryParams,
+        current: pageParams.current,
+        size: pageParams.size,
+      };
+      const res = await deviceMaintenanceTaskList(params);
+      const records = res?.data?.records || res?.records || [];
+      if (pageParams.current === 1) {
+        tableData.value = records;
+      } else {
+        tableData.value = [...tableData.value, ...records];
+      }
+      total.value = Number(res?.data?.total ?? res?.total ?? 0);
+    } catch (error) {
+      if (pageParams.current === 1) {
+        tableData.value = [];
+      }
+      uni.showToast({
+        title: "鑾峰彇鏁版嵁澶辫触",
+        icon: "none",
+      });
+    } finally {
+      loading.value = false;
+    }
+  };
+
+  const handleQuery = () => {
+    pageParams.current = 1;
+    total.value = 0;
+    getList();
+  };
+
+  const loadMore = () => {
+    if (loading.value || noMore.value) return;
+    pageParams.current += 1;
+    getList();
+  };
+
+  const handleAdd = row => {
+    nextTick(() => {
+      formDia.value?.openDialog(row ? "edit" : "add", row);
+    });
+  };
+
+  const deleteOne = async row => {
+    if (!row?.id) return;
+    const canDelete = await new Promise(resolve => {
+      uni.showModal({
+        title: "鎻愮ず",
+        content: "鏄惁纭鍒犻櫎璇ヤ繚鍏讳换鍔★紵",
+        success: modalRes => resolve(Boolean(modalRes.confirm)),
+        fail: () => resolve(false),
+      });
+    });
+    if (!canDelete) return;
+    try {
+      await deviceMaintenanceTaskDel([row.id]);
+      uni.showToast({
+        title: "鍒犻櫎鎴愬姛",
+        icon: "success",
+      });
+      handleQuery();
+    } catch (error) {
+      uni.showToast({
+        title: "鍒犻櫎澶辫触",
+        icon: "none",
+      });
+    }
+  };
+
+  const onSwipeActionClick = (event, row) => {
+    if (event?.position !== "right") return;
+    deleteOne(row);
+  };
+
+  onShow(() => {
+    handleQuery();
+  });
+
+  onReachBottom(() => {
+    loadMore();
+  });
+
+  onPullDownRefresh(() => {
+    handleQuery();
+    uni.stopPullDownRefresh();
+  });
+</script>
+
+<style scoped>
+  .upkeep-task-page {
+    min-height: 100vh;
+    background: #f6f7fb;
+  }
+
+  .toolbar {
+    padding: 20rpx 24rpx;
+    background: #fff;
+    border-bottom: 1rpx solid #f0f0f0;
+    position: sticky;
+    top: 0;
+    z-index: 10;
+  }
+
+  .search-section {
+    margin-top: 0;
+  }
+
+  .search-bar {
+    display: flex;
+    align-items: center;
+    background: #f7f8fa;
+    border-radius: 14rpx;
+    padding: 8rpx 12rpx 8rpx 16rpx;
+    border: 1rpx solid #eef1f5;
+  }
+
+  .search-input {
+    flex: 1;
+    min-width: 0;
+  }
+
+  .search-text {
+    background: transparent !important;
+  }
+
+  :deep(.search-text .u-input__content),
+  :deep(.search-text .up-input__content) {
+    background: transparent !important;
+    padding: 0 !important;
+  }
+
+  .search-button {
+    width: 64rpx;
+    height: 64rpx;
+    border-radius: 12rpx;
+    background: #ffffff;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .meta-bar {
+    margin-top: 16rpx;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    background: #f7f9fc;
+    border-radius: 12rpx;
+    padding: 10rpx 16rpx;
+  }
+
+  .meta-text {
+    color: #5c6b8a;
+    font-size: 22rpx;
+  }
+
+  .list-section {
+    padding: 20rpx 24rpx;
+    padding-bottom: calc(132rpx + env(safe-area-inset-bottom));
+  }
+
+  .ledger-item {
+    background: #ffffff;
+    border-radius: 20rpx;
+    margin-bottom: 16rpx;
+    overflow: hidden;
+    box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.05);
+    padding: 0 20rpx;
+  }
+
+  .item-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 22rpx 0;
+  }
+
+  .item-left {
+    display: flex;
+    align-items: center;
+    gap: 10rpx;
+    flex: 1;
+    min-width: 0;
+  }
+
+  .item-right {
+    display: flex;
+    align-items: center;
+  }
+
+  .document-icon {
+    width: 38rpx;
+    height: 38rpx;
+    border-radius: 8rpx;
+    background: #2979ff;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .item-id {
+    font-size: 28rpx;
+    color: #1f1f1f;
+    font-weight: 600;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+
+  .item-details {
+    padding: 18rpx 0 20rpx;
+  }
+
+  .detail-row {
+    display: flex;
+    align-items: flex-end;
+    justify-content: space-between;
+    margin-bottom: 12rpx;
+  }
+
+  .detail-label {
+    min-width: 160rpx;
+    color: #777;
+    font-size: 24rpx;
+  }
+
+  .detail-value {
+    flex: 1;
+    color: #333;
+    font-size: 24rpx;
+    text-align: right;
+    word-break: break-all;
+    margin-left: 12rpx;
+  }
+
+  .detail-value.highlight {
+    color: #2979ff;
+    font-weight: 500;
+  }
+
+  .card-actions {
+    padding-top: 8rpx;
+    display: flex;
+    justify-content: flex-end;
+  }
+
+  .action-btn {
+    min-width: 140rpx;
+  }
+
+  .fab-button {
+    position: fixed;
+    bottom: calc(30px + env(safe-area-inset-bottom));
+    right: 30px;
+    width: 56px;
+    height: 56px;
+    background: #2979ff;
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3);
+    z-index: 1000;
+  }
+
+  .no-data {
+    padding: 40rpx 0;
+    text-align: center;
+    color: #999;
+  }
+</style>

--
Gitblit v1.9.3