路由修改
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import axios from 'axios';
|
||||
|
||||
// 获取推送消息信息
|
||||
export function pushInfoApi(params) {
|
||||
return axios.get('/api/chain-remove-applies', {params});
|
||||
}
|
||||
// 推送消息判断确认
|
||||
export function confirmInfoApi(id,params) {
|
||||
return axios.post('/api/chain-remove-applies/'+id+'/audit',params);
|
||||
}
|
||||
+3
-3
@@ -59,8 +59,8 @@ const asyncRoutes = [
|
||||
// 异常工况模块:异常工况推送
|
||||
{
|
||||
path: '/abnormal',
|
||||
name: 'abnormalInbox',
|
||||
component: () => import('../views/abnormal/PushInbox.vue'),
|
||||
name: 'abnormal',
|
||||
component: () => import('../views/abnormal/index.vue'),
|
||||
meta: { title: '异常工况推送' },
|
||||
},
|
||||
]
|
||||
@@ -68,7 +68,7 @@ const asyncRoutes = [
|
||||
// 标志位:是否已添加动态路由
|
||||
let isRoutesAdded = false
|
||||
router.beforeEach((to, from, next) => {
|
||||
const token = localStorage.getItem('token') || '123'
|
||||
const token = localStorage.getItem('token') || ''
|
||||
if (token) {
|
||||
// 关键:有 token 但业务路由还没挂载 => 动态添加(仅一次)
|
||||
if (!isRoutesAdded) {
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
<script setup>
|
||||
/**
|
||||
* 移动端推送消息详情
|
||||
* 直接展示最新一条异常推送的完整信息,底部提供真实异常 / 信息误报研判反馈
|
||||
*/
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { showToast, showLoadingToast, closeToast } from 'vant'
|
||||
import { pushInfoApi, confirmInfoApi } from '@/api/abnormal'
|
||||
|
||||
// 数据加载中状态
|
||||
const loading = ref(false);
|
||||
// 异常工况推送详情
|
||||
const messageInfo = ref(null);
|
||||
|
||||
/**
|
||||
* 获取推送消息详情(模拟接口请求)
|
||||
* @returns {void}
|
||||
*/
|
||||
const getInfo = async () => {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
messageInfo.value = {
|
||||
card: '液氨储罐|泄漏中毒爆炸',
|
||||
type: 1,
|
||||
org: '二车间',
|
||||
triggerTime: '2026-10-30 13:28:54',
|
||||
name: '默认判定规则',
|
||||
condition: '液位正常控制25~205cm,HH=210cm;压力<1.3MPa;液位/压力趋势异常或出现报警。',
|
||||
reason: '法兰、阀门、安全附件泄漏;超装;罐体腐蚀或焊缝开裂;装卸车软管脱开。',
|
||||
result: '液氨喷出气化扩散导致人员中毒、燃爆及冻伤。',
|
||||
feedback: false,
|
||||
feedbackType: 0,
|
||||
feedbackBy: '',
|
||||
feedbackTime: '',
|
||||
}
|
||||
loading.value = false;
|
||||
}, 1500)
|
||||
|
||||
// try {
|
||||
// const res = await pushInfoApi({
|
||||
// org_id: 1,
|
||||
// });
|
||||
// messageInfo.value = res.data;
|
||||
// } finally {
|
||||
// loading.value = false;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交异常研判反馈
|
||||
* @param {string} type - 研判类型(真实异常 / 信息误报)
|
||||
* @returns {void}
|
||||
*/
|
||||
const onFeedback = async (type) => {
|
||||
if (!messageInfo.value) return
|
||||
showLoadingToast({
|
||||
message: '提交中...',
|
||||
forbidClick: true,
|
||||
duration: 0,
|
||||
})
|
||||
setTimeout(() => {
|
||||
messageInfo.value.feedback = true,
|
||||
messageInfo.value.feedbackType = type,
|
||||
messageInfo.value.feedbackBy = '张三',
|
||||
messageInfo.value.feedbackTime = '2026-10-30 13:28:54',
|
||||
closeToast()
|
||||
showToast(`${type === 1 ? '真实异常' : '信息误报'}已确认,已通知相关人员`)
|
||||
}, 1000)
|
||||
|
||||
// try {
|
||||
// const res = await confirmInfoApi({
|
||||
// org_id: 1,
|
||||
// });
|
||||
// messageInfo.value = res.data;
|
||||
// closeToast()
|
||||
// showToast(`${type === 1 ? '真实异常' : '信息误报'}已确认,已通知相关人员`)
|
||||
// } finally {
|
||||
// closeToast()
|
||||
// }
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getInfo()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="inbox-page">
|
||||
<van-nav-bar title="异常工况推送" fixed placeholder />
|
||||
|
||||
<div v-if="loading" class="loading-wrap">
|
||||
<van-loading color="#1989fa">加载中...</van-loading>
|
||||
</div>
|
||||
|
||||
<template v-else-if="messageInfo">
|
||||
<div class="message-meta">
|
||||
<span>
|
||||
<van-icon name="chat" />
|
||||
系统消息
|
||||
</span>
|
||||
<span>{{ messageInfo?.triggerTime?.slice(0, 16) }}</span>
|
||||
</div>
|
||||
|
||||
<van-cell-group inset class="alert-card">
|
||||
<div class="alert-title">
|
||||
<h2>{{ messageInfo?.card }}</h2>
|
||||
<van-tag :type="messageInfo?.type === 1 ? 'danger' : 'warning'" size="medium">
|
||||
{{ messageInfo?.type === 1 ? 'A级' : 'B级' }}
|
||||
</van-tag>
|
||||
</div>
|
||||
|
||||
<div class="alert-grid">
|
||||
<div class="alert-grid-item">
|
||||
<span>所属车间</span>
|
||||
<strong>{{ messageInfo?.org }}</strong>
|
||||
</div>
|
||||
<div class="alert-grid-item">
|
||||
<span>触发时间</span>
|
||||
<strong>{{ messageInfo?.triggerTime?.slice(0, 16) }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert-row alert-row-lined">
|
||||
<span>判定名称</span>
|
||||
<p>{{ messageInfo?.name }}</p>
|
||||
</div>
|
||||
<div class="alert-row alert-row-lined">
|
||||
<span>判定条件</span>
|
||||
<p>{{ messageInfo?.condition }}</p>
|
||||
</div>
|
||||
|
||||
<div class="alert-row alert-row-lined">
|
||||
<span>可能的原因</span>
|
||||
<p>{{ messageInfo?.reason }}</p>
|
||||
</div>
|
||||
<div class="alert-row">
|
||||
<span>可能的后果</span>
|
||||
<p>{{ messageInfo?.result }}</p>
|
||||
</div>
|
||||
</van-cell-group>
|
||||
|
||||
<div class="bottom-bar">
|
||||
<div v-if="messageInfo?.feedback" class="feedback-result">
|
||||
<van-icon name="checked" size="18" color="#07c160" />
|
||||
<div class="flex">
|
||||
<p>{{ messageInfo?.feedbackType === 1 ? '真实异常' : '信息误报' }} · {{ messageInfo?.feedbackBy }}</p>
|
||||
<span>{{ messageInfo?.feedbackTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<template v-else>
|
||||
<van-button block type="success" size="normal" @click="onFeedback(1)">真实异常</van-button>
|
||||
<van-button block type="warning" size="normal" @click="onFeedback(2)">信息误报</van-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<van-empty v-else description="暂无推送消息" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.inbox-page {
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.loading-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-top: 40vh;
|
||||
}
|
||||
|
||||
.message-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 16px 4px;
|
||||
font-size: 12px;
|
||||
color: #969799;
|
||||
}
|
||||
|
||||
.message-meta span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.alert-card {
|
||||
margin-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.alert-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 14px 16px 10px;
|
||||
}
|
||||
|
||||
.alert-title h2 {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.alert-grid {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin: 0 16px;
|
||||
padding: 0 0 8px;
|
||||
border-bottom: 1px solid #ebedf0;
|
||||
}
|
||||
|
||||
.alert-row {
|
||||
margin: 0 16px;
|
||||
padding: 10px 0 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.alert-row-lined {
|
||||
border-bottom: 1px solid #ebedf0;
|
||||
}
|
||||
|
||||
.alert-grid-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 8px 10px;
|
||||
background: #f7f8fa;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.alert-grid-item span,
|
||||
.alert-row span {
|
||||
font-size: 14px;
|
||||
color: #969799;
|
||||
}
|
||||
|
||||
.alert-grid-item strong {
|
||||
margin-top: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.alert-row p {
|
||||
margin: 4px 0 0;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 10px 16px;
|
||||
padding-bottom: calc(10px + env(safe-area-inset-bottom));
|
||||
background: #fff;
|
||||
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.feedback-result {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background: #edfff3;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.feedback-result .flex {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.feedback-result p {
|
||||
color: var(--van-success-color);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.feedback-result span {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user