<template>
    <div>
        <el-dialog
          title="高级查询"
          :visible="moreQueryVisible"
          @close="close"
          width="66%">
          <el-form
            inline
            ref="queryForm"
            label-position="top"
            :model="formData">
            <el-form-item
              label="批次属性编码"
              prop="lotCode">
              <el-input v-model="formData.lotCode"></el-input>
            </el-form-item>
            <el-form-item
              label="批次属性名称"
              prop="lotName">
              <el-input v-model="formData.lotName"></el-input>
            </el-form-item>
            <el-form-item
              label="创建人"
              prop="creator">
              <PublicQuery
              title="创建人"
              baseUrl="/bd_web/bdweb"
              cfgKey="bdWmsCustomer"
              :valueField.sync="formData.creator">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="修改人"
              prop="modifier">
              <PublicQuery
              title="修改人"
              baseUrl="/bd_web/bdweb"
              cfgKey="bdWmsPackage"
              :valueField.sync="formData.modifier">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="创建时间">
              <el-date-picker
                v-model="date1"
                type="datetimerange"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm:ss"
                :default-time="['00:00:00', '23:59:59']"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :picker-options="pickerOptions2"
                @change="getcreateTime">
              </el-date-picker>
            </el-form-item>
            <el-form-item
              label="修改时间">
              <el-date-picker
                v-model="date2"
                type="daterange"
                align="right"
                unlink-panels
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :picker-options="pickerOptions2"
                @change="getmodifyTime">
              </el-date-picker>
            </el-form-item>
          </el-form>
          <div class="more-query-btn">
            <el-button v-auth="50400050103" type="primary" @click="submitForm">查询</el-button>
            <el-button v-auth="50400050104" @click="resetForm('queryForm')">重置</el-button>
          </div>
        </el-dialog>
    </div>
</template>
<script>
import { time } from 'apec-fe-utils'
import { today, yesterday, week, month, twoMonths, threeMonths } from '@/config/shortcuts'
export default {
  data () {
    return {
      formData: {
        esusUserNameCn: '',
        lotCode: '',
        lotName: '',
        creator: '',
        modifier: '',
        createTimeFrom: '',
        createTimeTo: '',
        modifyTimeFrom: '',
        modifyTimeTo: ''
      },
      date1: '',
      date2: '',
      pickerOptions2: {
        shortcuts: [today, yesterday, week, month, twoMonths, threeMonths]
      },
    }
  },
  mounted () {
  },
  props: {
    moreQueryVisible: Boolean
  },
  methods: {

    // 创建时间
    getcreateTime (val) {
      this.formData.createTimeFrom = val[0]
      this.formData.createTimeTo = val[1]
    },
    // 修改时间
    getmodifyTime (val) {
      this.formData.modifyTimeFrom = val[0]
      this.formData.modifyTimeTo = val[1]
    },

    // 关闭弹窗
    close () {
      this.$emit('close')
    },

    // 提交表单
    submitForm () {
      this.$emit('toGetList', this.formData)
      this.$refs['queryForm'].resetFields()
    },

    // 重置表单
    resetForm () {
      this.$refs['queryForm'].resetFields()
    },

  }
}
</script>
