From 14e880475bdc908c1ce670a1a5e892347d636562 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 16 五月 2026 13:41:49 +0800
Subject: [PATCH] 新增设备报修验收功能,更新报修表单,增加验收人字段,调整状态管理,优化报修详情展示。
---
src/pages/equipmentManagement/repair/index.vue | 80 +++++++++++++++++++++++++++++++++++-----
1 files changed, 70 insertions(+), 10 deletions(-)
diff --git a/src/pages/equipmentManagement/repair/index.vue b/src/pages/equipmentManagement/repair/index.vue
index a3c1eba..613f958 100644
--- a/src/pages/equipmentManagement/repair/index.vue
+++ b/src/pages/equipmentManagement/repair/index.vue
@@ -37,10 +37,8 @@
<text class="item-id">璁惧鍚嶇О锛歿{ item.deviceName }}</text>
</view>
<view class="status-tag">
- <u-tag v-if="item.status === 1"
- type="success">瀹岀粨</u-tag>
- <u-tag v-if="item.status === 0"
- type="error">寰呯淮淇�</u-tag>
+ <u-tag :type="getStatusTagType(item.status)"
+ size="small">{{ getStatusText(item.status) }}</u-tag>
</view>
</view>
<up-divider></up-divider>
@@ -55,15 +53,20 @@
</view>
<view class="detail-row">
<text class="detail-label">鎶ヤ慨浜�</text>
- <text class="detail-value">{{ item.repairName || '-' }}</text>
+ <text class="detail-value">{{ item.maintenanceName || item.repairName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">楠屾敹浜�</text>
+ <text class="detail-value">{{ item.acceptanceName || '-' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">鏁呴殰鐜拌薄</text>
<text class="detail-value">{{ item.remark || '-' }}</text>
</view>
- <view class="detail-row">
+ <view class="detail-row"
+ v-if="Number(item.status) !== 0">
<text class="detail-label">缁翠慨浜�</text>
- <text class="detail-value">{{ item.maintenanceName || '-' }}</text>
+ <text class="detail-value">{{ item.maintenancePerson || item.maintenanceName || '-' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">缁翠慨缁撴灉</text>
@@ -76,19 +79,33 @@
</view>
<!-- 鎸夐挳鍖哄煙 -->
<view class="action-buttons">
+ <u-button type="info"
+ size="small"
+ plain
+ class="action-btn"
+ @click="goDetail(item.id)">
+ 璇︽儏
+ </u-button>
<u-button type="primary"
size="small"
class="action-btn"
- :disabled="item.status === 1"
+ :disabled="Number(item.status) !== 0"
@click="edit(item.id)">
缂栬緫
</u-button>
<u-button type="warning"
size="small"
class="action-btn"
- :disabled="item.status === 1"
+ :disabled="Number(item.status) !== 0"
@click="addMaintain(item.id)">
鏂板缁翠慨
+ </u-button>
+ <u-button type="success"
+ size="small"
+ class="action-btn"
+ :disabled="!canAccept(item)"
+ @click="goAcceptance(item.id)">
+ 楠屾敹
</u-button>
<u-button type="error"
size="small"
@@ -130,6 +147,30 @@
};
const userStore = useUserStore();
+
+ const STATUS_MAP = {
+ 0: "寰呯淮淇�",
+ 3: "寰呴獙鏀�",
+ 1: "瀹屾垚",
+ 2: "缁翠慨澶辫触",
+ };
+
+ const getStatusText = status => STATUS_MAP[Number(status)] || "-";
+
+ const getStatusTagType = status => {
+ const map = { 0: "error", 3: "warning", 1: "success", 2: "error" };
+ return map[Number(status)] || "info";
+ };
+
+ const getCurrentUserName = () =>
+ (userStore.nickName || userStore.name || "").trim();
+
+ const canAccept = item => {
+ if (Number(item?.status) !== 3) return false;
+ const current = getCurrentUserName();
+ const target = (item?.acceptanceName || "").trim();
+ return Boolean(current && target && current === target);
+ };
// 鎼滅储鍏抽敭璇�
const searchKeyword = ref("");
@@ -205,6 +246,24 @@
});
};
+ const goDetail = id => {
+ if (!id) return;
+ uni.navigateTo({
+ url: `/pages/equipmentManagement/repair/detail?id=${id}`,
+ });
+ };
+
+ const goAcceptance = id => {
+ if (!id) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ uni.setStorageSync("repairId", id);
+ uni.navigateTo({
+ url: `/pages/equipmentManagement/repair/acceptance?id=${id}`,
+ });
+ };
+
// 缂栬緫 - 璺宠浆鍒癮dd椤甸潰锛岄�氳繃id鍖哄垎鏂板杩樻槸缂栬緫
const edit = id => {
if (!id) return;
@@ -262,6 +321,7 @@
}
.action-buttons {
- gap: 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 12px 涓嶅悓
+ flex-wrap: wrap;
+ gap: 8px;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3