<template>
  <div>
    <!-- <el-button @click="fenBtn" type="primary" style="float: right;margin-bottom: 10px;">分配任务</el-button> -->
    <el-table
            border
            style="width: 100%;"
            :data="tableData"
            v-loading="loading"
            header-row-class-name="custom-table-header"
            :default-sort="{ prop : 'date', order: 'descending' }">
            <el-table-column prop="patentNo"  label="专利号" sortable width="200" align="center">
              <template slot-scope="scope">
                <div>
                  <el-link @click.native="toContrast(scope.row,scope.$index)" :reportId="reportId">{{scope.row.patentNo}}</el-link>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="name" label="专利标题" sortable width="300" align="center"></el-table-column>
            <!-- <el-table-column prop="state" label="状态" sortable  align="center"></el-table-column> -->
            <el-table-column prop="simpleStatus" label="状态" align="center" >
              <!-- <template slot-scope="scope">
                  <span>{{state[scope.row.status]}}</span>
              </template> -->
            </el-table-column>
				  </el-table>
          <div style="text-align: center;">
            <el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
              :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="queryParams.total">
            </el-pagination>
        </div>
  </div>
</template>

<script>
import { Contrast } from '@/views/task/components/mixins';
export default {
  mixins:[Contrast],
  props:["activeName","reportId","onChangesIn",'type','signPatentNo',"taskStatus","formS","taskFeilSure"],//queryParams
  data() {
    return {
      tableData: [],
      state:[],
      loading: false,
      queryParams: {
        signPatentNo:this.signPatentNo,
        // taskId: this.taskId,
        reportId: this.reportId,
        applicationName: "",//申请人
        obligeeName: "",//权利人
        patentNo:"",
        applicationNo:"",
        numberIpc:"",
        numberCpc:"",
        numberUpc:"",
        patentName:"",
        abstractStr:"",
        filedOptions: [],//数组，用来存放自定义字段勾选项进行筛选
        taskStatus:"3",
        current: 1,
        size: 10,
        total: 0,
        type:this.type
      }
    }
  },
  created() {
  },
  mounted() {
    this.getList();
    
  },
  computed: {
    formTed() {
      return JSON.stringify(this.formS)
    }
  },
  methods: {
    handleCurrentChange(val) {
      this.queryParams.current=val
      this.getList()
    },
    getList() {
      this.loading=true
      // 需要根据报告id查询所有对比文件
      this.$api.getSureCompareFile(this.queryParams).then(res => {
        // console.log(res);
        if (res.code == 200) {
          console.log(res.data.records);
          this.queryParams.total =  res.data.total
          this.tableData = res.data.records
          this.loading=false
        }
      })
    },
    // fenBtn() {
    //   // let a=this.$router.resolve({
    //   //   path: "/AssignTasks",
    //   //   query: {
    //   //     // reportId:row.id
    //   //   }
    //   // })
    //   // window.open(a.href,"_blank")
    // }
  },
  watch: {
    activeName(val){
      this.queryParams.taskStatus = this.activeName=='first'?0:1
      this.getList()
    },
    onChangesIn(val) {
      this.queryParams.filedOptions=val
      this.getList()
    },
    taskStatus(val) {
      this.queryParams.taskStatus = val
      this.getList();
    },
    formTed(val) {
      let value=JSON.parse(val)
      if (Object.keys(value).length!=0) {
        for (let key in value) {
          this.queryParams[key]=value[key]
        }
        this.getList()
      } else {
        this.getList()
      }
    },
    taskFeilSure(val) {
      if (val) {
        this.$emit("taskFeilParams",this.queryParams)
      }
    }

  }
}
</script>

<style lang="scss" scoped>

</style>