<template>
  <a-modal
    :title="title"
    :width="modelStyle.width"
    :visible="visible"
    :bodyStyle="bodyStyle"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    :maskClosable="false"
    @cancel="handleCancel"
    cancelText="关闭"
    :footer="null">
    <a-spin :spinning="confirmLoading">
      <a-card :bordered="false">
        <!-- 查询区域 -->

        <!-- 查询区域-END -->

        <!-- 操作按钮区域 -->


        <!-- table区域-begin -->
        <div>
          <!--<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
          <!--<i class="anticon anticon-info-circle ant-alert-icon"></i> 选中:<a style="font-weight: 600">{{selectedPrice}}</a>-->
          <!--<a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
          <!--</div>-->

          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :loading="loading"
            :pagination="ipagination"
            @change="handleTableChange">


            <span slot="action" slot-scope="text, record">

            </span>

          </a-table>
        </div>
      </a-card>
    </a-spin>
  </a-modal>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { httpAction, getAction,putAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JDate from '@/components/jeecg/JDate'
  import { filterObj } from '@/utils/util'
  import qs from 'qs';
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  export default {
    name: "HlgTaxModifyModal",
    mixins:[JeecgListMixin],
    components: { 
      JDate,
    },
    data () {
      return {
        description: '修改记录',
        bodyStyle: {
          padding: '0',
          height: (window.innerHeight * 0.66) + 'px',
          'overflow-y': 'auto'
        },
        modelStyle: {
          width: '76%',
          style: { top: '20px' },
          fullScreen: false
        },
        // 查询条件
        queryParam: {
          taxId:0
        },
        // 表头
        columns: [
          {
            title: '修改时间',
            align: 'left',
            dataIndex: 'generateTime'
          },
          {
            title: '修改人',
            align: 'left',
            dataIndex: 'generateBy'
          },
          {
            title: '修改后内容',
            align: 'left',
            dataIndex: 'detail'
          },
        ],
        title: '操作',
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        },
        paymentId:0,
        confirmLoading: false,
        url: {
          list: "/hlgtax/hlgTaxModify/list",
          importExcelUrl: "/hlgtax/hlgTaxModify/importExcelUrl",
        },
        dictOptions: {},
        selectedPrice:0,
      }
    },
    created () {
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      getQueryParams() {
        var param = {}
        param.field = this.getQueryField()
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.taxId = this.model.id
        return filterObj(param)
      },
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams()//查询条件
        console.log(params)
        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
        })
      },
      initDictConfig() {
      },
      add() {
        this.edit({})
      },
      edit(record) {
        this.model = Object.assign({}, record)
        this.visible = true
        this.loadData(1)
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleOk() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel () {
        this.close()
      },
      popupCallback(row){
        this.form.setFieldsValue(pick(row,'taxId','detail','generateTime','generateBy'))
      },
      onDateOk(value) {
        console.log(value)
      },
      
    }
  }
</script>