|
@@ -1,6 +1,11 @@
|
|
|
-import { onMounted, onUnmounted, defineComponent, ref } from 'vue';
|
|
|
+import { onMounted, onUnmounted, defineComponent, ref, watchEffect } from 'vue';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
-import { useCommonStore, useIncidentStore, useMarkerStore } from '@/store';
|
|
|
+import {
|
|
|
+ useCommonStore,
|
|
|
+ useIncidentStore,
|
|
|
+ useMainStore,
|
|
|
+ useMarkerStore,
|
|
|
+} from '@/store';
|
|
|
import IncidentInfoCard from './IncidentInfoCard';
|
|
|
import CommandChainCard from './CommandChainCard';
|
|
|
import EmergencyLinkageCard from './EmergencyLinkageCard';
|
|
@@ -11,6 +16,8 @@ import LiveVideoCard from './LiveVideoCard';
|
|
|
import './index.scss';
|
|
|
import { watch } from 'fs';
|
|
|
import { isEmpty } from 'lodash';
|
|
|
+import isString from 'lodash/isString';
|
|
|
+import { NeedsReadUser, NeedsReadUserName } from '@/api/common';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'IncidentDetail',
|
|
@@ -18,11 +25,51 @@ export default defineComponent({
|
|
|
setup() {
|
|
|
const store = useIncidentStore();
|
|
|
const commonStore = useCommonStore();
|
|
|
+ const mainStore = useMainStore();
|
|
|
const markerStore = useMarkerStore();
|
|
|
const route = useRoute();
|
|
|
|
|
|
const liveVideoRef = ref<HTMLElement>();
|
|
|
|
|
|
+ watchEffect(() => {
|
|
|
+ const messageIDs =
|
|
|
+ store.incidentDetail?.process
|
|
|
+ ?.map((item) => (item.des === '发送消息' ? item.id : null))
|
|
|
+ .filter(isString) ?? [];
|
|
|
+ if (messageIDs.length > 0) {
|
|
|
+ Promise.all(
|
|
|
+ messageIDs.map((id) =>
|
|
|
+ mainStore.getMessage({
|
|
|
+ msType: '2',
|
|
|
+ msSource: '1',
|
|
|
+ msNo: id,
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ).then((rows) => {
|
|
|
+ rows.forEach((message) => {
|
|
|
+ if (message?.[0]) {
|
|
|
+ const m = message[0];
|
|
|
+ const idx = store.incidentDetail.process?.findIndex(
|
|
|
+ (p) => p.id === m.msNo,
|
|
|
+ );
|
|
|
+ if (idx && idx >= 0) {
|
|
|
+ // @ts-ignore
|
|
|
+ store.incidentDetail.process[idx].des =
|
|
|
+ m.msText?.split('事件的')[1] +
|
|
|
+ '++++' +
|
|
|
+ NeedsReadUserName.map((user) => user).join(',');
|
|
|
+ // (m.messageReadInfoList
|
|
|
+ // ?.map((user) =>
|
|
|
+ // user.readState === '0' ? user.userId : null,
|
|
|
+ // )
|
|
|
+ // .filter(isString)) ?? '' ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
commonStore.getGlobalDict('zhdd_incident_type');
|
|
|
commonStore.getGlobalDict('zhdd_incident_source');
|
|
@@ -32,9 +79,6 @@ export default defineComponent({
|
|
|
if (el.target && liveVideoRef.value?.contains(el.target as Node)) {
|
|
|
}
|
|
|
});
|
|
|
- if (isEmpty(store.incidentDetail)) {
|
|
|
- await store.getIncidentItem(route.query.id as string);
|
|
|
- }
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
store.incidentDetail = {};
|