From cd8ca0fdbf696374d93a8877398ace4fc0a1ce51 Mon Sep 17 00:00:00 2001 From: bestlee Date: Tue, 17 Nov 2026 11:15:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/abnormal.js | 8 +- src/views/abnormal/index.vue | 148 +++++++++++++++++++++++------------ 2 files changed, 100 insertions(+), 56 deletions(-) diff --git a/src/api/abnormal.js b/src/api/abnormal.js index a6dfefa..5e4c5a0 100644 --- a/src/api/abnormal.js +++ b/src/api/abnormal.js @@ -1,10 +1,10 @@ import axios from 'axios'; // 获取推送消息信息 -export function pushInfoApi(params) { - return axios.get('/api/chain-remove-applies', {params}); +export function pushInfoApi(id) { + return axios.get('/api/abnormal-work-conditions/events/'+id); } // 推送消息判断确认 -export function confirmInfoApi(id,params) { - return axios.post('/api/chain-remove-applies/'+id+'/audit',params); +export function confirmInfoApi(id,result, opinion = '') { + return axios.post('/api/abnormal-work-conditions/events/'+id+'/authenticity-confirmation',{ result, opinion }); } \ No newline at end of file diff --git a/src/views/abnormal/index.vue b/src/views/abnormal/index.vue index ea74794..56b5ee1 100644 --- a/src/views/abnormal/index.vue +++ b/src/views/abnormal/index.vue @@ -5,13 +5,18 @@ */ import { ref, onMounted } from 'vue' import { showToast, showLoadingToast, closeToast } from 'vant' +import { useRouter } from 'vue-router'; import { pushInfoApi, confirmInfoApi } from '@/api/abnormal' -import { getNowDateTime } from '@/utils/format' +const router = useRouter(); // 数据加载中状态 const loading = ref(false); // 异常工况推送详情 const messageInfo = ref(null); +// 异常工况推送详情ID +const currentId = ref(0); +// 确认意见 +const opinion = ref(''); /** * 获取推送消息详情(模拟接口请求) @@ -19,32 +24,27 @@ const messageInfo = ref(null); */ const getInfo = async () => { loading.value = true; - setTimeout(() => { + try { + const res = await pushInfoApi(currentId.value); messageInfo.value = { - card: '液氨储罐|泄漏中毒爆炸', - type: 1, - org: '二车间', - triggerTime: '2026-10-30 13:28:54', - name: '默认判定规则', + card: res?.data?.title || '', + type: res?.data?.card_snapshot?.severity || '', + org: res.data?.org_id, + triggerTime: res?.data?.occurred_at || '', + name: res?.data?.rule_snapshot?.name || '', condition: '液位正常控制25~205cm,HH=210cm;压力<1.3MPa;液位/压力趋势异常或出现报警。', - reason: '法兰、阀门、安全附件泄漏;超装;罐体腐蚀或焊缝开裂;装卸车软管脱开。', - result: '液氨喷出气化扩散导致人员中毒、燃爆及冻伤。', - feedback: false, - feedbackType: 0, - feedbackBy: '', - feedbackTime: '', + reason: res?.data?.card_snapshot?.causes?.map(item => item.cause).join(';') || '', + result: res?.data?.card_snapshot?.consequence || '', + feedback: !res?.data?.can_confirm, + feedbackType: res?.data?.confirmation_status || '', + feedbackBy: res?.data?.confirmation?.confirmer_name || '', + feedbackTime: res?.data?.confirmation?.confirmed_at || '', + opinion: res?.data?.confirmation?.opinion || '', } + } finally { + closeToast() loading.value = false; - }, 1500) - - // try { - // const res = await pushInfoApi({ - // org_id: 1, - // }); - // messageInfo.value = res.data; - // } finally { - // loading.value = false; - // } + } } /** @@ -59,34 +59,31 @@ const onFeedback = async (type) => { forbidClick: true, duration: 0, }) - setTimeout(() => { - messageInfo.value.feedback = true, - messageInfo.value.feedbackType = type, - messageInfo.value.feedbackBy = '张三', - messageInfo.value.feedbackTime = getNowDateTime()?.slice(0, 16), + try { + await confirmInfoApi( + Number(currentId.value), + type, + opinion.value + ); + showToast(`${type === true ? '真实异常' : '信息误报'}已确认`) + getInfo() + } catch (error) { 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() + const { id,token } = router.currentRoute.value.query; + if(id && token){ + // localStorage.setItem('token', token); + currentId.value = id; + getInfo() + } }) @@ -159,9 +173,22 @@ onMounted(() => {