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

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

View File

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

View File

@ -61,6 +61,25 @@
> >
<q-item-section> {{ $t("close all windwos") }} </q-item-section> <q-item-section> {{ $t("close all windwos") }} </q-item-section>
</q-item> </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 <q-item
v-if="false" v-if="false"
clickable clickable
@ -190,6 +209,8 @@ import GlobalData from "src/common/GlobalData";
import { defineComponent, ref, watch, onUnmounted, computed } from "vue"; import { defineComponent, ref, watch, onUnmounted, computed } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { SignalSourceEntity } from "src/entities/SignalSourceEntity"; import { SignalSourceEntity } from "src/entities/SignalSourceEntity";
import { NotifyMessage } from "src/common/ClientConnection";
import { Protocol } from "src/entities/WSProtocol";
class _Flags { class _Flags {
get up_flag() { get up_flag() {
@ -225,6 +246,9 @@ export default defineComponent({
mouse_area_flag: { mouse_area_flag: {
type: Boolean, type: Boolean,
}, },
plan_running: {
type: Boolean,
},
}, },
emits: [ emits: [
"close_this_window", "close_this_window",
@ -284,6 +308,9 @@ export default defineComponent({
} }
}, },
onClick(evt: MouseEvent) { onClick(evt: MouseEvent) {
if (props.plan_running) {
return;
}
if (ctrl_press_flag) { if (ctrl_press_flag) {
ctrl_press_flag = false; ctrl_press_flag = false;
return; return;

View File

@ -1,7 +1,6 @@
<template> <template>
<div <div
v-show="is_multimedia_window && selected_window" v-show="is_multimedia_window && selected_window"
ref="wall"
class="col full-width" class="col full-width"
style=" style="
background-color: #bce0f0; background-color: #bce0f0;
@ -17,7 +16,7 @@
round round
flag flag
size="lg" size="lg"
icon="arrow_back" icon="skip_previous"
:disable="!can_next_prev_window || plan_running" :disable="!can_next_prev_window || plan_running"
@click="playPrev" @click="playPrev"
> >
@ -54,7 +53,7 @@
flag flag
size="lg" size="lg"
:disable="!can_next_prev_window || plan_running" :disable="!can_next_prev_window || plan_running"
icon="arrow_forward" icon="skip_next"
@click="playNext" @click="playNext"
> >
<q-tooltip> {{ $t("play next") }}</q-tooltip></q-btn <q-tooltip> {{ $t("play next") }}</q-tooltip></q-btn
@ -145,26 +144,8 @@ export default defineComponent({
let can_pause_window = ref(false); let can_pause_window = ref(false);
let can_next_prev_window = ref(false); let can_next_prev_window = ref(false);
let plan_running = ref(false); const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
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;
}
}
}
); );
watch( watch(

View File

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

View File

@ -50,10 +50,11 @@
:id="'window_' + item.window_id" :id="'window_' + item.window_id"
:uuid="item.uuid" :uuid="item.uuid"
:disable="plan_running" :disable="plan_running"
class="window fit"
:mouse_area_flag="area_open_window_flag" :mouse_area_flag="area_open_window_flag"
:signal_source_table_uuid="item.signal_source_table_uuid" :signal_source_table_uuid="item.signal_source_table_uuid"
:window="item" :window="item"
:plan_running="plan_running"
class="window fit"
> >
</window> </window>
</vue3-resize-drag> </vue3-resize-drag>
@ -193,7 +194,9 @@ export default defineComponent({
const edit_volume_dialog: Ref<any> = ref(null); const edit_volume_dialog: Ref<any> = ref(null);
const polling_setting_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({ const windows = computed({
get: () => $store.state.windows, get: () => $store.state.windows,
@ -560,16 +563,6 @@ export default defineComponent({
} }
} }
break; 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 {} } catch {}
} }

View File

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