<template>
  <div id="search-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-form :model="form" ref="form" label-width="130px">
          <el-col :span="6">
            <el-form-item label="名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入名称" size="small"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="跳转类型" prop="to_type">
              <el-select v-model="form.to_type" clearable filterable placeholder="请选择" style="width: 100%" size="small">
                <el-option v-for="i in typeList" :key="i.label" :label="i.label" :value="i.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24" class="btn">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="onSubmit('form')">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="toReset('form')">重置</el-button>
          </el-col>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'search-1',
  props: { form: { type: Object }, typeList: { type: Array } },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    onSubmit() {
      this.$emit('onSubmit');
    },
    toReset(formName) {
      this.$refs[formName].resetFields();
      this.$emit('toReset');
    },
  },
  computed: {
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .btn {
    text-align: right;
  }
  /deep/.el-form-item {
    float: left;
    width: 100%;
    margin: 0 0 10px 0;
  }
}
</style>
