<template>
  <a-modal
    :title="title"
    :width="modelStyle.width"
    :visible="visible"
    :bodyStyle="bodyStyle"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    :maskClosable="false"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24" type="flex" justify="center">
              <a-col :md="6" :sm="8">
                <a-form-item label="">
                  <a-input placeholder="企业名称" v-model="queryParam.userName"></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>
            </span>
              </a-col>

            </a-row>
          </a-form>
        </div>
        <!-- 查询区域-END -->

        <!-- 操作按钮区域 -->
        <div class="table-operator">

        </div>

        <!-- table区域-begin -->
        <div>

          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
            @change="handleTableChange">
          </a-table>
        </div>
      </a-card>
    </a-spin>
  </a-modal>
</template>

<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { httpAction, getAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JDate from '@/components/jeecg/JDate'

  export default {
    name: 'HlgPaymentCompanyListModal',
    mixins: [JeecgListMixin],
    components: {
      JDate

    },
    data() {
      return {
        title: '',
        bodyStyle: {
          padding: '0',
          height: (window.innerHeight * 0.62) + 'px',
          'overflow-y': 'auto'
        },
        modelStyle: {
          width: '76%',
          style: { top: '10px' },
          fullScreen: false
        },
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        },
        // 表头
        columns: [
          {
            title: '企业名称',
            align: 'left',
            dataIndex: 'generateTime'
          }
        ],
        confirmLoading: false,
        dataSource: [],
        companyName: '',
        companyId: 0,
        accountId: 0,
        url: {
          list: '/hlgaccount/hlgAccountDetail/refundList'
        }

      }
    },
    created() {
    },
    methods: {
      add() {
        this.edit({})
      },
      edit(record) {
        this.model = Object.assign({}, record)
        this.companyId = record.companyId
        this.visible = true
        this.companyName = record.companyName
        this.accountId = record.id
        this.loadData(1)
      },
      loadData(arg) {
        // if (!this.url.list) {
        //   this.$message.error('请设置url.list属性!')
        //   return
        // }
        // //加载数据 若传入参数1则加载第一页的内容
        // if (arg === 1) {
        //   this.ipagination.current = 1
        // }
        // var params = this.getQueryParams()//查询条件
        // params.accountId = this.id
        // params.type = 0
        // this.loading = true
        // getAction(this.url.list, params).then((res) => {
        //   if (res.success) {
        //     this.dataSource = res.result.records
        //     this.ipagination.total = res.result.total
        //   }
        //   if (res.code === 510) {
        //     this.$message.warning(res.message)
        //   }
        //   this.loading = false
        // })
      },
      close(data) {
        this.$emit('ok', data)
        this.visible = false
      },
      handleOk() {
        if (this.selectionRows.length) {
          this.close(this.selectionRows[0])
        } else {
          this.$message.warning('请选择企业')
        }
        this.close()
      },
      handleCancel() {
        this.close()
      },
      changeItem() {
        this.loadData()
      }
    }
  }
</script>