修复轮询资源无法开窗的BUG,添加轮询资源删除协议

This commit is contained in:
fangxiang 2022-02-25 16:30:12 +08:00
parent cd968f9cbe
commit e65352d757
5 changed files with 170 additions and 103 deletions

View File

@ -365,6 +365,26 @@ export default class ClientConnection {
} }
} }
public async deletePollingGroup(uuid: string) {
try {
return await this.doRpc<Protocol.DeletePollingGroupResponseEntity>(
new Protocol.DeletePollingGroupRequestEntity(0, uuid)
);
} catch (e) {
console.error(e);
}
}
public async deletePolling(uuid: string) {
try {
return await this.doRpc<Protocol.DeletePollingResponseEntity>(
new Protocol.DeletePollingRequestEntity(0, uuid)
);
} catch (e) {
console.error(e);
}
}
public async getCurrentRunningPlan() { public async getCurrentRunningPlan() {
try { try {
return await this.doRpc<Protocol.GetCurrentRunningPlanResponseEntity>( return await this.doRpc<Protocol.GetCurrentRunningPlanResponseEntity>(

View File

@ -80,7 +80,7 @@
clickable clickable
v-ripple v-ripple
v-close-popup v-close-popup
v-if="prop.node.item_data" v-if="prop.node.item_data && false"
@click=" @click="
() => () =>
(prop.node.is_group (prop.node.is_group
@ -176,30 +176,30 @@ export default defineComponent({
is_group: boolean, is_group: boolean,
uuid: string uuid: string
) { ) {
// let success = false; let success = false;
// if (is_group) { if (is_group) {
// let response = await GlobalData.getInstance() let response = await GlobalData.getInstance()
// .getCurrentClient() .getCurrentClient()
// ?.deletePlanGroup(uuid); ?.deletePollingGroup(uuid);
// if (response) { if (response) {
// success = response.success; success = response.success;
// } }
// } else { } else {
// let response = await GlobalData.getInstance() let response = await GlobalData.getInstance()
// .getCurrentClient() .getCurrentClient()
// ?.deletePlan(uuid); ?.deletePolling(uuid);
// if (response) { if (response) {
// success = response.success; success = response.success;
// } }
// } }
// $q.notify({ $q.notify({
// color: success ? "positive" : "negative", color: success ? "positive" : "negative",
// icon: success ? "done" : "warning", icon: success ? "done" : "warning",
// message: message:
// $t.t("delete") + (success ? $t.t("success") : $t.t("fail")) + "!", $t.t("delete") + (success ? $t.t("success") : $t.t("fail")) + "!",
// position: "top", position: "top",
// timeout: 1500, timeout: 1500,
// }); });
}, },
onDragStart(e: DragEvent, node: PollingTreeItemEntity) { onDragStart(e: DragEvent, node: PollingTreeItemEntity) {
e.dataTransfer?.setData("uuid", node.uuid); e.dataTransfer?.setData("uuid", node.uuid);

View File

@ -5,7 +5,7 @@
<q-item <q-item
class="full-width" class="full-width"
clickable clickable
:draggable="!prop.node.is_group" :draggable="!prop.node.is_group && !prop.node.local_file_flag"
@dragstart="(evt) => onDragStart(evt, prop.node)" @dragstart="(evt) => onDragStart(evt, prop.node)"
@click=" @click="
$store.commit( $store.commit(

View File

@ -1146,6 +1146,45 @@ export namespace Protocol {
} }
} }
export class DeletePollingGroupRequestEntity extends Protocol.PacketEntity {
uuid = "";
constructor(rcp_id?: number, uuid?: string) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcDeletePollingGroup;
this.uuid = uuid ?? "";
}
}
export class DeletePollingGroupResponseEntity extends Protocol.PacketEntity {
success = false;
constructor() {
super();
this.command = Protocol.Commands.kRpcDeletePollingGroup;
}
}
export class DeletePollingRequestEntity extends Protocol.PacketEntity {
uuid: string = "";
constructor(rcp_id?: number, uuid?: string) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcDeletePolling;
this.uuid = uuid ?? "";
}
}
export class DeletePollingResponseEntity extends Protocol.PacketEntity {
success = false;
constructor() {
super();
this.command = Protocol.Commands.kRpcDeletePolling;
}
}
export class AddPlanRequestEntity extends Protocol.PacketEntity { export class AddPlanRequestEntity extends Protocol.PacketEntity {
entity: PlanEntity = new PlanEntity(); entity: PlanEntity = new PlanEntity();
constructor(rcp_id?: number, entity?: PlanEntity) { constructor(rcp_id?: number, entity?: PlanEntity) {

View File

@ -663,90 +663,98 @@ export default defineComponent({
(item) => (item as any)?.uuid == uuid (item) => (item as any)?.uuid == uuid
); );
if (signal_sources.length) { {
const signal_source = signal_sources[0]; const dom: HTMLElement | null = e.target as HTMLElement;
if (signal_source) { if (wall.value && dom) {
const dom: HTMLElement | null = e.target as HTMLElement; if (dom.classList.contains("wall_item_flag")) {
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 x = dom.offsetLeft / wall.value.clientWidth; const width = dom.offsetWidth / wall.value.clientWidth;
const y = dom.offsetTop / wall.value.clientHeight; const height = dom.offsetHeight / wall.value.clientHeight;
const width = dom.offsetWidth / wall.value.clientWidth; console.log(type);
const height = dom.offsetHeight / wall.value.clientHeight; switch (type) {
switch (type) { case "polling":
case "polling": GlobalData.getInstance()
GlobalData.getInstance() .getCurrentClient()
.getCurrentClient() ?.openPolling(
?.openPolling( new Protocol.OpenPollingRequestEntity(
new Protocol.OpenPollingRequestEntity( uuid,
uuid, x,
x, y,
y, width,
width, height
height )
) );
); break;
break; case "signal_source" /**OpenPollingRequestEntity */:
case "signal_source" /**OpenPollingRequestEntity */: if (signal_sources.length) {
GlobalData.getInstance() const signal_source = signal_sources[0];
.getCurrentClient() if (signal_source) {
?.openWindow( GlobalData.getInstance()
new Protocol.OpenWindowRequestEntity( .getCurrentClient()
signal_source.uuid, ?.openWindow(
x, new Protocol.OpenWindowRequestEntity(
y, signal_source.uuid,
width, x,
height y,
) width,
); height
break; )
} );
} else if (dom.classList.contains("window_flag")) { }
// }
const rep_uuid = dom.getAttribute("uuid"); break;
if (rep_uuid) { }
let window = $store.state.windows.find( } else if (dom.classList.contains("window_flag")) {
(item) => item.uuid == rep_uuid //
); const rep_uuid = dom.getAttribute("uuid");
if (window) { if (rep_uuid) {
let client = GlobalData.getInstance().getCurrentClient(); let window = $store.state.windows.find(
if (client) { (item) => item.uuid == rep_uuid
let x = window.x; );
let y = window.y; if (window) {
let width = window.width; let client = GlobalData.getInstance().getCurrentClient();
let height = window.height; if (client) {
let x = window.x;
let y = window.y;
let width = window.width;
let height = window.height;
client.closeWindow(window.window_id); client.closeWindow(window.window_id);
setTimeout(() => { setTimeout(() => {
switch (type) { switch (type) {
case "polling": case "polling":
GlobalData.getInstance() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.openPolling( ?.openPolling(
new Protocol.OpenPollingRequestEntity( new Protocol.OpenPollingRequestEntity(
uuid, uuid,
x,
y,
width,
height
)
);
break;
case "signal_source":
client?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x, x,
y, y,
width, width,
height height
) )
); );
break; break;
} case "signal_source":
}, 100); 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);
} }
} }
} }