添加轮询、预案内容时自动弹窗列表框
This commit is contained in:
parent
7ff2e48b84
commit
cf98b9ba08
|
@ -0,0 +1,37 @@
|
||||||
|
export interface ShowProupParam {
|
||||||
|
refs: any;
|
||||||
|
ref_name: string;
|
||||||
|
delay: number;
|
||||||
|
count: number;
|
||||||
|
max_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TableAddRowHelper {
|
||||||
|
private timer_handler: any = null;
|
||||||
|
|
||||||
|
showProup(param: ShowProupParam) {
|
||||||
|
if (this.timer_handler) {
|
||||||
|
clearTimeout(this.timer_handler);
|
||||||
|
this.timer_handler = null;
|
||||||
|
}
|
||||||
|
this.show_proup(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private show_proup = (param: ShowProupParam) => {
|
||||||
|
this.timer_handler = setTimeout(() => {
|
||||||
|
param.count += param.delay;
|
||||||
|
if (param.count > param.max_count) {
|
||||||
|
console.log("errrrrrrrrr");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (param.refs) {
|
||||||
|
const dom = param.refs[param.ref_name];
|
||||||
|
if (dom) {
|
||||||
|
dom.show();
|
||||||
|
} else {
|
||||||
|
this.show_proup(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, param.delay);
|
||||||
|
};
|
||||||
|
}
|
|
@ -146,7 +146,10 @@
|
||||||
{{ props.pageIndex + 1 }}
|
{{ props.pageIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="props.col.name == 'uuid'" class="fit">
|
<div v-else-if="props.col.name == 'uuid'" class="fit">
|
||||||
<q-popup-edit ref="popup_edit" v-model="props.row.uuid">
|
<q-popup-edit
|
||||||
|
:ref="'popup_edit' + props.pageIndex"
|
||||||
|
v-model="props.row.uuid"
|
||||||
|
>
|
||||||
<q-tree
|
<q-tree
|
||||||
ref="tree"
|
ref="tree"
|
||||||
:nodes="$store.state.mode_tree"
|
:nodes="$store.state.mode_tree"
|
||||||
|
@ -161,7 +164,9 @@
|
||||||
@click="
|
@click="
|
||||||
(evt) => {
|
(evt) => {
|
||||||
props.row.uuid = prop.node.item_data.uuid;
|
props.row.uuid = prop.node.item_data.uuid;
|
||||||
$refs.popup_edit.hide();
|
$refs[
|
||||||
|
'popup_edit' + props.pageIndex
|
||||||
|
]?.hide();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:style="{
|
:style="{
|
||||||
|
@ -343,7 +348,7 @@
|
||||||
no-caps
|
no-caps
|
||||||
:label="$t('add row')"
|
:label="$t('add row')"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="addRow"
|
@click="addRow(false)"
|
||||||
/>
|
/>
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-btn
|
<q-btn
|
||||||
|
@ -376,7 +381,12 @@
|
||||||
/></q-item-section>
|
/></q-item-section>
|
||||||
<q-item-section>{{ $t("delete row") }}</q-item-section>
|
<q-item-section>{{ $t("delete row") }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable v-close-popup @click="(evt) => addRow()">
|
<q-item
|
||||||
|
v-if="false"
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="(evt) => addRow(true)"
|
||||||
|
>
|
||||||
<q-item-section avatar><q-icon name="add" /></q-item-section>
|
<q-item-section avatar><q-icon name="add" /></q-item-section>
|
||||||
<q-item-section>{{ $t("add row") }}</q-item-section>
|
<q-item-section>{{ $t("add row") }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
@ -406,14 +416,18 @@ import { useI18n } from "vue-i18n";
|
||||||
import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity";
|
import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity";
|
||||||
import { PlanEntity } from "src/entities/PlanEntity";
|
import { PlanEntity } from "src/entities/PlanEntity";
|
||||||
import { EWeekDays } from "src/entities/EWeekDays";
|
import { EWeekDays } from "src/entities/EWeekDays";
|
||||||
|
import { TableAddRowHelper } from "src/common/TableAddRowHelper";
|
||||||
|
|
||||||
const __MIN_DELAY = 10;
|
const __MIN_DELAY = 10;
|
||||||
|
const __DEFAULT_DELAY = 60;
|
||||||
|
|
||||||
class TableRow {
|
class TableRow {
|
||||||
uuid = "";
|
uuid = "";
|
||||||
delay = __MIN_DELAY;
|
delay = __MIN_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const table_add_row_helper = new TableAddRowHelper();
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentPlanDialog",
|
name: "ComponentPlanDialog",
|
||||||
|
|
||||||
|
@ -729,13 +743,19 @@ export default defineComponent({
|
||||||
addRow(insert_flag: boolean = false) {
|
addRow(insert_flag: boolean = false) {
|
||||||
const item = {
|
const item = {
|
||||||
uuid: GlobalData.getInstance().modes[0].uuid,
|
uuid: GlobalData.getInstance().modes[0].uuid,
|
||||||
delay: __MIN_DELAY,
|
delay: __DEFAULT_DELAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (insert_flag) {
|
if (insert_flag) {
|
||||||
datas.value.splice(current_index + 1, 0, item);
|
datas.value.splice(current_index + 1, 0, item);
|
||||||
} else {
|
} else {
|
||||||
datas.value.push(item);
|
datas.value.push(item);
|
||||||
|
table_add_row_helper.showProup({
|
||||||
|
refs: (<any>this).$refs,
|
||||||
|
ref_name: "popup_edit" + (datas.value.length - 1),
|
||||||
|
delay: 5,
|
||||||
|
count: 0,
|
||||||
|
max_count: 5000,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onContextMenu(
|
onContextMenu(
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
:rows-per-page-options="[0]"
|
:rows-per-page-options="[0]"
|
||||||
:virtual-scroll-sticky-size-start="48"
|
:virtual-scroll-sticky-size-start="48"
|
||||||
@row-contextmenu="onContextMenu"
|
@row-contextmenu="onContextMenu"
|
||||||
|
ref="polling_table"
|
||||||
>
|
>
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
<q-inner-loading showing color="primary" />
|
<q-inner-loading showing color="primary" />
|
||||||
|
@ -82,7 +83,10 @@
|
||||||
{{ props.pageIndex + 1 }}
|
{{ props.pageIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="props.col.name == 'uuid'" class="fit">
|
<div v-else-if="props.col.name == 'uuid'" class="fit">
|
||||||
<q-popup-edit ref="popup_edit" v-model="props.row.uuid">
|
<q-popup-edit
|
||||||
|
:ref="'popup_edit' + props.pageIndex"
|
||||||
|
v-model="props.row.uuid"
|
||||||
|
>
|
||||||
<q-tree
|
<q-tree
|
||||||
ref="tree"
|
ref="tree"
|
||||||
:nodes="$store.state.signal_source_tree"
|
:nodes="$store.state.signal_source_tree"
|
||||||
|
@ -97,7 +101,9 @@
|
||||||
@click="
|
@click="
|
||||||
(evt) => {
|
(evt) => {
|
||||||
props.row.uuid = prop.node.uuid;
|
props.row.uuid = prop.node.uuid;
|
||||||
$refs.popup_edit.hide();
|
$refs[
|
||||||
|
'popup_edit' + props.pageIndex
|
||||||
|
]?.hide();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:style="{
|
:style="{
|
||||||
|
@ -221,7 +227,12 @@
|
||||||
/></q-item-section>
|
/></q-item-section>
|
||||||
<q-item-section>{{ $t("delete row") }}</q-item-section>
|
<q-item-section>{{ $t("delete row") }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable v-close-popup @click="(evt) => addRow(true)">
|
<q-item
|
||||||
|
v-if="false"
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="(evt) => addRow(true)"
|
||||||
|
>
|
||||||
<q-item-section avatar><q-icon name="add" /></q-item-section>
|
<q-item-section avatar><q-icon name="add" /></q-item-section>
|
||||||
<q-item-section>{{ $t("add row") }}</q-item-section>
|
<q-item-section>{{ $t("add row") }}</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
@ -250,14 +261,18 @@ import { useQuasar } from "quasar";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity";
|
import { StringKeyValueEntity } from "src/entities/StringKeyValueEntity";
|
||||||
import { Common } from "src/common/Common";
|
import { Common } from "src/common/Common";
|
||||||
|
import { TableAddRowHelper } from "src/common/TableAddRowHelper";
|
||||||
|
|
||||||
const __MIN_DELAY = 10;
|
const __MIN_DELAY = 10;
|
||||||
|
const __DEFAULT_DELAY = 60;
|
||||||
|
|
||||||
class TableRow {
|
class TableRow {
|
||||||
uuid = "";
|
uuid = "";
|
||||||
delay = __MIN_DELAY;
|
delay = __MIN_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const table_add_row_helper = new TableAddRowHelper();
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentPollingSettingDialog",
|
name: "ComponentPollingSettingDialog",
|
||||||
|
|
||||||
|
@ -269,6 +284,8 @@ export default defineComponent({
|
||||||
const min_delay = ref(__MIN_DELAY);
|
const min_delay = ref(__MIN_DELAY);
|
||||||
let show_dialog = ref(false);
|
let show_dialog = ref(false);
|
||||||
|
|
||||||
|
const polling_table: Ref<any> = ref(null);
|
||||||
|
|
||||||
let loading = ref(false);
|
let loading = ref(false);
|
||||||
let datas: Ref<TableRow[]> = ref([]);
|
let datas: Ref<TableRow[]> = ref([]);
|
||||||
let signals = ref(GlobalData.getInstance().signal_source);
|
let signals = ref(GlobalData.getInstance().signal_source);
|
||||||
|
@ -307,6 +324,7 @@ export default defineComponent({
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show_dialog,
|
show_dialog,
|
||||||
|
polling_table,
|
||||||
min_delay,
|
min_delay,
|
||||||
loading,
|
loading,
|
||||||
datas,
|
datas,
|
||||||
|
@ -380,12 +398,20 @@ export default defineComponent({
|
||||||
addRow(insert_flag: boolean = false) {
|
addRow(insert_flag: boolean = false) {
|
||||||
const item = {
|
const item = {
|
||||||
uuid: GlobalData.getInstance().signal_source[0].uuid,
|
uuid: GlobalData.getInstance().signal_source[0].uuid,
|
||||||
delay: __MIN_DELAY,
|
delay: __DEFAULT_DELAY,
|
||||||
};
|
};
|
||||||
if (insert_flag) {
|
if (insert_flag) {
|
||||||
datas.value.splice(current_index + 1, 0, item);
|
datas.value.splice(current_index + 1, 0, item);
|
||||||
|
(<any>this).$refs["popup_edit" + current_index]?.show();
|
||||||
} else {
|
} else {
|
||||||
datas.value.push(item);
|
datas.value.push(item);
|
||||||
|
table_add_row_helper.showProup({
|
||||||
|
refs: (<any>this).$refs,
|
||||||
|
ref_name: "popup_edit" + (datas.value.length - 1),
|
||||||
|
delay: 5,
|
||||||
|
count: 0,
|
||||||
|
max_count: 5000,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
signals.value = GlobalData.getInstance().signal_source;
|
signals.value = GlobalData.getInstance().signal_source;
|
||||||
|
|
Loading…
Reference in New Issue