<!-- @desc:角色管理  @auth:周兴  @time:2024/1/30 9:21 -->
<template>
  <div class="main-div" ref="mainDiv">
    <loading :loading="loading" v-if="!modalVisible"></loading>
    <!--按钮区-->
    <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
      <template #left>
        <!--    查询    -->
        <BaseIndexButton ref="search" name="search"></BaseIndexButton>
        <!--    清空条件    -->
        <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
        <!--    编辑    -->
        <BaseIndexButton ref="edit" name="edit"></BaseIndexButton>
        <!--    启用    -->
        <BaseIndexButton ref="enable" name="enable"></BaseIndexButton>
        <!--    停用    -->
        <BaseIndexButton ref="disable" name="disable"></BaseIndexButton>
        <!--    调整顺序    -->
        <BaseIndexButton ref="changeDisplayNo" name="changeDisplayNo"></BaseIndexButton>
      </template>
      <template #right>
        <!--   新建     -->
        <BaseIndexButton ref="add" name="add"></BaseIndexButton>
      </template>
    </BaseIndexButtonGroup>

    <!--  查询条件区域  -->
    <div id="search-cond-div" ref="search-cond-div" class="search-cond-class">
      <SearchCond ref="searchCond" v-model="searchCond"
                  @collapse-change="collapseChange" :setFlag="false"
                  :search-content="searchContent"></SearchCond>
    </div>

    <!--  表格部分  -->
    <div>
      <DkTable :id="'table-'+$options.name" ref="table-select" :data="tableData"
               :page-total="pageInfo.total"
               :current-page="pageInfo.currentPage"
               :height="tableHeight" :primaryKey="primaryKey"
               :multiple="false"
               :choose-flag="false"
               @pageChange="pageSizeChange">
        <DkTableColumn field="角色编码" type="link"
                       @on-link="handleLink(Object.assign($event,{button:'edit'}))"></DkTableColumn>
        <DkTableColumn field="角色名称"></DkTableColumn>
        <DkTableColumn field="功能权限"></DkTableColumn>
        <DkTableColumn field="数据权限"></DkTableColumn>
        <DkTableColumn field="敏感数据"></DkTableColumn>
        <DkTableColumn field="flgValid" type="switch" ></DkTableColumn>
        <DkTableColumn field="remarks" width="auto"></DkTableColumn>
      </DkTable>
    </div>

    <!--新建编辑-->
    <DkModal
      :loading="loading"
      v-model="editAddModal"
      ref="modal_editAdd"
      @on-visible-change="handleVisibleModal"
      @modalOk="save"
      :saveFlag="true"
      :title="modalTitle"
    >
      <DkForm ref="formInline" v-model="formData" :col-count="1">
        <!--  角色编码  -->
        <DkFormItem prop="角色编码" :required="true">
          <InputPop v-model="formData.角色编码" />
        </DkFormItem>
        <!--  角色名称  -->
        <DkFormItem prop="角色名称" :required="true">
          <InputPop v-model="formData.角色名称" />
        </DkFormItem>
        <!--  功能权限  -->
        <DkFormItem prop="功能权限" :data-type="$config.dataType.array">
          <SelectMagnifier v-model="formData.functionIds" :display-text="formData.functionNames"
                           :type="this.$config.MagnifierType.organization"
                           :multiple="false"></SelectMagnifier>
        </DkFormItem>
        <!--  数据权限  -->
        <DkFormItem prop="数据权限" :data-type="$config.dataType.array">
          <SelectMagnifier v-model="formData.purviewIds" :display-text="formData.purviewNames"
                           :type="this.$config.MagnifierType.organization"
                           :multiple="false"></SelectMagnifier>
        </DkFormItem>
        <!--  敏感数据  -->
        <DkFormItem prop="敏感数据" >
          <SelectMagnifier v-model="formData.functionIds" :display-text="formData.functionNames"
                           :type="this.$config.MagnifierType.organization"
                           :multiple="false"></SelectMagnifier>
        </DkFormItem>
        <!--   备注     -->
        <DkFormItem prop="remarks">
          <InputPop v-model="formData.remarks" textareaFlag/>
        </DkFormItem>
      </DkForm>
    </DkModal>
  </div>
</template>

<script>
import {indexMixin} from "@/mixins";

export default {
  name: "index",
  mixins: [indexMixin],
  data() {
    let self = this
    return {
      formData: {
        角色名称:null,
        角色编码: '',
        functions: null,
        purviews: null,
        displayNo: 0,
        remarks: ''
      },
      // 查询条件
      searchContent: [
        {
          itemCode: 'roleName',
        },
        self.$config.flgValidSearch // 有效标识
      ],
    }
  },
  methods:{
    /**
     * @desc   : desc
     * @author : 周兴
     * @date   : 2024/1/30 14:10
     */
    enable(){

    },
  },
  created() {
    this.primaryKey = 'roleId'  // 设置主键Id
    this.routeObjName = 'role'  // 设置路由名称
  }
}
</script>

<style scoped>

</style>
