<template>
|
<view class="hazard-source-detail">
|
<PageHeader title="危险源详情"
|
@back="goBack" />
|
<!-- 内容容器 -->
|
<view class="content-container">
|
<!-- 危险源信息 -->
|
<view class="section">
|
<view class="section-title">危险源信息</view>
|
<view class="info-item">
|
<text class="info-label">危险源名称</text>
|
<text class="info-value">{{ form.name || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">危险源编码</text>
|
<text class="info-value">{{ form.code || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">危险源类型</text>
|
<text class="info-value">{{ hazard_source_type.find(item => item.value === form.type)?.label || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">风险等级</text>
|
<text class="info-value"><u-tag :type="getRiskLevelType(form.riskLevel)">
|
{{ form.riskLevel || '-' }}
|
</u-tag></text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">所在位置</text>
|
<text class="info-value">{{ form.location || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">管控措施</text>
|
<text class="info-value">{{ form.controlMeasures || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">库存数量</text>
|
<text class="info-value">{{ form.stockQty || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">管控责任人</text>
|
<text class="info-value">{{ form.principalUser || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">责任人联系电话</text>
|
<text class="info-value">{{ form.principalMobile || '-' }}</text>
|
</view>
|
<view class="info-item">
|
<text class="info-label">规格 / 风险描述</text>
|
<text class="info-value">{{ form.specInfo || '-' }}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
// 替换 toast 方法
|
const showToast = message => {
|
uni.showToast({
|
title: message,
|
icon: "none",
|
});
|
};
|
|
import { ref, onMounted } from "vue";
|
import PageHeader from "@/components/PageHeader.vue";
|
import useUserStore from "@/store/modules/user";
|
import { useDict } from "@/utils/dict";
|
|
const userStore = useUserStore();
|
|
// 获取字典数据
|
const { hazard_source_type } = useDict("hazard_source_type");
|
const { risk_level } = useDict("risk_level");
|
|
// 表单数据
|
const form = ref({
|
name: "",
|
code: "",
|
type: "",
|
riskLevel: "",
|
location: "",
|
controlMeasures: "",
|
stockQty: "",
|
principalUser: "",
|
principalMobile: "",
|
specInfo: "",
|
});
|
|
// 返回上一页
|
const goBack = () => {
|
// 返回时清除本地存储的数据
|
uni.removeStorageSync("hazardSourceLedger");
|
uni.navigateBack();
|
};
|
const getRiskLevelType = riskLevel => {
|
const typeMap = {
|
低风险: "info",
|
一般风险: "info",
|
较大风险: "warning",
|
重大风险: "error",
|
};
|
return typeMap[riskLevel] || "info";
|
};
|
|
// 初始化页面数据
|
const initPageData = () => {
|
// 从本地存储获取危险源详情
|
const row = uni.getStorageSync("hazardSourceLedger");
|
if (row) {
|
form.value = { ...row };
|
} else {
|
showToast("暂无危险源数据");
|
}
|
};
|
|
onMounted(() => {
|
initPageData();
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/static/scss/form-common.scss";
|
|
.client-visit-detail {
|
min-height: 100vh;
|
background-color: #f8f9fa;
|
}
|
|
.content-container {
|
padding: 16px;
|
}
|
|
.section {
|
background-color: #ffffff;
|
border-radius: 12px;
|
margin-bottom: 16px;
|
overflow: hidden;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
}
|
|
.section-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #333333;
|
padding: 16px 16px 12px;
|
border-bottom: 1px solid #f0f0f0;
|
}
|
|
.info-item {
|
display: flex;
|
padding: 14px 16px;
|
border-bottom: 1px solid #f8f8f8;
|
align-items: flex-start;
|
}
|
|
.info-item:last-child {
|
border-bottom: none;
|
}
|
|
.info-label {
|
font-size: 14px;
|
color: #666666;
|
min-width: 80px;
|
flex-shrink: 0;
|
line-height: 22px;
|
}
|
|
.info-value {
|
font-size: 14px;
|
color: #333333;
|
flex: 1;
|
line-height: 22px;
|
text-align: right;
|
}
|
|
.multi-line {
|
text-align: left;
|
word-break: break-all;
|
line-height: 1.6;
|
}
|
|
.remark-item {
|
padding-bottom: 16px;
|
}
|
</style>
|