import { openVisual } from "@/views/event/components/details/mixins";
export default {
  mixins: [openVisual],
  props: {
    tableData: {//数据
      type: Array,
      default: () => {
        return []
      }
    },
    queryParams: {//分页信息
      type: Object,
      default: () => {
        return {
          size: 10,
          current: 1,
        }
      }
    },
  },
  computed: {
    dictMessage() {
      var a = JSON.parse(JSON.stringify(this.$store.state.dictMessage.dictMessage))
      if (a.REPORT_TYPE) {
        a.REPORT_TYPE.forEach(item => {
          if (['0', '1', '2'].includes(item.value)) {
            item.permission = 'invalid'
          } else if (item.value == 3) {
            item.permission = 'FTO'
          } else if (item.value == 4) {
            item.permission = 'tort'
          } else if (item.value == 5) {
            item.permission = 'avoidDesign'
          } else if (item.value == 7) {
            item.permission = 'reInvalid'
          }
        })
      }
      if (a.REPORT_TYPE) {
        a.REPORT_TYPE.push(
          {
            value: 'w',
            label: '专利挖掘',
            permission: 'reInvalid'
          },
          {
            value: 'e',
            label: '其他',
            permission: 'reInvalid'
          }
        )
      }

      return a
    },
  },
  methods: {
    // 点击名称等事件
    handleItem(row, key) {
      var param = {
        Scenario:row.scenarioNames, 
        eventId:row.id, 
        eventName:row.name
      }
      this.checkVisual(param)
    },
    // 取消与专利数据库的关联
    handleDelete(row) {
      this.$emit('option', { option: 'cancel', row })
    },
    //操作列事件
    handleCommand(option, row) { 
      var isLast = false
      if(option == 10){
        this.action={
          type:'1',
          id:row.id
        } 
        if(this.tableData.length == 1){
          isLast = true
        }
      }
      
      this.$emit('option', { option, row,isLast:isLast })
    },
    //新增报告
    handleAnalyse(type, row) {
      this.$emit('option', { option: 'addReport', row, type })
    },
    //编辑事件
    handleClick(row) {
      this.action={
        type:'2',
        id:row.id
      } 
      this.$emit('option', { option: 'edit', row })
    }
  },
}