From e65352d757b69ae11a002154cbac7b273ca2a980 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 25 Feb 2022 16:30:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AE=E8=AF=A2=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=97=A0=E6=B3=95=E5=BC=80=E7=AA=97=E7=9A=84BUG,?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=AE=E8=AF=A2=E8=B5=84=E6=BA=90=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 20 ++++ src/components/PollingTree.vue | 50 ++++----- src/components/SignalSourceTree.vue | 2 +- src/entities/WSProtocol.ts | 39 +++++++ src/pages/WallPage.vue | 162 +++++++++++++++------------- 5 files changed, 170 insertions(+), 103 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index a81ebc3..10d2443 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -365,6 +365,26 @@ export default class ClientConnection { } } + public async deletePollingGroup(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeletePollingGroupRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + + public async deletePolling(uuid: string) { + try { + return await this.doRpc( + new Protocol.DeletePollingRequestEntity(0, uuid) + ); + } catch (e) { + console.error(e); + } + } + public async getCurrentRunningPlan() { try { return await this.doRpc( diff --git a/src/components/PollingTree.vue b/src/components/PollingTree.vue index 2a57aa5..0ec63c9 100644 --- a/src/components/PollingTree.vue +++ b/src/components/PollingTree.vue @@ -80,7 +80,7 @@ clickable v-ripple v-close-popup - v-if="prop.node.item_data" + v-if="prop.node.item_data && false" @click=" () => (prop.node.is_group @@ -176,30 +176,30 @@ export default defineComponent({ is_group: boolean, uuid: string ) { - // let success = false; - // if (is_group) { - // let response = await GlobalData.getInstance() - // .getCurrentClient() - // ?.deletePlanGroup(uuid); - // if (response) { - // success = response.success; - // } - // } else { - // let response = await GlobalData.getInstance() - // .getCurrentClient() - // ?.deletePlan(uuid); - // if (response) { - // success = response.success; - // } - // } - // $q.notify({ - // color: success ? "positive" : "negative", - // icon: success ? "done" : "warning", - // message: - // $t.t("delete") + (success ? $t.t("success") : $t.t("fail")) + "!", - // position: "top", - // timeout: 1500, - // }); + let success = false; + if (is_group) { + let response = await GlobalData.getInstance() + .getCurrentClient() + ?.deletePollingGroup(uuid); + if (response) { + success = response.success; + } + } else { + let response = await GlobalData.getInstance() + .getCurrentClient() + ?.deletePolling(uuid); + if (response) { + success = response.success; + } + } + $q.notify({ + color: success ? "positive" : "negative", + icon: success ? "done" : "warning", + message: + $t.t("delete") + (success ? $t.t("success") : $t.t("fail")) + "!", + position: "top", + timeout: 1500, + }); }, onDragStart(e: DragEvent, node: PollingTreeItemEntity) { e.dataTransfer?.setData("uuid", node.uuid); diff --git a/src/components/SignalSourceTree.vue b/src/components/SignalSourceTree.vue index cdc423d..192bb10 100644 --- a/src/components/SignalSourceTree.vue +++ b/src/components/SignalSourceTree.vue @@ -5,7 +5,7 @@ (item as any)?.uuid == uuid ); - if (signal_sources.length) { - const signal_source = signal_sources[0]; - if (signal_source) { - const dom: HTMLElement | null = e.target as HTMLElement; - if (wall.value && dom) { - if (dom.classList.contains("wall_item_flag")) { - // 开窗 - const x = dom.offsetLeft / wall.value.clientWidth; - const y = dom.offsetTop / wall.value.clientHeight; - const width = dom.offsetWidth / wall.value.clientWidth; - const height = dom.offsetHeight / wall.value.clientHeight; - switch (type) { - case "polling": - GlobalData.getInstance() - .getCurrentClient() - ?.openPolling( - new Protocol.OpenPollingRequestEntity( - uuid, - x, - y, - width, - height - ) - ); - break; - case "signal_source" /**OpenPollingRequestEntity */: - GlobalData.getInstance() - .getCurrentClient() - ?.openWindow( - new Protocol.OpenWindowRequestEntity( - signal_source.uuid, - x, - y, - width, - height - ) - ); - break; - } - } else if (dom.classList.contains("window_flag")) { - // 替换窗口 - const rep_uuid = dom.getAttribute("uuid"); - if (rep_uuid) { - let window = $store.state.windows.find( - (item) => item.uuid == rep_uuid - ); - if (window) { - let client = GlobalData.getInstance().getCurrentClient(); - if (client) { - let x = window.x; - let y = window.y; - let width = window.width; - let height = window.height; + { + const dom: HTMLElement | null = e.target as HTMLElement; + if (wall.value && dom) { + if (dom.classList.contains("wall_item_flag")) { + // 开窗 + const x = dom.offsetLeft / wall.value.clientWidth; + const y = dom.offsetTop / wall.value.clientHeight; + const width = dom.offsetWidth / wall.value.clientWidth; + const height = dom.offsetHeight / wall.value.clientHeight; + console.log(type); + switch (type) { + case "polling": + GlobalData.getInstance() + .getCurrentClient() + ?.openPolling( + new Protocol.OpenPollingRequestEntity( + uuid, + x, + y, + width, + height + ) + ); + break; + case "signal_source" /**OpenPollingRequestEntity */: + if (signal_sources.length) { + const signal_source = signal_sources[0]; + if (signal_source) { + GlobalData.getInstance() + .getCurrentClient() + ?.openWindow( + new Protocol.OpenWindowRequestEntity( + signal_source.uuid, + x, + y, + width, + height + ) + ); + } + } + break; + } + } else if (dom.classList.contains("window_flag")) { + // 替换窗口 + const rep_uuid = dom.getAttribute("uuid"); + if (rep_uuid) { + let window = $store.state.windows.find( + (item) => item.uuid == rep_uuid + ); + if (window) { + let client = GlobalData.getInstance().getCurrentClient(); + if (client) { + let x = window.x; + let y = window.y; + let width = window.width; + let height = window.height; - client.closeWindow(window.window_id); - setTimeout(() => { - switch (type) { - case "polling": - GlobalData.getInstance() - .getCurrentClient() - ?.openPolling( - new Protocol.OpenPollingRequestEntity( - uuid, - x, - y, - width, - height - ) - ); - break; - case "signal_source": - client?.openWindow( - new Protocol.OpenWindowRequestEntity( - signal_source.uuid, + client.closeWindow(window.window_id); + setTimeout(() => { + switch (type) { + case "polling": + GlobalData.getInstance() + .getCurrentClient() + ?.openPolling( + new Protocol.OpenPollingRequestEntity( + uuid, x, y, width, height ) ); - break; - } - }, 100); - } + break; + case "signal_source": + if (signal_sources.length) { + const signal_source = signal_sources[0]; + if (signal_source) { + client?.openWindow( + new Protocol.OpenWindowRequestEntity( + signal_source.uuid, + x, + y, + width, + height + ) + ); + } + } + break; + } + }, 100); } } }