<template>
<el-dialog
  class="more-query"
  title="高级查询"
  width="70%"
  :visible="showMore"
  @close="close"
>
  <el-form
    inline
    label-position="top"
    :model="query"
    ref="queryForm"
  >
    <el-form-item label="车牌号" prop="vehicleNo">
      <el-input v-model="query.vehicleNo"></el-input>
    </el-form-item>
    <!--筛选框-->
    <el-form-item label="车辆类型" prop="businessType">
      <el-select multiple v-model="typeArr" @change="selectChange">
        <el-option
          v-for="item in $keys.warehouseBasic.vehicle.businessType"
          :key="item.id"
          :label="item.name"
          :value="item.key"
        ></el-option>
      </el-select>
    </el-form-item>

    <!--输入框-->
    <template v-for="item in inputs">
      <el-form-item
        :key="item.prop"
        :label="item.label"
        :prop="item.prop"
      >
        <el-input v-model="query[item.prop]"></el-input>
      </el-form-item>
    </template>

  </el-form>
  <div class="more-query__btn">
    <el-button type="primary" @click="submitForm">查询</el-button>
    <el-button @click="resetForm('queryForm')">重置</el-button>
  </div>
</el-dialog>
</template>

<script>
export default {
  props: ['showMore', 'queryProp'],
  created () {
  },
  mounted () {
  },

  data () {
    return {
      query: {}, // 查询条件
      baseUrl: '/bd_web/bdweb', // 多条件基础URL
      typeArr: [], // 类型选择结果
      inputs: [
        { label: '驾驶员', prop: 'driver' },
        { label: '车型', prop: 'vehicleType' },
        { label: '身份证号', prop: 'driverIdentity' },
        { label: '联系电话', prop: 'driverTel' },
      ],
    }
  },
  methods: {
    // 关闭弹窗
    close () {
      this.$emit('close')
    },
    // 提交表单
    submitForm () {
      this.$emit('toGetList', this.query)
      this.close()
    },
    // 重置表单
    resetForm (formName) {
      this.typeArr = []
      this.$refs[formName].resetFields()
    },
    // 多选变化
    selectChange (val) {
      this.query.businessType = val.join(',')
    },
  },
}
</script>

<style lang="scss" scoped>
</style>
