From 620c33682327a9d4d0fca84d9590b15a8f185455 Mon Sep 17 00:00:00 2001 From: riverflow <3011499946@qq.com> Date: Sun, 24 Aug 2025 19:56:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpc=E7=AB=AF=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA=E7=94=A8=E6=88=B7=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E7=9A=84bug=20=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=9B=BE=E7=89=87=E5=B1=82=E5=8F=A0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compositions/comment/useCommentTable.ts | 42 ++-- .../src/compositions/order/useOrderTable.ts | 1 + order-system/src/views/comment/Index.vue | 226 +++++++++++++++--- 3 files changed, 219 insertions(+), 50 deletions(-) diff --git a/order-system/src/compositions/comment/useCommentTable.ts b/order-system/src/compositions/comment/useCommentTable.ts index 3c31fb2..ce9a51d 100644 --- a/order-system/src/compositions/comment/useCommentTable.ts +++ b/order-system/src/compositions/comment/useCommentTable.ts @@ -1,65 +1,67 @@ import type { CommentListParm } from "../../api/comment/CommentModel"; -import { reactive ,ref,onMounted,nextTick} from "vue"; -import {getListApi,deleteApi} from '../../api/comment/index' +import { reactive, ref, onMounted, nextTick } from "vue"; +import { getListApi, deleteApi } from '../../api/comment/index' import useInstance from "@/hooks/useInstance"; import { ElMessage } from "element-plus"; -export default function useCommentTable(){ - const {global} = useInstance() +export default function useCommentTable() { + const { global } = useInstance() //表格高度 const tableHeight = ref(0) //接收表格数据 const tableList = ref([]) + //列表查询的参数 const listParm = reactive({ - currentPage:1, - pageSize:10, - total:0 + currentPage: 1, + pageSize: 10, + total: 0 }) //列表 - const getList = async()=>{ + const getList = async () => { let res = await getListApi(listParm) - if(res && res.code == 200){ + if (res && res.code == 200) { tableList.value = res.data.records; listParm.total = res.data.total; } } //删除 - const deleteBtn = async(commentId:string)=>{ + const deleteBtn = async (commentId: string) => { const confirm = await global.$myconfirm('确定删除吗?') - if(confirm){ + if (confirm) { let res = await deleteApi(commentId) - if(res && res.code == 200){ + if (res && res.code == 200) { ElMessage.success(res.msg) getList() } } } //搜索 - const searchBtn = ()=>{ + const searchBtn = () => { getList() } //重置 - const resetBtn = ()=>{ + const resetBtn = () => { listParm.currentPage = 1; getList() } //页容量改变时触发 - const sizeChange = (size:number)=>{ + const sizeChange = (size: number) => { listParm.pageSize = size; getList() } //页数改变触发 - const currentChange = (page:number)=>{ + const currentChange = (page: number) => { listParm.currentPage = page; getList() } - onMounted(()=>{ + onMounted(() => { getList() - nextTick(()=>{ + nextTick(() => { tableHeight.value = window.innerHeight - 180 }) }) - return{ + + return { listParm, getList, searchBtn, @@ -68,6 +70,6 @@ export default function useCommentTable(){ sizeChange, currentChange, tableHeight, - deleteBtn + deleteBtn, } } \ No newline at end of file diff --git a/order-system/src/compositions/order/useOrderTable.ts b/order-system/src/compositions/order/useOrderTable.ts index eae2e98..6c6cace 100644 --- a/order-system/src/compositions/order/useOrderTable.ts +++ b/order-system/src/compositions/order/useOrderTable.ts @@ -86,6 +86,7 @@ export default function useOrderTable() { tableHeight.value = window.innerHeight - 220 }) }) + return { tableList, sendOrder, diff --git a/order-system/src/views/comment/Index.vue b/order-system/src/views/comment/Index.vue index 61336fd..f784850 100644 --- a/order-system/src/views/comment/Index.vue +++ b/order-system/src/views/comment/Index.vue @@ -1,19 +1,30 @@