import{d as J,r as i,o as K,f as x,h as p,i as t,w as a,t as Q,p as s,q as X,s as Z,v as _,F as ee,x as te,m,j as V,k as y,l as C,y as I}from"./index-ByQGGPf6.js";import{g as ae}from"./goodsInventoryLoss-C6uShEou.js";import{a as ne}from"./setting-nWDj4rDN.js";import{g as oe}from"./basicSetting-BFYAi9Sk.js";const le={class:"search bg-white p-3"},se={class:"flex justify-end"},re={class:"inner-toolbar"},ue={class:"toolbar-btns"},pe=J({__name:"goodsInventoryLoss",setup(ie){const h=Q(),b=X();Z();const w=i([]);i([]);const v=i(!1),r=i({page_no:1,page_size:10,company_id:h.state.companId}),u=i({goodsInventory_time_range:[]}),d=i([]),z=i([]),L=i([]),g=()=>{v.value=!0,ae(r.value).then(e=>{v.value=!1,d.value=e}).catch(()=>{v.value=!1})},S={disabledDate(e){return e.getTime()-1>=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()).getTime()+864e5-1},shortcuts:[{text:"今天",onClick(e){const o=new Date,l=new Date(new Date().toDateString());e.$emit("pick",[l,o])}},{text:"最近一周",onClick(e){const o=new Date,l=new Date;l.setTime(l.getTime()-3600*1e3*24*7),e.$emit("pick",[l,o])}},{text:"最近一个月",onClick(e){const o=new Date,l=new Date;l.setTime(l.getTime()-3600*1e3*24*30),e.$emit("pick",[l,o])}}]},T=()=>{oe().then(e=>{w.value=e}),ne({dictType:"inventory_status"}).then(e=>{L.value=e.data})},N=e=>{b.push({name:"goodsInventoryLossAdd",query:{id:e.id,type:"view"}})},G=e=>{let o="";return w.value.map(l=>{l.id==e&&(o=l.name)}),o},A=e=>{b.push({name:"goodsInventoryLossAdd",query:{id:e.id,type:"examine"}})},E=()=>{b.push({name:"goodsInventoryLossAdd"})},F=e=>{let o="";return L.value.map(l=>{l.value==e&&(o=l.label)}),o},Y=e=>{z.value=e},$=e=>{r.value.page_size=e,g()},B=e=>{r.value.page_no=e,g()},M=()=>{r.value={...r.value,...u.value},delete r.value.start_time,delete r.value.end_time,u.value.goodsInventory_time_range&&(r.value.start_time=parseInt(String(Number(u.value.goodsInventory_time_range[0])/1e3)),r.value.end_time=parseInt(String(Number(u.value.goodsInventory_time_range[1])/1e3))),delete r.value.goodsInventory_time_range,r.value.page_no=1,g()};return K(()=>{g(),T()}),(e,o)=>{const l=s("el-date-picker"),k=s("el-form-item"),D=s("el-col"),j=s("el-option"),q=s("el-select"),H=s("el-input"),P=s("el-row"),U=s("el-form"),f=s("el-button"),c=s("el-table-column"),O=s("el-pagination"),R=s("en-table-layout");return _(),x("div",null,[p("div",le,[t(U,{model:u.value,"label-width":"160px"},{default:a(()=>[t(P,null,{default:a(()=>[t(D,{span:6},{default:a(()=>[t(k,{label:"报损日期"},{default:a(()=>[t(l,{modelValue:u.value.goodsInventory_time_range,"onUpdate:modelValue":o[0]||(o[0]=n=>u.value.goodsInventory_time_range=n),type:"daterange",align:"center",editable:!1,"unlink-panels":"",clearable:!0,"default-time":["00:00:00","23:59:59"],"range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期","value-format":"YYYY-MM-DD HH:mm:ss","picker-options":S},null,8,["modelValue"])]),_:1})]),_:1}),t(D,{span:6},{default:a(()=>[t(k,{label:"仓库"},{default:a(()=>[t(q,{modelValue:u.value.warehouse_id,"onUpdate:modelValue":o[1]||(o[1]=n=>u.value.warehouse_id=n)},{default:a(()=>[(_(!0),x(ee,null,te(w.value,n=>(_(),y(j,{key:n.id,label:n.name,value:n.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(D,{span:6},{default:a(()=>[t(k,{label:"报损人"},{default:a(()=>[t(H,{modelValue:u.value.creator,"onUpdate:modelValue":o[2]||(o[2]=n=>u.value.creator=n),placeholder:"请输入内容",width:"200px"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),p("div",se,[t(f,{onClick:M},{default:a(()=>[m(" 搜索 ")]),_:1})])]),t(R,{tableData:d.value.data,loading:v.value,onSelectionChange:Y},{toolbar:a(()=>[p("div",re,[p("div",ue,[V(h).state.user.user.founder!==1?(_(),y(f,{key:0,size:"mini",type:"primary",onClick:E},{default:a(()=>[m("新增")]),_:1})):C("",!0)])])]),"table-columns":a(()=>[t(c,{type:"selection",width:"55"}),t(c,{prop:"sn",label:"报损单编号"},{default:a(n=>[p("span",null,I(n.row.sn),1)]),_:1}),t(c,{label:"仓库"},{default:a(n=>[m(I(G(n.row.warehouse_id)),1)]),_:1}),t(c,{prop:"status",label:"状态"},{default:a(n=>[m(I(F(n.row.status)),1)]),_:1}),t(c,{prop:"report_desc",label:"报损说明"}),t(c,{label:"操作",width:"450"},{default:a(n=>[t(f,{type:"mini",size:"mini",onClick:W=>N(n.row)},{default:a(()=>[m("查看")]),_:2},1032,["onClick"]),n.row.status=="NOT_HANDLE"&&V(h).state.user.user.founder!==1?(_(),y(f,{key:0,type:"mini",size:"mini",onClick:W=>A(n.row)},{default:a(()=>[m("审核")]),_:2},1032,["onClick"])):C("",!0)]),_:1})]),default:a(()=>[d.value?(_(),y(O,{key:0,onSizeChange:$,onCurrentChange:B,"current-page":d.value.page_no,"page-sizes":[10,20,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"])):C("",!0)]),_:1},8,["tableData","loading"])])}}});export{pe as default};
