添加执行预案时,禁止窗口操作的功能

This commit is contained in:
fangxiang 2022-02-12 12:23:36 +08:00
parent 65886030b9
commit 0702704e0a
7 changed files with 59 additions and 58 deletions

View File

@ -81,6 +81,7 @@ export default class RemoteDataExangeProcesser {
) as Protocol.PlanRunningStateChangeNotifyEntity;
if (temp && temp.plan) {
if (temp.running) {
$store.commit("setCurrentRunningPlan", temp.plan.uuid);
if (this.plan_notify) {
this.plan_notify(void 0);
this.plan_notify = null;
@ -99,6 +100,7 @@ export default class RemoteDataExangeProcesser {
"!",
});
} else {
$store.commit("setCurrentRunningPlan", "");
if (this.plan_notify) {
this.plan_notify(void 0);
this.plan_notify = null;

View File

@ -8,9 +8,13 @@
<template v-slot:default-header="prop">
<q-item
class="full-width"
:disable="$store.state.current_running_plan.trim() != ''"
clickable
@dblclick="
(evt) => !prop.node.is_group && callMode(prop.node.item_data)
(evt) =>
$store.state.current_running_plan.trim() == '' &&
!prop.node.is_group &&
callMode(prop.node.item_data)
"
>
<q-item-section avatar>
@ -131,6 +135,8 @@ import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n";
import { ModeEntity } from "src/entities/ModeEntity";
import EventBus, { EventNamesDefine } from "src/common/EventBus";
import { NotifyMessage } from "src/common/ClientConnection";
import { Protocol } from "src/entities/WSProtocol";
export default defineComponent({
name: "ComponentModeTree",

View File

@ -61,6 +61,25 @@
>
<q-item-section> {{ $t("close all windwos") }} </q-item-section>
</q-item>
<q-item clickable v-if="false">
<q-item-section>{{ $t("trimming window") }}</q-item-section>
<q-item-section side>
<q-icon name="keyboard_arrow_right" />
</q-item-section>
<q-menu anchor="top end" self="top start">
<q-list>
<q-item v-close-popup :disable="$props.disable" clickable>
<q-item-section>{{ $t("trimming window pos") }}</q-item-section>
</q-item>
<q-item v-close-popup :disable="$props.disable" clickable>
<q-item-section>{{
$t("trimming window size")
}}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-item>
<q-item
v-if="false"
clickable
@ -190,6 +209,8 @@ import GlobalData from "src/common/GlobalData";
import { defineComponent, ref, watch, onUnmounted, computed } from "vue";
import { useStore } from "src/store";
import { SignalSourceEntity } from "src/entities/SignalSourceEntity";
import { NotifyMessage } from "src/common/ClientConnection";
import { Protocol } from "src/entities/WSProtocol";
class _Flags {
get up_flag() {
@ -225,6 +246,9 @@ export default defineComponent({
mouse_area_flag: {
type: Boolean,
},
plan_running: {
type: Boolean,
},
},
emits: [
"close_this_window",
@ -284,6 +308,9 @@ export default defineComponent({
}
},
onClick(evt: MouseEvent) {
if (props.plan_running) {
return;
}
if (ctrl_press_flag) {
ctrl_press_flag = false;
return;

View File

@ -1,7 +1,6 @@
<template>
<div
v-show="is_multimedia_window && selected_window"
ref="wall"
class="col full-width"
style="
background-color: #bce0f0;
@ -17,7 +16,7 @@
round
flag
size="lg"
icon="arrow_back"
icon="skip_previous"
:disable="!can_next_prev_window || plan_running"
@click="playPrev"
>
@ -54,7 +53,7 @@
flag
size="lg"
:disable="!can_next_prev_window || plan_running"
icon="arrow_forward"
icon="skip_next"
@click="playNext"
>
<q-tooltip> {{ $t("play next") }}</q-tooltip></q-btn
@ -145,26 +144,8 @@ export default defineComponent({
let can_pause_window = ref(false);
let can_next_prev_window = ref(false);
let plan_running = ref(false);
EventBus.getInstance().on(
EventNamesDefine.NotifyMessage,
(notify: NotifyMessage) => {
if (notify) {
switch (notify.packet.command) {
case Protocol.Commands.kCurrentRunningPlanStateChanged:
{
const temp = JSON.parse(
notify.data
) as Protocol.PlanRunningStateChangeNotifyEntity;
if (temp && temp.plan) {
plan_running.value = temp.running;
}
}
break;
}
}
}
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
watch(

View File

@ -89,6 +89,7 @@
stretch
flat
stack
:disable="plan_running"
icon="vertical_align_top"
:label="$t('top window')"
class="q-mr-sm"
@ -99,6 +100,7 @@
stretch
flat
stack
:disable="plan_running"
icon="vertical_align_bottom"
:label="$t('lower window')"
class="q-mr-sm"
@ -109,6 +111,7 @@
stretch
flat
stack
:disable="plan_running"
icon="close"
:label="$t('close this window')"
class="q-mr-sm"
@ -119,6 +122,7 @@
stretch
flat
stack
:disable="plan_running"
icon="clear_all"
:label="$t('close all windwos')"
class="q-mr-sm"
@ -132,7 +136,7 @@
icon="stop"
:label="$t('stop plan')"
class="q-mr-sm"
v-if="show_stop_plan"
v-if="plan_running"
@click="stopPlan"
/>
@ -227,7 +231,7 @@
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import { defineComponent, ref, computed } from "vue";
import { useStore } from "src/store";
import GridSettingDialog from "src/components/GridSettingDialog.vue";
@ -268,31 +272,14 @@ export default defineComponent({
let $t = useI18n();
let show_advanced_menu = ref(true);
let show_stop_plan = ref(false);
EventBus.getInstance().on(
EventNamesDefine.NotifyMessage,
(notify: NotifyMessage) => {
if (notify) {
switch (notify.packet.command) {
case Protocol.Commands.kCurrentRunningPlanStateChanged:
{
const temp = JSON.parse(
notify.data
) as Protocol.PlanRunningStateChangeNotifyEntity;
if (temp && temp.plan) {
show_stop_plan.value = temp.running;
}
}
break;
}
}
}
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
return {
show_advanced_menu,
show_stop_plan,
plan_running,
async backupDB() {
let client = GlobalData.getInstance().getCurrentClient();

View File

@ -50,10 +50,11 @@
:id="'window_' + item.window_id"
:uuid="item.uuid"
:disable="plan_running"
class="window fit"
:mouse_area_flag="area_open_window_flag"
:signal_source_table_uuid="item.signal_source_table_uuid"
:window="item"
:plan_running="plan_running"
class="window fit"
>
</window>
</vue3-resize-drag>
@ -193,7 +194,9 @@ export default defineComponent({
const edit_volume_dialog: Ref<any> = ref(null);
const polling_setting_dialog: Ref<any> = ref(null);
const plan_running = ref(false);
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
const windows = computed({
get: () => $store.state.windows,
@ -560,16 +563,6 @@ export default defineComponent({
}
}
break;
case Protocol.Commands.kCurrentRunningPlanStateChanged:
{
const temp = JSON.parse(
notify.data
) as Protocol.PlanRunningStateChangeNotifyEntity;
if (temp && temp.plan) {
plan_running.value = temp.running;
}
}
break;
}
} catch {}
}

View File

@ -44,6 +44,7 @@ export interface StateInterface {
fan_temp: number;
selected_window: string;
selected_signal_source: string;
current_running_plan: string;
}
// provide typings for `this.$store`
@ -277,6 +278,7 @@ export default store(function (/* { ssrContext } */) {
selected_window: "",
selected_signal_source:
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
current_running_plan: "",
},
mutations: {
@ -722,6 +724,9 @@ export default store(function (/* { ssrContext } */) {
setSelectedSignalSource(state: StateInterface, playload?: any) {
state.selected_signal_source = playload;
},
setCurrentRunningPlan(state: StateInterface, playload?: any) {
state.current_running_plan = playload;
},
},
// enable strict mode (adds overhead!)