<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form ref="query" style="display: inline-block;">
        <el-input placeholder="预案名称" clearable style="width: 200px;" class="filter-item" name="userskk" />
        <el-input placeholder="预案编号" clearable style="width: 200px;" class="filter-item" name="userskk" />
        <el-button v-waves class="filter-item" type="primary" icon="el-icon-search">
          {{ $t('table.search') }}
        </el-button>
        <el-button v-waves class="filter-item" type="primary" icon="el-icon-plus">
          {{ $t('table.add') }}
        </el-button>
      </el-form>
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-download">
        {{ $t('table.export') }}
      </el-button>
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-upload">
        导入
      </el-button>
    </div>
    <div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column label="发布日期" width="160">
          <template slot-scope="scope">
            <i class="el-icon-time"></i>
            <span style="margin-left: 10px">{{ scope.row.date }}</span>
          </template>
        </el-table-column>
        <el-table-column label="预案编号" width="100">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.id }}</span>
          </template>
        </el-table-column>
        <el-table-column label="预案类别" width="100">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.leibie }}</span>
          </template>
        </el-table-column>
        <el-table-column label="单位名称" width="180">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.infodanwei }}</span>
          </template>
        </el-table-column>
        <el-table-column label="使用领域" width="100">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.shiyong }}</span>
          </template>
        </el-table-column>
        <el-table-column label="关联事件" width="180">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.guanlian }}</span>
          </template>
        </el-table-column>
        <el-table-column label="事件级别" width="90">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.shjianjibei }}</span>
          </template>
        </el-table-column>
        <el-table-column label="预案内容" width="300">
          <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.yuaninfo }}</span>
          </template>
        </el-table-column>
        <el-table-column label="预案名称" width="180">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top">
              <p>预案名称: {{ scope.row.name }}</p>
              <p>预案信息: {{ scope.row.address }}</p>
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium">{{ scope.row.name }}</el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="100px">
          <template slot-scope="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">查询</el-button>
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
            <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import waves from '@/directive/waves'; // 水波纹效果
export default {
  directives: { waves },
  data() {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '一级预案',
        address: '上海市普陀区金沙江路 1518 弄一级预案',
        id: 1,
        leibie: '预案1',
        infodanwei: '河北泽宏科技股份有限公司',
        shiyong: '报警使用',
        guanlian: '石家庄xxx爆炸',
        shjianjibei: '1级',
        yuaninfo: '员工处置燃气管道或设备设施突发泄漏时的应急能力,有效地实施燃气泄漏报警及燃气泄漏应急处理,预防和减少因燃气泄露有可能造成的严重后果,特制定燃气...',
      }, {
        date: '2016-05-04',
        name: '二级预案',
        address: '上海市普陀区金沙江路 1517 弄二级预案',
        id: 2,
        leibie: '预案1',
        infodanwei: '河北泽宏科技股份有限公司',
        shiyong: '消防使用',
        guanlian: '石家庄xxx爆炸',
        shjianjibei: '1级',
        yuaninfo: '员工处置燃气管道或设备设施突发泄漏时的应急能力,有效地实施燃气泄漏报警及燃气泄漏应急处理,预防和减少因燃气泄露有可能造成的严重后果,特制定燃气...',
      }, {
        date: '2016-05-01',
        name: '三级预案',
        address: '上海市普陀区金沙江路 1519 弄三级预案',
        id: 3,
        leibie: '预案3',
        infodanwei: '河北泽宏科技股份有限公司',
        shiyong: '火灾使用',
        guanlian: '石家庄xxx爆炸',
        shjianjibei: '3级',
        yuaninfo: '员工处置燃气管道或设备设施突发泄漏时的应急能力,有效地实施燃气泄漏报警及燃气泄漏应急处理,预防和减少因燃气泄露有可能造成的严重后果,特制定燃气...',
      }, {
        date: '2016-05-03',
        name: '四级预案',
        address: '上海市普陀区金沙江路 1516 弄四级预案',
        id: 4,
        leibie: '预案2',
        infodanwei: '河北泽宏科技股份有限公司',
        shiyong: '报警使用',
        guanlian: '石家庄xxx爆炸',
        shjianjibei: '5级',
        yuaninfo: '员工处置燃气管道或设备设施突发泄漏时的应急能力,有效地实施燃气泄漏报警及燃气泄漏应急处理,预防和减少因燃气泄露有可能造成的严重后果,特制定燃气...',
      }],
    };
  },
  methods: {
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
  },
};
</script>

<style>
</style>
