| <template> | 
|   <div class="dialog-container"> | 
|     <el-dialog v-dialogDrag :visible.sync="currentVisible" width="1200px" title="确认入库"> | 
|       <el-alert title="确认入库" type="success"></el-alert> | 
|       <el-table :data="listtableData" stripe style="width: 100%"> | 
|         <el-table-column prop="typeName" label="物料类别" width="80"> | 
|         </el-table-column> | 
|         <el-table-column prop="productCode" label="物料编号" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="quantity" label="订单数量" width="80"> | 
|         </el-table-column> | 
|         <el-table-column prop="productName" label="物料名称" width="150"> | 
|         </el-table-column> | 
|         <el-table-column prop="applyDate" label="入库日期" width="160"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-date-picker v-model="row.applyDate" class="w-140" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker> | 
|           </template> | 
|         </el-table-column> | 
|         <!-- <el-table-column prop="Quantity" label="数量"> | 
|         </el-table-column> --> | 
|         <el-table-column prop="enterQuantity" label="待收数量" width="110"> | 
|           <template slot-scope="{$idnex, row, col}"> | 
|             <el-input-number v-model.number="row.enterQuantity" :max="row.quantity" controls-position="right" class="w-100" @change="changeEnterQuantity(row, col)"></el-input-number> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="unQuantity" label="已收数量" width="80"> | 
|         </el-table-column> | 
|         <el-table-column prop="positionName" label="收货位" width="160"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <!-- <el-input v-model="row.positionName" clearable controls-position="right" class="w-100"></el-input> --> | 
|             <!-- <el-select v-model="row.positionName" clearable placeholder="请选择"> | 
|               <el-option v-for="item in positionlist" :key="item.positionName" :label="item.positionName" :value="item.positionName"> | 
|               </el-option> | 
|             </el-select> --> | 
|             <input-select v-model="row.positionName" :options="positionlist" label="货位" input-width="150px" trigger="focus" @on-item-click="elDropdownSelect(scope, arguments[1])" @on-row-change="elDropdownChange(scope, arguments[1])" @on-key-up="elDropdownKeyup(scope,arguments[1])"> | 
|             </input-select> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="productnature" label="物料属性" width="100"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-select v-model="row.productnature" placeholder="请选择"> | 
|               <el-option v-for="item in dropDownList_DestAttr" :key="item.value" :label="item.label" :value="item.value"> | 
|               </el-option> | 
|             </el-select> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="creator" label="验货员" width="150"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-select v-model="row.creator" placeholder="请选择"> | 
|               <el-option v-for="item in creatorlist" :key="item.userTrueName" :label="item.userTrueName" :value="item.userTrueName"> | 
|               </el-option> | 
|             </el-select> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="weight" label="单位重量" width="110"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model.number="row.weight" class="w-100pc" @change="changeWeight(row, col)"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="totalWeight" label="小计重量" width="110"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model.number="row.totalWeight" class="w-100pc" @change="changeTotalWeight(row, col)"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="produceDate" label="生产日期" width="160"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-date-picker v-model="row.produceDate" class="w-140" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="plateCode" label="收货拍号" width="120"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model="row.plateCode" class="w-100"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="totalPackageQty" label="总件数" width="80"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model.number="row.totalPackageQty" class="w-100pc" @change="changeUnitPackage(row, col)"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="unitPackage" label="打包配置" width="80"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model.number="row.unitPackage" class="w-100pc" @change="changeUnitPackage(row, col)"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="paiQty" label="建议拍数" width="80"> | 
|           <template slot-scope="{$idnex, row}"> | 
|             <el-input v-model.number="row.paiQty" class="w-100pc" @change="changeUnitPackage(row, col)"></el-input> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="batchNumber" label="批次号" width="120"> | 
|         </el-table-column> | 
|         <el-table-column prop="singleSignCode" label="唯一码" width="200"> | 
|         </el-table-column> | 
|         <!-- <el-table-column prop="dockCrossing" label="装卸道口" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="sealNo" label="铅封号" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="surveyDegree" label="测温温度" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="storageDegree" label="存储温度" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="isDock" label="是否使用装卸" width="120"> | 
|         </el-table-column> | 
|         <el-table-column prop="abnormal" label="异常" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="abnormalPieces" label="异常件数" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="otherServices" label="其他服务" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="truckNo" label="车牌号" width="100"> | 
|         </el-table-column> | 
|         <el-table-column prop="mobile" label="司机电话" width="120"> | 
|         </el-table-column> --> | 
|         <el-table-column v-if="show" prop="product_Id" label="物料ID" width="110"> | 
|         </el-table-column> | 
|       </el-table> | 
|       <div slot="footer" class="dialog-footer"> | 
|         <!-- <el-switch v-model="isSorting" active-color="#13ce66" inactive-color="#ff4949" active-text="是否分拣"></el-switch> --> | 
|         <el-button @click="currentVisible = false">取 消</el-button> | 
|         <el-button type="primary" @click="saveCheck">确 定</el-button> | 
|       </div> | 
|     </el-dialog> | 
|   </div> | 
| </template> | 
|   | 
| <script> | 
| import InputSelect from "@/components/base/InputSelect"; | 
| var moment = require("moment"); | 
| export default { | 
|   name: "quick-enter", | 
|   components: { InputSelect }, | 
|   props: { | 
|     // 显示对话框 | 
|     visible: { | 
|       type: Boolean, | 
|       default: false, | 
|       required: true | 
|     } | 
|   }, | 
|   data() { | 
|     return { | 
|       // 明细数据 | 
|       listtableData: [], | 
|       isSorting: false, | 
|       show: false, | 
|       // 获取验证员 | 
|       creatorlist: [], | 
|       // 获取货位 | 
|       positionlist: [], | 
|       creator: "", | 
|       positionName: "", | 
|       // 物料属性 | 
|       productnature: "", | 
|       // 物料属性 | 
|       dropDownList_DestAttr: [ | 
|         { | 
|           value: "合格", | 
|           label: "合格" | 
|         }, | 
|         { | 
|           value: "冲压待返修", | 
|           label: "冲压待返修" | 
|         } | 
|       ], | 
|       // 当前订单ID | 
|       order_Id: 0, | 
|       // 当前仓库ID | 
|       storage_Id: 0 | 
|     }; | 
|   }, | 
|   computed: { | 
|     currentVisible: { | 
|       get: function() { | 
|         return this.visible; | 
|       }, | 
|       set: function(val) { | 
|         this.$emit("update:visible", val); | 
|       } | 
|     } | 
|   }, | 
|   mounted() { | 
|     this.getCreater(); | 
|   }, | 
|   methods: { | 
|     // 收货位触发的实践 | 
|     elDropdownSelect(scope, data) { | 
|       scope.row.shelvePositionName = data; | 
|     }, | 
|     elDropdownChange(scope, data) { | 
|       scope.row.shelvePositionName = data; | 
|     }, | 
|     elDropdownKeyup(scope, data) { | 
|       try { | 
|         this.getVagueName(data); | 
|         if (!data) { | 
|           scope.row.choosePositionNameArray = scope.row.shelvePositionNameArray.filter(item => { | 
|             return true; | 
|           }); | 
|           return; | 
|         } | 
|         const filterItems = scope.row.shelvePositionNameArray.filter(item => { | 
|           if (!item.label) return false; | 
|           return item.label.indexOf(data) >= 0; | 
|         }); | 
|         scope.row.choosePositionNameArray = filterItems; | 
|       } catch (error) { | 
|         // console.log(error.message); | 
|       } | 
|     }, | 
|     // 初始化数据 | 
|     initData(order_Id, storage_Id, plateCode) { | 
|       this.getPositionName(storage_Id); | 
|       this.storage_Id = storage_Id; | 
|       this.plateCode = plateCode; | 
|       debugger; | 
|   | 
|       this.order_Id = order_Id; | 
|       const url = "/api/inbound/order/getOrderDetails"; | 
|       const params = { | 
|         order_Id: order_Id, | 
|         storage_Id: storage_Id | 
|       }; | 
|       this.common.ajax(url, params, res => { | 
|         this.common.showMsg(res); | 
|         if (res.result) { | 
|           this.listtableData = res.data.map(row => { | 
|             row.applyDate = moment(row.applyDate).format("YYYY-MM-DD HH:mm:ss"); | 
|             row.creator = "超级管理员"; | 
|             row.productnature = "合格"; | 
|             return row; | 
|           }); | 
|         } | 
|       }); | 
|     }, | 
|     // 确认入库提交数据 | 
|     saveCheck() { | 
|       const the = this; | 
|       const jsonDetails = this.listtableData; | 
|       const url = "/api/inbound/order/saveCheck"; | 
|       const params = { | 
|         order_Id: this.order_Id, | 
|         storage_Id: this.storage_Id, | 
|         jsonDetails: jsonDetails, | 
|         plateCode: this.plateCode | 
|       }; | 
|       debugger; | 
|       const ref = this.$parent.dataList; | 
|       var callback = res => { | 
|         the.common.showMsg(res); | 
|         if (res.result) { | 
|           this.listtableData = []; // 重置 | 
|           this.currentVisible = false; // 关闭弹框 | 
|           ref.loadData(); // 刷新 | 
|         } | 
|       }; | 
|       the.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 验货员获取用户管理中的用户 | 
|     getCreater() { | 
|       const url = "/api/sys/user/getList"; | 
|       const params = {}; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.creatorlist = res.data; | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 获取当前订单的收货位 | 
|     getPositionName(storage_Id) { | 
|       const url = "/api/basicInfo/base/position/getPositionName"; | 
|       const params = { | 
|         storage_Id: storage_Id | 
|       }; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.positionlist = res.data.map(item => { | 
|             item.label = item.positionName; | 
|             item.value = item.positionName; | 
|             return item; | 
|           }); | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 根据仓库和货位名称模糊查询 | 
|     getVagueName(positionName) { | 
|       const url = "/api/basicInfo/base/position/getVaguePositionName"; | 
|       const params = { | 
|         storage_Id: this.storage_Id, | 
|         positionName: positionName | 
|       }; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.positionlist = []; | 
|           this.positionlist = res.data.map(item => { | 
|             item.label = item.positionName; | 
|             item.value = item.positionName; | 
|             return item; | 
|           }); | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|   | 
|     // 数量改变 | 
|     changeEnterQuantity(row, col) { | 
|       const number = row.quantity - row.unQuantity; // 总数量-已收数量 = 最大可收货数量 | 
|       if (row.enterQuantity > number) { | 
|         this.$message.error("已为你设置最大待收数量!"); | 
|         return false; | 
|       } | 
|       // row.unQuantity = row.quantity - row.enterQuantity; | 
|       row.totalWeight = row.weight * row.enterQuantity; | 
|   | 
|       // 待入库数量改变时,同步总件数 | 
|       row.totalPackageQty = row.enterQuantity; | 
|   | 
|       // 建议拍数 = 总件数 / 打包配置 | 
|       row.paiQty = row.unitPackage ? Math.ceil((row.totalPackageQty || 0) / (row.unitPackage || 0)) : 0; | 
|     }, | 
|     // 单位重量改变 | 
|     changeWeight(row, col) { | 
|       row.totalWeight = row.weight * row.enterQuantity; | 
|     }, | 
|     // 小计重量改变 | 
|     changeTotalWeight(row, col) { | 
|       row.weight = row.enterQuantity ? row.totalWeight / row.enterQuantity : 0; | 
|     }, | 
|     // 计算拍数 | 
|     changeUnitPackage(row, col) { | 
|       // 建议拍数 = 总件数 / 打包配置 | 
|       row.paiQty = row.unitPackage ? Math.ceil(row.totalPackageQty / row.unitPackage) : 0; | 
|     } | 
|   } | 
| }; | 
| </script> |