<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="报表名称">
              <a-input placeholder="请输入报表名称" v-model="queryParam.fileName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!--<a-row :gutter="24" style="margin-bottom:10px">
      <a-col :md="6" :sm="8">
        <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-button type="primary" @click="addData">新增</a-button>
        </span>
      </a-col>
    </a-row>-->
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <a @click="lookView(record)">预览</a>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <uReportFileBindUser-modal ref="modalForm" @ok="modalFormOk"></uReportFileBindUser-modal>
  </a-card>
</template>

<script>
import UReportFileBindUserModal from './modules/UReportFileBindUserModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'UReportFileBindUserList',
  mixins: [JeecgListMixin],
  components: {
    UReportFileBindUserModal
  },
  data() {
    return {
      description: '用户绑定报表信息管理页面',
      // 表头
      columns: [
        {
          title: '报表模板名称',
          align: 'center',
          dataIndex: 'fileName'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/ctop/uReportFileBindUser/list',
        delete: '/ctop/uReportFileBindUser/delete',
        deleteBatch: '/ctop/uReportFileBindUser/deleteBatch',
        exportXlsUrl: 'ctop/uReportFileBindUser/exportXls',
        importExcelUrl: 'ctop/uReportFileBindUser/importExcel'
      }
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    lookView(item) {
      var url = ''
      if (process.env.NODE_ENV === 'development') {
        url = 'http://39.106.184.70:8080/jeecg-boot/ureport/preview?_u=mysql:' + item.fileName
      } else if (process.env.NODE_ENV === 'production') {
        url = 'http://139.186.29.76:8804/jeecg-boot/ureport/preview?_u=mysql:' + item.fileName
      }
      window.open(url, '_blank')
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
