<template> <!-- 排水防涝子系统 公众服务 评论留言--> <div class="publicContainer"> <!-- 搜索区域 --> <el-form :model="queryParams" ref="queryRef" :inline="true"> <el-form-item label="留言评论标题" prop="title"> <el-input v-model="queryParams.title" placeholder="请输入" clearable @keyup.enter="handleQuery" style="width: 200px" /> </el-form-item> <el-form-item> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <!-- 留言内容区域 --> <div class="rightCon"> <el-table v-loading="tableLoading" :data="tableData" max-height="720"> <el-table-column label="项目名称" prop="projectName" /> <el-table-column label="头像" prop="wechatCoverPhotosFileList"> <template #default="scope"> <ImagePreview :src="scope.row.wechatCoverPhotosFileList.length > 0 ? scope.row.wechatCoverPhotosFileList[0].url : ''" :width="50" :height="50" ></ImagePreview> </template> </el-table-column> <el-table-column label="昵称" prop="nickName" /> <el-table-column label="粉丝id" prop="wechatMiniuserId" /> <el-table-column label="留言时间" prop="createTime" /> <el-table-column label="留言标题" prop="title" /> <el-table-column label="留言内容" prop="desc" show-overflow-tooltip /> <el-table-column label="操作" width="160" class-name="small-padding fixed-width"> <template #default="scope"> <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['floodSys:jing:remove']"> 删除 </el-button> </template> </el-table-column> </el-table> <!-- 分页 --> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getDataList" /> </div> </div> </template> <script setup name="评论留言"> import { projectComList, projectComDel } from '@/api/publicService/index'; const { proxy } = getCurrentInstance(); const tableData = ref([]); const tableLoading = ref(false); const total = ref(0); const queryParams = ref({ pageNum: 1, pageSize: 10, title: '', }); /** 搜索按钮操作 */ function handleQuery() { queryParams.value.pageNum = 1; getDataList(); } /** 重置按钮操作 */ function resetQuery() { proxy.resetForm('queryRef'); handleQuery(); } /** 获取搜索数据列表 */ function getDataList() { tableLoading.value = true; projectComList(queryParams.value).then(response => { tableData.value = response.data; total.value = response.total; tableLoading.value = false; }); } /** 删除按钮操作 */ function handleDelete(row) { const postIds = row.id; proxy.$modal .confirm('是否确认删除该数据项?') .then(function () { return projectComDel(postIds); }) .then(() => { getDataList(); proxy.$modal.msgSuccess('删除成功'); }) .catch(() => {}); } onMounted(() => { getDataList(); }); </script> <style lang="scss" scoped> .publicContainer { .rightCon { height: calc(100vh - 150px); overflow: auto; } } </style>