<template>
  <div class="serious-illegality">
    <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: 'addDate',
          showTooltip: true
        },
        {
          label: '作出决定机关',
          showTooltip: true,
          prop: 'addOffice'
        },
        {
          label: '列入严重违法失信企业名单原因',
          prop: 'addReason'
        },
        {
          label: '是否严重违法',
          prop: 'seriousIllegality',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              v-model={row.seriousIllegality}
              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.videoDueDiligenceSeriousIllegality}
              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>
.serious-illegality {

}
</style>
