<template>
|
<view class="repair-detail">
|
<PageHeader title="设备报修详情"
|
@back="goBack" />
|
<view class="content-container">
|
<!-- 1. 报修登记 -->
|
<view class="section">
|
<view class="section-head">
|
<view class="section-bar"></view>
|
<text class="section-head-text">1. 报修登记</text>
|
</view>
|
<view class="desc-table">
|
<view class="desc-row">
|
<view class="desc-cell">
|
<text class="desc-label">设备名称</text>
|
<text class="desc-value">{{ detail.deviceName || '-' }}</text>
|
</view>
|
<view class="desc-cell">
|
<text class="desc-label">规格型号</text>
|
<text class="desc-value">{{ detail.deviceModel || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row">
|
<view class="desc-cell">
|
<text class="desc-label">报修日期</text>
|
<text class="desc-value">{{ formatDate(detail.repairTime) || '-' }}</text>
|
</view>
|
<view class="desc-cell">
|
<text class="desc-label">报修人</text>
|
<text class="desc-value">{{ detail.repairName || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row">
|
<view class="desc-cell">
|
<text class="desc-label">验收人</text>
|
<text class="desc-value">{{ detail.acceptanceName || '-' }}</text>
|
</view>
|
<view class="desc-cell">
|
<text class="desc-label">维修人</text>
|
<text class="desc-value">{{ detail.maintenanceName || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row full">
|
<view class="desc-cell full">
|
<text class="desc-label">故障现象</text>
|
<text class="desc-value">{{ detail.remark || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row full">
|
<view class="desc-cell full status-cell">
|
<text class="desc-label">当前状态</text>
|
<view class="desc-value">
|
<u-tag :type="getStatusType(detail.status)"
|
size="mini">{{ getStatusLabel(detail.status) }}</u-tag>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="image-block">
|
<text class="image-block-title">设备问题图片</text>
|
<view v-if="imageList.length"
|
class="image-content">
|
<CommonUpload :model-value="imageList"
|
disabled />
|
</view>
|
<view v-else
|
class="image-empty">
|
<up-icon name="photo"
|
size="40"
|
color="#c0c4cc"></up-icon>
|
<text class="image-empty-text">暂无设备问题图片</text>
|
</view>
|
</view>
|
</view>
|
|
<!-- 2. 维修处理 -->
|
<view class="section">
|
<view class="section-head">
|
<view class="section-bar"></view>
|
<text class="section-head-text">2. 维修处理</text>
|
</view>
|
<view class="desc-table">
|
<view class="desc-row">
|
<view class="desc-cell">
|
<text class="desc-label">维修人</text>
|
<text class="desc-value">{{ detail.maintenanceName || '-' }}</text>
|
</view>
|
<view class="desc-cell">
|
<text class="desc-label">维修时间</text>
|
<text class="desc-value">{{ formatDateTime(detail.maintenanceTime) || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row full">
|
<view class="desc-cell full">
|
<text class="desc-label">维修结果</text>
|
<text class="desc-value">{{ detail.maintenanceResult || '-' }}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 3. 验收 -->
|
<view class="section">
|
<view class="section-head">
|
<view class="section-bar"></view>
|
<text class="section-head-text">3. 验收</text>
|
</view>
|
<view class="desc-table">
|
<view class="desc-row">
|
<view class="desc-cell">
|
<text class="desc-label">验收人</text>
|
<text class="desc-value">{{ detail.acceptanceName || '-' }}</text>
|
</view>
|
<view class="desc-cell">
|
<text class="desc-label">验收时间</text>
|
<text class="desc-value">{{ formatDateTime(detail.acceptanceTime) || '-' }}</text>
|
</view>
|
</view>
|
<view class="desc-row full">
|
<view class="desc-cell full">
|
<text class="desc-label">验收备注</text>
|
<text class="desc-value">{{ detail.acceptanceRemark || '-' }}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref, computed, onMounted } from "vue";
|
import { onLoad } from "@dcloudio/uni-app";
|
import PageHeader from "@/components/PageHeader.vue";
|
import CommonUpload from "@/components/CommonUpload.vue";
|
import { getRepairById } from "@/api/equipmentManagement/repair";
|
import dayjs from "dayjs";
|
|
defineOptions({ name: "repair-detail" });
|
|
const showToast = message => {
|
uni.showToast({ title: message, icon: "none" });
|
};
|
|
const repairId = ref("");
|
const detail = ref({});
|
|
const STATUS_MAP = {
|
0: { label: "待维修", type: "error" },
|
1: { label: "完成", type: "success" },
|
2: { label: "维修失败", type: "warning" },
|
3: { label: "待验收", type: "primary" },
|
};
|
|
const getStatusLabel = status => STATUS_MAP[status]?.label || "-";
|
const getStatusType = status => STATUS_MAP[status]?.type || "info";
|
|
const imageList = computed(() => {
|
return detail.value.storageBlobVOs || detail.value.storageBlobDTOs || [];
|
});
|
|
const formatDate = dateStr => {
|
if (!dateStr) return "";
|
return dayjs(dateStr).format("YYYY-MM-DD");
|
};
|
|
const formatDateTime = dateStr => {
|
if (!dateStr) return "";
|
return dayjs(dateStr).format("YYYY-MM-DD HH:mm:ss");
|
};
|
|
const loadDetail = async id => {
|
try {
|
const cached = uni.getStorageSync("repairDetail");
|
if (cached) {
|
detail.value = typeof cached === "string" ? JSON.parse(cached) : cached;
|
}
|
if (id) {
|
const { code, data } = await getRepairById(id);
|
if (code == 200) {
|
detail.value = { ...detail.value, ...data };
|
}
|
}
|
} catch (e) {
|
showToast("获取详情失败");
|
}
|
};
|
|
const goBack = () => {
|
uni.removeStorageSync("repairDetail");
|
uni.navigateBack();
|
};
|
|
onLoad(options => {
|
if (options.id) {
|
repairId.value = options.id;
|
}
|
});
|
|
onMounted(() => {
|
loadDetail(repairId.value);
|
});
|
</script>
|
|
<style scoped lang="scss">
|
.repair-detail {
|
min-height: 100vh;
|
background-color: #f0f2f5;
|
padding-bottom: 24px;
|
}
|
|
.content-container {
|
padding: 12px;
|
}
|
|
.section {
|
background-color: #ffffff;
|
border-radius: 4px;
|
margin-bottom: 12px;
|
overflow: hidden;
|
border: 1px solid #ebeef5;
|
}
|
|
.section-head {
|
display: flex;
|
align-items: center;
|
padding: 12px 16px;
|
border-bottom: 1px solid #ebeef5;
|
background: #fff;
|
}
|
|
.section-bar {
|
width: 4px;
|
height: 16px;
|
background: #409eff;
|
border-radius: 2px;
|
margin-right: 8px;
|
flex-shrink: 0;
|
}
|
|
.section-head-text {
|
font-size: 15px;
|
font-weight: 600;
|
color: #303133;
|
}
|
|
.desc-table {
|
border-top: 1px solid #ebeef5;
|
}
|
|
.desc-row {
|
display: flex;
|
border-bottom: 1px solid #ebeef5;
|
|
&:last-child {
|
border-bottom: none;
|
}
|
|
&.full {
|
.desc-cell.full {
|
flex: 1;
|
width: 100%;
|
}
|
}
|
}
|
|
.desc-cell {
|
flex: 1;
|
display: flex;
|
min-width: 0;
|
border-right: 1px solid #ebeef5;
|
|
&:last-child {
|
border-right: none;
|
}
|
|
&.full {
|
border-right: none;
|
}
|
}
|
|
.desc-label {
|
width: 88px;
|
flex-shrink: 0;
|
padding: 10px 12px;
|
font-size: 13px;
|
color: #606266;
|
background: #f5f7fa;
|
border-right: 1px solid #ebeef5;
|
line-height: 20px;
|
box-sizing: border-box;
|
}
|
|
.desc-value {
|
flex: 1;
|
padding: 10px 12px;
|
font-size: 13px;
|
color: #303133;
|
background: #ffffff;
|
line-height: 20px;
|
word-break: break-all;
|
min-width: 0;
|
box-sizing: border-box;
|
}
|
|
.status-cell {
|
.desc-value {
|
display: flex;
|
align-items: center;
|
}
|
}
|
|
.image-block {
|
padding: 12px 16px 16px;
|
border-top: 1px solid #ebeef5;
|
}
|
|
.image-block-title {
|
display: block;
|
font-size: 13px;
|
color: #606266;
|
margin-bottom: 12px;
|
}
|
|
.image-content {
|
padding: 0;
|
}
|
|
.image-empty {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
min-height: 120px;
|
background: #fafafa;
|
border: 1px dashed #dcdfe6;
|
border-radius: 4px;
|
gap: 8px;
|
}
|
|
.image-empty-text {
|
font-size: 13px;
|
color: #c0c4cc;
|
}
|
|
@media (max-width: 400px) {
|
.desc-row:not(.full) {
|
flex-direction: column;
|
|
.desc-cell {
|
border-right: none;
|
border-bottom: 1px solid #ebeef5;
|
|
&:last-child {
|
border-bottom: none;
|
}
|
}
|
}
|
}
|
</style>
|