|
|
@@ -114,17 +114,16 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, onMounted, watch, computed } from 'vue';
|
|
|
+import { reactive, onMounted, watch } from 'vue';
|
|
|
import { Modal, message } from 'ant-design-vue';
|
|
|
import { ExclamationCircleOutlined, ApiOutlined, CopyOutlined, GatewayOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
import Airport from '/@/components/airport/index.vue';
|
|
|
import CreateTaskModal from './components/CreateTaskModal.vue';
|
|
|
import noDataSrc from '/@/assets/icons/no-data.png';
|
|
|
-import { useMyStore } from '/@/store';
|
|
|
import { useFormatTask } from '/@/components/task/use-format-task';
|
|
|
import { apis } from '/@/api/custom';
|
|
|
-import { getDeviceTopo, getUnreadDeviceHms } from '/@/api/manage';
|
|
|
+import { getDeviceTopo } from '/@/api/manage';
|
|
|
import { createPlan } from '/@/api/wayline';
|
|
|
import { getWorkspaceId } from '/@/utils';
|
|
|
import { OnlineDevice, EModeCode } from '/@/types/device';
|
|
|
@@ -163,18 +162,8 @@ watch(() => checkState.checkSnList, val => {
|
|
|
checkState.checkAll = val.length === state.onlineDockList.length;
|
|
|
}, { deep: true });
|
|
|
|
|
|
-const store = useMyStore();
|
|
|
const { formatMediaTaskStatus } = useFormatTask();
|
|
|
|
|
|
-const deviceInfo = computed(() => store.state.deviceState.deviceInfo)
|
|
|
-const dockInfo = computed(() => store.state.deviceState.dockInfo)
|
|
|
-const hmsInfo = computed({
|
|
|
- get: () => store.state.hmsInfo,
|
|
|
- set: (val) => {
|
|
|
- return val
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
const fetchOnlineDock = async () => {
|
|
|
state.onlineDockListLoading = true;
|
|
|
try {
|
|
|
@@ -244,43 +233,11 @@ const fetchList = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function getUnreadHms(sn: string) {
|
|
|
- getUnreadDeviceHms(getWorkspaceId(), sn).then(res => {
|
|
|
- if (res.data.length !== 0) {
|
|
|
- hmsInfo.value[sn] = res.data
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function getOnlineDeviceHms() {
|
|
|
- const snList = Object.keys(dockInfo.value)
|
|
|
- if (snList.length === 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- snList.forEach(sn => {
|
|
|
- getUnreadHms(sn)
|
|
|
- })
|
|
|
- const deviceSnList = Object.keys(deviceInfo.value)
|
|
|
- if (deviceSnList.length === 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- deviceSnList.forEach(sn => {
|
|
|
- getUnreadHms(sn)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
onMounted(async () => {
|
|
|
- await fetchOnlineDock();
|
|
|
- setTimeout(() => {
|
|
|
- watch(() => store.state.deviceStatusEvent, async data => {
|
|
|
- await fetchOnlineDock()
|
|
|
- if (data.deviceOnline.sn) {
|
|
|
- getUnreadHms(data.deviceOnline.sn)
|
|
|
- }
|
|
|
- }, { deep: true })
|
|
|
- getOnlineDeviceHms()
|
|
|
- }, 500)// 默认3秒,此时改成0.5秒
|
|
|
- await fetchList();
|
|
|
+ await Promise.all([
|
|
|
+ fetchOnlineDock(),
|
|
|
+ fetchList(),
|
|
|
+ ])
|
|
|
});
|
|
|
|
|
|
// 全选
|