import{p as Z,u as ee}from"./goodsTransfer-Cy-fO9Jk.js";import{b as ae}from"./setting-nWDj4rDN.js";import{g as le}from"./basicSetting-BFYAi9Sk.js";import{r,a as g,o as oe,T as te,f as N,h as v,i as e,w as a,t as ne,q as se,s as re,p as s,v as _,F as ue,x as ie,m,j as L,k as y,l as z,y as G,X as de,E as U}from"./index-ByQGGPf6.js";const ce={class:"search bg-white p-3"},pe={class:"flex justify-end"},_e={class:"inner-toolbar"},me={class:"toolbar-btns"},he={__name:"goodsTransfer",setup(fe){const w=ne();se();const j=re(),S=r([]),A=r([]),k=r(!1),u=g({page_no:1,page_size:50,company_id:w.state.companId}),i=g({}),d=r("");r([]),g({});const D=r(!1),B=r([]),f=r(!1),c=g({}),C=r([]),I=g({num:[{required:!0,message:"请输入预警库存数量",trigger:"blur"},{validator:(o,t,h)=>{/^(?:[1-9]\d*)$/.test(t)==!1?h(new Error("请输入正整数")):h()},trigger:"blur"}]});r(null);const p=()=>{k.value=!0,Z(u).then(o=>{k.value=!1,d.value=o}).catch(()=>{k.value=!1})},W=()=>{le().then(o=>{S.value=o})},P=()=>{ae("erp_goodstransfer_type").then(o=>{A.value=o})},R=()=>{c.value.validate(o=>{o&&ee({stock_id:C.value,warn_num:c.value.num}).then(t=>{f.value=!1,c.value={},U.success("预警库存设置成功!"),p()})})},q=()=>{if(C.value.length==0)return U.error("请选择");f.value=!0},M=o=>{C.value=o.map(t=>t.id)},$=o=>{u.page_size=o,p()},O=o=>{u.page_no=o,p()},X=()=>{Object.assign(u,i),u.page_no=1,p()};return oe(()=>{p(),P(),W()}),te(j,()=>{u.page_no=1,p()}),(o,t)=>{const h=s("el-option"),H=s("el-select"),V=s("el-form-item"),x=s("el-col"),E=s("el-input"),J=s("el-row"),T=s("el-form"),b=s("el-button"),n=s("el-table-column"),K=s("el-pagination"),Q=s("en-table-layout"),Y=s("el-table"),F=s("el-dialog");return _(),N("div",null,[v("div",ce,[e(T,{ref:"advancedForm",model:i,"label-width":"160px"},{default:a(()=>[e(J,null,{default:a(()=>[e(x,{span:6},{default:a(()=>[e(V,{label:"仓库"},{default:a(()=>[e(H,{modelValue:i.warehouse_id,"onUpdate:modelValue":t[0]||(t[0]=l=>i.warehouse_id=l),clearable:""},{default:a(()=>[(_(!0),N(ue,null,ie(S.value,l=>(_(),y(h,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(x,{span:6},{default:a(()=>[e(V,{label:"商品编号/sku/序列号"},{default:a(()=>[e(E,{modelValue:i.keyword,"onUpdate:modelValue":t[1]||(t[1]=l=>i.keyword=l),clearable:"",placeholder:"请输入内容",width:"200px"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),v("div",pe,[e(b,{class:"mr-3",onClick:X},{default:a(()=>[m(" 搜索 ")]),_:1})])]),e(Q,{tableData:d.value.data,ref:"table",loading:k.value,onSelectionChange:M},{toolbar:a(()=>[v("div",_e,[v("div",me,[o.checkPermission(["updateWarnStock:update"])&&L(w).state.user.user.founder!==1?(_(),y(b,{key:0,size:"mini",type:"primary",onClick:q},{default:a(()=>[m("设置预警库存")]),_:1})):z("",!0),L(w).state.user.user.founder!==1?(_(),y(b,{key:1,size:"mini",type:"primary",onClick:o.checkExport},{default:a(()=>[m("导出")]),_:1},8,["onClick"])):z("",!0)])])]),"table-columns":a(()=>[e(n,{type:"selection",width:"55"}),e(n,{prop:"warehouse_name",label:"仓库名称"}),e(n,{prop:"product_name",label:"商品名称"}),e(n,{prop:"type",label:"sku"},{default:a(l=>[m(G(l.row.product_vo?l.row.product_vo.sku:""),1)]),_:1}),e(n,{prop:"goods_unit",label:"单位"}),e(n,{prop:"actual_stock",label:"实际库存"},{default:a(l=>[v("span",{style:de(Number(l.row.actual_stock)<Number(l.row.warning_stock)?"color:red":"")},G(l.row.actual_stock),5)]),_:1}),e(n,{prop:"usable_stock",label:"可用库存"}),e(n,{prop:"transit_stock",label:"在途库存"}),e(n,{prop:"locked_stock",label:"冻结库存"}),e(n,{prop:"warning_stock",label:"预警库存"})]),pagination:a(()=>[d.value?(_(),y(K,{key:0,onSizeChange:$,onCurrentChange:O,"current-page":d.value.page_no,"page-sizes":[50,100],"page-size":d.value.page_size,layout:"total, sizes, prev, pager, next, jumper",total:d.value.data_total},null,8,["current-page","page-size","total"])):z("",!0)]),_:1},8,["tableData","loading"]),e(F,{title:"在途明细",visible:D.value,"onUpdate:visible":t[2]||(t[2]=l=>D.value=l),"append-to-body":"","close-on-click-modal":!1,"close-on-press-escape":!1},{default:a(()=>[e(Y,{data:B.value,border:"",class:"sku-table"},{default:a(()=>[e(n,{prop:"order_sn",label:"订单编号"}),e(n,{prop:"num",label:"在途数量"}),e(n,{prop:"end_time",label:"返回日期"})]),_:1},8,["data"])]),_:1},8,["visible"]),e(F,{title:"设置预警数量",visible:f.value,"onUpdate:visible":t[5]||(t[5]=l=>f.value=l),"append-to-body":"","close-on-click-modal":!1,"close-on-press-escape":!1,width:"30%"},{footer:a(()=>[e(b,{onClick:t[4]||(t[4]=l=>f.value=!1)},{default:a(()=>[m("取 消")]),_:1}),e(b,{onClick:R,type:"primary"},{default:a(()=>[m("确 定")]),_:1})]),default:a(()=>[e(T,{ref:"numAddForm",model:c,rules:I,"label-width":"160px",inline:"",class:"change-form"},{default:a(()=>[e(V,{label:"预警数量",prop:"num",class:"change-form-item"},{default:a(()=>[e(E,{modelValue:c.num,"onUpdate:modelValue":t[3]||(t[3]=l=>c.num=l),placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible"])])}}};export{he as default};
