<template>
  <el-card class="box-card">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="公示公告" prop="tatle">
        <el-input
          v-model="queryParams.tatle"
          placeholder="请输入公示公告"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="mesList" size="small"  stripe="true">
      <el-table-column label="公告名称" align="center" prop="tatle" />
      <el-table-column label="" align="center" prop="" />
      <el-table-column label="" align="center" prop="" />
      <el-table-column label="文件类型" align="center" prop="documentType" />
      <el-table-column label="" align="center" prop="" />
      <el-table-column label="" align="center" prop="" />
      <el-table-column label="" align="center" prop="" />
      <el-table-column label="" align="center" >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:mes:edit']"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 详情对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="63%" :show-close="true" append-to-body  >
      <el-container>
        <el-form ref="form" :model="form" :rules="rules"  style="width: 100%;">
          <el-form-item label="" prop="tatle">
            <el-header><span>{{this.form.tatle}}</span></el-header>
          </el-form-item>
          <el-form-item label=""prop="updateTime">
            <el-footer><span>{{"发布日期 : "+parseTime(this.form.updateTime,'{y}-{m}-{d}')}}</span></el-footer>
          </el-form-item>
          <el-divider></el-divider>
          <el-form-item label="" prop="fileDetails">
            <el-main><span v-html="this.form.fileDetails"></span></el-main>

          </el-form-item>
        </el-form>
      </el-container>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancel">关    闭</el-button>
      </div>
    </el-dialog>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </el-card>
</template>
<script>

  import { listMes,listMesOne,getMes } from "@/api/information/mes";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  export default {
    components: {

    },
    data() {
      return {


        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 【请填写功能名称】表格数据
        mesList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          tatle: undefined,
          documentType: undefined,
          img: undefined,
          putFilePath: undefined,
          fileDetails: undefined,
          xsState: undefined,
          typeId: undefined,
          flg: undefined,
          submitTime: undefined,
          lastUpdate: undefined
        },
        // 表单参数
        form: {}

      };
    },
    created() {
      this.getList();

    },
    methods: {
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length != 1
        this.multiple = !selection.length
      },
      getList() {
        this.loading = true;
        listMesOne(this.queryParams).then(response => {
          this.mesList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },


      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          id: undefined,
          tatle: undefined,
          documentType: [],
          img: undefined,
          putFilePath: undefined,
          fileDetails: undefined,
          xsState: undefined,
          typeId: undefined,
          flg: undefined,
          createBy: undefined,
          createTime: undefined,
          updateBy: undefined,
          updateTime: undefined,
          remark: undefined,
        };
        this.resetForm("form");
      },
      /** 详情按钮操作 */
      handleUpdate(row) {
        this.reset();
        const id = row.id || this.ids
        getMes(id).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "";
          this.form = response.data;
        })
      }
    }
  }
</script>

<style lang="less" scoped>

  .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
  .el-card__header{
    background: #34bfa3;
    color:#fff;
  }
  .el-header{
    color: red;
    width: 100%;
    text-align: center;
    line-height: 60px;
    font-size: 40px;
    font-weight: bold;
  }
  .el-footer{
    text-align: center;
    height: 40px !important;
    line-height: 40px;
    font-size: 18px;
  }
  .el-form-item{
    margin-bottom: 0 !important;
  }
  .el-divider--horizontal {
    display: block;
    height: 1px;
    width: 90% !important;
    margin: 10px 50px !important;
  }
  .el-main{
    padding: 0 70px !important;
  }
</style>
