<template>
  <div class="approval-cooperation ele-body">
    <el-card shadow="never" element-loading-background="rgba(255, 255, 255, 1)">
      <search @search:task="updateParams($event)" />
      <el-table
        border
        highlight-current-row
        :data="dataList"
        :height="tableHeight"
        v-loading="loading"
      >
        <el-table-column
          type="index"
          width="50"
          align="center"
          label="序号"
        ></el-table-column>
        <el-table-column
          label="申请部门"
          align="center"
          min-width="150"
        ></el-table-column
        ><el-table-column
          label="申请时间"
          align="center"
          min-width="150"
        ></el-table-column
        ><el-table-column
          label="申请理由"
          align="center"
          min-width="150"
        ></el-table-column>
        <el-table-column
          label="产业链名称"
          align="center"
          min-width="150"
        ></el-table-column>
        <el-table-column
          label="类型"
          align="center"
          min-width="100"
          prop="type"
        ></el-table-column>
        <el-table-column
          label="指标名称"
          align="center"
          min-width="100"
        ></el-table-column>
        <el-table-column
          label="分值"
          align="center"
          min-width="100"
        ></el-table-column>
        <el-table-column
          label="牵头部门"
          align="center"
          min-width="100"
        ></el-table-column>
        <el-table-column
          label="配合部门"
          align="center"
          min-width="100"
        ></el-table-column>
        <el-table-column label="操作" align="center" min-width="120">
          <el-link @click="edit(true)" type="primary" :underline="false"
            >同意</el-link
          >
          <el-link @click="edit(false)" type="primary" :underline="false"
            >不同意</el-link
          >
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page.sync="page.page"
        :page-size="page.limit"
        :total="count"
        :background="true"
        layout="total, prev, pager, next, jumper"
        :pager-count="5"
        class="ele-pagination-circle"
        @current-change="getDataList()"
      />
      <el-dialog
        title="审核配合申请"
        :visible.sync="showEdit"
        width="400px"
        custom-class="ele-dialog-form"
        :lock-scroll="false"
        :destroy-on-close="true"
        @closed="form = {}"
      >
        <div class="warning">
          <span
            class="el-icon-warning-outline"
            style="color: #f7ac2c; font-size: 25px; margin-right: 20px"
          ></span>
          <div class="right">
            <h5>{{ warning.title }}</h5>
            <p>{{ warning.info }}</p>
          </div>
        </div>
        <div slot="footer">
          <el-button @click="showEdit = false">取消</el-button>&nbsp;
          <el-button type="primary" @click="save">保存</el-button>
        </div>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
import search from "../search";
export default {
  components: {
    search,
  },
  data() {
    return {
      dataList: [[]],
      count: 0,
      page: {
        page: 1,
        limit: Math.floor(
          (document.documentElement.clientHeight - 260 - 45) / 45
        ),
      },
      tableHeight: document.documentElement.clientHeight - 260,
      loading: false,
      form: {},
      showEdit: false,
      warning: {
        title: "确定同意此申请？",
        info: "点击确定后，该部门将添加至考核任务配合部门中",
      },
    };
  },
  methods: {
    getDataList() {},
    edit(flag) {
      this.showEdit = true;
      if (flag) {
        this.warning = {
          title: "确定同意此申请？",
          info: "点击确定后，该部门将添加至考核任务配合部门中",
        };
      } else {
        this.warning = {
          title: "确定不同意此申请？",
          info:
            "点击确定后，该部门申请将驳回，如需再次添加，则有管理员确认后增加",
        };
      }
    },
    save() {},
  },
};
</script>

<style scoped>
.warning {
  display: flex;
  margin-bottom: 20px;
}
</style>