1 |
- import{d as qe,u as ze,r as i,a as De,o as Se,f as c,i as n,w as s,h as k,k as p,l as V,v as je,s as Fe,E as w,a3 as Re,p as m,q as Te,x as d,t as r,F as R,y as T,m as f,a2 as oe,Y as Q,L as Be,_ as Ne}from"./index-GCZD4BFP.js";import{e as We,a as Me,s as ue,b as Ye,c as Ke}from"./goodsInventoryLoss-DaDtQv6q.js";import{c as He}from"./goodsInventory-2NVqbt9i.js";import{c as se,k as Pe,d as Je}from"./goodsExchange-CxLOr8W3.js";import{b as Oe}from"./setting-CjsMgkQh.js";import{g as Qe}from"./basicSetting-B0Aq66-n.js";const Xe={class:"bg-in-stock"},Ze={style:{width:"100%"}},ea={key:0},aa={key:0},la={key:0},ta={key:0},oa={key:0},ua={key:0},sa={class:"mx"},na={style:{width:"100%",display:"block"}},da={key:0},ra={key:1},ia={key:0},_a={key:1},va={key:0},pa={class:"footer"},ca={style:{display:"flex","align-items":"center","justify-content":"flex-end",padding:"10px 0"}},ma=qe({__name:"goodsInventoryLossAdd",setup(fa){const{t:_}=ze(),B=je(),G=Fe(),E=Te(),$=i([]),N=i(!1),C=i([]);i([]);const W=i([]),L=i([]),h=i(""),o=i(""),t=i({product_list:[],creator_id:"",has_notice:!1}),ne=i({warehouse_id:{required:!0,message:_("change")+_("warechouse"),trigger:"change"},damage_type_value:{required:!0,message:_("change")+_("loss_type"),trigger:"change"},creator_id:{required:!0,message:_("change")+_("creator"),trigger:"change"}});i(null);const z=i(!1),D=i(""),M=i("");i([]);const b=i(""),I=i({}),Y=i([]),de=()=>{He().then(a=>{Y.value=a})},re=a=>{const e=Y.value.find(u=>u.id===a);return e?e.nickname:_("unknown")},q=i(!1),x=i([]),A=De({page_no:1,page_size:10,keyWord:""}),X=()=>{q.value=!1},K=()=>{se(A,t.value.warehouse_id).then(a=>{x.value=a})},H=i([]),ie=a=>{H.value=a.map(e=>e)},_e=()=>{H.value.length>=1?(t.value.product_list=H.value.map(a=>a),q.value=!1):w.error(_("change")+_("goods_info")+"!")},ve=a=>{A.page_size=a,K()},pe=a=>{A.page_no=a,K()},ce=a=>{const e=$.value.find(u=>u.id===a);return e?e.nickname:_("unknown")},me=a=>{const e=L.value.find(u=>u.value===a);return e?e.label:_("unknown")},fe=a=>{const e=C.value.find(u=>u.id===a);return e?e.name:_("unknown")},ge=()=>{t.value.product_list=[]},ye=()=>{},he=()=>{z.value=!0,Q(()=>{P.value.focus()})},Z=i(),be=()=>{Pe(t.value.warehouse_id,I.value.bar_code.replace(/\s+/g,"")).then(a=>{a.sn_code_list=[],M.value=a.product_vo.sku;const e=t.value.product_list.findIndex(u=>u.goods_vo.id===a.goods_id&&u.product_id===a.product_id&&u.product_vo.sku===a.product_vo.sku);e===-1?(b.value=t.value.product_list.length,t.value.product_list.push(a)):b.value=e,a.product_vo.have_sn?Q(()=>{Z.value.focus()}):(t.value.product_list[b.value].report_num+=1,t.value.product_list[b.value].report_num==t.value.product_list[b.value].num&&(z.value=!1))})},P=i(),ke=()=>{if(M.value=="")return w.error("请录入正确的sku");Je("out",M.value,D.value.replace(/\s+/g,"")).then(a=>{D.value="",t.value.product_list[b.value].sn_code_list.find(v=>v.sn_code===a.sn_code&&v.sku===a.sku)||t.value.product_list[b.value].sn_code_list.push(a),t.value.product_list[b.value].report_num=t.value.product_list[b.value].sn_code_list.length;const u=t.value.product_list.findIndex(v=>v.goods_id===a.goods_id&&v.product_id===a.product_id&&v.product_vo.sku===a.sku);t.value.product_list[b.value].id=t.value.product_list[u].id,I.value.bar_code="",Q(()=>{P.value.focus()})})},S=i(),we=()=>{S.value.validate(a=>{if(a){const e={...t.value};e.dept_id&&(e.dept_name=W.value.find(u=>u.id===e.dept_id).name),e.warehouse_id&&(e.warehouse_name=C.value.find(u=>u.id===e.warehouse_id).name),e.damage_type_value&&(e.damage_type_key=L.value.find(u=>u.value===e.damage_type_value).label),e.creator_id&&(e.creator=$.value.find(u=>u.id===e.creator_id).real_name),e.product_list=e.product_list.map(u=>({report_num:u.report_num,product_id:u.product_id,product_stock_id:u.id,sn_code_list:u.sn_code_list})),h.value?We(h.value,e).then(()=>{w.success(_("edit_success")+"!"),E.push({name:"goodsInventoryLoss"})}):Me(e).then(()=>{w.success(_("add_success")+"!"),E.push({name:"goodsInventoryLoss"})})}})},Ve=()=>{S.value.validate(a=>{if(a){const e={...t.value};e.dept_id&&(e.dept_name=W.value.find(u=>u.id===e.dept_id).name),e.warehouse_id&&(e.warehouse_name=C.value.find(u=>u.id===e.warehouse_id).name),e.damage_type_value&&(e.damage_type_key=L.value.find(u=>u.value===e.damage_type_value).label),e.creator_id&&(e.creator=$.value.find(u=>u.id===e.creator_id).real_name),e.product_list=e.product_list.map(u=>({report_num:u.report_num,product_id:u.product_id,product_stock_id:u.product_stock_id})),ue(h.value,e).then(()=>{w.success(_("audit_success")+"!"),E.push({name:"goodsInventoryLoss"})})}})},$e=()=>{S.value.validate(a=>{if(a){const e={...t.value};e.dept_id&&(e.dept_name=W.value.find(u=>u.id===e.dept_id).name),e.warehouse_id&&(e.warehouse_name=C.value.find(u=>u.id===e.warehouse_id).name),e.damage_type_value&&(e.damage_type_key=L.value.find(u=>u.value===e.damage_type_value).label),e.creator_id&&(e.creator=$.value.find(u=>u.id===e.creator_id).real_name),e.status="CANCEL_HANDLE",e.product_list=e.product_list.map(u=>({report_num:u.report_num,product_id:u.product_id,product_stock_id:u.product_stock_id})),ue(h.value,e).then(()=>{w.success(_("down_success")+"!"),G.params,E.push({name:"goodsInventoryLoss"})})}})},Ce=()=>{Be.confirm(_("confirm_rejec")+"?",_("prompt"),{type:"warning"}).then(()=>{Ke(h.value,{status:"REJECT",reject_reason:t.value.reject_reason}).then(()=>{w.success(_("rejected")+"!"),E.push({name:"goodsInventoryLoss"})})}).catch(()=>{})},Le=async()=>{if(!t.value.warehouse_id){w.error(_("change")+_("warechouse")+"!");return}se(A,t.value.warehouse_id,"gt").then(a=>{x.value=a,q.value=!0})},Ie=()=>{Re({page_no:1,page_size:9999,user_state:0}).then(a=>{$.value=a.data})},xe=()=>{Oe("es_stock_damage_report").then(a=>{L.value=a})},Ae=a=>{Qe().then(e=>{C.value=e})},ee=()=>{Ye(h.value).then(a=>{a.product_list.map(e=>{e.num=e.report_num}),t.value=a,t.value.distribution_name=a.staff_name})};return Se(()=>{G.query.type==="view"?(o.value="view",h.value=G.query.id,ee()):G.query.type==="examine"&&(o.value="examine",h.value=G.query.id,ee()),t.value.creator_id=B.state.user.uid,t.value.dept_id=B.state.user.dept_id,xe(),Ae({dept_id:B.state.user.dept_id}),Ie(),de()}),(a,e)=>{const u=m("el-date-picker"),v=m("el-form-item"),j=m("el-option"),F=m("el-select"),Ue=m("el-switch"),U=m("el-input"),g=m("el-button"),y=m("el-table-column"),ae=m("el-table"),J=m("el-form"),le=m("el-col"),Ge=m("el-row"),O=m("el-dialog"),Ee=m("el-pagination");return d(),c("div",Xe,[n(J,{ref_key:"goodsInventoryAddFormRef",ref:S,model:t.value,rules:ne.value,"label-width":"120px",inline:"",class:"change-form"},{default:s(()=>[k("h3",Ze,r(a.$t("goodsInventoryLoss")),1),n(v,{label:a.$t("loss_time"),prop:"report_time",class:"change-form-item"},{default:s(()=>[o.value=="view"||o.value=="examine"?(d(),c("span",ea,r(t.value.report_time),1)):(d(),p(u,{key:1,modelValue:t.value.report_time,"onUpdate:modelValue":e[0]||(e[0]=l=>t.value.report_time=l),"value-format":"YYYY-MM-DD HH:mm:ss",type:"datetime",disabled:o.value==="view"||o.value==="examine"||o.value==="edit",placeholder:a.$t("change")+a.$t("date")},null,8,["modelValue","disabled","placeholder"]))]),_:1},8,["label"]),n(v,{label:a.$t("warechouse"),prop:"warehouse_id",class:"change-form-item"},{default:s(()=>[o.value=="view"||o.value==="examine"?(d(),c("span",aa,r(fe(t.value.warehouse_id)),1)):(d(),p(F,{key:1,modelValue:t.value.warehouse_id,"onUpdate:modelValue":e[1]||(e[1]=l=>t.value.warehouse_id=l),onChange:ge,disabled:o.value==="view"||o.value==="audit"||o.value==="examine"},{default:s(()=>[(d(!0),c(R,null,T(C.value,l=>(d(),p(j,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"]))]),_:1},8,["label"]),n(v,{label:a.$t("loss_type"),prop:"damage_type_value",class:"change-form-item"},{default:s(()=>[o.value=="view"||o.value==="examine"?(d(),c("span",la,r(me(t.value.damage_type_value)),1)):(d(),p(F,{key:1,modelValue:t.value.damage_type_value,"onUpdate:modelValue":e[2]||(e[2]=l=>t.value.damage_type_value=l),disabled:o.value==="view"||o.value==="audit"||o.value==="examine"},{default:s(()=>[(d(!0),c(R,null,T(L.value,l=>(d(),p(j,{key:l.label,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"]))]),_:1},8,["label"]),n(v,{label:a.$t("creator"),prop:"creator_id",class:"change-form-item"},{default:s(()=>[o.value=="view"||o.value==="examine"?(d(),c("span",ta,r(ce(t.value.creator_id)),1)):(d(),p(F,{key:1,modelValue:t.value.creator_id,"onUpdate:modelValue":e[3]||(e[3]=l=>t.value.creator_id=l),disabled:o.value==="view"||o.value==="audit"||o.value==="examine",onChange:ye},{default:s(()=>[(d(!0),c(R,null,T($.value,l=>(d(),p(j,{key:l.id,label:l.nickname,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"]))]),_:1},8,["label"]),n(v,{label:a.$t("notifiedre")+":",prop:"has_notice",class:"change-form-item"},{default:s(()=>[n(Ue,{modelValue:t.value.has_notice,"onUpdate:modelValue":e[4]||(e[4]=l=>t.value.has_notice=l),disabled:o.value==="view"||o.value==="examine","inline-prompt":"","active-text":!0,"inactive-text":!1},null,8,["modelValue","disabled"])]),_:1},8,["label"]),t.value.has_notice?(d(),p(v,{key:0,label:a.$t("reviewer")+":",prop:"notice_user_id",class:"change-form-item"},{default:s(()=>[h.value&&o.value!=="examine"||o.value=="view"?(d(),c("span",oa,r(re(t.value.notice_user_id)),1)):(d(),p(F,{key:1,modelValue:t.value.notice_user_id,"onUpdate:modelValue":e[5]||(e[5]=l=>t.value.notice_user_id=l),disabled:o.value==="view"||o.value==="audit"||o.value==="examine"},{default:s(()=>[(d(!0),c(R,null,T(Y.value,l=>(d(),p(j,{key:l.id,label:l.nickname,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"]))]),_:1},8,["label"])):V("",!0),n(v,{label:a.$t("loss_desc"),prop:"report_desc",class:"change-form-item",style:{width:"61%"}},{default:s(()=>[o.value=="view"||o.value==="examine"?(d(),c("span",ua,r(t.value.report_desc),1)):(d(),p(U,{key:1,style:{flex:"1"},modelValue:t.value.report_desc,"onUpdate:modelValue":e[6]||(e[6]=l=>t.value.report_desc=l),type:"textarea",disabled:o.value==="view"||o.value==="audit"||o.value==="examine",autosize:{minRows:3,maxRows:4},placeholder:a.$t("place")+a.$t("loss_desc")},null,8,["modelValue","disabled","placeholder"]))]),_:1},8,["label"]),k("div",sa,[k("h3",null,r(a.$t("goods_inventory")),1),o.value!=="examine"&&o.value!=="audit"&&o.value!=="view"?(d(),p(g,{key:0,class:"button",size:"small",type:"primary",onClick:he},{default:s(()=>[f("录入SKU")]),_:1})):V("",!0),o.value!=="view"&&o.value!=="examine"?(d(),p(g,{key:1,class:"button",size:"small",type:"primary",onClick:Le},{default:s(()=>[f(r(a.$t("select")),1)]),_:1})):V("",!0)]),k("div",na,[n(v,{style:{width:"100%"}},{default:s(()=>[n(ae,{data:t.value.product_list,border:"","cell-style":{textAlign:"center"},"header-cell-style":{textAlign:"center"},style:{width:"100%","margin-top":"20px"}},{default:s(()=>[n(y,{label:a.$t("goods_name")},{default:s(l=>[h.value?(d(),c("span",da,r(l.row.product_vo.name),1)):(d(),c("span",ra,r(l.row.product_vo.name),1))]),_:1},8,["label"]),n(y,{label:"sku"},{default:s(l=>[k("span",null,r(l.row.product_vo.sku),1)]),_:1}),n(y,{label:a.$t("goods_unit")},{default:s(l=>[h.value?(d(),c("span",_a,r(l.row.product_vo.unit),1)):(d(),c("span",ia,r(l.row.product_vo.unit),1))]),_:1},8,["label"]),n(y,{label:a.$t("stock")},{default:s(l=>[f(r(l.row.usable_stock),1)]),_:1},8,["label"]),n(y,{label:a.$t("loss_num")},{default:s(l=>[o.value=="edit"?(d(),c("span",va,r(l.row.num),1)):(d(),p(U,{key:1,modelValue:l.row.report_num,"onUpdate:modelValue":te=>l.row.report_num=te,type:"number",min:0,maxlength:20,disabled:o.value==="view"||o.value==="examine"},null,8,["modelValue","onUpdate:modelValue","disabled"]))]),_:1},8,["label"]),o.value!=="view"&&o.value!=="audit"&&o.value!=="examine"?(d(),p(y,{key:0,label:a.$t("operate")},{default:s(l=>[n(g,{size:"small",type:"danger",onClick:te=>t.value.product_list.splice(l.$index,1)},{default:s(()=>[f(r(a.$t("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])):V("",!0)]),_:1},8,["data"])]),_:1})])]),_:1},8,["model","rules"]),k("div",pa,[o.value!=="examine"&&o.value!=="audit"&&o.value!=="view"?(d(),p(g,{key:0,type:"primary",onClick:we},{default:s(()=>[f(r(a.$t("save")),1)]),_:1})):V("",!0),o.value==="edit"||o.value==="examine"?(d(),p(g,{key:1,type:"primary",onClick:Ve},{default:s(()=>[f(r(a.$t("review")),1)]),_:1})):V("",!0),o.value==="edit"||o.value==="examine"?(d(),p(g,{key:2,type:"primary",onClick:$e},{default:s(()=>[f(r(a.$t("down")),1)]),_:1})):V("",!0),n(g,{onClick:e[7]||(e[7]=l=>a.$router.back())},{default:s(()=>[f(r(a.$t("return")),1)]),_:1})]),n(O,{title:"扫码录入",modelValue:z.value,"onUpdate:modelValue":e[12]||(e[12]=l=>z.value=l),width:"30%","close-on-click-modal":!1,class:"!rounded-lg"},{default:s(()=>[n(J,{ref_key:"scanGoodsForm",ref:I,model:I.value,inline:"","label-width":"60px"},{default:s(()=>[n(Ge,null,{default:s(()=>[n(le,{span:18},{default:s(()=>[n(v,{label:"sku:",prop:"bar_code"},{default:s(()=>[n(U,{modelValue:I.value.bar_code,"onUpdate:modelValue":e[8]||(e[8]=l=>I.value.bar_code=l),ref_key:"input",ref:P,onKeyup:e[9]||(e[9]=oe(l=>be(),["enter"])),minlength:0,maxlength:100},null,8,["modelValue"])]),_:1})]),_:1}),n(le,{span:18},{default:s(()=>[n(v,{label:"序列号:",prop:"sn_code"},{default:s(()=>[n(U,{modelValue:D.value,"onUpdate:modelValue":e[10]||(e[10]=l=>D.value=l),ref_key:"sn_input",ref:Z,onKeyup:e[11]||(e[11]=oe(l=>ke(),["enter"])),minlength:0,maxlength:100},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),n(O,{title:a.$t("prompt"),modelValue:N.value,"onUpdate:modelValue":e[16]||(e[16]=l=>N.value=l),width:"30%",class:"!rounded-lg"},{footer:s(()=>[n(g,{onClick:e[14]||(e[14]=l=>N.value=!1)},{default:s(()=>[f(r(a.$t("cancel")),1)]),_:1}),n(g,{type:"primary",onClick:e[15]||(e[15]=l=>Ce())},{default:s(()=>[f(r(a.$t("submit")),1)]),_:1})]),default:s(()=>[n(J,{ref_key:"goodsInventoryAddForm",ref:t,model:t.value,"label-width":"120px",inline:"",style:{width:"900px"}},{default:s(()=>[n(v,{label:a.$t("reject"),prop:"reject_reason"},{default:s(()=>[n(U,{modelValue:t.value.reject_reason,"onUpdate:modelValue":e[13]||(e[13]=l=>t.value.reject_reason=l),type:"textarea",minlength:0,maxlength:100},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"]),n(O,{title:a.$t("loss_goods"),modelValue:q.value,"onUpdate:modelValue":e[19]||(e[19]=l=>q.value=l),width:"1000px",onClose:X,class:"!rounded-lg"},{footer:s(()=>[n(g,{onClick:X},{default:s(()=>[f(r(a.$t("cancel")),1)]),_:1}),n(g,{type:"primary",onClick:e[18]||(e[18]=l=>_e())},{default:s(()=>[f(r(a.$t("submit")),1)]),_:1})]),default:s(()=>[k("div",ca,[k("span",null,r(a.$t("search")+a.$t("goods_info"))+":",1),n(U,{modelValue:A.keyWord,"onUpdate:modelValue":e[17]||(e[17]=l=>A.keyWord=l),style:{width:"200px","margin-right":"5px"}},null,8,["modelValue"]),n(g,{onClick:K},{default:s(()=>[f(r(a.$t("search")),1)]),_:1})]),n(ae,{data:x.value.records,border:"",style:{width:"100%"},onSelectionChange:ie},{default:s(()=>[n(y,{type:"selection",width:"55"}),n(y,{prop:"product_vo.name",label:a.$t("goods_name")},null,8,["label"]),n(y,{prop:"product_vo.sku",label:"sku"}),n(y,{prop:"",label:a.$t("brand")},{default:s(l=>[f(r(l.row.product_vo.brand),1)]),_:1},8,["label"]),n(y,{prop:"product_vo.weight",label:a.$t("weight")},null,8,["label"]),n(y,{prop:"product_vo.unit",label:a.$t("goods_unit")},null,8,["label"])]),_:1},8,["data"]),n(Ee,{onSizeChange:ve,onCurrentChange:pe,"current-page":x.value.current,"page-sizes":[10,20,50,100],"page-size":x.value.size,layout:"total, sizes, prev, pager, next, jumper",total:x.value.total},null,8,["current-page","page-size","total"])]),_:1},8,["title","modelValue"])])}}}),Va=Ne(ma,[["__scopeId","data-v-12393d85"]]);export{Va as default};
|