<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="asnNo">
              <el-input v-model="formData.asnNo"></el-input>
            </el-form-item>
            <el-form-item
              label="物流单号"
              prop="logisticNo">
              <el-input v-model="formData.logisticNo"></el-input>
            </el-form-item>
            <el-form-item
              label="状态"
              prop="status">
              <el-select multiple v-model="formData.status">
                <el-option label="创建" value="00"></el-option>
                <el-option label="部分收货" value="10"></el-option>
                <el-option label="完全收货" value="20"></el-option>
                <el-option label="取消订单" value="90"></el-option>
                <el-option label="关闭订单" value="99"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="入库单类型"
              prop="asnType">
              <el-select multiple v-model="formData.asnType">
                <el-option label="普通入库" value="PI"></el-option>
                <el-option label="调拨入库" value="AI"></el-option>
                <el-option label="退货入库" value="RI"></el-option>
                <el-option label="换货入库" value="EI"></el-option>
              </el-select>
            </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="getTime1">
              </el-date-picker>
            </el-form-item>
            <el-form-item
              label="货主"
              prop="ownerName">
              <PublicQuery
              title="货主"
              baseUrl="/rep_web/repweb"
              cfgKey="repWmsCustomer"
              :valueField.sync="formData.ownerCode"
              :textField.sync="formData.ownerName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="商品"
              prop="skuName">
              <PublicQuery
              title="商品"
              baseUrl="/rep_web/repweb"
              cfgKey="repWmsSku"
              :valueField.sync="formData.skuCode"
              :textField.sync="formData.skuName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="修改人">
              <PublicQuery
              title="修改人"
              baseUrl="/rep_web/repweb"
              cfgKey="repWmsOperator"
              :valueField.sync="formData.modifyName"
              :textField.sync="formData.modifyLoginName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="创建人"
              prop="businessItemName">
              <PublicQuery
              title="创建人"
              baseUrl="/rep_web/repweb"
              cfgKey="repWmsOperator"
              :valueField.sync="formData.createName"
              :textField.sync="formData.createLoginName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="修改时间">
              <el-date-picker
                v-model="date2"
                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="getTime2">
              </el-date-picker>
            </el-form-item>
            <el-form-item
              label="创建时间">
              <el-date-picker
                v-model="date3"
                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="getTime3">
              </el-date-picker>
            </el-form-item>
            <el-form-item
              label="订单时间">
              <el-date-picker
                v-model="date4"
                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="getTime4">
              </el-date-picker>
            </el-form-item>
          </el-form>
          <div class="more-query-btn">
            <el-button v-auth="50910010103" type="primary" @click="submitForm">查询</el-button>
            <el-button v-auth="50910010104" @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: {},
      pickerOptions2: {
        shortcuts: [today, yesterday, week, month, twoMonths, threeMonths]
      },
      date1: '',
      date2: '',
      date3: '',
      date4: '',

    }
  },
  mounted () {
  },
  props: {
    moreQueryVisible: Boolean,
  },
  methods: {

    // 获得时间
    getTime1 (val) {
      this.formData.rcvTimeFrom = val ? val[0] : ''
      this.formData.rcvTimeTo = val ? val[1] : ''
    },
    getTime2 (val) {
      this.formData.modifyTimeFrom = val ? val[0] : ''
      this.formData.modifyTimeTo = val ? val[1] : ''
    },
    getTime3 (val) {
      this.formData.createTimeFrom = val ? val[0] : ''
      this.formData.createTimeTo = val ? val[1] : ''
    },
    getTime4 (val) {
      this.formData.orderTimeFrom = val ? val[0] : ''
      this.formData.orderTimeTo = val ? val[1] : ''
    },

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

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

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

  }
}
</script>
