diff --git a/src/api/bulletins.ts b/src/api/bulletins.ts index 0a04211..5e24402 100644 --- a/src/api/bulletins.ts +++ b/src/api/bulletins.ts @@ -1,6 +1,7 @@ import axios from 'axios'; export interface BulletinsRecord { + id?: number; title?: string; state?: number[]; top?: boolean; @@ -13,7 +14,6 @@ export interface BulletinsRecord { } export interface BulletinsList extends BulletinsRecord{ - id?: number; remark: string; createBy: string; content: string; diff --git a/src/hooks/pagination.ts b/src/hooks/pagination.ts index 026b82f..27ffdf3 100644 --- a/src/hooks/pagination.ts +++ b/src/hooks/pagination.ts @@ -1,16 +1,24 @@ +import { ref } from 'vue'; export default function usePagination(initValue = false) { - const pagination: any = { + interface Pagination { + page: number; + size: number; + current: number; + total: number; + } + + const pagination = ref({ page: 1, size: 10, current: 1, total: 0, - }; - const setPagination = (value: any) => { - pagination.page = value.page; - pagination.size = value.size; - pagination.current = value.current; - pagination.total = value.total; + }); + const setPagination = (value: Pagination) => { + pagination.value.page = value.page; + pagination.value.size = value.size; + pagination.value.current = value.current; + pagination.value.total = value.total; }; return { pagination, diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 9261385..254e20c 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -307,21 +307,21 @@ // 查询 const search = () => { fetchData({ - ...pagination, + ...pagination.value, ...formModel.value, } as unknown as DeviceRecord); }; // 分页发生改变 const onPageChange = (current: number) => { - pagination.page = current; - pagination.current = current; + pagination.value.page = current; + pagination.value.current = current; search(); }; // 数据条数改变 const onSizeChange = (Size: number) => { - pagination.size = Size; + pagination.value.size = Size; search(); }; @@ -338,7 +338,7 @@ params: {id} }).href; router.push(url); - }; + } // 删除 const handleDelete = async (id: number) => { diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue index 3414fe2..0ba1724 100644 --- a/src/views/iot/product/index.vue +++ b/src/views/iot/product/index.vue @@ -317,21 +317,21 @@ // 查询 const search = () => { fetchData({ - ...pagination, + ...pagination.value, ...formModel.value, } as unknown as ProductRecord); }; // 分页发生改变 const onPageChange = (current: number) => { - pagination.page = current; - pagination.current = current; + pagination.value.page = current; + pagination.value.current = current; search(); }; // 数据条数改变 const onSizeChange = (Size: number) => { - pagination.size = Size; + pagination.value.size = Size; search(); }; @@ -348,7 +348,7 @@ params: {id} }).href; router.push(url); - }; + } // 打开物模型 function openTsl(id:number): void{ @@ -357,7 +357,7 @@ params: {id} }).href; router.push(url); - }; + } // 删除 const handleDelete = async (id: number) => { diff --git a/src/views/notification/bulletin/index.vue b/src/views/notification/bulletin/index.vue index cb428ff..33ff281 100644 --- a/src/views/notification/bulletin/index.vue +++ b/src/views/notification/bulletin/index.vue @@ -365,7 +365,7 @@ // 查询 const search = () => { fetchData({ - ...pagination, + ...pagination.value, ...formModel.value, } as unknown as BulletinsRecord); selectedIds.value = []; @@ -373,8 +373,8 @@ // 分页发生改变 const onPageChange = (current: number) => { - pagination.page = current; - pagination.current = current; + pagination.value.page = current; + pagination.value.current = current; search(); }; // 时间范围 @@ -387,7 +387,7 @@ // 数据条数改变 const onSizeChange = (Size: number) => { - pagination.size = Size; + pagination.value.size = Size; search(); }; @@ -421,7 +421,7 @@ params: {id} }).href; router.push(url); - }; + } // 发布公告 const publishBulletin = async (data:number[]) => { diff --git a/src/views/notification/notice/components/message-edit.vue b/src/views/notification/notice/components/message-edit.vue index 57bbfa5..5887cce 100644 --- a/src/views/notification/notice/components/message-edit.vue +++ b/src/views/notification/notice/components/message-edit.vue @@ -38,6 +38,20 @@ @click="queryDeptTree" /> + + + (); const formData = ref({ + sms: false, + email: false, ...props.prem, }); const messageStore = useMessageStore(); @@ -291,6 +305,16 @@ ]); const selectedDepartmentMembers: any = ref([]); const renderData = ref([]); + const messageType = computed(() => [ + { + label: '消息', + value: 'MESSAGE', + }, + { + label: '通知', + value: 'NOTICE', + }, + ]); // 获取部门树 const getDeptTree = async () => { const res = await getAllDeptTree(1); @@ -395,6 +419,7 @@ if (!valid) { // 新增 if (props.isCreate) { + formData.value.html = true; // formData.value.username = formData.value.email; const res = await messageStore.createMessage(formData.value); if (res.status === 200) { diff --git a/src/views/notification/notice/index.vue b/src/views/notification/notice/index.vue index ab2a9ad..43e3162 100644 --- a/src/views/notification/notice/index.vue +++ b/src/views/notification/notice/index.vue @@ -251,7 +251,7 @@ // 查询 const search = () => { fetchData({ - ...pagination, + ...pagination.value, ...formModel.value, } as unknown as MessageRecord); selectedIds.value = []; @@ -259,9 +259,7 @@ // 分页发生改变 const onPageChange = (current: number) => { - setPagination({ - current, - }); + pagination.value.current = current; search(); }; // 时间范围 @@ -274,9 +272,7 @@ // 数据条数改变 const onSizeChange = (size: number) => { - setPagination({ - size, - }) + pagination.value.size = size; search(); }; diff --git a/src/views/user/bulletin-card/components/card-wrap.vue b/src/views/user/bulletin-card/components/card-wrap.vue index c3b7271..73eb930 100644 --- a/src/views/user/bulletin-card/components/card-wrap.vue +++ b/src/views/user/bulletin-card/components/card-wrap.vue @@ -7,6 +7,9 @@ + +
+ + + + + +
+
{ fetchData({ - ...pagination, + ...pagination.value, ...formModel.value, } as unknown as BulletinsRecord); }; // 分页发生改变 const onPageChange = (current: number) => { - setPagination({ - current, - }) + pagination.value.current = current; search(); }; // 数据条数改变 const onSizeChange = (total: number) => { - pagination.total = total; + pagination.value.total = total; + console.log(pagination.value.total); search(); }; @@ -193,7 +212,7 @@ }; - \ No newline at end of file diff --git a/src/views/user/bulletins/index.vue b/src/views/user/bulletins/index.vue index 8482a10..e9af925 100644 --- a/src/views/user/bulletins/index.vue +++ b/src/views/user/bulletins/index.vue @@ -78,7 +78,6 @@ :style="highlightRow" style="margin-bottom: 40px" :filter-icon-align-left="alignLeft" - @change="handleSortChange" @page-change="onPageChange" >