<template>
  <div class="app-container">
    <el-table :data="response.rows" border height="calc(100vh - 195px)">
      <el-table-column type="index" label="序号" align="center" width="80" />
      <el-table-column label="通知标题" align="left" prop="title" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="200" />
      <el-table-column label="操作" align="center" width="220">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)">详情</el-button>
        </template>
      </el-table-column>
      <template slot="empty">
        <el-empty></el-empty>
      </template>
    </el-table>
    <pagination v-if="response.total > 0" :total="response.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>
<script>
import noticeDetail from '@/views/work/notice/detail';
export default {
  name: 'Notification',
  data() {
    return {
      ids: [],
      showSearch: true,
      response: {},
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderByColumn: 'id',
        isAsc: 'desc'
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.ajax({ url: '/work/notice/list', data: this.queryParams }).then((response) => {
        this.response = response;
      });
    },
    op(tag, row) {
      if (tag == 'detail') {
        this.iframe({ obj: noticeDetail, param: { id: row.id }, title: row.title, width: '58%', height: '75%' });
        return;
      }
    }
  }
};
</script>
