<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="30"></el-option>
                <el-option label="完全分配" value="40"></el-option>
                <el-option label="部分拣货" value="50"></el-option>
                <el-option label="完全拣货" value="60"></el-option>
                <el-option label="部分发运" value="70"></el-option>
                <el-option label="完全发运" value="80"></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="soType">
              <el-select multiple v-model="formData.soType">
                <el-option label="普通出库" value="PO"></el-option>
                <el-option label="调拨出库" value="AO"></el-option>
                <el-option label="退货出库" value="RO"></el-option>
                <el-option label="换货出库" value="EO"></el-option>
                <el-option label="排序出库" value="OO"></el-option>
              </el-select>
            </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="repWmsConsignee"
              :valueField.sync="formData.consigneeCode"
              :textField.sync="formData.consigneeName">
              </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="50910020103" type="primary" @click="submitForm">查询</el-button>
            <el-button v-auth="50910020104" @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]
      },
      date2: '',
      date3: '',
      date4: '',

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

    // 获得时间
    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>
