<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="locCode">
              <el-input v-model="formData.locCode"></el-input>
            </el-form-item>
            <el-form-item
              label="上架顺序"
              prop="paSeq">
              <el-input v-model="formData.paSeq"></el-input>
            </el-form-item>
            <el-form-item
              label="拣货顺序"
              prop="pkSeq">
              <el-input v-model="formData.pkSeq"></el-input>
            </el-form-item>
            <el-form-item
              label="库位组"
              prop="locGroup">
              <el-input v-model="formData.locGroup"></el-input>
            </el-form-item>
            <el-form-item
              label="最大混商品数"
              prop="maxMixSku">
              <el-input v-model="formData.maxMixSku"></el-input>
            </el-form-item>
            <el-form-item
              label="最大混批次数"
              prop="maxMixLot">
              <el-input v-model="formData.maxMixLot"></el-input>
            </el-form-item>
            <el-form-item
              label="库位编码从"
              prop="locCodeFrom">
              <el-input v-model="formData.locCodeFrom"></el-input>
            </el-form-item>
            <el-form-item
              label="库位编码到"
              prop="locCodeTo">
              <el-input v-model="formData.locCodeTo"></el-input>
            </el-form-item>
            <el-form-item
              label="通道"
              prop="lane">
              <el-input v-model="formData.lane"></el-input>
            </el-form-item>
            <el-form-item
              label="序号"
              prop="seq">
              <el-input v-model="formData.seq"></el-input>
            </el-form-item>
            <el-form-item
              label="层"
              prop="cdwlFloor">
              <el-input v-model="formData.cdwlFloor"></el-input>
            </el-form-item>
            <el-form-item
              label="最大托盘数"
              prop="maxPl">
              <el-input v-model="formData.maxPl"></el-input>
            </el-form-item>
            <el-form-item
              label="库位状态"
              prop="status">
              <el-select multiple v-model="formData.type">
                <el-option label="正常" value="00"></el-option>
                <el-option label="冻结" value="99"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="使用类型"
              prop="locUseType">
              <el-select multiple v-model="formData.locUseType">
                <el-option label="箱件合并拣货库位" value="PC"></el-option>
                <el-option label="过渡车位" value="ST"></el-option>
                <el-option label="理货站" value="SS"></el-option>
                <el-option label="品质库位" value="QC"></el-option>
                <el-option label="加工台" value="KT"></el-option>
                <el-option label="越库库位" value="CD"></el-option>
                <el-option label="存储库位" value="RS"></el-option>
                <el-option label="箱拣货库位" value="CS"></el-option>
                <el-option label="件拣货库位" value="EA"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="固定/动态拣货位"
              prop="locPkType">
              <el-select multiple v-model="formData.type">
                <el-option label="固定拣货位" value="FPL"></el-option>
                <el-option label="动态拣货位" value="DPL"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="库位ABC"
              prop="abc">
              <el-select multiple v-model="formData.abc">
                <el-option label="A" value="A"></el-option>
                <el-option label="B" value="B"></el-option>
                <el-option label="C" value="C"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="库位种类"
              prop="cdwlCategory">
              <el-select multiple v-model="formData.cdwlCategory">
                <el-option label="平面仓库位" value="1"></el-option>
                <el-option label="货架仓库位" value="2"></el-option>
                <el-option label="高架仓库位" value="3"></el-option>
                <el-option label="重力式货架库位" value="4"></el-option>
                <el-option label="堆垛机货架库位" value="5"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="混商品"
              prop="isMixSku">
              <el-select v-model="formData.isMixSku">
                <el-option label="是" value="Y"></el-option>
                <el-option label="否" value="N"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="混批次"
              prop="isMixLot">
              <el-select  v-model="formData.isMixLot">
                <el-option label="是" value="Y"></el-option>
                <el-option label="否" value="N"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="忽略跟踪号"
              prop="isLoseId">
              <el-select  v-model="formData.isLoseId">
                <el-option label="是" value="Y"></el-option>
                <el-option label="否" value="N"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="是否启用"
              prop="isEnable">
              <el-select  v-model="formData.isEnable">
                <el-option label="是" value="Y"></el-option>
                <el-option label="否" value="N"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="所属库区"
              prop="zoneCode">
              <PublicQuery
              title="所属库区"
              baseUrl="/bd_web/bdweb"
              cfgKey="bdWmsZone"
              :valueField.sync="formData.zoneCode"
              :textField.sync="formData.zoneName">
              </PublicQuery>
            </el-form-item>
          </el-form>
          <div class="more-query-btn">
            <el-button v-auth="50300030101" type="primary" @click="submitForm">查询</el-button>
            <el-button v-auth="50300030101" @click="resetForm('queryForm')">重置</el-button>
          </div>
        </el-dialog>
    </div>
</template>
<script>
export default {
  data () {
    return {
      formData: {
        locCode: '',
        paSeq: '',
        pkSeq: '',
        locGroup: '',
        maxMixSku: '',
        maxMixLot: '',
        locCodeFrom: '',
        locCodeTo: '',
        lane: '',
        seq: '',
        cdwlFloor: '',
        maxPl: '',
        status: [],
        locUseType: [],
        locPkType: [],
        abc: [],
        cdwlCategory: [],
        isMixSku: '',
        isMixLot: '',
        isLoseId: '',
        isEnable: '',
        zoneCode: '',
        zoneName: ''
      },
    }
  },
  mounted () {
  },
  props: {
    moreQueryVisible: Boolean
  },
  methods: {

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

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

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

    // 格式化对象数据
    format () {
      for (const key in this.formData) {
        if (this.formData.hasOwnProperty(key)) {
          const element = this.formData[key]
          if (Array.isArray(element)) {
            this.formData[key] = element.join(',')
          }
        }
      }
      return this.formData
    }
  }
}
</script>
