<template>
  <div class="big-news">
    <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: 'publishTime'
        },
        {
          label: '是否重大负面新闻舆情',
          prop: 'News',
          ruleRequired: this.type === 'supplier' || this.type === 'videoDue' || this.type === 'projectOwner',
          render: (h, row) => {
            return <el-select
              disabled={this.disabled}
              v-model={row.News}
              placeholder='请选择重大负面新闻舆情'>
              <el-option label='是' value={1}></el-option>
              <el-option label='否' value={0}></el-option>
            </el-select>
          }
        },
        {
          label: '重大负面新闻舆情（调整）',
          prop: 'userTypeName',
          show: this.type === 'videoDue',
          render: (h, row) => {
            return <el-select
              v-model={row.videoDueDiligenceNews}
              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
    }
  },
  created() {
  }
}
</script>

<style lang="scss" scoped>
.big-news {

}
</style>
