123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <template>
- <div class="app-container">
- <!-- 筛选 -->
- <div class="select-box">
- <div class="search-icon">
- <i class="el-icon-search"></i>
- <span> 筛选搜查</span>
- <div class="search-button">
- <el-button @click="resetQuery">重置</el-button>
- <el-button type="primary" @click="handleQuery">查询搜索</el-button>
- </div>
- </div>
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
- <el-form-item class="inline" label="公告标题: " prop="noticeTitle" >
- <el-input
- v-model="queryParams.noticeTitle"
- placeholder="筛选公告标题"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item class="inline" label="发布时间: " prop="dateRange">
- <el-date-picker
- v-model="queryParams.dateRange"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- placeholder="选择时间范围"
- value-format="yyyy-MM-dd"
- @keyup.enter.native="handleQuery"
- unlink-panels >
- </el-date-picker>
- </el-form-item>
- </el-form>
- </div>
-
- <!-- 标题 -->
- <el-row>
- <div class="list-title">
- <div class="title">
- <span class="el-icon-tickets"></span>
- <span class="title-font">公告列表</span>
- </div>
- <div class="btn-add">
- <el-button size="small" type="primary" plain @click="handleAdd()">添加</el-button>
- </div>
- </div>
- </el-row>
- <!-- 列表 -->
- <el-table v-loading="loading" :data="noticeList" border>
- <el-table-column label="ID" align="center" prop="noticeId" width="100" />
- <el-table-column
- label="公告标题"
- align="center"
- prop="noticeTitle"
- :show-overflow-tooltip="true"
- />
- <el-table-column label="发布时间" align="center" prop="createTime" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.createTime) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="170">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- @click="handleDetail(scope.row)"
- >查看详情</el-button>
- <el-button
- size="mini"
- type="text"
- @click="handleDelete(scope.row)"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <el-pagination
- background
- :current-page="pagination.current"
- :page-size="pagination.pageSize"
- layout="total, prev, pager, next"
- :total="pagination.total"
- @pagination="getList"
- @current-change="onPageChange"
- class="paper"
- >
- </el-pagination>
- </div>
- </template>
- <script>
- import { getNoticeList, deleteNotice } from '@/api/announce/list';
- export default {
- name: "Notice",
- data() {
- return {
- // 遮罩层
- loading: true,
- // 公告表格数据
- noticeList: [],
- // 查询参数
- queryParams: {
- noticeTitle: undefined,
- dateRange:[]
- },
- // 分页参数
- pagination:{
- total:0,
- current:1,
- pageSize:10,
- },
- };
- },
- created() {
- this.getList();
- },
- methods: {
- /** 查询公告列表 */
- getList() {
- this.loading = true;
- getNoticeList({
- pageIndex: this.pagination.current,
- pageSize: this.pagination.pageSize,
- queryParams:this.queryParams
- }).then( res =>{
- let data = res.data.data;
- this.noticeList = data.noticeList;
- this.pagination.total = data.total;
- this.pagination.current = data.pageIndex;
- this.loading = false;
- })
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.pagination.current = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.$router.push({name:"announcementAdd"});
- },
- // 查看详情
- handleDetail(row) {
- this.$router.push({name:"announcementDetail",params:{row}});
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const noticeIds = row.noticeId;
- this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
- return deleteNotice({id:noticeIds});
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
- },
- // 页号发生变化
- onPageChange(number){
- this.pagination.current=number;
- this.getList();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .el-row {
- margin-bottom: 20px;
- }
- .list-title {
- height: 50px;
- width: 100%;
- border: solid 1px #DCDFE6;
- .title {
- margin: 14px;
- float: left;
- }
- .title-font {
- margin-left: 5px;
- }
- }
- .btn-add {
- margin: 10px;
- float: right;
- }
- .select-box{
- border: 1px solid rgb(0, 0, 0,0.1);
- margin-bottom:20px;
- padding: 20px;
- }
- .inline{
- margin-right: 30px;
- }
- .search-icon{
- padding-bottom: 20px
- }
- .search-button{
- float: right;
- }
- .paper{
- float: right;
- margin-top: 10px;
- }
- </style>
|