<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :md="6" :sm="8">
            <a-form-item label="发票号">
              <a-input placeholder="请输入付款单号" v-model="queryParam.invoiceNumber"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="付款企业">
              <a-input placeholder="请输入付款企业"  v-model="queryParam.companyName"></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>
              <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
              <!--{{ toggleSearchStatus ? '收起' : '展开' }}-->
              <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
              <!--</a>-->
            </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"
        class="j-table-force-nowrap"
        @change="handleTableChange">



        <span slot="action" slot-scope="text, record">
            <a @click="viewInvoice(record)" >查看发票</a>
           <a-divider type="vertical"  />
            <a @click="handleDetail(record)" >发票明细</a>

        </span>

      </a-table>
    </div>

<hlw-invoice-manage-modal ref="modalForm" @ok="modalFormOk"></hlw-invoice-manage-modal>
    <hlw-picture-modal ref="hwViewPictureForm" @ok="modalFormOk"></hlw-picture-modal>
  </a-card>

</template>
<script>

  import { httpAction ,getAction,putAction} from '@/api/manage'
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import HlwInvoiceManageModal from './modules/HlwInvoiceManageModal'
  import HlwPictureModal from '../hlwsupervise/modules/HlwPictureModal'

  export default {
    name: "HlwInvoiceManageList",
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      HlwPictureModal,
      HlwInvoiceManageModal

    },
    data () {
      return {
        queryParam: {},
        selectedRowKeys: [],
        selectedRows: [],
        description: '开票申请',
        // 表头
        columns: [
          {
            title:'发票号',
            align:"center",
            dataIndex: 'invoiceNumber'
          },
          {
            title:'付款企业',
            align:"center",
            dataIndex: 'companyName'
          },
          {
            title:'通过平台',
            align:"center",
            dataIndex: 'isThroughPlatform_dictText'
          },
          {
            title:'收款服务商',
            align:"center",
            dataIndex: 'subcontractorName'
          },
          {
            title:'开票金额',
            align:"center",
            dataIndex: 'amount'
          },
          {
            title:'开票时间',
            align:"center",
            dataIndex: 'uploadTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            // fixed:"right",
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/wisdom/hlwInvoice/list",
          imgerver: window._CONFIG['imgDomainOssURL']
        },
        dictOptions:{},
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      viewInvoice(record){
        var idcard = [];
        if(record.invoice){
          var invoiceArr=record.invoice.split(",")
          for (let i = 0; i <invoiceArr.length ; i++) {
            if( invoiceArr[i].indexOf("http")!=-1){
              idcard.push(invoiceArr[i])
            }else{
              idcard.push(this.url.imgerver  +invoiceArr[i])
            }
          }
          this.$refs.hwViewPictureForm.edit(idcard);
          this.$refs.hwViewPictureForm.title = '营业执照'
          this.$refs.hwViewPictureForm.disableSubmit = false
        }else{
          this.$message.warning('未上传')
        }
      }



    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>