<template>
  <a-modal
    :title="title"
    :width="modelStyle.width"
    :bodyStyle="bodyStyle"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :maskClosable="false"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
    :footer="null">

    <a-card :bordered="false">
      <!-- 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">

            </span>

        </a-table>
      </div>



    </a-card>

  </a-modal>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { httpAction ,getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  import JDate from '@/components/jeecg/JDate'


  export default {
    name: "HlwInvoiceManageModal",
    mixins: [JeecgListMixin],
    components: {
      JDate,
    },
    data () {
      return {
        form: this.$form.createForm(this),
        title:"操作",
        modelStyle: {
          width: '80%',
          style: { top: '20px' },
          fullScreen: false
        },
        bodyStyle: {
          padding: '0',
          height: (window.innerHeight * 0.66) + 'px',
          'overflow-y': 'auto'
        },
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {

        },
        // 表头
        columns: [
          {
            title: '付款应用',
            align: 'center',
            dataIndex: 'applicationName'
          },
          {
            title: '付款单号',
            align: 'center',
            dataIndex: 'paymentCode'
          },
          {
            title: '开票金额',
            align: 'center',
            dataIndex: 'totalPayment'
          },

        ],
        url: {
          list: '/wisdom/hlwSubcontractorAccountFlow/invoiceDetailsList',
        },
        dictOptions: {}
      }
    },
    created () {
    },
    methods: {

      edit (record) {
        this.form.resetFields();
        this.model = Object.assign({}, record);
        this.visible = true;
        this.loadData()
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },

      loadData() {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        this.loading = true
        getAction(this.url.list, {invoiceId: this.model.id}).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
        })
      },
      handleCancel () {
        this.close()
      },

      handleOk() {
        this.close()
        this.visible = false
      },
    }
  }
</script>