export const Contrast = {
    methods:{
        toContrast(row,index){
          var location = (index + 1) + ((this.queryParams.current - 1) * this.queryParams.size)
        if (this.reportType != 3 && this.reportType!=4) {
            console.log("不是",this.reportType);
            var router = this.$router.resolve({
                path: '/ContrastIndex/' + row.id,
                query: {
                  // taskId: this.taskId,
                  patentNo:row.patentNo,
                  location:location,
                  // state:this.queryParams.taskStatus
                }
            })
            this.$s.setSession('params', this.queryParams)
            window.open(router.href, '_blank');
        } else {
          console.log("是", this.reportType, row, this.reportId,this.taskWorkRemak,this.coordination);
          if (this.taskWorkRemak == 0 && this.type == 1) {
            console.log(this.taskWorkRemak,this.type);
            var router = this.$router.resolve({
              path: '/FTOContrast/' + row.id,
              query: {
                // taskId: this.taskId,
                patentNo:row.patentNo,
                reportId:this.reportId,
                taskWorkRemak:this.taskWorkRemak,
                location:location,
                // state:this.queryParams.taskStatus
              }
            })
            this.$s.setSession('params', this.queryParams)
            window.open(router.href, '_blank');
          }
          // else if (this.coordination) {
          //   console.log(row.id);
          //   var router = this.$router.resolve({
          //     path: '/FTOContrasts/' + row.id,
          //     query: {
          //       // taskId: this.taskId,
          //       patentNo:row.patentNo,
          //       reportId:this.reportId,
          //       coordination:this.coordination,
          //       location:location,
          //       // state:this.queryParams.taskStatus
          //     }
          //   })
          //   this.$s.setSession('params', this.queryParams)
          //   window.open(router.href, '_blank');
            
          // }
          else {
            
            var router = this.$router.resolve({
              path: this.coordination?'/FTOContrasts/' + row.id:'/FTOContrast/' + row.id,
              query: {
                // taskId: this.taskId,
                patentNo:row.patentNo,
                reportId:this.reportId,
                location: location,
                coordination:this.coordination,
                // state:this.queryParams.taskStatus
              }
            })
            this.$s.setSession('params', this.queryParams)
            window.open(router.href, '_blank');
          }
        }
           
        }
    }
}

export const patentQueryMixins = {
  watch: {
    folder() {
      Object.assign(this.$data, this.$options.data())
      this.loadData()
    }
  },
  computed: {
    projectId() {
      return this.$store.state.patent.projectId
    },
    folder() {
      return this.$store.state.patent.folder
    },
    params() {
      return this.$store.state.patent.params
    },
    queryData() {
      return this.$store.state.patent.queryData
    },
    closeFieldDrawer() {
      return this.$store.state.project.closeFieldDrawer
    },
    submitIndexSetting() {
      return this.$store.state.project.submitIndexSetting
    }
  },
  mounted() {
    this.loadData()
  },
}