<template> <div class="from-clues"> <!-- 表单部分 --> <div class="from-clues-header"> <el-form :model="ruleForm" @submit.native.prevent label-width="80px"> <el-row> <el-col :span="5"> <el-form-item label="通知标题"> <el-input v-model="ruleForm.noticeTitle" @clear="queryClick()" clearable placeholder="通知标题"></el-input> </el-form-item> </el-col> <el-col :span="19" class="btnColRight"> <el-form-item> <el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" native-type="submit" @click="toReadAll()">一键已读</el-button> </el-form-item> </el-col> </el-row> </el-form> </div> <!-- 表格 --> <div class="from-clues-content"> <lb-table :page-size="pageData.size" border :current-page.sync="pageData.current" :total="tableData.total" @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns" :data="tableData.data"> </lb-table> </div> <addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle" /> </div> </template> <script> import table from "@/utils/mixin/table"; import { datas, sendThis } from "./xttzviewdata"; import { getSysNoticeList, setReadStatus, setAllRead } from "@/api/sysNotice.js" import addDialog from "./components/addDialog.vue"; export default { name: "xttzview", components: { addDialog }, mixins: [table], mounted () { sendThis(this); this.queryClick() }, data () { return { isDialog: false, isButtonFlag: true, dialogTitle: '', ruleForm: { noticeTitle: '', noticeStatus: '2' }, tableData: { total: 0, columns: datas.columns(), data: [], }, isDiglog: false } }, methods: { // 列表渲染接口 /** * @description: 列表渲染接口 * @author: renchao */ queryClick () { this.$startLoading() getSysNoticeList({ ...this.ruleForm, ...this.pageData }, { 'target': '#xttzLoading' }).then(res => { if (res.code === 200) { this.$endLoading() let { total, records } = res.result this.tableData.total = total; this.tableData.data = records } }) }, //打开新增弹窗 /** * @description: 打开新增弹窗 * @param {*} item * @author: renchao */ openDialog (item) { this.$nextTick(() => { this.isButtonFlag = false; this.$refs.addDialog.getDetailInfo(item); this.dialogTitle = '系统通知详情' this.isDialog = true; }) let that = this; if (item.isRead == 1) { setReadStatus({ bsmNotice: item.bsmNotice }).then(res => { if (res.code == 200) { that.$nextTick(() => { item.isRead = 2 }) } }) } }, //一键已读 /** * @description: 一键已读 * @author: renchao */ toReadAll () { setAllRead().then(res => { if (res.code == 200) { this.$message.success('设置成功') this.queryClick(); } else { this.$message.error("设置失败") } }) }, /** * @description: downloadFile * @param {*} item * @author: renchao */ downloadFile (item) { const href = item.noticeFileUrl window.open(href, '_blank'); } }, }; </script> <style scoped lang="scss"> @import "~@/styles/public.scss"; </style>