<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-input v-model="queryForm.name" placeholder="权限名称"></el-input>
        </el-form-item>

        <el-form-item label="权限类型:">
          <el-select v-model="queryForm.type" class="m-2" clearable placeholder="请选择权限类型" size="large">
              <el-option
                v-for="item in typeList"
                :key="item.value"
                :label="item.name"
                :value="item.value"
              />
            </el-select>
        </el-form-item>
        <el-form-item label="权限状态:">
          <el-select v-model="queryForm.status" class="m-2" clearable 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="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,
            type:'',
            code:'',
            name:'',
            status:''
          }
        }
    },
  },
  data(){
    return{
        statusOptions:[
          {
            value:5,
            label:"启用"
          },
          {
            value:6,
            label:'禁用'
          }
        ],
        typeList:[
          {
            value:1,
            name:'项目管理'
          },
          {
            value:2,
            name:'客户管理'
          },
          {
            value:3,
            name:'产品管理'
          },
          {
            value:4,
            name:'文档管理'
          },
          {
            value:5,
            name:'系统设置'
          },

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

  },
  methods:{

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

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

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