webpackJsonp([2],{"32al":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o("Xxa5"),a=o.n(n),s=o("exGp"),r=o.n(s),i=o("Dd8w"),d=o.n(i),c=o("NYxO"),u=(o("jQQ7"),o("dO7o")),l=o("hky6"),p=o("dClm"),h=o("CIZm"),_=o("Pfph"),m={name:"goodsExchangeAdd",data:function(){return{typeList:[],adminList:[],dialogVisible:!1,warehouseList:[],deptList:[],deptListAll:[],orderList:[],id:"",type:"",goodsExchangeAddForm:{order_list:[{order_id:"1752156400898293761",order_item_list:[{batch_list:[{batch_id:0,batch_sn:"",out_num:0,remain_num:0,warehouse_entry_sn:""}],num:0,order_item_id:0,product_id:0,product_name:"string",product_sn:"string",product_specification:"string",product_unit:"string"}],order_sn:""}],product_list:[],type:""},goodsExchangeAddFormRule:{warehouse_id:[{required:!0,message:"请选择出库仓库",trigger:"change"}],type:[{required:!0,message:"请选择出库类型",trigger:"change"}]},warehouseProduct:null,scanDialogVisible:!1,scanGoodsForm:{},routeName:"",sttorageType:"",goodsVisible:!1,goodsData:[],goodsList:[],product_list:[],snCodeVisible:!1,sn_code:"",sku:"",sn_code_list:[],index:""}},mounted:function(){this.routeName=this.$route.name,this.sttorageType=this.$route.params.type,this.GET_WarehouseList(),this.GET_DeptList(),this.outType()},watch:{$route:{immediate:!0,handler:function(e){"goodsExchangeEdit"===this.$route.name?this.type="edit":"goodsExchangeAudit"===this.$route.name?this.type="audit":"goodsExchangeReturn"===this.$route.name?this.type="return":"goodsExchangeAdd"===this.$route.name?(this.type="add",this.GET_WarehouseList({dept_id:this.user.dept_id}),this.$set(this.goodsExchangeAddForm,"change_time",(new Date).getTime())):"goodsExchangeDetail"===this.$route.name&&(this.type="detail"),this.$route.params.id&&(this.id=this.$route.params.id,this.GET_goodsExchangeAddDetail()),this.GET_AdministratorList()}}},computed:d()({},Object(c.b)(["user"])),methods:{toBack:function(){this.$router.push({name:"goodsExchange",params:{type:"first"}})},toSnCode:function(){var e=this;u.l("out",this.sku,this.sn_code.replace(/\s+/g,"")).then(function(t){e.sn_code="",e.goodsExchangeAddForm.product_list[e.index].sn_code_list.find(function(e){return e.sn_code===t.sn_code&&e.sku===t.sku})||e.goodsExchangeAddForm.product_list[e.index].sn_code_list.push(t),e.goodsExchangeAddForm.product_list[e.index].out_num=e.goodsExchangeAddForm.product_list[e.index].sn_code_list.length,e.scanGoodsForm.bar_code="",e.$nextTick(function(){e.$refs.input.focus()})})},addSnCode:function(e,t){this.sku=e.product_vo.sku,this.index=t,this.snCodeVisible=!0},outType:function(){var e=this;l.u({dictType:"out_warehouse_type"}).then(function(t){e.typeList=t.data})},printIng:function(){},toSearch:function(){var e=this;u.k(this.goodsExchangeAddForm.warehouse_id,this.scanGoodsForm.bar_code.replace(/\s+/g,"")).then(function(t){t.sn_code_list=[],e.sku=t.product_vo.sku;var o=e.goodsExchangeAddForm.product_list.findIndex(function(e){return console.log("Comparing with:",e),e.goods_id===t.goods_id&&e.product_id===t.product_id&&e.warehouse_id===t.warehouse_id&&e.product_vo.sku===t.product_vo.sku});-1===o?(e.index=e.goodsExchangeAddForm.product_list.length,e.goodsExchangeAddForm.product_list.push(t)):e.index=o,t.product_vo.have_sn&&e.$nextTick(function(){e.$refs.sn_input.focus()})})},scanCode:function(){var e=this;this.goodsExchangeAddForm.warehouse_id?(this.scanDialogVisible=!0,this.$nextTick(function(){e.$refs.input.focus()})):this.$message.error("请先选择仓库!")},GET_AdministratorList:function(){var e=this;_.h({page_no:1,page_size:9999,user_state:0}).then(function(t){e.adminList=t.data})},GET_WarehouseList:function(e){var t=this;p.E().then(function(e){t.warehouseList=e})},saveGoodsExchangeAddForm:function(){var e=this;this.$refs.goodsExchangeAddForm.validate(function(t){if(t){var o=e.goodsExchangeAddForm.id,n=e.MixinClone(e.goodsExchangeAddForm);if(n.save_or_submit="save",n.warehouse_consignee_id=e.deptListAll.id,n.out_time=Date.parse(new Date),n.staff_name=e.goodsExchangeAddForm.distribution_name,n.warehouse_id&&(n.warehouse_name=e.warehouseList.find(function(e){return e.id===n.warehouse_id}).name),n.handled_by_id&&(n.handled_by=e.adminList.find(function(e){return e.id===n.handled_by_id}).real_name),n.change_time=Math.floor(n.change_time/1e3),!e.goodsExchangeAddForm.product_list.length)return;if(!n.product_list.map(function(t){return!(t.out_num