diff --git a/src/utils/zmq.ts b/src/utils/zmq.ts index 8de081a..c97b1b3 100644 --- a/src/utils/zmq.ts +++ b/src/utils/zmq.ts @@ -14,6 +14,12 @@ export enum WorkerCMD { SET_TIMEOUT } +export enum ZmqMsgResultType { + SUCCESS = 200, + PROGRESS = 1002, + ERROR = 1003, +} + export enum ZmqCMD { MSG, diff --git a/src/views/stationData/components/offTransferDlg.vue b/src/views/stationData/components/offTransferDlg.vue index cea133a..8f82164 100644 --- a/src/views/stationData/components/offTransferDlg.vue +++ b/src/views/stationData/components/offTransferDlg.vue @@ -23,7 +23,7 @@ const message = useMessage() const emit = defineEmits<{ - 'on-save': [msg: PublishMsg<'import'>, site: IOfflineDevice] + 'on-save': [msg: PublishMsg<'import'>[], site: IOfflineDevice[]] }>() const props = defineProps<{ @@ -36,41 +36,48 @@ const fromData = { clientIp: '', } -const curOffDeive = ref() +const curOffDeive = ref([]) const form = ref(cloneDeep(fromData)) +const isBatchTransfer = ref(false) - -function open(item: IOfflineDevice) { +function open(item: IOfflineDevice[], isBatch: boolean = false) { curOffDeive.value = item visible.value = true + isBatchTransfer.value = isBatch } function onSave() { if (verifyData()) return - if (!curOffDeive.value) { + if (!curOffDeive.value.length) { message.error('请选择设备') return } - const params = [ - `${form.value.clientIp}`, - '', - '', - '', - '', - '', - `${props.siteInfo!.name}/${curOffDeive.value.sn}`, - ] - const msg = getPubInitData<'import'>('import', params) - emit('on-save', msg, curOffDeive.value) + const msgList: PublishMsg<"import">[] = [] + for (const device of curOffDeive.value) { + const params = [ + `${form.value.clientIp}`, + '', + '', + '', + '', + '', + `${props.siteInfo!.name}/${device.sn}`, + ] + const msg = getPubInitData<'import'>('import', params) + msgList.push(msg) + } + + emit('on-save', msgList, curOffDeive.value) close() } function close() { form.value = cloneDeep(fromData) - curOffDeive.value = undefined + curOffDeive.value = [] visible.value = false + isBatchTransfer.value = false } const ipPattern = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ diff --git a/src/views/stationData/index.vue b/src/views/stationData/index.vue index d0420d1..d1c474d 100644 --- a/src/views/stationData/index.vue +++ b/src/views/stationData/index.vue @@ -110,9 +110,6 @@ function onSiteDetails(site: ISite) { }) } -const isSiteTransfer = ref(false) -const transferLoading = ref(false) - const siteList = ref([]) async function loadSiteList() { const res = await getSiteList() diff --git a/src/views/stationData/transferData.vue b/src/views/stationData/transferData.vue index 148641f..0b0fc4d 100644 --- a/src/views/stationData/transferData.vue +++ b/src/views/stationData/transferData.vue @@ -12,12 +12,13 @@
- +
@@ -29,11 +30,11 @@
- + - + @@ -46,9 +47,9 @@
-