|
|
@@ -5,7 +5,7 @@ import useViolationNoticeStore, { getPlace, emitter } from '../stores/use-violat
|
|
|
import { onUnmounted, onMounted } from 'vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { push } from 'notivue';
|
|
|
-
|
|
|
+import TestImg from 'D:/任务/机场节点.2png.png';
|
|
|
const useViolationRealtimeCompany = () => {
|
|
|
/** 消息队列,最新的排在最前面,最老的排在最后面 */
|
|
|
// 报警消息最后返回数据的id
|
|
|
@@ -17,32 +17,56 @@ const useViolationRealtimeCompany = () => {
|
|
|
const showNotice = () => {
|
|
|
const showItem = violationStore.getLastNotice();
|
|
|
// 从数组最末尾弹出消息
|
|
|
- if (!showItem) return;
|
|
|
|
|
|
- // 只显示当天的时分秒
|
|
|
- const renderTime = dayjs(showItem.createdAt).format('HH:mm:ss');
|
|
|
- const renderPlace = getPlace([showItem.workshopName, showItem.workspaceName]);
|
|
|
- push.success({
|
|
|
- props: {
|
|
|
- thumbnail: showItem.pictures?.[0],
|
|
|
- title: showItem.title,
|
|
|
- message: `<div>
|
|
|
+ if (!showItem) {
|
|
|
+ const renderTime = dayjs().format('HH:mm:ss');
|
|
|
+ const renderPlace = 'test place';
|
|
|
+ push.success({
|
|
|
+ props: {
|
|
|
+ thumbnail: TestImg,
|
|
|
+ title: '报警标题',
|
|
|
+ message: `<div>
|
|
|
<div>地点:${renderPlace}</div>
|
|
|
<div>时间:${renderTime}</div>
|
|
|
</div>`,
|
|
|
- onClick: () => {
|
|
|
- // 这里打开问题列表
|
|
|
+ onClick: () => {
|
|
|
+ // 这里打开问题列表
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- onAutoClear(item) {
|
|
|
- showNotice();
|
|
|
- },
|
|
|
- onManualClear(item) {
|
|
|
- showNotice();
|
|
|
- },
|
|
|
- });
|
|
|
- };
|
|
|
+ onAutoClear(item) {
|
|
|
+ showNotice();
|
|
|
+ },
|
|
|
+ onManualClear(item) {
|
|
|
+ showNotice();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // if (!showItem) return;
|
|
|
|
|
|
+ // 只显示当天的时分秒
|
|
|
+ // const renderTime = dayjs(showItem.createdAt).format('HH:mm:ss');
|
|
|
+ // const renderPlace = getPlace([showItem.workshopName, showItem.workspaceName]);
|
|
|
+ // push.success({
|
|
|
+ // props: {
|
|
|
+ // thumbnail: showItem.pictures?.[0],
|
|
|
+ // title: showItem.title,
|
|
|
+ // message: `<div>
|
|
|
+ // <div>地点:${renderPlace}</div>
|
|
|
+ // <div>时间:${renderTime}</div>
|
|
|
+ // </div>`,
|
|
|
+ // onClick: () => {
|
|
|
+ // // 这里打开问题列表
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // onAutoClear(item) {
|
|
|
+ // showNotice();
|
|
|
+ // },
|
|
|
+ // onManualClear(item) {
|
|
|
+ // showNotice();
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ };
|
|
|
+ showNotice();
|
|
|
emitter.on('showNotice', showNotice);
|
|
|
|
|
|
const getViolationsRealtime = () => {
|