|
|
@@ -67,9 +67,9 @@
|
|
|
<a-tooltip title="复制任务">
|
|
|
<CopyOutlined style="margin-right: 10px;" />
|
|
|
</a-tooltip>
|
|
|
- <!-- <a-tooltip title="查看轨迹">
|
|
|
+ <a-tooltip title="查看轨迹" v-if="false">
|
|
|
<GatewayOutlined style="margin-right: 10px;" />
|
|
|
- </a-tooltip> -->
|
|
|
+ </a-tooltip>
|
|
|
<a-tooltip title="删除">
|
|
|
<DeleteOutlined @click="onClickDelete(record.job_id, record.job_name)" />
|
|
|
</a-tooltip>
|
|
|
@@ -81,14 +81,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, onMounted } from 'vue';
|
|
|
+import { reactive, onMounted, watch, computed } from 'vue';
|
|
|
import { Modal, message } from 'ant-design-vue';
|
|
|
import { CopyOutlined, GatewayOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
import Airport from '/@/components/airport/index.vue'
|
|
|
+import { useMyStore } from '/@/store';
|
|
|
import { useFormatTask } from '/@/components/task/use-format-task'
|
|
|
import { apis } from '/@/api/custom';
|
|
|
-import { OnlineDevice } from '/@/types/device'
|
|
|
+import { getDeviceTopo, getUnreadDeviceHms } from '/@/api/manage';
|
|
|
+import { getWorkspaceId } from '/@/utils';
|
|
|
+import { OnlineDevice, EModeCode } from '/@/types/device'
|
|
|
+import { EDeviceTypeName } from '/@/types'
|
|
|
|
|
|
interface State {
|
|
|
onlineDockList: OnlineDevice[],
|
|
|
@@ -104,16 +108,55 @@ const state: State = reactive({
|
|
|
list: [],
|
|
|
});
|
|
|
|
|
|
-const { formatMediaTaskStatus } = useFormatTask()
|
|
|
+const store = useMyStore();
|
|
|
+const { formatMediaTaskStatus } = useFormatTask();
|
|
|
|
|
|
-const paginationConfig = reactive({
|
|
|
- pageSizeOptions: ['20', '50', '100'],
|
|
|
- showQuickJumper: true,
|
|
|
- showSizeChanger: true,
|
|
|
- pageSize: 20,
|
|
|
- current: 1,
|
|
|
- total: 0
|
|
|
-});
|
|
|
+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 () => {
|
|
|
+ const res = await getDeviceTopo(getWorkspaceId());
|
|
|
+ if (res.code !== 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const list = state.onlineDockList;
|
|
|
+ res.data.forEach((gateway: any) => {
|
|
|
+ const child = gateway.children
|
|
|
+ const device: OnlineDevice = {
|
|
|
+ model: child?.device_name,
|
|
|
+ callsign: child?.nickname,
|
|
|
+ sn: child?.device_sn,
|
|
|
+ mode: EModeCode.Disconnected,
|
|
|
+ gateway: {
|
|
|
+ model: gateway?.device_name,
|
|
|
+ callsign: gateway?.nickname,
|
|
|
+ sn: gateway?.device_sn,
|
|
|
+ domain: gateway?.domain
|
|
|
+ },
|
|
|
+ payload: []
|
|
|
+ }
|
|
|
+ child?.payloads_list.forEach((payload: any) => {
|
|
|
+ device.payload.push({
|
|
|
+ index: payload.index,
|
|
|
+ model: payload.model,
|
|
|
+ payload_name: payload.payload_name,
|
|
|
+ payload_sn: payload.payload_sn,
|
|
|
+ control_source: payload.control_source,
|
|
|
+ payload_index: payload.payload_index
|
|
|
+ })
|
|
|
+ })
|
|
|
+ if (EDeviceTypeName.Dock === gateway.domain) {
|
|
|
+ list.push(device)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.onlineDockList = list;
|
|
|
+}
|
|
|
|
|
|
const fetchList = async () => {
|
|
|
state.listLoading = true;
|
|
|
@@ -136,10 +179,56 @@ 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()
|
|
|
+ }, 3000)
|
|
|
await fetchList();
|
|
|
});
|
|
|
|
|
|
+const paginationConfig = reactive({
|
|
|
+ pageSizeOptions: ['20', '50', '100'],
|
|
|
+ showQuickJumper: true,
|
|
|
+ showSizeChanger: true,
|
|
|
+ pageSize: 20,
|
|
|
+ current: 1,
|
|
|
+ total: 0
|
|
|
+});
|
|
|
+
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '计划|实际时间',
|
|
|
@@ -266,6 +355,7 @@ const onClickDelete = (id: string, name: string) => {
|
|
|
&-left {
|
|
|
width: 240px;
|
|
|
height: calc(100vh - 146px);
|
|
|
+ padding: 20px 15px;
|
|
|
background-color: #232323;
|
|
|
margin-right: 20px;
|
|
|
}
|