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"> |
| 31 | <span>{{scope.row.ggbt}}</span> |
| 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> |
| 54 | </div> |
| 55 | </template> |
| 56 | |
| 57 | <script> |
| 58 | import { getList } from '@/api/newspublish-api' |
| 59 | import { getDicList } from '@/api/dictionary-api' |
| 60 | import waves from '@/directive/waves' // 水波纹指令 |
| 61 | import { resetForm } from '@/utils' |
| 62 | import { crudPageList } from '@/utils/crud' |
| 63 | import mixindata from '@/utils/crud' |
| 64 | |
| 65 | export default { |
| 66 | name: 'newview', |
| 67 | directives: { |
| 68 | waves |
| 69 | }, |
| 70 | mixins: [mixindata], |
| 71 | data() { |
| 72 | return { |
| 73 | gglxList: [] |
| 74 | } |
| 75 | }, |
| 76 | created() { |
| 77 | this.getGglxList() |
| 78 | this.handlePageList() |
| 79 | this.height = window.innerHeight - 216 |
| 80 | }, |
| 81 | methods: { |
| 82 | getGglxList() { |
| 83 | getDicList({ type: 'gglx' }).then(response => { |
| 84 | this.gglxList = response.items |
| 85 | }) |
| 86 | }, |
| 87 | handlePageList() { |
| 88 | crudPageList(this, getList) |
| 89 | }, |
| 90 | handleReset() { |
| 91 | resetForm(this.listQuery) |
| 92 | }, |
| 93 | handleFilter() { |
| 94 | this.listQuery.pageIndex = 1 |
| 95 | this.handlePageList() |
| 96 | }, |
| 97 | handleSizeChange(val) { |
| 98 | this.listQuery.pageSize = val |
| 99 | this.handlePageList() |
| 100 | }, |
| 101 | handleCurrentChange(val) { |
| 102 | this.listQuery.pageIndex = val |
| 103 | this.handlePageList() |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | </script> |