<template>
  <div class="data-search">
    <el-form :inline="true" :model="queryForm" class="demo-form-inline">
        <el-form-item label="客户名称:">
          <el-input v-model="queryForm.name" placeholder="请选择客户名称"></el-input>
        </el-form-item>

        <el-form-item label="状态:">
          <el-select v-model="queryForm.status" class="m-2" placeholder="请选择状态" size="large">
              <el-option
                v-for="item in statusOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">  <svg-icon icon-class="search"/> 搜索</el-button>
          <el-button type="primary" @click="onSync">  <svg-icon icon-class="search"/> 同步客户数据</el-button>
        </el-form-item>
      </el-form>


  </div>
</template>

<script>
import {syncCustomer} from "@/api/customer"
export default{
  props:{
    queryForm:{
        type:Object,
        default:()=>{
          return {
             page:1,
             pageSize:10,
             name:'',
             status:'',
          }
        }
    },
  },
  data(){
    return{
        statusOptions:[
          {
            value:'',
            label:"请选择状态"
          },
          {
            value:5,
            label:'启用'
          },
          {
            value:6,
            label:"停用"
          },

        ],
        dialogVisible:false,
    }
  },
  created() {

  },
  methods:{

    onSync(e){
      let _this=this;
      syncCustomer().then(res=>{
        console.log('res',res);
      })
    },

    onCreate(e){
      this.dialogVisible=true;
    },
    //搜索
    onSubmit(){
      this.$emit("bindSetQuery",this.$props.queryForm);
    }
  }
}
</script>

<style lang="scss">
@import "./dataSearch.scss"
</style>
