<!--
     授权范围审计
    @Author:laiyh
    @Date:  2020-07-29
-->
<template>
  <dg-row>
    <!-- 搜索栏 -->
    <search-bar :conditionForm="conditionForm" @submitSearch="receiveSearch"></search-bar>
    <new-table
      ref="table"
      rowKey="createTime"
      :tableUrl="tableUrl"
      :tableHeader="tableHeader"
      :condition="condition"
      :tableOptList="tableOptList"
      @submitTableOpt="receviceOpt"
    >
    </new-table>
  </dg-row>
</template>

<script>
import newTable from '@/components/new-table';
import timeLine from './timeLine';
import * as logAuditApi from '@/api/log-audit';
import searchBar from '@/components/search-bar';
import { searchOpt } from '@/mixins/page-opt';
export default {
  name: 'index',
  components: {
    newTable,
    searchBar
  },
  mixins: [searchOpt],
  // 接收父页面传过来的属性
  props: {},
  // 页面数据绑定
  data() {
    return {
      tableUrl: logAuditApi.scopeTableUrl,
      tableHeader: [
        { label: '姓名', prop: 'name' },
        { label: '单位名称', prop: 'orgName' },
        { label: '警号', prop: 'policeNumber' },
        { label: '用户类型', prop: 'userType', enum: 'UserTypeEnum' },
        { label: '人员类型', prop: 'manType', code: 'DM_MAN_TYPE' },
        { label: '职级', prop: 'title', code: 'DM_CERT_DUTY_LEVEL' },
        { label: '创建人姓名', prop: 'createUserName' },
        { label: '创建时间', prop: 'createTime', dateFormat: "YYYY-MM-DD HH:mm:ss" }
      ],
      conditionForm: [
        {
          label: '单位名称',
          name: 'orgId',
          op: '=',
          value: '',
          apiName: 'getOrgTree',
          nodeKey: 'id',
          type: 'APP',
          component: 'SelectOrgTree',
          placeholder: '请选择单位名称'
        }
      ],
      tableOptList: ['详情']
    };
  },
  // 计算属性
  computed: {},
  // 方法
  methods: {
    receviceOpt(opt, row) {
      this.handleDetail(row);
    },
    // 详情
    handleDetail({ id, idcard }) {
      const that = this;
      logAuditApi
        .getAuditManageDetail({
          type: '50',
          id: id
        })
        .then((res) => {
          const layer = that.$dgLayer({
            title: '详情',
            shade: [0.4, '#FFF'],
            area: ['1000px', '880px'],
            content: timeLine,
            props: {
              timeData: res,
              auditType: 'admin_audit'
            },
            on: {}
          });
        });
    }
  },
  // 创建组件时调用
  created() {}
};
</script>

<style scoped></style>
