feat: 添加权限查询和管理机制
- 新增权限管理页面 - 改进轮询链,引入权限查询 - 支持订阅权限变更或轮询权限检测变更 - 应用权限到页面和组件
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
import { initStationAlarms, initStationDevices, syncCameraApi, syncNvrChannelsApi, type Station } from '@/apis';
|
||||
import { AlarmDetailModal, DeviceDetailModal, DeviceParamConfigModal, IcmpExportModal, RecordCheckExportModal, StationCard, type StationCardProps } from '@/components';
|
||||
import { useBatchActions, useLineDevicesQuery } from '@/composables';
|
||||
import { useAlarmStore, useDeviceStore, useSettingStore, useStationStore } from '@/stores';
|
||||
import { useAlarmStore, useDeviceStore, usePermissionStore, useSettingStore } from '@/stores';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { objectEntries, useElementSize } from '@vueuse/core';
|
||||
import { useElementSize } from '@vueuse/core';
|
||||
import { isCancel } from 'axios';
|
||||
import { NButton, NButtonGroup, NCheckbox, NFlex, NGrid, NGridItem, NScrollbar } from 'naive-ui';
|
||||
import { storeToRefs } from 'pinia';
|
||||
@@ -13,8 +13,8 @@ import { computed, ref, useTemplateRef } from 'vue';
|
||||
const settingStore = useSettingStore();
|
||||
const { stationGridCols } = storeToRefs(settingStore);
|
||||
|
||||
const stationStore = useStationStore();
|
||||
const { stations } = storeToRefs(stationStore);
|
||||
const permissionStore = usePermissionStore();
|
||||
const stations = computed(() => permissionStore.stations.VIEW ?? []);
|
||||
|
||||
const deviceStore = useDeviceStore();
|
||||
const { lineDevices } = storeToRefs(deviceStore);
|
||||
@@ -42,7 +42,10 @@ const showRecordCheckExportModal = ref(false);
|
||||
|
||||
const abortController = ref(new AbortController());
|
||||
|
||||
const { batchActions, selectedAction, selectableStations, stationSelection, toggleSelectAction, toggleSelectAllStations, confirmAction, cancelAction } = useBatchActions(stations, abortController);
|
||||
const { batchActions, selectedAction, selectableStations, stationSelection, selectionProps, toggleSelectAction, toggleSelectAllStations, confirmAction, cancelAction } = useBatchActions(
|
||||
stations,
|
||||
abortController,
|
||||
);
|
||||
|
||||
const { refetch: refetchLineDevicesQuery } = useLineDevicesQuery();
|
||||
|
||||
@@ -177,12 +180,7 @@ const onClickDetail: StationCardProps['onClickDetail'] = (type, station) => {
|
||||
</template>
|
||||
</NButtonGroup>
|
||||
<template v-if="selectedAction">
|
||||
<NCheckbox
|
||||
label="全选"
|
||||
:disabled="selectableStations.length === 0"
|
||||
:checked="selectableStations.length > 0 && selectableStations.length === objectEntries(stationSelection).filter(([, selected]) => selected).length"
|
||||
@update:checked="toggleSelectAllStations"
|
||||
/>
|
||||
<NCheckbox label="全选" :disabled="selectionProps.disabled" :checked="selectionProps.checked" :indeterminate="selectionProps.indeterminate" @update:checked="toggleSelectAllStations" />
|
||||
<NButton tertiary size="small" type="primary" :focusable="false" :loading="confirming" @click="onClickConfirmAction">确定</NButton>
|
||||
<NButton tertiary size="small" type="tertiary" :focusable="false" @click="cancelAction">取消</NButton>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user