消息推送接口完成
This commit is contained in:
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
// 获取推送消息信息
|
// 获取推送消息信息
|
||||||
export function pushInfoApi(params) {
|
export function pushInfoApi(id) {
|
||||||
return axios.get('/api/chain-remove-applies', {params});
|
return axios.get('/api/abnormal-work-conditions/events/'+id);
|
||||||
}
|
}
|
||||||
// 推送消息判断确认
|
// 推送消息判断确认
|
||||||
export function confirmInfoApi(id,params) {
|
export function confirmInfoApi(id,result, opinion = '') {
|
||||||
return axios.post('/api/chain-remove-applies/'+id+'/audit',params);
|
return axios.post('/api/abnormal-work-conditions/events/'+id+'/authenticity-confirmation',{ result, opinion });
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,18 @@
|
|||||||
*/
|
*/
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { showToast, showLoadingToast, closeToast } from 'vant'
|
import { showToast, showLoadingToast, closeToast } from 'vant'
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { pushInfoApi, confirmInfoApi } from '@/api/abnormal'
|
import { pushInfoApi, confirmInfoApi } from '@/api/abnormal'
|
||||||
import { getNowDateTime } from '@/utils/format'
|
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
// 数据加载中状态
|
// 数据加载中状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
// 异常工况推送详情
|
// 异常工况推送详情
|
||||||
const messageInfo = ref(null);
|
const messageInfo = ref(null);
|
||||||
|
// 异常工况推送详情ID
|
||||||
|
const currentId = ref(0);
|
||||||
|
// 确认意见
|
||||||
|
const opinion = ref('');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取推送消息详情(模拟接口请求)
|
* 获取推送消息详情(模拟接口请求)
|
||||||
@@ -19,32 +24,27 @@ const messageInfo = ref(null);
|
|||||||
*/
|
*/
|
||||||
const getInfo = async () => {
|
const getInfo = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
setTimeout(() => {
|
try {
|
||||||
|
const res = await pushInfoApi(currentId.value);
|
||||||
messageInfo.value = {
|
messageInfo.value = {
|
||||||
card: '液氨储罐|泄漏中毒爆炸',
|
card: res?.data?.title || '',
|
||||||
type: 1,
|
type: res?.data?.card_snapshot?.severity || '',
|
||||||
org: '二车间',
|
org: res.data?.org_id,
|
||||||
triggerTime: '2026-10-30 13:28:54',
|
triggerTime: res?.data?.occurred_at || '',
|
||||||
name: '默认判定规则',
|
name: res?.data?.rule_snapshot?.name || '',
|
||||||
condition: '液位正常控制25~205cm,HH=210cm;压力<1.3MPa;液位/压力趋势异常或出现报警。',
|
condition: '液位正常控制25~205cm,HH=210cm;压力<1.3MPa;液位/压力趋势异常或出现报警。',
|
||||||
reason: '法兰、阀门、安全附件泄漏;超装;罐体腐蚀或焊缝开裂;装卸车软管脱开。',
|
reason: res?.data?.card_snapshot?.causes?.map(item => item.cause).join(';') || '',
|
||||||
result: '液氨喷出气化扩散导致人员中毒、燃爆及冻伤。',
|
result: res?.data?.card_snapshot?.consequence || '',
|
||||||
feedback: false,
|
feedback: !res?.data?.can_confirm,
|
||||||
feedbackType: 0,
|
feedbackType: res?.data?.confirmation_status || '',
|
||||||
feedbackBy: '',
|
feedbackBy: res?.data?.confirmation?.confirmer_name || '',
|
||||||
feedbackTime: '',
|
feedbackTime: res?.data?.confirmation?.confirmed_at || '',
|
||||||
|
opinion: res?.data?.confirmation?.opinion || '',
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
closeToast()
|
||||||
loading.value = false;
|
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,
|
forbidClick: true,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
try {
|
||||||
messageInfo.value.feedback = true,
|
await confirmInfoApi(
|
||||||
messageInfo.value.feedbackType = type,
|
Number(currentId.value),
|
||||||
messageInfo.value.feedbackBy = '张三',
|
type,
|
||||||
messageInfo.value.feedbackTime = getNowDateTime()?.slice(0, 16),
|
opinion.value
|
||||||
|
);
|
||||||
|
showToast(`${type === true ? '真实异常' : '信息误报'}已确认`)
|
||||||
|
getInfo()
|
||||||
|
} catch (error) {
|
||||||
closeToast()
|
closeToast()
|
||||||
showToast(`${type === 1 ? '真实异常' : '信息误报'}已确认,已通知相关人员`)
|
}
|
||||||
}, 1000)
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const res = await confirmInfoApi({
|
|
||||||
// org_id: 1,
|
|
||||||
// });
|
|
||||||
// messageInfo.value = res.data;
|
|
||||||
// closeToast()
|
|
||||||
// showToast(`${type === 1 ? '真实异常' : '信息误报'}已确认,已通知相关人员`)
|
|
||||||
// } finally {
|
|
||||||
// closeToast()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const { id,token } = router.currentRoute.value.query;
|
||||||
|
if(id && token){
|
||||||
|
// localStorage.setItem('token', token);
|
||||||
|
currentId.value = id;
|
||||||
getInfo()
|
getInfo()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="inbox-page">
|
<div class="inbox-page" :class="messageInfo?.feedback?'pb-80':'pb-130'">
|
||||||
<van-nav-bar title="异常工况推送" fixed placeholder />
|
<van-nav-bar title="异常工况推送" fixed placeholder />
|
||||||
|
|
||||||
<div v-if="loading" class="loading-wrap">
|
<div v-if="loading" class="loading-wrap">
|
||||||
@@ -99,14 +96,14 @@ onMounted(() => {
|
|||||||
<van-icon name="chat" />
|
<van-icon name="chat" />
|
||||||
系统消息
|
系统消息
|
||||||
</span>
|
</span>
|
||||||
<span>{{ messageInfo?.triggerTime?.slice(0, 16) }}</span>
|
<span>{{ messageInfo?.triggerTime }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<van-cell-group inset class="alert-card">
|
<van-cell-group inset class="alert-card">
|
||||||
<div class="alert-title">
|
<div class="alert-title">
|
||||||
<h2>{{ messageInfo?.card }}</h2>
|
<h2>{{ messageInfo?.card }}</h2>
|
||||||
<van-tag :type="messageInfo?.type === 1 ? 'danger' : 'warning'" size="medium">
|
<van-tag :type="messageInfo?.type === 1 ? 'danger' : 'warning'" size="medium">
|
||||||
{{ messageInfo?.type === 1 ? 'A级' : 'B级' }}
|
{{ messageInfo?.type === 'A级' ? 'A级' : 'B级' }}
|
||||||
</van-tag>
|
</van-tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -117,11 +114,11 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="alert-grid-item">
|
<div class="alert-grid-item">
|
||||||
<span>触发时间</span>
|
<span>触发时间</span>
|
||||||
<strong>{{ messageInfo?.triggerTime?.slice(0, 16) }}</strong>
|
<strong>{{ messageInfo?.triggerTime }}</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert-row alert-row-lined">
|
<div class="alert-row">
|
||||||
<span>判定名称</span>
|
<span>判定名称</span>
|
||||||
<p>{{ messageInfo?.name }}</p>
|
<p>{{ messageInfo?.name }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -134,23 +131,40 @@ onMounted(() => {
|
|||||||
<span>可能的原因</span>
|
<span>可能的原因</span>
|
||||||
<p>{{ messageInfo?.reason }}</p>
|
<p>{{ messageInfo?.reason }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert-row">
|
<div class="alert-row alert-row-lined">
|
||||||
<span>可能的后果</span>
|
<span>可能的后果</span>
|
||||||
<p>{{ messageInfo?.result }}</p>
|
<p>{{ messageInfo?.result }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="messageInfo?.opinion" class="alert-row alert-row-lined">
|
||||||
|
<span>确认意见</span>
|
||||||
|
<p>{{ messageInfo?.opinion }}</p>
|
||||||
|
</div>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="bottom-bar">
|
<div class="bottom-bar">
|
||||||
<div v-if="messageInfo?.feedback" class="feedback-result">
|
<div v-if="messageInfo?.feedback" class="feedback-result">
|
||||||
<van-icon name="checked" size="18" color="#07c160" />
|
<van-icon name="checked" size="18" color="#07c160" />
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<p>{{ messageInfo?.feedbackType === 1 ? '真实异常' : '信息误报' }} · {{ messageInfo?.feedbackBy }}</p>
|
<div class="flex-left">
|
||||||
|
<p v-if="messageInfo?.feedbackType=='NOT_REQUIRED'">无需确认</p>
|
||||||
|
<p v-if="messageInfo?.feedbackType=='CONFIRMED_TRUE'">真实异常</p>
|
||||||
|
<p v-if="messageInfo?.feedbackType=='CONFIRMED_FALSE'">信息误报</p>
|
||||||
|
<p v-if="messageInfo?.feedbackType=='TIMEOUT_TRUE'">超时默认真实</p>
|
||||||
|
<p v-if="messageInfo?.feedbackType=='CANCELLED'">规则变更终止</p>
|
||||||
|
<p v-if="messageInfo?.feedbackType=='PENDING_CONFIRMATION'">待真实性确认</p>
|
||||||
|
<span>{{ messageInfo?.feedbackBy }}</span>
|
||||||
|
</div>
|
||||||
<span>{{ messageInfo?.feedbackTime }}</span>
|
<span>{{ messageInfo?.feedbackTime }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<van-button block type="success" size="normal" @click="onFeedback(1)">真实异常</van-button>
|
<div class="bottom">
|
||||||
<van-button block type="warning" size="normal" @click="onFeedback(2)">信息误报</van-button>
|
<van-field v-model="opinion" label="确认意见:" label-width="65px" placeholder="选填" />
|
||||||
|
<div class="flex">
|
||||||
|
<van-button block type="success" size="normal" @click="onFeedback(true)">真实异常</van-button>
|
||||||
|
<van-button block type="warning" size="normal" @click="onFeedback(false)">信息误报</van-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -159,9 +173,22 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
:deep(.bottom .van-cell) {
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #ebedf0;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
:deep(.bottom .van-cell:after) {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
.inbox-page {
|
.inbox-page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
|
}
|
||||||
|
.pb-130 {
|
||||||
|
padding-bottom: 130px;
|
||||||
|
}
|
||||||
|
.pb-80 {
|
||||||
padding-bottom: 80px;
|
padding-bottom: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +249,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.alert-row-lined {
|
.alert-row-lined {
|
||||||
border-bottom: 1px solid #ebedf0;
|
border-top: 1px solid #ebedf0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert-grid-item {
|
.alert-grid-item {
|
||||||
@@ -265,6 +292,14 @@ onMounted(() => {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
.bottom-bar .bottom {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.bottom-bar .flex {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.feedback-result {
|
.feedback-result {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -282,6 +317,15 @@ onMounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
.flex-left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.flex-left span {
|
||||||
|
margin-left: 10px;
|
||||||
|
color: #333 !important;
|
||||||
|
}
|
||||||
.feedback-result p {
|
.feedback-result p {
|
||||||
color: var(--van-success-color);
|
color: var(--van-success-color);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
Reference in New Issue
Block a user