|
|
@@ -0,0 +1,196 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <vab-query-form>
|
|
|
+ <vab-query-form-top-panel>
|
|
|
+ <el-form ref="queryForm" :inline="true" label-width="68px" :model="queryForm" size="small">
|
|
|
+ <el-form-item prop="msgTitle">
|
|
|
+ <el-input
|
|
|
+ v-model="queryForm.msgTitle"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入消息标题"
|
|
|
+ @keyup.enter.native="queryData" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="msgType">
|
|
|
+ <el-select v-model="queryForm.msgType" clearable placeholder="消息类别">
|
|
|
+ <el-option v-for="dict in msgTypeOptions" :key="dict.key" :label="dict.value" :value="dict.key" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button icon="el-icon-search" type="primary" @click="queryData">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </vab-query-form-top-panel>
|
|
|
+ </vab-query-form>
|
|
|
+ <el-table
|
|
|
+ :key="uuid"
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="list"
|
|
|
+ :height="$baseTableHeight(1)"
|
|
|
+ @selection-change="setSelectRows">
|
|
|
+ <el-table-column
|
|
|
+ v-for="(item, index) in columns"
|
|
|
+ :key="index"
|
|
|
+ align="center"
|
|
|
+ :formatter="item.formatter"
|
|
|
+ :label="item.label"
|
|
|
+ :prop="item.prop"
|
|
|
+ :sortable="item.sortable"
|
|
|
+ :width="item.width" />
|
|
|
+ <el-table-column align="center" label="操作" width="85">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="text" @click="handleLook(row)">查看</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ :current-page="queryForm.pageNum"
|
|
|
+ :layout="layout"
|
|
|
+ :page-size="queryForm.pageSize"
|
|
|
+ :total="total"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ @size-change="handleSizeChange" />
|
|
|
+
|
|
|
+ <notice-details ref="notice-details" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import messageApi from '@/api/system/message'
|
|
|
+ import NoticeDetails from './details.vue'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'NoticeHistory',
|
|
|
+ components: { NoticeDetails },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ uuid: '',
|
|
|
+ checkList: [],
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ prop: 'msgType',
|
|
|
+ label: '消息类别',
|
|
|
+ width: 'auto',
|
|
|
+ disableCheck: true,
|
|
|
+ formatter: this.msgTypeFormat,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'msgTitle',
|
|
|
+ label: '消息标题',
|
|
|
+ width: 'auto',
|
|
|
+ disableCheck: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'isRead',
|
|
|
+ label: '已读',
|
|
|
+ width: 'auto',
|
|
|
+ formatter: this.yesOrNoFormat,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'readTime',
|
|
|
+ label: '读取时间',
|
|
|
+ width: 'auto',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ listLoading: false,
|
|
|
+ layout: 'total, sizes, prev, pager, next, jumper',
|
|
|
+ total: 0,
|
|
|
+ selectRows: '',
|
|
|
+ queryForm: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ configName: '',
|
|
|
+ configKey: '',
|
|
|
+ configType: '',
|
|
|
+ },
|
|
|
+ msgTypeOptions: [],
|
|
|
+ msgStatusOptions: [],
|
|
|
+ yesOrNoOptions: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ finallyColumns() {
|
|
|
+ return this.columns.filter((item) => this.checkList.includes(item.label))
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getOptions()
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getOptions() {
|
|
|
+ this.getDicts('sys_msg_type').then((response) => {
|
|
|
+ this.msgTypeOptions = response.data.values || []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 参数系统内置字典翻译
|
|
|
+ msgTypeFormat(row) {
|
|
|
+ return this.selectDictLabel(this.msgTypeOptions, row.msgType)
|
|
|
+ },
|
|
|
+ msgStatusFormat(row) {
|
|
|
+ return this.selectDictLabel(this.msgStatusOptions, row.msgStatus)
|
|
|
+ },
|
|
|
+ yesOrNoFormat(row) {
|
|
|
+ return row.isRead === '20' ? '是' : '否'
|
|
|
+ },
|
|
|
+ setSelectRows(val) {
|
|
|
+ this.selectRows = val
|
|
|
+ },
|
|
|
+ handleLook(row) {
|
|
|
+ this.$refs['notice-details'].open(row.id)
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ if (row.id) {
|
|
|
+ this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
+ const { msg } = await messageApi.doDelete({ ids: [row.id] })
|
|
|
+ this.$baseMessage(msg, 'success')
|
|
|
+ await this.fetchData()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (this.selectRows.length > 0) {
|
|
|
+ const ids = this.selectRows.map((item) => item.id)
|
|
|
+ this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
|
|
+ const { msg } = await messageApi.doDelete({ ids })
|
|
|
+ this.$baseMessage(msg, 'success')
|
|
|
+ await this.fetchData()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$baseMessage('未选中任何行', 'error')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.queryForm.pageSize = val
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.queryForm.pageNum = val
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ queryData() {
|
|
|
+ this.queryForm.pageNum = 1
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ async fetchData() {
|
|
|
+ this.listLoading = true
|
|
|
+ const {
|
|
|
+ data: { list, total },
|
|
|
+ } = await messageApi.getUserHistory(this.queryForm)
|
|
|
+ this.list = list
|
|
|
+ this.total = total
|
|
|
+ this.listLoading = false
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|