<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="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="80%" 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:4,
            label:"启用"
          },
          {
            value:5,
            label:'禁用'
          }
        ],
        dialogVisible:false,
    }
  },
  created() {

  },
  methods:{

    onCreate(e){
     this.$router.push({path:'/system/role/create'});
    },

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

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