Files
sh-app/pipe/precast/detail.vue
T
2026-06-12 15:14:46 +08:00

110 lines
2.6 KiB
Vue

<template>
<view class="page-detail">
<!-- 基本信息 -->
<view class="info-group">
<view class="info-item">
<text class="info-label">预制图纸名称</text>
<text class="info-value">{{ form.DrawingName || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">组件编号</text>
<text class="info-value">{{ form.PipelineComponentCode || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">物流箱号</text>
<text class="info-value">{{ form.BoxNumber || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">计划安装日期</text>
<text class="info-value">{{ form.PlanStartDate || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">验收人</text>
<text class="info-value">{{ form.ReceiveMan || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">验收日期</text>
<text class="info-value">{{ form.ReceiveDate || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">状态</text>
<text class="card-tag" :class="getStatusClass(form.State)">{{ getStatus(form.State) }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
// 表单数据
const form = ref({
PipelineComponentId: '',
DrawingName: '',
PipelineComponentCode: '',
BoxNumber: '',
PlanStartDate: '',
ReceiveMan: '',
ReceiveDate: '',
State: 0
})
// 获取状态文本
const getStatus = (state) => {
const statusMap = {
0: '未验收',
1: '已验收',
2: '已出库',
'-2': '待整改',
'-1': '已整改'
}
return statusMap[state] || '--'
}
// 获取状态样式类
const getStatusClass = (state) => {
const classMap = {
0: 'status-0',
1: 'status-2',
2: 'status-3',
'-2': 'status-1',
'-1': 'status-2'
}
return classMap[state] || 'status-0'
}
// 获取详情
const getInfo = async (id) => {
try {
// 替换为实际的API调用
const res = {
code: 1,
data: {
PipelineComponentId: id,
DrawingName: '预制组件A-001',
PipelineComponentCode: 'PC-2024-001',
BoxNumber: 'BOX-001',
PlanStartDate: '2024-01-15',
ReceiveMan: '张三',
ReceiveDate: '',
State: 0
}
}
if (res.code === 1) {
form.value = { ...form.value, ...res.data }
}
} catch (error) {
console.error('获取预制组件详情失败:', error)
}
}
// 生命周期
onLoad((options) => {
const id = options?.id || ''
if (id) {
getInfo(id)
}
})
</script>