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";
// vConsole
// vConsole
{
if (window.location.href.indexOf("__showDebug__=_1025_") != -1) {
new VConsole();

View File

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

View File

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

View File

@ -469,7 +469,7 @@ export default defineComponent({
let uploading = ref(false);
let files = ref(<FileEntity[]>[]);
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 default_path_label = ref($t.t("local disk"));
let default_path = ref("media");
@ -818,6 +818,7 @@ export default defineComponent({
path.value = default_path.value;
status.value = "normal";
upload_url.value = "";
target_dom.value = undefined;
clipboard.clear();
if (resolve) {
resolve(resolve_value);

View File

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

View File

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

View File

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

View File

@ -54,6 +54,11 @@ export interface StateInterface {
selected_signal_source: string;
current_running_plan: string;
connect_list: ConnectTableEntity[];
modes: ModeEntity[];
plans: PlanEntity[];
pollings: PollingEntity[];
signal_sources: SignalSourceEntity[];
}
// provide typings for `this.$store`
@ -295,12 +300,29 @@ export default store(function (/* { ssrContext } */) {
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
current_running_plan: "",
connect_list: [],
modes: [],
plans: [],
pollings: [],
signal_sources: [],
},
mutations: {
setInitialized(state: StateInterface, playload?: any[]) {
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[]) {
if (playload && Array.isArray(playload)) {
for (let item of playload) {