<template>
  <div class="other-operations">
    <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: 'exception',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              v-model={row.exception}
              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.videoDueDiligenceException}
              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>
.other-operations {

}
</style>
