|
@@ -2,10 +2,13 @@
|
|
|
|
|
|
|
|
import { getNewIssueList, updateReadIssueId } from '../apis';
|
|
import { getNewIssueList, updateReadIssueId } from '../apis';
|
|
|
import useViolationNoticeStore, { getPlace, emitter } from '../stores/use-violation-notice-store';
|
|
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 dayjs from 'dayjs';
|
|
|
import { push } from 'notivue';
|
|
import { push } from 'notivue';
|
|
|
|
|
+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 = () => {
|
|
const useViolationRealtimeCompany = () => {
|
|
|
/** 消息队列,最新的排在最前面,最老的排在最后面 */
|
|
/** 消息队列,最新的排在最前面,最老的排在最后面 */
|
|
|
// 报警消息最后返回数据的id
|
|
// 报警消息最后返回数据的id
|
|
@@ -17,21 +20,26 @@ const useViolationRealtimeCompany = () => {
|
|
|
const showNotice = () => {
|
|
const showNotice = () => {
|
|
|
const showItem = violationStore.getLastNotice();
|
|
const showItem = violationStore.getLastNotice();
|
|
|
// 从数组最末尾弹出消息
|
|
// 从数组最末尾弹出消息
|
|
|
|
|
+
|
|
|
if (!showItem) return;
|
|
if (!showItem) return;
|
|
|
|
|
|
|
|
- // 只显示当天的时分秒
|
|
|
|
|
- const renderTime = dayjs(showItem.createdAt).format('HH:mm:ss');
|
|
|
|
|
|
|
+ const renderTime = dayjs(showItem.createdAt).format('yyyy-MM-dd HH:mm:ss');
|
|
|
const renderPlace = getPlace([showItem.workshopName, showItem.workspaceName]);
|
|
const renderPlace = getPlace([showItem.workshopName, showItem.workspaceName]);
|
|
|
push.success({
|
|
push.success({
|
|
|
props: {
|
|
props: {
|
|
|
thumbnail: showItem.pictures?.[0],
|
|
thumbnail: showItem.pictures?.[0],
|
|
|
- title: showItem.title,
|
|
|
|
|
- message: `<div>
|
|
|
|
|
- <div>地点:${renderPlace}</div>
|
|
|
|
|
- <div>时间:${renderTime}</div>
|
|
|
|
|
- </div>`,
|
|
|
|
|
|
|
+ type: showItem.title,
|
|
|
|
|
+ device: showItem.cameraCode,
|
|
|
|
|
+ place: renderPlace,
|
|
|
|
|
+ time: renderTime,
|
|
|
onClick: () => {
|
|
onClick: () => {
|
|
|
- // 这里打开问题列表
|
|
|
|
|
|
|
+ questionListStore.setState({
|
|
|
|
|
+ type: 'all',
|
|
|
|
|
+ workshopCodes: WORKSHOP_INFOS.map((item) => item.workshopCode),
|
|
|
|
|
+ });
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ questionListStore.openList();
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
onAutoClear(item) {
|
|
onAutoClear(item) {
|
|
@@ -42,7 +50,6 @@ const useViolationRealtimeCompany = () => {
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
emitter.on('showNotice', showNotice);
|
|
emitter.on('showNotice', showNotice);
|
|
|
|
|
|
|
|
const getViolationsRealtime = () => {
|
|
const getViolationsRealtime = () => {
|