|
|
@@ -52,7 +52,13 @@
|
|
|
<el-table v-loading="loading" :data="dangerSourceList" border stripe>
|
|
|
<el-table-column prop="sourceCode" label="危险源编号" align="center" width="140" />
|
|
|
<el-table-column prop="sourceName" label="危险源名称" align="center" :show-overflow-tooltip="true" min-width="180" />
|
|
|
- <el-table-column label="类型" align="center" prop="sourceType" width="130" />
|
|
|
+ <el-table-column label="类型" align="center" prop="sourceType" width="130">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-tag :type="getSourceTypeTag(row.sourceType)" effect="light" round>
|
|
|
+ {{ getDictLabel(sourceTypeOptions, row.sourceType) }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="位置" align="center" prop="location" :show-overflow-tooltip="true" width="180" />
|
|
|
<el-table-column label="可能危害" align="center" prop="sourceDesc" :show-overflow-tooltip="true" min-width="200" />
|
|
|
<el-table-column label="防控方式" align="center" prop="controlMeasures" :show-overflow-tooltip="true" min-width="200" />
|
|
|
@@ -116,21 +122,6 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="风险等级" prop="riskLevel">
|
|
|
- <el-select v-model="form.riskLevel" placeholder="请选择风险等级" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="d in riskLevelOptions"
|
|
|
- :key="d.value"
|
|
|
- :label="d.label"
|
|
|
- :value="d.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="位置" prop="location">
|
|
|
<el-input v-model="form.location" placeholder="请输入危险源位置" maxlength="100" show-word-limit />
|
|
|
@@ -164,8 +155,8 @@
|
|
|
<el-date-picker
|
|
|
v-model="form.reportTime"
|
|
|
type="date"
|
|
|
- placeholder="请选择上报时间"
|
|
|
- value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ placeholder="年/月/日"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
format="YYYY-MM-DD"
|
|
|
:disabled-date="disabledFutureDate"
|
|
|
style="width: 100%"
|
|
|
@@ -185,7 +176,7 @@
|
|
|
<el-descriptions :column="1" border>
|
|
|
<el-descriptions-item label="危险源编号">{{ viewForm.sourceCode }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="危险源名称">{{ viewForm.sourceName }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="危险源类型">{{ viewForm.sourceType }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="危险源类型">{{ getDictLabel(sourceTypeOptions, viewForm.sourceType) }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="位置">{{ viewForm.location }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="可能危害">
|
|
|
<div class="multi-line">{{ viewForm.sourceDesc || '—' }}</div>
|
|
|
@@ -193,7 +184,7 @@
|
|
|
<el-descriptions-item label="防控方式">
|
|
|
<div class="multi-line">{{ viewForm.controlMeasures || '—' }}</div>
|
|
|
</el-descriptions-item>
|
|
|
- <el-descriptions-item label="上报时间">{{ formatDateTime(viewForm.reportTime) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="上报时间">{{ viewForm.reportTime || '—' }}</el-descriptions-item>
|
|
|
</el-descriptions>
|
|
|
<template #footer>
|
|
|
<el-button @click="viewDialog.visible = false">关闭</el-button>
|
|
|
@@ -224,7 +215,6 @@ const dangerSourceList = ref<RiskDangerSourceVo[]>([]);
|
|
|
const loading = ref(true);
|
|
|
const total = ref(0);
|
|
|
const sourceTypeOptions = ref<Array<{ label: string; value: string }>>([]);
|
|
|
-const riskLevelOptions = ref<Array<{ label: string; value: string }>>([]);
|
|
|
|
|
|
const queryFormRef = ref<FormInstance>();
|
|
|
const formRef = ref<FormInstance>();
|
|
|
@@ -235,7 +225,6 @@ const data = reactive<any>({
|
|
|
sourceCode: '',
|
|
|
sourceName: '',
|
|
|
sourceType: '',
|
|
|
- riskLevel: '',
|
|
|
location: '',
|
|
|
sourceDesc: '',
|
|
|
controlMeasures: '',
|
|
|
@@ -262,7 +251,6 @@ const data = reactive<any>({
|
|
|
}
|
|
|
],
|
|
|
sourceType: [{ required: true, message: '请选择危险源类型', trigger: 'change' }],
|
|
|
- riskLevel: [{ required: true, message: '请选择风险等级', trigger: 'change' }],
|
|
|
location: [{ required: true, message: '请输入危险源位置', trigger: 'blur' }],
|
|
|
sourceDesc: [{ required: true, message: '请描述可能造成的危害', trigger: 'blur' }],
|
|
|
controlMeasures: [{ required: true, message: '请描述防控方式', trigger: 'blur' }],
|
|
|
@@ -298,24 +286,31 @@ const mapDictData = (resOrList: any) => {
|
|
|
|
|
|
const loadDicts = async () => {
|
|
|
try {
|
|
|
- const [typeRes, levelRes] = await Promise.all([
|
|
|
- getDicts('risk_source_type'),
|
|
|
- getDicts('risk_danger_level').catch(() => [])
|
|
|
- ]);
|
|
|
+ const typeRes = await getDicts('risk_source_type');
|
|
|
sourceTypeOptions.value = mapDictData(typeRes as any);
|
|
|
- // 风险等级字典不存在时使用默认三档
|
|
|
- riskLevelOptions.value = (levelRes as any[]).length
|
|
|
- ? mapDictData(levelRes as any)
|
|
|
- : [
|
|
|
- { label: '高', value: 'high' },
|
|
|
- { label: '中', value: 'medium' },
|
|
|
- { label: '低', value: 'low' }
|
|
|
- ];
|
|
|
} catch (e) {
|
|
|
console.error('加载危险源字典失败', e);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/** 危险源类型 tag 颜色(按字典 value 映射) */
|
|
|
+const getSourceTypeTag = (type: string) => {
|
|
|
+ const map: Record<string, string> = {
|
|
|
+ 电气危险源: 'danger',
|
|
|
+ 消防危险源: 'warning',
|
|
|
+ 高空危险源: 'primary',
|
|
|
+ 设备危险源: 'info',
|
|
|
+ 食品危险源: 'success'
|
|
|
+ };
|
|
|
+ return map[type] || 'info';
|
|
|
+};
|
|
|
+
|
|
|
+/** 字典值 → 中文 label */
|
|
|
+const getDictLabel = (opts: Array<{ label: string; value: string }>, val: string) => {
|
|
|
+ if (!val) return '';
|
|
|
+ return opts.find((o) => o.value === val)?.label || val;
|
|
|
+};
|
|
|
+
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
|
const res = await listDangerSource(queryParams.value as RiskDangerSourceBo);
|
|
|
@@ -400,7 +395,6 @@ const reset = () => {
|
|
|
sourceCode: '',
|
|
|
sourceName: '',
|
|
|
sourceType: '',
|
|
|
- riskLevel: '',
|
|
|
location: '',
|
|
|
sourceDesc: '',
|
|
|
controlMeasures: '',
|
|
|
@@ -433,7 +427,7 @@ onMounted(async () => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- danger-source-page {
|
|
|
+.danger-source-page {
|
|
|
padding: 16px;
|
|
|
height: 100%;
|
|
|
overflow-y: auto;
|