|
|
@@ -2,10 +2,13 @@
|
|
|
|
|
|
import { getNewIssueList, updateReadIssueId } from '../apis';
|
|
|
import useViolationNoticeStore, { getPlace, emitter } from '../stores/use-violation-notice-store';
|
|
|
-import { onUnmounted, onMounted } from 'vue';
|
|
|
+import { onUnmounted, onMounted, nextTick } from 'vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { push } from 'notivue';
|
|
|
-import TestImg from 'D:/任务/机场节点.2png.png';
|
|
|
+import useQuestionListStore from '@/views/institute-safety/modules/safety-company-home/stores/use-question-list';
|
|
|
+import { WORKSHOP_INFOS } from '../../safety-workshop-list/constants';
|
|
|
+
|
|
|
+const questionListStore = useQuestionListStore();
|
|
|
const useViolationRealtimeCompany = () => {
|
|
|
/** 消息队列,最新的排在最前面,最老的排在最后面 */
|
|
|
// 报警消息最后返回数据的id
|
|
|
@@ -18,55 +21,35 @@ const useViolationRealtimeCompany = () => {
|
|
|
const showItem = violationStore.getLastNotice();
|
|
|
// 从数组最末尾弹出消息
|
|
|
|
|
|
- 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: () => {
|
|
|
- // 这里打开问题列表
|
|
|
- },
|
|
|
- },
|
|
|
- onAutoClear(item) {
|
|
|
- showNotice();
|
|
|
- },
|
|
|
- onManualClear(item) {
|
|
|
- showNotice();
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- // if (!showItem) return;
|
|
|
+ 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();
|
|
|
- // },
|
|
|
- // });
|
|
|
+ const renderTime = dayjs(showItem.createdAt).format('yyyy-MM-dd HH:mm:ss');
|
|
|
+ const renderPlace = getPlace([showItem.workshopName, showItem.workspaceName]);
|
|
|
+ push.success({
|
|
|
+ props: {
|
|
|
+ thumbnail: showItem.pictures?.[0],
|
|
|
+ type: showItem.title,
|
|
|
+ device: showItem.cameraCode,
|
|
|
+ place: renderPlace,
|
|
|
+ time: renderTime,
|
|
|
+ onClick: () => {
|
|
|
+ questionListStore.setState({
|
|
|
+ type: 'all',
|
|
|
+ workshopCodes: WORKSHOP_INFOS.map((item) => item.workshopCode),
|
|
|
+ });
|
|
|
+ nextTick(() => {
|
|
|
+ questionListStore.openList();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onAutoClear(item) {
|
|
|
+ showNotice();
|
|
|
+ },
|
|
|
+ onManualClear(item) {
|
|
|
+ showNotice();
|
|
|
+ },
|
|
|
+ });
|
|
|
};
|
|
|
- showNotice();
|
|
|
emitter.on('showNotice', showNotice);
|
|
|
|
|
|
const getViolationsRealtime = () => {
|