diff --git a/src/api/system.ts b/src/api/system.ts index 37428b3..290a9f1 100644 --- a/src/api/system.ts +++ b/src/api/system.ts @@ -19,7 +19,7 @@ type ResultDept = { data?: Array; }; -interface SystemNoticeQuery extends BasePageQuery { +export interface SystemNoticeQuery extends BasePageQuery { noticeType: string; noticeTitle: string; creatorName: string; diff --git a/src/utils/common.ts b/src/utils/common.ts new file mode 100644 index 0000000..a90d719 --- /dev/null +++ b/src/utils/common.ts @@ -0,0 +1,55 @@ +import { PaginationProps } from "@pureadmin/table"; +import { Sort } from "element-plus"; + +export class CommonUtils { + static getBeginTimeSafely(timeRange: string[]): string { + if (timeRange == null) { + return undefined; + } + + if (timeRange.length <= 0) { + return undefined; + } + + if (timeRange[0] == null) { + return undefined; + } + + return timeRange[0]; + } + + static getEndTimeSafely(timeRange: string[]): string { + if (timeRange == null) { + return undefined; + } + + if (timeRange.length <= 1) { + return undefined; + } + + if (timeRange[1] == null) { + return undefined; + } + + return timeRange[1]; + } + + static fillPaginationParams( + baseQuery: BasePageQuery, + pagination: PaginationProps + ) { + baseQuery.pageNum = pagination.currentPage; + baseQuery.pageSize = pagination.pageSize; + } + + static fillSortParams(baseQuery: BasePageQuery, sort: Sort) { + if (sort == null) { + return; + } + baseQuery.orderColumn = sort.prop; + baseQuery.orderDirection = sort.order; + } + + // 私有构造函数,防止类被实例化 + private constructor() {} +} diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index e7a3cda..fda1047 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -13,7 +13,7 @@ import Refresh from "@iconify-icons/ep/refresh"; import AddFill from "@iconify-icons/ri/add-circle-line"; import { useUserStoreHook } from "@/store/modules/user"; -/** 组件name最好和菜单表中的router_name一致 */ +/** !!!重要!!! 组件name最好和菜单表中的router_name一致, copy的时候记得更改这个名字*/ defineOptions({ name: "SystemNotice" }); @@ -30,15 +30,13 @@ const { dataList, pagination, defaultSort, + multipleSelection, onSearch, resetForm, openDialog, handleDelete, - handleSizeChange, - handleCurrentChange, - handleSortChange, - handleSelectionChange, - handleBulkDelete + handleBulkDelete, + getNoticeList } = useNoticeHook(); @@ -121,6 +119,7 @@ const {