<template> <!-- 数据服务-数据任务 --> <div class="app-container"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="" prop="noticeType"> <el-select v-model="queryParams.noticeType" placeholder="请选择消息类型"> <el-option v-for="dict in sys_notice_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> </el-select> </el-form-item> <el-form-item label="" prop="readStatus"> <el-select v-model="queryParams.readStatus" placeholder="请选择消息状态"> <el-option v-for="dict in readStatus" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> </el-select> </el-form-item> <el-form-item label="" prop="dateTime"> <dateSelect valueFormat="YYYY-MM-DD" dateType="daterange" :dateTime="queryParams.dateTime" @update="changeTime" ></dateSelect> </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> <el-table v-loading="loading" :data="tableData" border @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" /> <el-table-column label="序号" type="index" width="55" /> <el-table-column label="消息类型" prop="noticeType" width="100"> <template #default="scope"> <dict-tag :options="sys_notice_type" :value="scope.row.noticeType" /> </template> </el-table-column> <el-table-column label="发送时间" prop="createTime" width="180"> </el-table-column> <el-table-column label="消息内容" prop="noticeTitle" show-overflow-tooltip /> <el-table-column label="发送人" prop="createBy" show-overflow-tooltip width="150" /> <el-table-column label="附件" prop="fileInfo"> <template #default="scope"> <span class="pointer" v-divDownLoad="scope.row.fileInfo['url']">{{ scope.row.fileInfo['name'] }}</span> </template> </el-table-column> </el-table> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> </div> </template> <script setup name="dataTask"> import { listNotice } from '@/api/system/notice'; import dateSelect from '@/views/dataAnalysis/components/dateSelect'; //日期组件 const { proxy } = getCurrentInstance(); const readStatus = proxy.fixDict['readStatus']; const { sys_notice_type } = proxy.useDict('sys_notice_status', 'sys_notice_type'); const showSearch = ref(true); const loading = ref(false); const total = ref(0); const tableData = ref([]); const data = reactive({ form: {}, queryParams: { pageNum: 1, pageSize: 10, noticeType: '', readStatus: '', dateTime: [proxy.moment(new Date()).format('YYYY-MM-DD'), proxy.moment(new Date()).add(1, 'days').format('YYYY-MM-DD')], }, }); const { queryParams, form } = toRefs(data); //修改时间 function changeTime(val) { queryParams.value.dateTime = val; } //获取分页数据 function getList() { loading.value = true; let params = proxy.formatAddDateRange(queryParams.value, queryParams.value.dateTime, 'createTimeStart', 'createTimeEnd'); queryParams.value.refType = 'RtuMonitorDataExport'; listNotice(params).then(response => { tableData.value = response.data; total.value = response.total; loading.value = false; }); } /** 搜索按钮操作 */ function handleQuery() { queryParams.value.pageNum = 1; getList(); } /** 重置按钮操作 */ function resetQuery() { proxy.resetForm('queryRef'); handleQuery(); } // 多选框选中数据 function handleSelectionChange(selection) { ids.value = selection.map(item => item.id); single.value = selection.length != 1; multiple.value = !selection.length; } getList(); // 初始化 onMounted(() => {}); </script> <style lang="scss" scoped> .syntherticData { width: 100%; .cell { height: 30px; padding: 3px 0; box-sizing: border-box; } .cell .text { width: 24px; height: 24px; display: block; margin: 0 auto; line-height: 24px; position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; } .cell.current .text { background: #626aef; color: #fff; } .cell .holiday { position: absolute; width: 6px; height: 6px; background: var(--el-color-danger); border-radius: 50%; bottom: 0px; left: 50%; transform: translateX(-50%); } } </style>