<template>
  <div class="tax-revenue">
    <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: 'punishDate',
          showTooltip: true
        },
        {
          label: '案件性质',
          showTooltip: true,
          prop: 'caseNature'
        },
        {
          label: '所属税务机关',
          prop: 'taxGov'
        },
        {
          label: '主要违法事实',
          prop: 'illegalContent'
        },
        {
          label: '法律依据及处理处罚情况',
          prop: 'punishContent'
        },
        {
          label: '是否税收违法',
          prop: 'taxIllegal',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              v-model={row.taxIllegal}
              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.videoDueDiligenceTaxIllegal}
              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-revenue {

}
</style>
