
<template>
    <div>
      <el-dialog title="上架任务" :visible.sync="goodsFormVisible" :before-close="handleProcessclose">
           <el-form
            inline
            ref="formData"
            label-position="top"
            :model="formData"
            :rules="rules">
            <div>
              <el-form-item
                label="货主"
                prop="ownerName">
                <el-input v-model="formData.ownerName" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="商品编码"
                prop="skuCode">
                <el-input v-model="formData.skuCode" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="商品名称"
                prop="skuName">
                <el-input v-model="formData.skuName" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="包装规格"
                prop="packDesc">
                <el-input v-model="formData.packDesc" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="包装单位"
                prop="uomDesc">
                <el-input v-model="formData.uomDesc" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="批次号"
                prop="qtyPlanEa">
                <el-input v-model="formData.lotNum" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="源库位"
                prop="fmLoc">
                <PublicQuery
                title="计划工作台"
                single
                disabled
                cfgKey="kitWmsLoc"
                baseUrl="/kit_web/kitweb"
                :valueField.sync="formData.fmLoc"
                :textField.sync="formData.fmLoc"
              ></PublicQuery>
              </el-form-item>
              <el-form-item
                label="源跟踪号"
                prop="fmId">
                <el-input v-model="formData.fmId" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="上架人"
                prop="paName">
                <PublicQuery
                title="计划工作台"
                single
                cfgKey="kitWmsOperator"
                baseUrl="/kit_web/kitweb"
                :valueField.sync="formData.paName"
                :textField.sync="formData.paName"
              ></PublicQuery>
              </el-form-item>
              <el-form-item
                label="上架时间"
                prop="paTime">
                <el-date-picker
                    v-model="formData.paTime"
                    value-format="yyyy-MM-dd HH:mm:00"
                  ></el-date-picker>
              </el-form-item>
               <el-form-item
                label="推荐单位"
                prop="qtyPlanEa">
                <el-input v-model="formData.suggestLoc" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="上架库位"
                prop="toLoc">
                <PublicQuery
                title="计划工作台"
                single
                cfgKey="kitWmsLoc"
                baseUrl="/kit_web/kitweb"
                :valueField.sync="formData.toLoc"
                :textField.sync="formData.toLoc"
              ></PublicQuery>
              </el-form-item>
              <el-form-item
                label="上架跟踪号"
                prop="toId">
                <el-input v-model="formData.toId" ></el-input>
              </el-form-item>
              <el-form-item
                label="上架数"
                prop="logisticLineNo">
                <el-input v-model="formData.qtyPaUom" type="Number"></el-input>
              </el-form-item>
              <el-form-item
                label="上架数EA"
                prop="logisticLineNo">
                <el-input v-model="formData.currentPaQtyEa" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="上架库位指定规则"
                prop="logisticLineNo">
                <el-select  v-model="formData.qtyPaUom"  filterable  placeholder="请选择" disabled>
                    <el-option label="创建" value="10"></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-select>
              </el-form-item>
              <el-form-item
                label="上架规则"
                prop="paRuleName">
                <el-input v-model="formData.paRuleName" disabled></el-input>
              </el-form-item>
              <el-form-item
                label="备注"
                prop="remark">
                <el-input v-model="formData.remark" ></el-input>
              </el-form-item>
            </div>
          </el-form>
          <el-button type="primary" style="margin-top: 10px" @click="handleAffirm('formData')">上架确认</el-button>
      </el-dialog>
    </div>
</template>
<script>
export default {
  data () {
    return {
      formData: {},
      rules: {
        toLoc: [{ required: true, message: '请输入上架库位', trigger: 'change' }],
        toId: [{ required: true, message: '请输入上架跟踪号', trigger: 'blur' }],
      }
    }
  },
  props: {
    goodsFormVisible: Boolean,
  },
  mounted () {

  },
  methods: {
    handleAffirm (formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const url = this.$API.maintain.KitTaskPaList.kitBatch
          const param = { paTasks: JSON.stringify([this.formData]) }
          this.$https.post(url, param).then(res => {
            this.$emit('handleProcessclose')
          })
        } else {
          return false
        }
      })
    },
    getMessage (data) {
      this.formData = data
    },
    handleProcessclose () {
      this.$emit('handleProcessclose')
    },
  }
}
</script>
