<template>
  <div class="tax-arrears">
    <cy-comm-table
      ref="commTable"
      :columns="columns"
      :data="tableData"
    />
  </div>
</template>

<script>
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: ''
    },
    detailsData: {
      type: Array,
      default: () => []
    }
  },
  inject: {
    disabled: {
      form: 'disabled',
      default: false
    }
  },
  data() {
    return {
      tableData: [],
      columns: [
        {
          label: '序号',
          index: true
        },
        {
          label: '欠税税种',
          prop: 'title',
          showTooltip: true
        },
        {
          label: '欠税金额（元）',
          showTooltip: true,
          prop: 'amount'
        },
        {
          label: '当前新发生的欠税金额（元）',
          prop: 'newAmount'
        },
        {
          label: '发布日期',
          prop: 'punishDate'
        },
        {
          label: '发布单位',
          prop: 'punishOffice'
        },
        {
          label: '是否欠税公告',
          prop: 'taxOweNotice',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              v-model={row.taxOweNotice}
              disabled={this.disabled}
              placeholder='请选择欠税公告'>
              <el-option label='是' value={1}></el-option>
              <el-option label='否' value={0}></el-option>
            </el-select>
          }
        },
        {
          label: '欠税公告（调整）',
          prop: 'inDate',
          show: this.type === 'videoDue',
          render: (h, row) => {
            return <el-select
              v-model={row.videoDueDiligenceTaxOweNotice}
              disabled={this.disabled}
              placeholder='请选择欠税公告'>
              <el-option label='是' value={1}></el-option>
              <el-option label='否' value={0}></el-option>
            </el-select>
          }
        }
      ]
    }
  },
  watch: {
    detailsData: {
      handler(newV) {
        this.tableData = JSON.parse(JSON.stringify(newV))
      },
      deep: true
    }
  }
}
</script>

<style lang="scss" scoped>
.tax-arrears {

}
</style>
