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/upkeep/index.vue | 360 ++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 245 insertions(+), 115 deletions(-)
diff --git a/src/pages/equipmentManagement/upkeep/index.vue b/src/pages/equipmentManagement/upkeep/index.vue
index f14712f..7e043c3 100644
--- a/src/pages/equipmentManagement/upkeep/index.vue
+++ b/src/pages/equipmentManagement/upkeep/index.vue
@@ -1,92 +1,82 @@
<template>
- <view class="sales-account">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <view class="upkeep-page">
<PageHeader title="璁惧淇濆吇"
@back="goBack" />
- <!-- 鎼滅储鍖哄煙 -->
- <view class="search-section">
- <view class="search-bar">
- <view class="search-input">
- <up-input class="search-text"
- placeholder="璇疯緭鍏ヨ澶囧悕绉版悳绱�"
- v-model="searchKeyword"
- @change="getList"
- clearable />
- </view>
- <view class="filter-button"
- @click="getList">
- <up-icon name="search"
- size="24"
- color="#999"></up-icon>
+ <view class="toolbar">
+ <view class="search-section">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input class="search-text"
+ placeholder="璇疯緭鍏ヨ澶囧悕绉版悳绱�"
+ v-model="searchKeyword"
+ 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="ledger-list"
- v-if="upkeepList.length > 0">
+ <view class="list-section">
<view v-for="(item, index) in upkeepList"
- :key="index">
- <view class="ledger-item"
- @click="toggleSelection(item)">
- <view class="item-header">
- <view class="item-left">
- <view class="document-icon">
- <up-icon name="file-text"
- size="16"
- color="#ffffff"></up-icon>
- </view>
- <text class="item-id">璁惧鍚嶇О锛歿{ item.deviceName }}</text>
+ :key="item.id || index"
+ 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>
- <view class="status-tag">
- <u-tag v-if="item.status === 1"
- type="success">瀹岀粨</u-tag>
- <u-tag v-if="item.status === 0"
- type="warning">寰呬繚鍏�</u-tag>
- <u-tag v-if="item.status === 2"
- type="error">澶辫触</u-tag>
- </view>
+ <text class="item-id">{{ item.deviceName || "--" }}</text>
+ </view>
+ <view class="item-right">
+ <u-tag v-if="item.status === 1"
+ type="success">瀹岀粨</u-tag>
+ <u-tag v-if="item.status === 0"
+ type="warning">寰呬繚鍏�</u-tag>
+ <u-tag v-if="item.status === 2"
+ type="error">澶辫触</u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ item.deviceModel || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">璁″垝淇濆吇鏃ユ湡</text>
+ <text class="detail-value">{{ formatDate(item.maintenancePlanTime) || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆浜�</text>
+ <text class="detail-value">{{ item.createUserName || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆鏃ユ湡</text>
+ <text class="detail-value">{{ formatDateTime(item.createTime) || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹為檯淇濆吇浜�</text>
+ <text class="detail-value">{{ item.maintenanceActuallyName || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹為檯淇濆吇鏃ユ湡</text>
+ <text class="detail-value">{{ formatDateTime(item.maintenanceActuallyTime) || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">淇濆吇缁撴灉</text>
+ <text class="detail-value">{{ item.maintenanceResult || "--" }}</text>
</view>
<up-divider></up-divider>
- <view class="item-details">
- <view class="detail-row">
- <text class="detail-label">瑙勬牸鍨嬪彿</text>
- <text class="detail-value">{{ item.deviceModel || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">璁″垝淇濆吇鏃ユ湡</text>
- <text class="detail-value">{{ formatDate(item.maintenancePlanTime) || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">褰曞叆浜�</text>
- <text class="detail-value">{{ item.createUserName || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">褰曞叆鏃ユ湡</text>
- <text class="detail-value">{{ formatDateTime(item.createTime) || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瀹為檯淇濆吇浜�</text>
- <text class="detail-value">{{ item.maintenanceActuallyName || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瀹為檯淇濆吇鏃ユ湡</text>
- <text class="detail-value">{{ formatDateTime(item.maintenanceActuallyTime) || '-' }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">淇濆吇缁撴灉</text>
- <text class="detail-value">{{item.maintenanceResult || '-'}}
- </text>
- </view>
- </view>
- <!-- 鎸夐挳鍖哄煙 -->
- <view class="action-buttons">
- <!-- <u-button type="primary"
- size="small"
- class="action-btn"
- :disabled="item.status === 1"
- @click.stop="edit(item.id)">
- 缂栬緫
- </u-button> -->
+ <view class="card-actions">
<u-button type="warning"
size="small"
class="action-btn"
@@ -107,21 +97,14 @@
@click.stop="viewDetail(item)">
璇︽儏
</u-button>
- <!-- <u-button type="warning"
- size="small"
- class="action-btn"
- @click.stop="addFile(item.id)">
- 闄勪欢
- </u-button> -->
</view>
</view>
</view>
+ <view v-if="!loading && upkeepList.length === 0"
+ class="no-data">
+ <text>鏆傛棤璁惧淇濆吇鏁版嵁</text>
+ </view>
</view>
- <view v-else
- class="no-data">
- <text>鏆傛棤璁惧淇濆吇鏁版嵁</text>
- </view>
- <!-- 娴姩鏂板鎸夐挳 -->
<view class="fab-button"
@click="addPlan">
<up-icon name="plus"
@@ -154,7 +137,10 @@
// 璁惧淇濆吇鏁版嵁
const upkeepList = ref([]);
- // 澶氶�夊垪琛�
+ const total = ref(0);
+ const loading = ref(false);
+
+ // 澶氶�夊垪琛紙淇濆吇鎸夐挳鏈紶 id 鏃剁敤锛�
const multipleList = ref([]);
// 杩斿洖涓婁竴椤�
@@ -174,9 +160,13 @@
return dayjs(dateStr).format("YYYY-MM-DD HH:mm:ss");
};
+ const handleQuery = () => {
+ getList();
+ };
+
// 鏌ヨ鍒楄〃
const getList = () => {
- showLoadingToast("鍔犺浇涓�...");
+ loading.value = true;
const params = {
current: -1,
size: -1,
@@ -184,13 +174,16 @@
};
getUpkeepPage(params)
.then(res => {
- // 濡傛灉res.data涓嶆槸鏁扮粍锛岃缃负绌烘暟缁�
- upkeepList.value = res.records || res.data?.records || [];
- closeToast();
+ const records = res?.records ?? res?.data?.records ?? [];
+ upkeepList.value = records;
+ total.value = Array.isArray(records) ? records.length : Number(res?.total ?? res?.data?.total ?? 0);
})
.catch(() => {
- closeToast();
+ upkeepList.value = [];
showToast("鑾峰彇鏁版嵁澶辫触");
+ })
+ .finally(() => {
+ loading.value = false;
});
};
// 鏂板闄勪欢 - 璺宠浆鍒伴檮浠堕〉闈�
@@ -322,45 +315,182 @@
</script>
<style scoped lang="scss">
- @import "@/styles/sales-common.scss";
-
- // 璁惧淇濆吇鐗规湁鏍峰紡
- .sales-account {
- padding-bottom: 80px; // 涓烘诞鍔ㄦ寜閽暀鍑虹┖闂�
+ .upkeep-page {
+ min-height: 100vh;
+ background: #f6f7fb;
}
- .action-section {
- padding: 10px 20px;
+ .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;
- border-bottom: 1px solid #f0f0f0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
}
- .action-section .action-buttons {
- gap: 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 12px 涓嶅悓
- justify-content: flex-start;
+ .meta-bar {
+ margin-top: 16rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: #f7f9fc;
+ border-radius: 12rpx;
+ padding: 10rpx 16rpx;
}
- .checkbox-wrapper {
+ .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;
}
- .status-tag {
+ .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: 80px; // 涓庡叕鍏辨牱寮忎腑鐨� 60px 涓嶅悓
+ min-width: 160rpx;
+ color: #777;
+ font-size: 24rpx;
}
.detail-value {
- display: flex;
- justify-content: flex-end;
- align-items: center;
+ flex: 1;
+ color: #333;
+ font-size: 24rpx;
+ text-align: right;
+ word-break: break-all;
+ margin-left: 12rpx;
}
- .ledger-item .action-buttons {
- gap: 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 12px 涓嶅悓
+ .card-actions {
+ padding-top: 8rpx;
+ display: flex;
+ justify-content: flex-end;
+ flex-wrap: wrap;
+ gap: 12rpx;
+ }
+
+ .action-btn {
+ min-width: 100rpx;
+ }
+
+ .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>
\ No newline at end of file
--
Gitblit v1.9.3