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

        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus" v-has="'tax:add'">新增</a-button>

    </div>

    <!-- 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">
          <a @click="handleEdit(record)" v-has="'tax:edit'">编辑</a>

          <a-divider type="vertical" v-has="'tax:editRecord'" />
         <a @click="viewRecord(record)" v-has="'tax:editRecord'">修改记录</a>
        </span>

      </a-table>
    </div>

    <hlgTax-modal ref="modalForm" @ok="modalFormOk"></hlgTax-modal>
    <hlg-tax-modify-modal ref="recordForm" @ok="modalFormOk"></hlg-tax-modify-modal>
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import HlgTaxModal from './modules/HlgTaxModal'
  import HlgTaxModifyModal from './modules/HlgTaxModifyModal'
  export default {
    name: "HlgTaxList",
    mixins:[JeecgListMixin],
    components: {
      HlgTaxModifyModal,
      HlgTaxModal
    },
    data () {
      return {
        description: 'hlg_tax管理页面',
        // 表头
        columns: [
          {
            title:'服务商',
            align:"left",
            dataIndex: 'hlgSubcontractor.name'
          },
          {
            title:'税率',
            align:"left",
            dataIndex: 'taxDetail'
          },
          {
            title:'计税方式',
            align:"left",
            dataIndex: 'taxType_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"left",
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/hlgtax/hlgTax/list",
          delete: "/hlgtax/hlgTax/delete",
          deleteBatch: "/hlgtax/hlgTax/deleteBatch",
          exportXlsUrl: "/hlgtax/hlgTax/exportXls",
          importExcelUrl: "hlgtax/hlgTax/importExcel",
        },
        dictOptions:{
        } 
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
      },
      //刷新路由
      routeReload(){
        this.reloadFlag = false
        let ToggleMultipage = "ToggleMultipage"
        this.$store.dispatch(ToggleMultipage,false)
        this.$nextTick(()=>{
          this.$store.dispatch(ToggleMultipage,true)
          this.reloadFlag = true
        })
      },
      modalFormOk(){
        this.routeReload()
      },
      viewRecord(record){
        this.$refs.recordForm.edit(record);
        this.$refs.recordForm.title = '修改记录'
        this.$refs.recordForm.disableSubmit = false
      }
       
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>