huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 1 | <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.xie | 1718f36 | 2018-08-24 14:50:58 +0800 | [diff] [blame] | 31 | <a href="javascript:void(0);" @click="showDetail(scope.row)">{{scope.row.ggbt}}</a> |
huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 32 | </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.xie | 464c156 | 2018-08-21 11:10:43 +0800 | [diff] [blame] | 54 | <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.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 79 | </div> |
| 80 | </template> |
| 81 | |
| 82 | <script> |
| 83 | import { getList } from '@/api/newspublish-api' |
| 84 | import { getDicList } from '@/api/dictionary-api' |
| 85 | import waves from '@/directive/waves' // 水波纹指令 |
| 86 | import { resetForm } from '@/utils' |
| 87 | import { crudPageList } from '@/utils/crud' |
| 88 | import mixindata from '@/utils/crud' |
| 89 | |
| 90 | export default { |
| 91 | name: 'newview', |
| 92 | directives: { |
| 93 | waves |
| 94 | }, |
| 95 | mixins: [mixindata], |
| 96 | data() { |
| 97 | return { |
huibing.xie | 464c156 | 2018-08-21 11:10:43 +0800 | [diff] [blame] | 98 | title: null, |
| 99 | subtitle: null, |
| 100 | content: null, |
huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 101 | gglxList: [] |
| 102 | } |
| 103 | }, |
| 104 | created() { |
| 105 | this.getGglxList() |
| 106 | this.handlePageList() |
| 107 | this.height = window.innerHeight - 216 |
| 108 | }, |
| 109 | methods: { |
huibing.xie | 464c156 | 2018-08-21 11:10:43 +0800 | [diff] [blame] | 110 | showDetail(item) { |
| 111 | this.title = item.ggbt |
huibing.xie | 9685639 | 2018-08-21 11:26:43 +0800 | [diff] [blame] | 112 | this.subtitle = '发布人: ' + item.fbr + ' ' + '发布时间:' + item.fbrq |
huibing.xie | 464c156 | 2018-08-21 11:10:43 +0800 | [diff] [blame] | 113 | this.content = item.ggnr |
| 114 | this.dialogFormVisible = true |
| 115 | }, |
huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 116 | getGglxList() { |
huibing.xie | 99536f5 | 2018-08-29 14:30:32 +0800 | [diff] [blame^] | 117 | getDicList({ dicType: 'gglx' }).then(response => { |
huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame] | 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.xie | 1718f36 | 2018-08-24 14:50:58 +0800 | [diff] [blame] | 142 | <style scoped> |
| 143 | .app-container a { |
huibing.xie | 464c156 | 2018-08-21 11:10:43 +0800 | [diff] [blame] | 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> |