修复pad端预案运行时还能开窗的BUG并添加相应提示

This commit is contained in:
fangxiang 2022-04-22 14:45:44 +08:00
parent 9b68fa58a5
commit 40a1705c07
3 changed files with 161 additions and 138 deletions

View File

@ -476,4 +476,5 @@ export default {
"the current browser does not support full screen": "当前浏览器不支持全屏", "the current browser does not support full screen": "当前浏览器不支持全屏",
_SOFT_PAD_LOGIN_TITLE_: "软件管理平台", _SOFT_PAD_LOGIN_TITLE_: "软件管理平台",
welcome: "欢迎", welcome: "欢迎",
"plan running! can't open window!": "预案正在运行!不能开窗!",
}; };

View File

@ -608,160 +608,172 @@ export default defineComponent({
} }
const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => { const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => {
if (evt && evt.data) { if (!plan_running.value) {
// const x = if (evt && evt.data) {
// evt.pos.x - // const x =
// (wall.value.parentElement?.offsetLeft ?? 0) - // evt.pos.x -
// wall_content.value.offsetLeft; // (wall.value.parentElement?.offsetLeft ?? 0) -
// const y = // wall_content.value.offsetLeft;
// evt.pos.y - // const y =
// (wall.value.parentElement?.offsetTop ?? 0) - // evt.pos.y -
// wall_content.value.offsetTop; // (wall.value.parentElement?.offsetTop ?? 0) -
// wall_content.value.offsetTop;
let dom = document.elementFromPoint( let dom = document.elementFromPoint(
evt.pos.x, evt.pos.x,
evt.pos.y evt.pos.y
) as HTMLElement; ) as HTMLElement;
const signal_sources = GlobalData.getInstance().signal_source.filter( const signal_sources = GlobalData.getInstance().signal_source.filter(
(item) => (item as any)?.uuid == evt.data.uuid (item) => (item as any)?.uuid == evt.data.uuid
); );
// //
if (dom) { if (dom) {
const temp = find_parent_dom(dom, ["wall_item_flag", "window_flag"]); const temp = find_parent_dom(dom, [
if (temp) { "wall_item_flag",
dom = temp; "window_flag",
} ]);
} if (temp) {
dom = temp;
if (dom) {
if (dom.classList.contains("wall_item_flag")) {
//
// 1
const x = dom.offsetLeft / wall_content.value.clientWidth;
const y = dom.offsetTop / wall_content.value.clientHeight;
const width = dom.offsetWidth / wall_content.value.clientWidth;
const height = dom.offsetHeight / wall_content.value.clientHeight;
switch (evt.type) {
case "polling":
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(
new Protocol.OpenPollingRequestEntity(
evt.data.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); if (dom) {
const open_window_request = if (dom.classList.contains("wall_item_flag")) {
new Protocol.OpenPollingRequestEntity( //
evt.data.uuid, // 1
x, const x = dom.offsetLeft / wall_content.value.clientWidth;
y, const y = dom.offsetTop / wall_content.value.clientHeight;
width, const width = dom.offsetWidth / wall_content.value.clientWidth;
height const height = dom.offsetHeight / wall_content.value.clientHeight;
switch (evt.type) {
case "polling":
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(
new Protocol.OpenPollingRequestEntity(
evt.data.uuid,
x,
y,
width,
height
)
); );
open_window_request.muted = window.muted; break;
open_window_request.volume = window.volume; case "signal_source" /**OpenPollingRequestEntity */:
open_window_request.paused = window.paused; if (signal_sources.length) {
open_window_request.play_speed = window.play_speed; const signal_source = signal_sources[0];
if (signal_source) {
setTimeout(() => { GlobalData.getInstance()
if (!window) { .getCurrentClient()
return; ?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
)
);
} }
switch (evt.type) { }
case "polling": break;
{ }
const open_polling_request = } else if (dom.classList.contains("window_flag")) {
new Protocol.OpenPollingRequestEntity( //
evt.data.uuid, const rep_uuid = dom.getAttribute("uuid");
x, if (rep_uuid) {
y, let window = $store.state.windows.find(
width, (item) => item.uuid == rep_uuid
height );
); if (window) {
open_polling_request.muted = window.muted; let client = GlobalData.getInstance().getCurrentClient();
open_polling_request.volume = window.volume; if (client) {
open_polling_request.paused = window.paused; let x = window.x;
open_polling_request.play_speed = window.play_speed; let y = window.y;
GlobalData.getInstance() let width = window.width;
.getCurrentClient() let height = window.height;
?.openPolling(open_polling_request);
}
break; client.closeWindow(window.window_id);
case "signal_source": const open_window_request =
{ new Protocol.OpenPollingRequestEntity(
if (signal_sources.length) { evt.data.uuid,
const signal_source = signal_sources[0]; x,
if (signal_source) { y,
const open_window_request = width,
new Protocol.OpenWindowRequestEntity( height
signal_source.uuid, );
x, open_window_request.muted = window.muted;
y, open_window_request.volume = window.volume;
width, open_window_request.paused = window.paused;
height open_window_request.play_speed = window.play_speed;
);
open_window_request.muted = window.muted; setTimeout(() => {
open_window_request.volume = window.volume; if (!window) {
open_window_request.paused = window.paused; return;
open_window_request.play_speed = }
window.play_speed; switch (evt.type) {
client?.openWindow(open_window_request); case "polling":
{
const open_polling_request =
new Protocol.OpenPollingRequestEntity(
evt.data.uuid,
x,
y,
width,
height
);
open_polling_request.muted = window.muted;
open_polling_request.volume = window.volume;
open_polling_request.paused = window.paused;
open_polling_request.play_speed = window.play_speed;
GlobalData.getInstance()
.getCurrentClient()
?.openPolling(open_polling_request);
}
break;
case "signal_source":
{
if (signal_sources.length) {
const signal_source = signal_sources[0];
if (signal_source) {
const open_window_request =
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
x,
y,
width,
height
);
open_window_request.muted = window.muted;
open_window_request.volume = window.volume;
open_window_request.paused = window.paused;
open_window_request.play_speed =
window.play_speed;
client?.openWindow(open_window_request);
}
} }
} }
}
break; break;
} }
}, 50); }, 50);
}
} }
} }
} }
} }
} }
} else {
$q.notify({
type: "warning",
message: $t.t("plan running! can't open window!"),
position: "top",
timeout: 1500,
});
} }
}; };

View File

@ -708,6 +708,16 @@ export default defineComponent({
target.classList.remove("drag-enter"); target.classList.remove("drag-enter");
} }
if (plan_running.value) {
$q.notify({
type: "warning",
message: $t.t("plan running! can't open window!"),
position: "top",
timeout: 1500,
});
return;
}
const type = e.dataTransfer?.getData("type"); const type = e.dataTransfer?.getData("type");
const uuid = e.dataTransfer?.getData("uuid"); const uuid = e.dataTransfer?.getData("uuid");
if (uuid && uuid.length > 0 && type && type.length > 0) { if (uuid && uuid.length > 0 && type && type.length > 0) {