<template>
  <div class="black-list">
    <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: 'punishType',
          showTooltip: true
        },
        {
          label: '列入原因',
          showTooltip: true,
          prop: 'caseReason'
        },
        {
          label: '列入机关',
          prop: 'decisionOffice'
        },
        {
          label: '列入日期',
          prop: 'decisionDate'
        },
        {
          label: '移出日期',
          prop: 'removedDate'
        },
        {
          label: '是否黑名单',
          prop: 'blacklist',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              v-model={row.blacklist}
              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.videoDueDiligenceBlacklist}
              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>
.black-list {

}
</style>
