修复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": "当前浏览器不支持全屏",
_SOFT_PAD_LOGIN_TITLE_: "软件管理平台",
welcome: "欢迎",
"plan running! can't open window!": "预案正在运行!不能开窗!",
};

View File

@ -608,160 +608,172 @@ export default defineComponent({
}
const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => {
if (evt && evt.data) {
// const x =
// evt.pos.x -
// (wall.value.parentElement?.offsetLeft ?? 0) -
// wall_content.value.offsetLeft;
// const y =
// evt.pos.y -
// (wall.value.parentElement?.offsetTop ?? 0) -
// wall_content.value.offsetTop;
if (!plan_running.value) {
if (evt && evt.data) {
// const x =
// evt.pos.x -
// (wall.value.parentElement?.offsetLeft ?? 0) -
// wall_content.value.offsetLeft;
// const y =
// evt.pos.y -
// (wall.value.parentElement?.offsetTop ?? 0) -
// wall_content.value.offsetTop;
let dom = document.elementFromPoint(
evt.pos.x,
evt.pos.y
) as HTMLElement;
let dom = document.elementFromPoint(
evt.pos.x,
evt.pos.y
) as HTMLElement;
const signal_sources = GlobalData.getInstance().signal_source.filter(
(item) => (item as any)?.uuid == evt.data.uuid
);
const signal_sources = GlobalData.getInstance().signal_source.filter(
(item) => (item as any)?.uuid == evt.data.uuid
);
//
if (dom) {
const temp = find_parent_dom(dom, ["wall_item_flag", "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;
//
if (dom) {
const temp = find_parent_dom(dom, [
"wall_item_flag",
"window_flag",
]);
if (temp) {
dom = temp;
}
} 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);
const open_window_request =
new Protocol.OpenPollingRequestEntity(
evt.data.uuid,
x,
y,
width,
height
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
)
);
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;
setTimeout(() => {
if (!window) {
return;
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
)
);
}
switch (evt.type) {
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;
}
} 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;
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);
client.closeWindow(window.window_id);
const open_window_request =
new Protocol.OpenPollingRequestEntity(
evt.data.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;
setTimeout(() => {
if (!window) {
return;
}
switch (evt.type) {
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;
}
}, 50);
break;
}
}, 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");
}
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 uuid = e.dataTransfer?.getData("uuid");
if (uuid && uuid.length > 0 && type && type.length > 0) {