<template>
  <div class="permission_list">
    <apass-list
      @list-action="listAction"
      :list-total="listTotal"
      :hide-header="true"
    >
      <el-breadcrumb separator="/" slot="breadcrumb">
        <el-breadcrumb-item to="/authority">权限管理</el-breadcrumb-item>
        <el-breadcrumb-item to="/authority/users">用户管理</el-breadcrumb-item>
        <el-breadcrumb-item>权限审批</el-breadcrumb-item>
      </el-breadcrumb>
      <el-table slot="list" :border="false" :data="listData">
        <el-table-column label="" width="40"></el-table-column>
        <el-table-column label="账号" width="160">
          <template slot-scope="scope">
            <span v-text="scope.row.account"></span>
          </template>
        </el-table-column>
        <el-table-column label="业务系统名称">
          <template slot-scope="scope">
            <span v-text="scope.row.name"></span>
          </template>
        </el-table-column>
        <el-table-column label="用户类型" align="center" width="240">
          <template slot-scope="scope">
            <span v-text="scope.row.role"></span>
          </template>
        </el-table-column>
        <el-table-column label="用户所属组织">
          <template slot-scope="scope">
            <span v-text="scope.row.organization"></span>
          </template>
        </el-table-column>
        <el-table-column label="用户状态" align="center" width="160">
          <template slot-scope="scope">
            <span v-text="scope.row.state === 0 ? '禁用' : '启用'"></span>
          </template>
        </el-table-column>
        <el-table-column label="申请时间" align="center" width="200">
          <template slot-scope="scope">
            <span v-text="scope.row.update_time"></span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="300">
          <template slot-scope="scope">
            <div class="row_action">
              <a class="btn" @click="permissionAction(scope.row)">
                通过
              </a>
              <span class="interval_line">|</span>
              <a class="btn warn" @click="permissionAction(scope.row, false)">
                拒绝
              </a>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </apass-list>
  </div>
</template>

<script>
import apassList from "@/components/apass-list";
import apassDialog from "@/components/apass-dialog";

export default {
  components: { apassList, apassDialog },
  data: () => ({
    listTotal: 300,
    listData: [
      {
        account: "012344",
        name: "贵阳机关事务大数据平台",
        role: "普通用户",
        organization: "贵阳市水利局",
        state: 0,
        update_time: "2020-04-27 13:24:19",
      },
      {
        account: "012345",
        name: "贵州省水利厅",
        role: "普通用户",
        organization: "贵阳市水利局",
        state: 1,
        update_time: "2020-04-27 13:24:19",
      },
      {
        account: "012346",
        name: "贵州省公安厅",
        role: "普通用户",
        organization: "贵阳市水利局",
        state: 1,
        update_time: "2020-04-27 13:24:19",
      },
      {
        account: "012347",
        name: "贵阳机关事务大数据平台",
        role: "普通用户",
        organization: "贵阳市水利局",
        state: 1,
        update_time: "2020-04-27 13:24:19",
      },
      {
        account: "012348",
        name: "长兴县应急指挥平台",
        role: "普通用户",
        organization: "贵阳市水利局",
        state: 1,
        update_time: "2020-04-27 13:24:19",
      },
    ],
  }),
  methods: {
    listAction(value) {
      console.log(value);
    },
    permissionAction(item, passFlag = true) {
      console.log((passFlag ? "通过 " : "拒绝 ") + item.name);
    },
  },
};
</script>

<style scoped>
.permission_list {
  height: 100%;
}
</style>
