feat: 系统日志板块的交互权限

This commit is contained in:
yangsy
2026-01-13 13:24:15 +08:00
parent 0072407be5
commit 22aafb8da4
2 changed files with 28 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ const callLogTypeOptions: SelectOption[] = [
<script setup lang="ts">
import { exportCallLogApi, pageCallLogApi, type NdmCallLog, type NdmCallLogResultVO, type PageQueryExtra, type Station } from '@/apis';
import { useStationStore } from '@/stores';
import { usePermissionStore } from '@/stores';
import { downloadByData, parseErrorFeedback } from '@/utils';
import { useMutation } from '@tanstack/vue-query';
import { isCancel } from 'axios';
@@ -63,8 +63,11 @@ interface SearchFields extends PageQueryExtra<NdmCallLog> {
createdTime: [string, string];
}
const stationStore = useStationStore();
const { stations, onlineStations } = storeToRefs(stationStore);
const permissionStore = usePermissionStore();
const { permissions } = storeToRefs(permissionStore);
const stations = computed(() => permissionStore.stations.VIEW ?? []);
const onlineStations = computed(() => stations.value.filter((station) => station.online));
const stationSelectOptions = computed(() => {
return stations.value.map<SelectOption>((station) => ({
@@ -74,6 +77,14 @@ const stationSelectOptions = computed(() => {
}));
});
// 权限变化时,需要刷新表格数据
watch(permissions, (newPermissions, oldPermissions) => {
const oldPermissionsJson = JSON.stringify(oldPermissions);
const newPermissionsJson = JSON.stringify(newPermissions);
if (oldPermissionsJson === newPermissionsJson) return;
onClickReset();
});
const searchFields = ref<SearchFields>({
logType_in: [],
createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')],

View File

@@ -29,7 +29,7 @@ const vimpLogTypeOptions: SelectOption[] = [
<script setup lang="ts">
import { exportVimpLogApi, pageVimpLogApi, type NdmVimpLog, type NdmVimpLogResultVO, type PageQueryExtra, type Station } from '@/apis';
import { useStationStore } from '@/stores';
import { usePermissionStore } from '@/stores';
import { downloadByData, parseErrorFeedback } from '@/utils';
import { useMutation } from '@tanstack/vue-query';
import { isCancel } from 'axios';
@@ -59,8 +59,11 @@ interface SearchFields extends PageQueryExtra<NdmVimpLog> {
createdTime: [string, string];
}
const stationStore = useStationStore();
const { stations, onlineStations } = storeToRefs(stationStore);
const permissionStore = usePermissionStore();
const { permissions } = storeToRefs(permissionStore);
const stations = computed(() => permissionStore.stations.VIEW ?? []);
const onlineStations = computed(() => stations.value.filter((station) => station.online));
const stationSelectOptions = computed(() => {
return stations.value.map<SelectOption>((station) => ({
@@ -70,6 +73,14 @@ const stationSelectOptions = computed(() => {
}));
});
// 权限变化时,需要刷新表格数据
watch(permissions, (newPermissions, oldPermissions) => {
const oldPermissionsJson = JSON.stringify(oldPermissions);
const newPermissionsJson = JSON.stringify(newPermissions);
if (oldPermissionsJson === newPermissionsJson) return;
onClickReset();
});
const searchFields = ref<SearchFields>({
logType_in: [],
createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')] as [string, string],