<template>
  <div class="data-search">
    <el-form :inline="true" :model="queryForm" class="demo-form-inline">

        <el-form-item label="分类编码:">
          <el-input v-model="queryForm.code" 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.name"
                :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="success" @click="onCreate" >  <svg-icon icon-class="edit"/> 创建分类</el-button>
        </el-form-item>
      </el-form>



    <el-dialog  :visible.sync="dialogVisible" append-to-body v-el-drag-dialog  width="50%" custom-class="prod-verify" title="创建项目分类">
         <dataInfo @onClose="onClose" ></dataInfo>
     </el-dialog>

  </div>
</template>

<script>
import dataInfo from './dataInfo.vue';
import elDragDialog from '@/directive/el-drag-dialog'
export default{
  components:{
    dataInfo,
  },
  directives: { elDragDialog },
  props:{
    queryForm:{
        type:Object,
        default:()=>{
          return {
             page:1,
             pageSize:10,
             name:'',
             status:'',
          }
        }
    },
  },
  data(){
    return{
        statusOptions:[
          {
            value:5,
            name:'使用中'
          },
          {
            value:6,
            name:'已停用'
          },
        ],
        dialogVisible:false,
    }
  },
  created() {

  },
  methods:{

    onCreate(e){
      this.dialogVisible=true;
    },

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

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