1.修改手表监测来通知,更新页面数据
This commit is contained in:
2025-04-27 15:24:55 +08:00
parent 48a137133d
commit fd02cf131a
2 changed files with 39 additions and 11 deletions
@@ -40,6 +40,7 @@
<TerminalAlarm <TerminalAlarm
:refreshState="refreshState" :refreshState="refreshState"
:setting="setting" :setting="setting"
:socketData="socketData"
:set-inter="true" :set-inter="true"
:show-statistics="true" :show-statistics="true"
:time-interval="getTimeInterval()" :time-interval="getTimeInterval()"
@@ -28,21 +28,21 @@
<div> <div>
<div> <div>
日累计 日累计
<span>{{ 0 }}</span> <span>{{ dayInfo?.dayCount || 0 }}</span>
</div> </div>
</div> </div>
<div> <div>
<div> <div>
周累计 周累计
<span>{{ 0 }}</span> <span>{{ dayInfo?.weekCount || 0 }}</span>
</div> </div>
</div> </div>
<div> <div>
<div> <div>
月累计 月累计
<span>{{ 0 }}</span> <span>{{ dayInfo?.monthCount || 0 }}</span>
</div> </div>
</div> </div>
@@ -113,7 +113,7 @@
import PublicTitle from '/@/components/publicTitle.vue'; import PublicTitle from '/@/components/publicTitle.vue';
import Dialog from '/@/components/dialog/Dialog.vue'; import Dialog from '/@/components/dialog/Dialog.vue';
import { Vue3SeamlessScroll } from 'vue3-seamless-scroll'; import { Vue3SeamlessScroll } from 'vue3-seamless-scroll';
import { getMonitorList } from '/@/views/centralScreen/centralScreen.api.ts'; import { getMonitorList, monitorTotalApi } from '/@/views/centralScreen/centralScreen.api.ts';
import { Map } from '/@/assets/mapUtils/map.ts'; import { Map } from '/@/assets/mapUtils/map.ts';
import { caching, useSession } from '/@/hooks/autoRefresh/caching.ts'; import { caching, useSession } from '/@/hooks/autoRefresh/caching.ts';
import { DataType } from '/@/utils/settings.ts'; import { DataType } from '/@/utils/settings.ts';
@@ -136,6 +136,10 @@
type: Boolean, type: Boolean,
default: () => false, default: () => false,
}, },
socketData: {
type: Object,
default: () => {},
},
}); });
const { themeType } = useTheme(); const { themeType } = useTheme();
const emit = defineEmits(['emit-view-detail']); const emit = defineEmits(['emit-view-detail']);
@@ -156,10 +160,30 @@
address: '', address: '',
dataValue: '', dataValue: '',
}); });
const dayInfo = ref<any>({});
onMounted(() => { onMounted(() => {
getScrollList(); getScrollList();
// 如果为庆阳应急中心,需调用统计接口
if (props.setInter) {
interval.value = setInterval(() => {
getScrollList();
}, 30000);
getStatic();
}
}); });
function getStatic() {
monitorTotalApi({ orgCodeList: userStore.getCenterInfo?.serviceScope })
.then((res: any) => {
if (res.code === 200) {
dayInfo.value = res?.result;
}
})
.catch((e) => {
console.log(e);
});
}
/** /**
* @desc open员工信息 * @desc open员工信息
*/ */
@@ -184,18 +208,21 @@
const interval = ref<any>(null); const interval = ref<any>(null);
const nowDate = ref(dayjs()); const nowDate = ref(dayjs());
onMounted(() => {
if (props.setInter) {
interval.value = setInterval(() => {
getScrollList();
}, 30000);
}
});
onUnmounted(() => { onUnmounted(() => {
interval.value && clearInterval(interval.value); interval.value && clearInterval(interval.value);
}); });
watch(
() => props.socketData,
(v) => {
console.log(v);
if (props.setInter) {
getStatic();
}
getScrollList();
}
);
async function getScrollList() { async function getScrollList() {
try { try {
let orgCodeList = userStore.getCenterInfo?.serviceScope; let orgCodeList = userStore.getCenterInfo?.serviceScope;