fix(station-page): keep polling when open modal
This commit is contained in:
@@ -10,12 +10,11 @@ import {
|
||||
type StationAlarmCounts,
|
||||
} from '@/apis';
|
||||
import { AlarmType, DeviceType, DeviceTypeCode, DeviceTypeName, FaultLevel, type DeviceTypeVal } from '@/enums';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { downloadByData } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCol, NDataTable, NModal, NRow, NSpace, NStatistic, NTag, type DataTableColumns, type DataTableProps, type DataTableRowData, type PaginationProps } from 'naive-ui';
|
||||
import { computed, h, reactive, ref, toRefs, watch } from 'vue';
|
||||
import { computed, h, reactive, ref, toRefs } from 'vue';
|
||||
import { renderAlarmDateCell, renderDeviceTypeCell, renderAlarmTypeCell, renderFaultLevelCell } from '../helper';
|
||||
|
||||
interface Props {
|
||||
@@ -27,17 +26,6 @@ const props = defineProps<Props>();
|
||||
const { station, stationAlarmCounts } = toRefs(props);
|
||||
const show = defineModel<boolean>('show', { required: true, default: false });
|
||||
|
||||
watch(show, (newValue) => {
|
||||
const queryControlStore = useQueryControlStore();
|
||||
if (newValue) {
|
||||
console.log('对话框打开,停止轮询');
|
||||
queryControlStore.disablePolling();
|
||||
} else {
|
||||
console.log('对话框关闭,开启轮询');
|
||||
queryControlStore.enablePolling();
|
||||
}
|
||||
});
|
||||
|
||||
const alarmCount = computed(() => stationAlarmCounts.value?.unclassified ?? 0);
|
||||
|
||||
const classifiedAlarmCounts = computed(() => {
|
||||
|
||||
@@ -69,10 +69,9 @@ const getItemSuffix = (name: string) => {
|
||||
|
||||
<script setup lang="ts">
|
||||
import { postDefParameterPage, putDefParameter, type Station } from '@/apis';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { NForm, NFormItemGi, NGrid, NInputNumber, NModal, NTabPane, NTabs, NTimePicker, NSpin, NFlex } from 'naive-ui';
|
||||
import { ref, toRefs, watch } from 'vue';
|
||||
import { ref, toRefs } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
station?: Station;
|
||||
@@ -80,18 +79,6 @@ const props = defineProps<{
|
||||
const { station } = toRefs(props);
|
||||
const show = defineModel<boolean>('show', { required: true });
|
||||
|
||||
const queryControlStore = useQueryControlStore();
|
||||
|
||||
watch(show, (newValue) => {
|
||||
if (newValue) {
|
||||
console.log('对话框打开,停止轮询');
|
||||
queryControlStore.disablePolling();
|
||||
} else {
|
||||
console.log('对话框关闭,开启轮询');
|
||||
queryControlStore.enablePolling();
|
||||
}
|
||||
});
|
||||
|
||||
const tabPanes = [
|
||||
{
|
||||
tab: '交换机阈值',
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceVO, Station, StationDevices } from '@/apis';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { NButton, NCol, NInput, NModal, NRow, NStatistic, NTree, type TreeOption, type TreeOverrideNodeClickBehavior, type TreeProps } from 'naive-ui';
|
||||
import { computed, h, ref, toRefs, watch } from 'vue';
|
||||
import { computed, h, ref, toRefs } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
interface Props {
|
||||
@@ -18,18 +17,6 @@ const show = defineModel<boolean>('show', { required: true, default: false });
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const queryControlStore = useQueryControlStore();
|
||||
|
||||
watch(show, (newValue) => {
|
||||
if (newValue) {
|
||||
console.log('对话框打开,停止轮询');
|
||||
queryControlStore.disablePolling();
|
||||
} else {
|
||||
console.log('对话框关闭,开启轮询');
|
||||
queryControlStore.enablePolling();
|
||||
}
|
||||
});
|
||||
|
||||
const searchPattern = ref('');
|
||||
const searchFilter: (pattern: string, node: TreeOption) => boolean = (pattern, node) => {
|
||||
const device = node['device'] as NdmDeviceVO | undefined;
|
||||
@@ -74,7 +61,6 @@ const treeData = computed<TreeOption[]>(() => {
|
||||
size: 'tiny',
|
||||
type: 'info',
|
||||
onClick: () => {
|
||||
queryControlStore.enablePolling();
|
||||
const dev = device as NdmDeviceVO;
|
||||
router.push({
|
||||
path: '/device',
|
||||
@@ -108,7 +94,6 @@ const nodeProps: TreeProps['nodeProps'] = ({ option }) => {
|
||||
return {
|
||||
onDblclick: (payload: MouseEvent) => {
|
||||
payload.stopPropagation();
|
||||
queryControlStore.enablePolling();
|
||||
const device = option['device'] as NdmDeviceVO;
|
||||
router.push({
|
||||
path: '/device',
|
||||
|
||||
Reference in New Issue
Block a user