<!--
    机构配额管理
    @Author:laiyh
    @Date:  2020-08-03
-->
<template>
  <dg-row>
    <!-- 搜索栏 -->
    <search-bar :conditionForm="conditionForm" @submitSearch="receiveSearch"></search-bar>
    <!-- 表格 -->
    <new-table
      ref="table"
      :tableUrl="tableUrl"
      :tableHeader="tableHeader"
      :condition="condition"
      :tableOptList="tableOptList"
      @submitTableOpt="receviceOpt"
    >
    </new-table>
  </dg-row>
</template>

<script>
import newTable from '@/components/new-table';
import Editor from './edit';
import { tableUrl } from '@/api/empower-manage';
import searchBar from '@/components/search-bar';
import { searchOpt } from '@/mixins/page-opt';
import { appRestApi } from '@/api/application';
export default {
  name: 'index',
  components: {
    newTable,
    searchBar
  },
  mixins: [searchOpt],
  // 接收父页面传过来的属性
  props: {},
  // 页面数据绑定
  data() {
    return {
      tableUrl,
      conditionForm: [
        {
          label: '应用系统名称',
          name: 'applyName',
          op: '=',
          value: '',
          component: 'SelectApp',
          apiUrl: appRestApi.table,
          valueName: 'applyName',
          labelName: 'applyName'
        },
        // {
        //   label: '单位名称',
        //   name: 'orgCode',
        //   op: '=',
        //   value: '',
        //   apiName: 'getOrgTree',
        //   nodeKey: 'code',
        //   type: 'APP',
        //   component: 'SelectOrgTree',
        //   placeholder: '请选择单位名称'
        // }
      ],
      tableHeader: [
        {
          label: '应用系统名称',
          prop: 'name'
        },
        {
          label: '应用角色',
          prop: 'roles'
        }
      ],
      tableOptList: ['配置']
    };
  },
  // 计算属性
  computed: {},
  // 方法
  methods: {
    handleSetting(row) {
      const layer = this.$dgLayer({
        title: '配置',
        shade: [0.4, '#fff'],
        props: {
          row
        },
        area: ['1400px', '837px'],
        content: Editor,
        on: {}
      });
    },
    receviceOpt(opt, row) {
      this.handleSetting(row);
    }
  },
  // 创建组件时调用
  created() {}
};
</script>
<style lang="scss">
</style>
<style scope lang="scss">
</style>
