<template>
  <el-select
    v-model="contractId"
    placeholder="请选择合同"
    filterable
    clearable
    @change="handleInput"
  >
    <el-option
      v-for="item in options"
      :key="item.id"
      :label="item.name"
      :value="item.id"
    >
    </el-option>
  </el-select>
</template>
<script>
export default {
  data() {
    return {
      options: [],
      contractId:''
    }
  },
  // mounted() {
  //   this.getProjectData()
  // },

  methods: {
    getProjectData(val) {
      console.log(val)
      let param={
    pageBean: {
		page: 1,
		pageSize: -1,
		showTotal: true
	},
  	querys: [
		{
			group: "main",
			operation: "EQUAL",
			parentGroup: "",
			property: "pm.ID_",
			relation: "AND",
			value: val
		}
	],
      }
      //  let param = {
      //   'pm.ID_': val.projectId,
      //   register_date_: this.searchForm.registerDate,
      //   register_person_name_: this.searchForm.registerPersonName,
      // }

      this.$http.post('${cqxy}/biz/contract/v1/page',param).then(res => {
        let resp= res.data.value.rows  
        console.log(resp)
        let newArr=[]
        resp.forEach(item=>{
          let obj=item.contract
          newArr.push(obj)
        })
        this.options=newArr
      })
    },
    handleInput(val) {
       let arr= this.options.filter(item=>{
          return item.id==val
        })
      this.$emit('inputContract', val, ...arr)
      this.$emit('selectContract', val,...arr)
    }
  }
}
</script>
<style scoped>
</style>