blob: c4d62f18220f8901568e8211bb9954cb7b1b8864 [file] [log] [blame]
huibing.xie1f1606f2018-08-20 15:46:55 +08001<template>
2 <div class="app-container">
3 <div class="filter-container">
4 <el-row :gutter="20">
5 <el-col :span="4">
6 <el-select clearable class="filter-item" v-model="listQuery.gglx" placeholder="类型名称">
7 <el-option v-for="item in gglxList" :key="item.id" :label="item.name" :value="item.id">
8 </el-option>
9 </el-select>
10 </el-col>
11 <el-col :span="4">
12 <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="公告标题" v-model="listQuery.ggbt">
13 </el-input>
14 </el-col>
15 <el-col :span="12">
16 <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button>
17 <el-button class="filter-item" style="margin-left: 10px;" @click="handleReset" type="primary" icon="el-icon-edit">重置</el-button>
18 </el-col>
19 </el-row>
20 </div>
21 <el-table :height="height" :data="items" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row>
22 <el-table-column align="center" type="index" label='序号' width="95">
23 </el-table-column>
24 <el-table-column label="类型名称" align="center">
25 <template slot-scope="scope">
26 {{scope.row.gglx}}
27 </template>
28 </el-table-column>
29 <el-table-column label="公告标题" align="center">
30 <template slot-scope="scope">
huibing.xie464c1562018-08-21 11:10:43 +080031 <a href="#" @click="showDetail(scope.row)">{{scope.row.ggbt}}</a>
huibing.xie1f1606f2018-08-20 15:46:55 +080032 </template>
33 </el-table-column>
34 <el-table-column label="接收对象类型" align="center">
35 <template slot-scope="scope">
36 {{scope.row.jszlx}}
37 </template>
38 </el-table-column>
39 <el-table-column label="发布人" align="center">
40 <template slot-scope="scope">
41 {{scope.row.fbr}}
42 </template>
43 </el-table-column>
44 <el-table-column label="发布日期" align="center">
45 <template slot-scope="scope">
46 {{scope.row.fbrq}}
47 </template>
48 </el-table-column>
49 </el-table>
50 <div class="pagination-container">
51 <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageIndex" :page-sizes="[10,20,30, 50]" :page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="recordCount">
52 </el-pagination>
53 </div>
huibing.xie464c1562018-08-21 11:10:43 +080054 <el-dialog :visible.sync="dialogFormVisible" width="80%" top="10vh">
55 <el-row>
56 <el-col :span="24">
57 <h3 class="news-title">
58 {{title}}
59 </h3>
60 </el-col>
61 </el-row>
62 <el-row>
63 <el-col :span="24">
64 <div class="news-bar">
65 {{subtitle}}
66 </div>
67 </el-col>
68 </el-row>
69 <el-row>
70 <el-col :span="24">
71 <div class="news-content" v-html="content">
72 </div>
73 </el-col>
74 </el-row>
75 <div slot="footer" class="dialog-footer" style="text-align:center">
76 <el-button @click="dialogFormVisible = false">关闭</el-button>
77 </div>
78 </el-dialog>
huibing.xie1f1606f2018-08-20 15:46:55 +080079 </div>
80</template>
81
82<script>
83import { getList } from '@/api/newspublish-api'
84import { getDicList } from '@/api/dictionary-api'
85import waves from '@/directive/waves' // 水波纹指令
86import { resetForm } from '@/utils'
87import { crudPageList } from '@/utils/crud'
88import mixindata from '@/utils/crud'
89
90export default {
91 name: 'newview',
92 directives: {
93 waves
94 },
95 mixins: [mixindata],
96 data() {
97 return {
huibing.xie464c1562018-08-21 11:10:43 +080098 title: null,
99 subtitle: null,
100 content: null,
huibing.xie1f1606f2018-08-20 15:46:55 +0800101 gglxList: []
102 }
103 },
104 created() {
105 this.getGglxList()
106 this.handlePageList()
107 this.height = window.innerHeight - 216
108 },
109 methods: {
huibing.xie464c1562018-08-21 11:10:43 +0800110 showDetail(item) {
111 this.title = item.ggbt
huibing.xie96856392018-08-21 11:26:43 +0800112 this.subtitle = '发布人: ' + item.fbr + ' ' + '发布时间:' + item.fbrq
huibing.xie464c1562018-08-21 11:10:43 +0800113 this.content = item.ggnr
114 this.dialogFormVisible = true
115 },
huibing.xie1f1606f2018-08-20 15:46:55 +0800116 getGglxList() {
117 getDicList({ type: 'gglx' }).then(response => {
118 this.gglxList = response.items
119 })
120 },
121 handlePageList() {
122 crudPageList(this, getList)
123 },
124 handleReset() {
125 resetForm(this.listQuery)
126 },
127 handleFilter() {
128 this.listQuery.pageIndex = 1
129 this.handlePageList()
130 },
131 handleSizeChange(val) {
132 this.listQuery.pageSize = val
133 this.handlePageList()
134 },
135 handleCurrentChange(val) {
136 this.listQuery.pageIndex = val
137 this.handlePageList()
138 }
139 }
140}
141</script>
huibing.xie464c1562018-08-21 11:10:43 +0800142<style>
143.app-container a:visited {
144 color: #00a4f4;
145 text-decoration: none;
146}
147.news-title {
148 color: #f8043d;
149 font-family: "黑体";
150 font-size: 20px;
151 clear: both;
152 padding-top: 15px;
153 padding-bottom: 15px;
154 padding-right: 20px;
155 padding-left: 20px;
156 line-height: 1.5em;
157 text-align: center;
158 font-weight: bold;
159 border-bottom: 3px #c4d8f7 solid;
160 margin: 10px 0px;
161}
162.news-bar {
163 text-align: center;
164 color: #666;
165 font-size: 12px;
166}
167.news-content {
168 padding: 20px;
169}
170</style>