vuex添加信号源,模式,预案,轮询列表。修复文件管理器对话框没显示但是会显示菜单的BUG

This commit is contained in:
fangxiang 2022-04-18 17:08:40 +08:00
parent a1ae3bb395
commit 74abf865fd
10 changed files with 110 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -15,7 +15,7 @@ import { useStore } from "src/store";
import VConsole from "vconsole"; import VConsole from "vconsole";
// vConsole // vConsole
{ {
if (window.location.href.indexOf("__showDebug__=_1025_") != -1) { if (window.location.href.indexOf("__showDebug__=_1025_") != -1) {
new VConsole(); new VConsole();

View File

@ -46,6 +46,10 @@ export default class Initializer {
let response = await this.getSignalSources(); let response = await this.getSignalSources();
if (response) { if (response) {
$store.commit("buildSignalSourceTree", { options, response }); $store.commit("buildSignalSourceTree", { options, response });
$store.commit("setArrayValue", {
name: "signal_sources",
value: response.signal_sources,
});
GlobalData.getInstance().signal_source = response.signal_sources; GlobalData.getInstance().signal_source = response.signal_sources;
} }
} catch (e) { } catch (e) {
@ -63,6 +67,11 @@ export default class Initializer {
let response = await this.getModes(); let response = await this.getModes();
if (response) { if (response) {
$store.commit("buildModeTree", { options, response }); $store.commit("buildModeTree", { options, response });
$store.commit("setArrayValue", {
name: "modes",
value: response.modes,
});
GlobalData.getInstance().modes = response.modes; GlobalData.getInstance().modes = response.modes;
} }
} catch (e) { } catch (e) {
@ -79,6 +88,10 @@ export default class Initializer {
let response = await this.getPlans(); let response = await this.getPlans();
if (response) { if (response) {
$store.commit("buildPlanTree", { options, response }); $store.commit("buildPlanTree", { options, response });
$store.commit("setArrayValue", {
name: "plans",
value: response.plans,
});
GlobalData.getInstance().plans = response.plans; GlobalData.getInstance().plans = response.plans;
} }
} catch (e) { } catch (e) {
@ -95,6 +108,10 @@ export default class Initializer {
let response = await this.getPollings(); let response = await this.getPollings();
if (response) { if (response) {
$store.commit("buildPollingTree", { options, response }); $store.commit("buildPollingTree", { options, response });
$store.commit("setArrayValue", {
name: "pollings",
value: response.pollings,
});
GlobalData.getInstance().pollings = response.pollings; GlobalData.getInstance().pollings = response.pollings;
} }
} catch (e) { } catch (e) {

View File

@ -114,6 +114,10 @@ export default class RemoteDataExangeProcesser {
) as Protocol.ModeAddNotifyEntity; ) as Protocol.ModeAddNotifyEntity;
if (temp) { if (temp) {
GlobalData.getInstance().modes.push(temp.mode); GlobalData.getInstance().modes.push(temp.mode);
$store.commit("setArrayValue", {
name: "modes",
value: GlobalData.getInstance().modes,
});
$store.commit("addModeTreeItem", { $store.commit("addModeTreeItem", {
parent: temp.mode.group_uuid, parent: temp.mode.group_uuid,
is_group: false, is_group: false,
@ -134,6 +138,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().modes.splice(pos, 1); GlobalData.getInstance().modes.splice(pos, 1);
} }
$store.commit("setArrayValue", {
name: "modes",
value: GlobalData.getInstance().modes,
});
$store.commit("deleteModeTreeItem", { $store.commit("deleteModeTreeItem", {
is_group: false, is_group: false,
uuid: temp.uuid, uuid: temp.uuid,
@ -153,6 +161,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().modes[pos] = temp.mode; GlobalData.getInstance().modes[pos] = temp.mode;
} }
$store.commit("setArrayValue", {
name: "modes",
value: GlobalData.getInstance().modes,
});
$store.commit("setModeTreeItem", { $store.commit("setModeTreeItem", {
is_group: false, is_group: false,
item_data: temp.mode, item_data: temp.mode,
@ -207,6 +219,10 @@ export default class RemoteDataExangeProcesser {
) as Protocol.PlanAddNotifyEntity; ) as Protocol.PlanAddNotifyEntity;
if (temp) { if (temp) {
GlobalData.getInstance().plans.push(temp.plan); GlobalData.getInstance().plans.push(temp.plan);
$store.commit("setArrayValue", {
name: "plans",
value: GlobalData.getInstance().plans,
});
$store.commit("addPlanTreeItem", { $store.commit("addPlanTreeItem", {
parent: temp.plan.group_uuid, parent: temp.plan.group_uuid,
is_group: false, is_group: false,
@ -227,6 +243,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().plans.splice(pos, 1); GlobalData.getInstance().plans.splice(pos, 1);
} }
$store.commit("setArrayValue", {
name: "plans",
value: GlobalData.getInstance().plans,
});
$store.commit("deletePlanTreeItem", { $store.commit("deletePlanTreeItem", {
is_group: false, is_group: false,
uuid: temp.uuid, uuid: temp.uuid,
@ -246,6 +266,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().plans[pos] = temp.plan; GlobalData.getInstance().plans[pos] = temp.plan;
} }
$store.commit("setArrayValue", {
name: "plans",
value: GlobalData.getInstance().plans,
});
$store.commit("setPlanTreeItem", { $store.commit("setPlanTreeItem", {
is_group: false, is_group: false,
item_data: temp.plan, item_data: temp.plan,
@ -301,6 +325,10 @@ export default class RemoteDataExangeProcesser {
) as Protocol.PollingAddNotifyEntity; ) as Protocol.PollingAddNotifyEntity;
if (temp) { if (temp) {
GlobalData.getInstance().pollings.push(temp.polling); GlobalData.getInstance().pollings.push(temp.polling);
$store.commit("setArrayValue", {
name: "pollings",
value: GlobalData.getInstance().pollings,
});
$store.commit("addPollingTreeItem", { $store.commit("addPollingTreeItem", {
parent: temp.polling.group_uuid, parent: temp.polling.group_uuid,
is_group: false, is_group: false,
@ -321,6 +349,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().pollings.splice(pos, 1); GlobalData.getInstance().pollings.splice(pos, 1);
} }
$store.commit("setArrayValue", {
name: "pollings",
value: GlobalData.getInstance().pollings,
});
$store.commit("deletePollingTreeItem", { $store.commit("deletePollingTreeItem", {
is_group: false, is_group: false,
uuid: temp.uuid, uuid: temp.uuid,
@ -340,6 +372,10 @@ export default class RemoteDataExangeProcesser {
if (pos != -1) { if (pos != -1) {
GlobalData.getInstance().pollings[pos] = temp.polling; GlobalData.getInstance().pollings[pos] = temp.polling;
} }
$store.commit("setArrayValue", {
name: "pollings",
value: GlobalData.getInstance().pollings,
});
$store.commit("setPollingTreeItem", { $store.commit("setPollingTreeItem", {
is_group: false, is_group: false,
item_data: temp.polling, item_data: temp.polling,
@ -395,6 +431,10 @@ export default class RemoteDataExangeProcesser {
) as Protocol.SignalSourceAddNotifyEntity; ) as Protocol.SignalSourceAddNotifyEntity;
if (temp) { if (temp) {
GlobalData.getInstance().signal_source.push(temp.signal_source); GlobalData.getInstance().signal_source.push(temp.signal_source);
$store.commit("setArrayValue", {
name: "signal_sources",
value: GlobalData.getInstance().signal_source,
});
$store.commit("addSignalSourceTreeItem", { $store.commit("addSignalSourceTreeItem", {
parent: temp.signal_source.group_uuid, parent: temp.signal_source.group_uuid,
is_group: false, is_group: false,
@ -409,6 +449,16 @@ export default class RemoteDataExangeProcesser {
notify.data notify.data
) as Protocol.SignalSourceDeleteNotifyEntity; ) as Protocol.SignalSourceDeleteNotifyEntity;
if (temp) { if (temp) {
let pos = GlobalData.getInstance().signal_source.findIndex(
(element) => element && element.uuid == temp.uuid
);
if (pos != -1) {
GlobalData.getInstance().signal_source.splice(pos, 1);
}
$store.commit("setArrayValue", {
name: "signal_sources",
value: GlobalData.getInstance().signal_source,
});
$store.commit("deleteSignalSourceTreeItem", { $store.commit("deleteSignalSourceTreeItem", {
is_group: false, is_group: false,
uuid: temp.uuid, uuid: temp.uuid,
@ -422,6 +472,17 @@ export default class RemoteDataExangeProcesser {
notify.data notify.data
) as Protocol.SignalSourceEditNotifyEntity; ) as Protocol.SignalSourceEditNotifyEntity;
if (temp) { if (temp) {
let pos = GlobalData.getInstance().signal_source.findIndex(
(element) => element && element.uuid == temp.signal_source.uuid
);
if (pos != -1) {
GlobalData.getInstance().signal_source[pos] =
temp.signal_source;
}
$store.commit("setArrayValue", {
name: "signal_sources",
value: GlobalData.getInstance().signal_source,
});
$store.commit("setSignalSourceTreeItem", { $store.commit("setSignalSourceTreeItem", {
is_group: false, is_group: false,
item_data: temp.signal_source, item_data: temp.signal_source,

View File

@ -469,7 +469,7 @@ export default defineComponent({
let uploading = ref(false); let uploading = ref(false);
let files = ref(<FileEntity[]>[]); let files = ref(<FileEntity[]>[]);
let show_context_menu = ref(false); let show_context_menu = ref(false);
let target_dom: any = ref(document.body.children[0]); let target_dom: any = ref(undefined);
let current_file = ref(new FileEntity()); let current_file = ref(new FileEntity());
let default_path_label = ref($t.t("local disk")); let default_path_label = ref($t.t("local disk"));
let default_path = ref("media"); let default_path = ref("media");
@ -818,6 +818,7 @@ export default defineComponent({
path.value = default_path.value; path.value = default_path.value;
status.value = "normal"; status.value = "normal";
upload_url.value = ""; upload_url.value = "";
target_dom.value = undefined;
clipboard.clear(); clipboard.clear();
if (resolve) { if (resolve) {
resolve(resolve_value); resolve(resolve_value);

View File

@ -33,7 +33,7 @@
:isActive="item.uuid == $store.state.selected_window" :isActive="item.uuid == $store.state.selected_window"
:resizeIconSize="14" :resizeIconSize="14"
:isGuide="true" :isGuide="true"
v-for="(item, index) in windows" v-for="(item, index) of windows"
:key="index" :key="index"
@resizeEndHandler="resizeWindow(item.window_id, $event)" @resizeEndHandler="resizeWindow(item.window_id, $event)"
@moveEndHandler="moveWindow(item.window_id, $event)" @moveEndHandler="moveWindow(item.window_id, $event)"
@ -68,7 +68,7 @@
@touchstart="$store.commit('setSelectedWindow', '')" @touchstart="$store.commit('setSelectedWindow', '')"
> >
<div <div
v-for="row in wall_rows" v-for="row of wall_rows"
:key="row" :key="row"
class="row" class="row"
:style="{ :style="{
@ -77,7 +77,7 @@
> >
<div <div
:ref="'item' + (row - 1) * wall_cols + col" :ref="'item' + (row - 1) * wall_cols + col"
v-for="col in wall_cols" v-for="col of wall_cols"
:key="col" :key="col"
class="col wall_item wall_item_flag" class="col wall_item wall_item_flag"
:style="{ :style="{

View File

@ -37,7 +37,7 @@
<q-list> <q-list>
<div v-if="false"> <div v-if="false">
<div <div
v-for="(item, index) in $store.state.connect_list" v-for="(item, index) of $store.state.connect_list"
:key="index" :key="index"
> >
<q-item clickable v-close-popup @click="changeHost(item)"> <q-item clickable v-close-popup @click="changeHost(item)">

View File

@ -28,7 +28,7 @@
:isActive="item.uuid == $store.state.selected_window" :isActive="item.uuid == $store.state.selected_window"
:resizeIconSize="14" :resizeIconSize="14"
:isGuide="true" :isGuide="true"
v-for="(item, index) in windows" v-for="(item, index) of windows"
:key="index" :key="index"
@resizeEndHandler="resizeWindow(item.window_id, $event)" @resizeEndHandler="resizeWindow(item.window_id, $event)"
@moveEndHandler="moveWindow(item.window_id, $event)" @moveEndHandler="moveWindow(item.window_id, $event)"
@ -63,7 +63,7 @@
</div> </div>
<div ref="wall_grids" @click="onWallGridsClick"> <div ref="wall_grids" @click="onWallGridsClick">
<div <div
v-for="row in wall_rows" v-for="row of wall_rows"
:key="row" :key="row"
class="row" class="row"
:style="{ :style="{
@ -72,7 +72,7 @@
> >
<div <div
:ref="'item' + (row - 1) * wall_cols + col" :ref="'item' + (row - 1) * wall_cols + col"
v-for="col in wall_cols" v-for="col of wall_cols"
:key="col" :key="col"
class="col wall_item wall_item_flag" class="col wall_item wall_item_flag"
:style="{ :style="{

View File

@ -54,6 +54,11 @@ export interface StateInterface {
selected_signal_source: string; selected_signal_source: string;
current_running_plan: string; current_running_plan: string;
connect_list: ConnectTableEntity[]; connect_list: ConnectTableEntity[];
modes: ModeEntity[];
plans: PlanEntity[];
pollings: PollingEntity[];
signal_sources: SignalSourceEntity[];
} }
// provide typings for `this.$store` // provide typings for `this.$store`
@ -295,12 +300,29 @@ export default store(function (/* { ssrContext } */) {
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
current_running_plan: "", current_running_plan: "",
connect_list: [], connect_list: [],
modes: [],
plans: [],
pollings: [],
signal_sources: [],
}, },
mutations: { mutations: {
setInitialized(state: StateInterface, playload?: any[]) { setInitialized(state: StateInterface, playload?: any[]) {
state.initialized = true; state.initialized = true;
}, },
setArrayValue(state: StateInterface, playload?: any) {
if (Array.isArray(playload.value)) {
const arr: Array<any> = (<any>state)[playload.name];
if (arr) {
arr.splice(0, arr.length);
for (const item of playload.value) {
if (item) {
arr.push(item);
}
}
}
}
},
setWindowPropertys(state: StateInterface, playload?: any[]) { setWindowPropertys(state: StateInterface, playload?: any[]) {
if (playload && Array.isArray(playload)) { if (playload && Array.isArray(playload)) {
for (let item of playload) { for (let item of playload) {