addOutbound-CRH-KyYT.js 12 KB

1
  1. import{_ as we,r as n,c as xe,a as Ve,o as Ce,f as g,i as l,w as s,h as w,k as b,l as k,s as Oe,q as Ee,t as Se,E as m,V as D,p as f,v as r,F as M,x as N,m as _,y as h,a1 as X,Z as Ue,$ as Te}from"./index-DrwGqDEP.js";import{h as Y,i as ee,j as Ae,d as Re,s as Ge,k as ze,c as Be,l as De}from"./goodsExchange-DJIzdXdA.js";import{a as Fe}from"./setting-BY0b_v3N.js";import{g as Le}from"./basicSetting-zIImSysu.js";const te=A=>(Ue("data-v-7183a4ec"),A=A(),Te(),A),We={class:"bg-in-stock"},Ie={class:"mx"},$e=te(()=>w("h3",null,"商品明细",-1)),je={style:{width:"100%",display:"block"}},qe={key:0,slot:"reference"},Me={key:0},Ne={key:1},Pe={key:0},He={key:1},Ke={class:"footer"},Ze={style:{display:"flex","align-items":"center","justify-content":"flex-end",padding:"10px 0"}},Je=te(()=>w("span",null,"搜索商品:",-1)),Qe={__name:"addOutbound",setup(A){const C=Oe(),O=Ee(),ae=Se(),u=n({product_list:[],type:""}),le=n({warehouse_id:[{required:!0,message:"请选择出库仓库",trigger:"change"}],type:[{required:!0,message:"请选择出库类型",trigger:"change"}]}),P=n([]),H=n([]),F=n(!1),R=n([]);n([]);const G=n([]);n([]);const z=n(""),d=n("");n(null);const L=n(!1),x=n({}),oe=n(""),ue=n(""),E=n(!1),S=n([]);n(!1);const B=n(""),W=n("");n([]);const y=n("");xe(()=>ae.getters.user);const se=()=>{O.push({name:"goodsOutBound"})},ne=async()=>{if(W.value=="")return m.error("请录入正确的sku");await Re("out",W.value,B.value.replace(/\s+/g,"")).then(async o=>{B.value="",u.value.product_list[y.value].sn_code_list.find(t=>t.sn_code===o.sn_code&&t.sku===o.sku)||(z.value?await Ge({send_order_id:z.value,item_id:u.value.product_list[y.value].id,sku:o}).then(t=>{u.value.product_list[y.value].sn_code_list.push(o)}):u.value.product_list[y.value].sn_code_list.push(o)),u.value.product_list[y.value].out_num=u.value.product_list[y.value].sn_code_list.length,x.value.bar_code="",D(()=>{refs.input.focus()})})},de=()=>{Fe({dictType:"out_warehouse_type"}).then(o=>{P.value=o.data})},ie=()=>{},re=()=>{ze(u.value.warehouse_id,x.value.bar_code.replace(/\s+/g,"")).then(o=>{o.sn_code_list=[],W.value=o.product_vo.sku;const a=u.value.product_list.findIndex(t=>t.goods_id===o.goods_id&&t.product_id===o.product_id&&t.product_vo.sku===o.product_vo.sku);a===-1?(y.value=u.value.product_list.length,u.value.product_list.push(o)):y.value=a,o.product_vo.have_sn?D(()=>{refs.sn_input.focus()}):u.value.product_list[y.value].num+=1})},_e=()=>{if(!u.value.warehouse_id){m.error("请先选择仓库!");return}L.value=!0,D(()=>{refs.input.focus()})},K=o=>{Le().then(a=>{R.value=a})},I=n(),ce=()=>{console.log(112),I.value.validate(o=>{if(o){const{id:a}=u.value,t={...u.value};if(t.save_or_submit="save",t.warehouse_consignee_id=G.value.id,t.out_time=Date.parse(new Date),t.staff_name=u.value.distribution_name,t.warehouse_id&&(t.warehouse_name=R.value.find(i=>i.id===t.warehouse_id).name),t.handled_by_id&&(t.handled_by=H.value.find(i=>i.id===t.handled_by_id).real_name),t.change_time=Math.floor(t.change_time/1e3),!u.value.product_list.length||(t.type=="OTHER_OUT"||t.type=="BORROW_OUT")&&!t.product_list.map(p=>p.out_num>p.usable_stock?(m.error("该商品库存不足!"),!1):!0))return;d.value=="edit"?Y(a,t).then(i=>{m.success("修改成功!"),O.push({name:"goodsOutBound"})}):(console.log(t),t.product_list.map(i=>{i.product_stock_id=i.id,i.id=""}),ee(t).then(()=>{m.success("添加成功!"),O.push({name:"goodsOutBound"})}))}})},pe=()=>{I.value.validate(o=>{if(o){const{id:a}=u.value,t={...u.value};if(t.save_or_submit="submit",t.warehouse_consignee_id=G.value.id,t.out_time=Date.parse(new Date),t.staff_name=u.value.distribution_name,t.warehouse_id&&(t.warehouse_name=R.value.find(i=>i.id===t.warehouse_id).name),t.handled_by_id&&(t.handled_by=H.value.find(i=>i.id===t.handled_by_id).real_name),t.change_time=Math.floor(t.change_time/1e3),!u.value.product_list.length){m.error("请选择商品!");return}if((t.type=="OTHER_OUT"||t.type=="BORROW_OUT")&&!t.product_list.map(p=>p.out_num>p.usable_stock?(m.error("该商品库存不足!"),!1):!0))return;d.value=="edit"?Y(a,t).then(i=>{m.success("修改成功!"),O.push({name:"goodsOutBound"})}):(t.product_list.map(i=>{i.product_stock_id=i.id,i.id=""}),ee(t).then(()=>{m.success("添加成功!"),O.push({name:"goodsOutBound"})}))}})},Z=()=>{E.value=!1},U=Ve({page_no:1,page_size:10,keyWord:""}),ve=async()=>{if(!u.value.warehouse_id){m.error("请先选择仓库!");return}Be(U,u.value.warehouse_id,"gt").then(o=>{S.value=o,E.value=!0})},$=n([]),me=o=>{$.value=o.map(a=>a)},fe=()=>{$.value.length>=1?(u.value.product_list=$.value.map(o=>o),E.value=!1):m.error("请选择商品信息")},ge=o=>{U.page_size=o,searchGoodEvent()},he=o=>{U.page_no=o,searchGoodEvent()},ye=()=>{Ae().then(o=>{G.value=o,G.value.password=""})},J=()=>{D(()=>{De(C.query.id).then(o=>{u.value=o,K({dept_id:o.warehouse_id}),u.value.change_time=Math.floor(u.value.change_time*1e3),u.value.distribution_name=o.staff_name,u.value.product_list=o.product_list})})};return Ce(()=>{C.query.type=="view"?(d.value="view",J()):C.query.type=="edit"&&(d.value="edit",J()),oe.value=C.name,ue.value=C.params.type,K(),ye(),de()}),(o,a)=>{const t=f("el-option"),i=f("el-select"),p=f("el-form-item"),V=f("el-input"),v=f("el-button"),be=f("el-popover"),c=f("el-table-column"),Q=f("el-table"),j=f("el-form"),q=f("el-dialog"),ke=f("el-pagination");return r(),g("div",We,[l(j,{ref_key:"goodsExchangeAddFormRef",ref:I,model:u.value,rules:le.value,"label-width":"160px",inline:"",class:"change-form"},{default:s(()=>[l(p,{prop:"warehouse_id",label:"出库仓库",class:"change-form-item"},{default:s(()=>[l(i,{modelValue:u.value.warehouse_id,"onUpdate:modelValue":a[0]||(a[0]=e=>u.value.warehouse_id=e),disabled:d.value==="view"||d.value==="audit"},{default:s(()=>[(r(!0),g(M,null,N(R.value,e=>(r(),b(t,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),l(p,{label:"类型",prop:"type",class:"change-form-item"},{default:s(()=>[l(i,{modelValue:u.value.type,"onUpdate:modelValue":a[1]||(a[1]=e=>u.value.type=e),filterable:"","allow-create":"",clearable:"","default-first-option":"",disabled:d.value==="view"||d.value==="audit"},{default:s(()=>[(r(!0),g(M,null,N(P.value,e=>(r(),b(t,{key:e.value,label:e.label,value:e.value,disabled:e.value=="SALE_OUT"||e.value=="HAIL_OUT"||e.value=="DAMAGE_OUT"||e.value=="TRANSFER_OUT"},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),l(p,{label:"备注",prop:"notes",class:"change-form-item",style:{width:"61%"}},{default:s(()=>[l(V,{style:{flex:"1"},modelValue:u.value.notes,"onUpdate:modelValue":a[2]||(a[2]=e=>u.value.notes=e),type:"textarea",disabled:d.value==="view"||d.value==="audit",maxlength:"250",autosize:{minRows:3,maxRows:4},placeholder:"请输入"},null,8,["modelValue","disabled"])]),_:1}),w("div",Ie,[$e,d.value!=="view"&&d.value!=="audit"?(r(),b(v,{key:0,class:"button",size:"mini",type:"primary",onClick:_e},{default:s(()=>[_("扫码出库")]),_:1})):k("",!0),d.value!=="view"&&d.value!=="audit"?(r(),b(v,{key:1,class:"button",size:"mini",type:"primary",onClick:ve},{default:s(()=>[_("选择")]),_:1})):k("",!0)]),w("div",je,[l(p,{style:{width:"100%"}},{default:s(()=>[l(Q,{data:u.value.product_list,border:"","cell-style":{textAlign:"center"},"header-cell-style":{textAlign:"center"},style:{width:"100%","margin-top":"20px"}},{default:s(()=>[l(c,{label:"库位号"},{default:s(e=>[e.row.area_stock_list?(r(),b(be,{key:0,placement:"right",trigger:"click"},{default:s(()=>[w("div",null,[(r(!0),g(M,null,N(e.row.area_stock_list,T=>(r(),g("p",{key:T.id},h(T.warehouse_area_name),1))),128))]),e.row.area_stock_list.length!==0?(r(),g("span",qe,h(e.row.area_stock_list[0].warehouse_area_name),1)):k("",!0)]),_:2},1024)):k("",!0)]),_:1}),l(c,{label:"商品名称"},{default:s(e=>[z.value?(r(),g("span",Me,h(e.row.product_vo.name),1)):(r(),g("span",Ne,h(e.row.product_vo.name),1))]),_:1}),l(c,{label:"sku"},{default:s(e=>[z.value?(r(),g("span",Pe,h(e.row.product_vo.sku),1)):(r(),g("span",He,h(e.row.product_vo.sku),1))]),_:1}),l(c,{label:"单位"},{default:s(e=>[_(h(e.row.product_vo.unit),1)]),_:1}),l(c,{label:"出库数量"},{default:s(e=>[l(V,{modelValue:e.row.out_num,"onUpdate:modelValue":T=>e.row.out_num=T,type:"number",min:0,maxlength:20,disabled:d.value==="view"||d.value==="audit"},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1}),l(c,{label:"可用库存"},{default:s(e=>[_(h(e.row.usable_stock),1)]),_:1}),l(c,{label:"实际库存"},{default:s(e=>[_(h(e.row.actual_stock),1)]),_:1}),d.value!=="view"&&d.value!=="audit"?(r(),b(c,{key:0,width:"200",label:"操作"},{default:s(e=>[l(v,{size:"mini",type:"danger",onClick:T=>u.value.product_list.splice(e.$index,1)},{default:s(()=>[_("删除")]),_:2},1032,["onClick"])]),_:1})):k("",!0)]),_:1},8,["data"])]),_:1})])]),_:1},8,["model","rules"]),w("div",Ke,[d.value!=="audit"&&d.value!=="view"&&o.checkPermission(["warehouseOut2:add"])?(r(),b(v,{key:0,type:"primary",onClick:ce},{default:s(()=>[_("保存 ")]),_:1})):k("",!0),d.value!=="audit"&&d.value!=="view"&&o.checkPermission(["warehouseOut:update"])?(r(),b(v,{key:1,type:"primary",onClick:pe},{default:s(()=>[_("出库 ")]),_:1})):k("",!0),d.value=="audit"?(r(),b(v,{key:2,onClick:ie},{default:s(()=>[_("打印")]),_:1})):k("",!0),l(v,{onClick:a[3]||(a[3]=e=>se())},{default:s(()=>[_("返回")]),_:1})]),l(q,{title:"提示",visible:F.value,"onUpdate:visible":a[7]||(a[7]=e=>F.value=e),width:"30%"},{footer:s(()=>[l(v,{onClick:a[5]||(a[5]=e=>F.value=!1)},{default:s(()=>[_("取 消")]),_:1}),l(v,{type:"primary",onClick:a[6]||(a[6]=e=>o.handleRejectGoodsExchange())},{default:s(()=>[_("确 定")]),_:1})]),default:s(()=>[l(j,{ref_key:"goodsExchangeAddForm",ref:u,model:u.value,"label-width":"120px",inline:"",style:{width:"900px"}},{default:s(()=>[l(p,{label:"驳回原因",prop:"reject_reason"},{default:s(()=>[l(V,{modelValue:u.value.reject_reason,"onUpdate:modelValue":a[4]||(a[4]=e=>u.value.reject_reason=e),type:"textarea",minlength:0,maxlength:100},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible"]),l(q,{title:"扫码出库",visible:L.value,"onUpdate:visible":a[12]||(a[12]=e=>L.value=e),width:"30%","close-on-click-modal":!1},{default:s(()=>[l(j,{ref_key:"scanGoodsForm",ref:x,model:x.value,"label-width":"120px",inline:""},{default:s(()=>[l(p,{label:"sku",prop:"bar_code"},{default:s(()=>[l(V,{modelValue:x.value.bar_code,"onUpdate:modelValue":a[8]||(a[8]=e=>x.value.bar_code=e),ref:"input",onKeyup:a[9]||(a[9]=X(e=>re(),["enter"])),minlength:0,maxlength:100},null,8,["modelValue"])]),_:1}),l(p,{label:"序列号",prop:"sn_code"},{default:s(()=>[l(V,{modelValue:B.value,"onUpdate:modelValue":a[10]||(a[10]=e=>B.value=e),ref:"sn_input",onKeyup:a[11]||(a[11]=X(e=>ne(),["enter"])),minlength:0,maxlength:100},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible"]),l(q,{title:"出库商品",modelValue:E.value,"onUpdate:modelValue":a[15]||(a[15]=e=>E.value=e),width:"1000px",onClose:Z},{footer:s(()=>[l(v,{onClick:Z},{default:s(()=>[_("取 消")]),_:1}),l(v,{type:"primary",onClick:a[14]||(a[14]=e=>fe())},{default:s(()=>[_("确 定")]),_:1})]),default:s(()=>[w("div",Ze,[Je,l(V,{modelValue:U.keyWord,"onUpdate:modelValue":a[13]||(a[13]=e=>U.keyWord=e),style:{width:"200px","margin-right":"5px"}},null,8,["modelValue"]),l(v,{onClick:o.searchGoodEvent},{default:s(()=>[_(" 搜索 ")]),_:1},8,["onClick"])]),l(Q,{data:S.value.records,border:"",style:{width:"100%"},onSelectionChange:me},{default:s(()=>[l(c,{type:"selection",width:"55"}),l(c,{prop:"product_vo.name",label:"商品名称"}),l(c,{prop:"product_vo.sku",label:"sku"}),l(c,{prop:"",label:"品牌"},{default:s(e=>[_(h(e.row.product_vo.brand),1)]),_:1}),l(c,{prop:"product_vo.weight",label:"重量"}),l(c,{prop:"product_vo.unit",label:"单位"})]),_:1},8,["data"]),l(ke,{onSizeChange:ge,onCurrentChange:he,"current-page":S.value.current,"page-sizes":[10,20,50,100],"page-size":S.value.size,layout:"total, sizes, prev, pager, next, jumper",total:S.value.total},null,8,["current-page","page-size","total"])]),_:1},8,["modelValue"])])}}},at=we(Qe,[["__scopeId","data-v-7183a4ec"]]);export{at as default};