<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="请输入stateDate" v-model="queryParam.stateDate"></a-input>-->
              <a-date-picker v-model="queryParam.stateDate" format="YYYY-MM-DD" style="width:100%" />
            </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>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel"
      >
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-button type="primary" style="margin-left:20px" @click="openNewWindow">日报预览</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete" />删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px">
          批量操作
          <a-icon type="down" />
        </a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
      </a-table>
    </div>
    <!-- table区域-end -->

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

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

export default {
  name: 'JhsBakendDataList',
  mixins: [JeecgListMixin],
  components: {
    JhsBakendDataModal,
  },
  data() {
    return {
      description: '聚划算后端数据管理页面',
      // 表头
      columns: [
        {
          title: '日期',
          align: 'center',
          dataIndex: 'stateDate',
        },
        {
          title: '产品线',
          align: 'center',
          dataIndex: 'productLine',
        },
        {
          title: '任务名称',
          align: 'center',
          dataIndex: 'taskName',
        },
        {
          title: '客户端',
          align: 'center',
          dataIndex: 'clientName',
        },
        {
          title: '渠道id',
          align: 'center',
          dataIndex: 'channelId',
        },
        {
          title: '渠道名称',
          align: 'center',
          dataIndex: 'channelName',
        },
        {
          title: '计划id',
          align: 'center',
          dataIndex: 'adId',
        },
        {
          title: '页面访问UV',
          align: 'center',
          dataIndex: 'pageView',
        },
        {
          title: '成交笔数',
          align: 'center',
          dataIndex: 'dealNumber',
        },
      ],
      url: {
        list: '/okr/jhsBakendData/list',
        delete: '/okr/jhsBakendData/delete',
        deleteBatch: '/okr/jhsBakendData/deleteBatch',
        exportXlsUrl: 'okr/jhsBakendData/exportXls',
        importExcelUrl: 'okr/jhsBakendData/importExcel',
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    openNewWindow(){
      window.open("http://139.186.29.76:8804/jeecg-boot/ureport/preview?_u=mysql:%E8%81%9A%E5%88%92%E7%AE%97%E8%B4%A6%E6%88%B7%E6%8A%A5%E8%A1%A8-%E5%A4%B4%E6%9D%A1.ureport.xml", '_blank')
    }
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>