feat: 系统日志板块的交互权限
This commit is contained in:
@@ -32,7 +32,7 @@ const callLogTypeOptions: SelectOption[] = [
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { exportCallLogApi, pageCallLogApi, type NdmCallLog, type NdmCallLogResultVO, type PageQueryExtra, type Station } from '@/apis';
|
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 { downloadByData, parseErrorFeedback } from '@/utils';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import { isCancel } from 'axios';
|
import { isCancel } from 'axios';
|
||||||
@@ -63,8 +63,11 @@ interface SearchFields extends PageQueryExtra<NdmCallLog> {
|
|||||||
createdTime: [string, string];
|
createdTime: [string, string];
|
||||||
}
|
}
|
||||||
|
|
||||||
const stationStore = useStationStore();
|
const permissionStore = usePermissionStore();
|
||||||
const { stations, onlineStations } = storeToRefs(stationStore);
|
const { permissions } = storeToRefs(permissionStore);
|
||||||
|
|
||||||
|
const stations = computed(() => permissionStore.stations.VIEW ?? []);
|
||||||
|
const onlineStations = computed(() => stations.value.filter((station) => station.online));
|
||||||
|
|
||||||
const stationSelectOptions = computed(() => {
|
const stationSelectOptions = computed(() => {
|
||||||
return stations.value.map<SelectOption>((station) => ({
|
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>({
|
const searchFields = ref<SearchFields>({
|
||||||
logType_in: [],
|
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')],
|
createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')],
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const vimpLogTypeOptions: SelectOption[] = [
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { exportVimpLogApi, pageVimpLogApi, type NdmVimpLog, type NdmVimpLogResultVO, type PageQueryExtra, type Station } from '@/apis';
|
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 { downloadByData, parseErrorFeedback } from '@/utils';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import { isCancel } from 'axios';
|
import { isCancel } from 'axios';
|
||||||
@@ -59,8 +59,11 @@ interface SearchFields extends PageQueryExtra<NdmVimpLog> {
|
|||||||
createdTime: [string, string];
|
createdTime: [string, string];
|
||||||
}
|
}
|
||||||
|
|
||||||
const stationStore = useStationStore();
|
const permissionStore = usePermissionStore();
|
||||||
const { stations, onlineStations } = storeToRefs(stationStore);
|
const { permissions } = storeToRefs(permissionStore);
|
||||||
|
|
||||||
|
const stations = computed(() => permissionStore.stations.VIEW ?? []);
|
||||||
|
const onlineStations = computed(() => stations.value.filter((station) => station.online));
|
||||||
|
|
||||||
const stationSelectOptions = computed(() => {
|
const stationSelectOptions = computed(() => {
|
||||||
return stations.value.map<SelectOption>((station) => ({
|
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>({
|
const searchFields = ref<SearchFields>({
|
||||||
logType_in: [],
|
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],
|
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],
|
||||||
|
|||||||
Reference in New Issue
Block a user