<!-- @desc:最大化  @auth:周兴  @time:2023/12/21 16:08 -->
<template>
  <DkModal
    v-model="visible"
    :saveFlag="true"
    fullscreen
    ref="modal"
    :title="vm.$t('tableFullScreen')"
    :footer-flag="false"
    @on-cancel="handleCancel"
  >
    <!--正常列表-->
    <div style="height: calc(100% - 30px)">
      <DkTable :id="'table-'+$options.name" ref="table-select"
               :data="tableData"
               :auto-height="true"
               :show-setting-flag="false"
               :choose-flag="false"
               :pageFlag="false">
        <div v-for="(item, index) in columns" :key="item.field">
          <DkTableColumn
            :type="item.type"
            :field="item.field"
            :title="item.title"
            :digits="item.digits"
            :align="item.align"
            :sum="item.sum"
            :dataType="item.dataType"
            @on-link="(row,rowIndex,field)=>handleLink(item,row,rowIndex,field)"
          >
          </DkTableColumn>
        </div>
      </DkTable>
    </div>
  </DkModal>
</template>

<script>
export default {
  name: "dk-table-max",
  props: {
  },
  data() {
    const vm = window.vm
    let self = this
    return {
      vm: vm,
      page:null,
      visible: true,
      tableData:[],
      columns:[]
    }
  },
  methods:{
    /**
     * @desc   : 关闭查询页面
     * @author : 周兴
     * @date   : 2023/2/14 17:29
     */
    handleCancel() {
      this.visible = false;
    },
    /**
     * @desc   : 点击链接事件
     * @author : 周兴
     * @date   : 2023/12/22 9:33
     */
    handleLink(item,row,rowIndex,field){
      if(item && item.instance ){
        let col = item.col[0].componentInstance.linkObj;
        if(col && col.url){
          row.url = col.url
        }
        if(col && col.button){
          row.button = col.button
        }
        if(col && col.child){
          row.child = col.child
        }
        // 如果没有设置，默认打开edit
        if(!row.url && !row.button){
          row.button = 'edit'
        }
        item.instance?.handleLink(row, rowIndex, field);
        this.visible = false
      }
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
