<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">新增</a-button>
    </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="handleDetail(record)" >详情</a>
          <template v-if="record.canEdit">
             <a-divider type="vertical"  />
         <a @click="editEndTime(record)">修改到期时间</a>
          </template>

           <template v-if="record.canDelete">
         <a-divider type="vertical"  />
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
           </template>
        </span>

      </a-table>
    </div>

    <hlwTax-modal ref="modalForm" @ok="modalFormOk"></hlwTax-modal>
    <hlw-tax-edit-end-date-modal ref="recordForm" @ok="modalFormOk"></hlw-tax-edit-end-date-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import HlwTaxModal from './modules/HlwTaxModal'
  import HlwTaxEditEndDateModal from './modules/HlwTaxEditEndDateModal'

  export default {
    name: "HlwTaxList",
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      HlwTaxEditEndDateModal,
      HlwTaxModal
    },
    data () {
      return {
        description: 'hlw_tax管理页面',
        // 表头
        columns: [
          {
            title:'服务商',
            align:"left",
            dataIndex: 'hlwSubcontractor.name'
          },
          {
            title:'税率提醒',
            align:"left",
            dataIndex: 'taxWarning_dictText'
          },
          {
            title:'累计方式',
            align:"left",
            dataIndex: 'accumulationType_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            // fixed:"right",
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/wisdom/hlwTax/list",
          delete: "/wisdom/hlwTax/delete",
          deleteBatch: "/wisdom/hlwTax/deleteBatch",
          exportXlsUrl: "/wisdom/hlwTax/exportXls",
          importExcelUrl: "wisdom/hlwTax/importExcel",
        },
        dictOptions:{},
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      modalFormOk(){
        this.loadData()
      },

      editEndTime(record){
        this.$refs.recordForm.edit(record);
        this.$refs.recordForm.title = '修改时间'
        this.$refs.recordForm.disableSubmit = false
      }


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