jm-expense-vue-ts/assets/Logs.4ace55bd.js
2022-03-29 09:55:31 +08:00

2 lines
6.5 KiB
JavaScript

import{g as w}from"./dateFormat.26b8f760.js";import{r as $}from"./record.faac3df9.js";import{f as L,x as m,g as A,o as s,c as n,h as e,F as i,k as y,n as F,t as o,m as _,P as l,p as x,A as N,B as I,l as c,S as T}from"./vendor.495b01ec.js";import{S as U}from"./Spinner.5acc2245.js";import{_ as V}from"./index.e0544e65.js";var E="/assets/favicon.90f8b31e.ico",C="/assets/karol.27263ac1.png";const D=h=>(N("data-v-e4c5480a"),h=h(),I(),h),z={key:0},P={id:"pc",style:{width:"100vw"}},R={class:"btn-group mb-3",role:"group","aria-label":"Basic radio toggle button group"},W=["id","checked"],j=["for","onClick"],q={class:"col-3 mt-4"},G={class:"fw-bold"},H={class:"fw-bold"},J={class:"col-9"},K={class:"bg-white border p-3"},M={class:"d-flex"},O={key:0,src:E,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},Q={key:1,src:C,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},X={class:"text-start mt-2"},Y={class:"px-1 me-1",style:{"background-color":"yellow"}},Z={style:{color:"salmon"}},tt=D(()=>e("i",{class:"fas fa-chevron-right m-2"},null,-1)),et={style:{color:"blue"}},ot=c(" | "),st={style:{color:"brown"}},nt=c(" | "),ct={style:{color:"orange"}},at=c(" | "),rt={style:{color:"green"}},it=D(()=>e("br",null,null,-1)),lt=c(" \u539F\u7D00\u9304\uFF1A"),dt={style:{color:"blue"}},ut=c(" | "),_t={style:{color:"brown"}},ht=c(" | "),mt={style:{color:"orange"}},yt=c(" | "),vt={style:{color:"green"}},ft=c(" \u7D50\u7B97\u91D1\u984D "),pt={style:{color:"orange"}},Dt=["onClick"],gt={id:"mobile",class:"card text-center",style:{width:"100vw"}},bt={class:"card-header"},kt={class:"nav nav-tabs card-header-tabs"},Bt=["onClick"],wt={class:"card-body"},Ft={class:"card-header"},Et={class:"card-body d-flex"},Ct={key:0,src:E,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},St={key:1,src:C,class:"my-auto img-thumbnail me-2",width:"60",height:"60"},$t={class:"text-start mt-2"},Lt={class:"px-1 me-1",style:{"background-color":"yellow"}},At={style:{color:"salmon"}},xt=D(()=>e("i",{class:"fas fa-chevron-right m-2"},null,-1)),Nt={key:0},It={style:{color:"blue"}},Tt=c(" | "),Ut={style:{color:"brown"}},Vt=c(" | "),zt={style:{color:"orange"}},Pt=c(" | "),Rt={style:{color:"green"}},Wt={key:1},jt=c(" \u539F\u7D00\u9304\uFF1A"),qt={style:{color:"blue"}},Gt=c(" | "),Ht={style:{color:"brown"}},Jt=c(" | "),Kt={style:{color:"orange"}},Mt=c(" | "),Ot={style:{color:"green"}},Qt={key:2},Xt=c(" \u7D50\u7B97\u91D1\u984D "),Yt={style:{color:"orange"}},Zt=["onClick"],te={class:"mt-3"},ee=L({setup(h){const g=[{title:"\u7E3D\u89BD",btnColor:"secondary"},{title:"\u65B0\u589E",btnColor:"primary"},{title:"\u7DE8\u8F2F",btnColor:"success"},{title:"\u7D50\u7B97",btnColor:"danger"}],b=m(!0),v=m([]),a=m("\u7E3D\u89BD"),f=m({\u7E3D\u89BD:5,\u65B0\u589E:5,\u7DE8\u8F2F:5,\u7D50\u7B97:5}),p=A(()=>a.value==="\u7E3D\u89BD"?v.value:v.value.filter(r=>r.action===a.value)),S=async function(){try{const{data:r}=await $.getLogs();v.value=r.data,b.value=!1}catch(r){console.error("error",r)}},k=async r=>{if(!r.length)return;let d='<table class="table"><thead><tr><th scope="col">\u9805\u76EE</th><th scope="col">\u5546\u5BB6</th><th scope="col">\u91D1\u984D</th><th scope="col">\u65E5\u671F</th></tr></thead><tbody>';for(const t of r)d+=`<tr><td>${t.item}</td><td>${t.merchant}</td><td>${t.amount}</td><td>${new Date(t.date).toLocaleDateString()}</td></tr>`;d+=`</tbody></table>${document.documentElement.scrollWidth>=500?"":"<style>table{font-size:0.7em;}</style>"}`,await T.fire({title:"\u7D50\u7B97\u7D00\u9304",html:d})};return S(),(r,d)=>b.value?(s(),x(U,{key:1})):(s(),n("div",z,[e("div",P,[e("div",R,[(s(),n(i,null,y(g,(t,u)=>(s(),n(i,{key:u},[e("input",{type:"radio",class:"btn-check",name:"btnradio",id:t.title,autocomplete:"off",checked:a.value===t.title},null,8,W),e("label",{class:F(`btn btn-outline-${t.btnColor}`),for:t.title,onClick:B=>a.value=t.title},o(t.title),11,j)],64))),64))]),(s(!0),n(i,null,y(_(p),(t,u)=>(s(),n("div",{class:"row h-20 mb-3",key:u},[e("div",q,[e("div",G,o(new Date(t.createdAt).toLocaleDateString()+" "+_(w)(t.createdAt)),1),e("div",H,o(new Date(t.createdAt).toLocaleTimeString()),1)]),e("div",J,[e("div",K,[e("div",M,[t.User.displayName==="\u5EFA\u55B5"?(s(),n("img",O)):(s(),n("img",Q)),e("div",X,[e("strong",Y,o(t.User.displayName),1),e("strong",Z,o(t.action)+"\u7D00\u9304",1),tt,t.action==="\u65B0\u589E"||t.action==="\u7DE8\u8F2F"?(s(),n(i,{key:0},[e("strong",et,o(t.item),1),ot,e("strong",st,o(t.merchant),1),nt,e("strong",ct,"$ "+o(t.amount),1),at,e("strong",rt,o(new Date(t.date||"").toLocaleDateString()),1)],64)):l("",!0),t.action==="\u7DE8\u8F2F"?(s(),n(i,{key:1},[it,e("h6",null,[lt,e("strong",dt,o(t.itemBefore),1),ut,e("strong",_t,o(t.merchantBefore),1),ht,e("strong",mt,"$ "+o(t.amountBefore),1),yt,e("strong",vt,o(new Date(t.dateBefore||"").toLocaleDateString()),1)])],64)):l("",!0),t.action==="\u7D50\u7B97"?(s(),n(i,{key:2},[e("span",null,[ft,e("strong",pt,"$ "+o(t.closeAmount),1)]),e("i",{class:"far fa-list-alt fa-lg ms-2",id:"records",onClick:B=>k(t.Records)},null,8,Dt)],64)):l("",!0)])])])])]))),128))]),e("div",gt,[e("div",bt,[e("ul",kt,[(s(),n(i,null,y(g,t=>e("li",{class:"nav-item",key:t.title,onClick:u=>a.value=t.title},[e("span",{class:F(["nav-link",{active:a.value===t.title}])},o(t.title),3)],8,Bt)),64))])]),e("div",wt,[(s(!0),n(i,null,y(_(p).slice(0,f.value[a.value]),(t,u)=>(s(),n("div",{class:"card mb-3",key:u},[e("div",Ft,o(new Date(t.createdAt).toLocaleDateString()+" "+_(w)(t.createdAt)+new Date(t.createdAt).toLocaleTimeString()),1),e("div",Et,[t.User.displayName==="\u5EFA\u55B5"?(s(),n("img",Ct)):(s(),n("img",St)),e("div",$t,[e("strong",Lt,o(t.User.displayName),1),e("strong",At,o(t.action)+"\u7D00\u9304",1),xt,t.action==="\u65B0\u589E"||t.action==="\u7DE8\u8F2F"?(s(),n("h6",Nt,[e("strong",It,o(t.item),1),Tt,e("strong",Ut,o(t.merchant),1),Vt,e("strong",zt,"$ "+o(t.amount),1),Pt,e("strong",Rt,o(new Date(t.date||"").toLocaleDateString()),1)])):l("",!0),t.action==="\u7DE8\u8F2F"?(s(),n("h6",Wt,[jt,e("strong",qt,o(t.itemBefore),1),Gt,e("strong",Ht,o(t.merchantBefore),1),Jt,e("strong",Kt,"$ "+o(t.amountBefore),1),Mt,e("strong",Ot,o(new Date(t.dateBefore||"").toLocaleDateString()),1)])):l("",!0),t.action==="\u7D50\u7B97"?(s(),n("h6",Qt,[e("span",null,[Xt,e("strong",Yt,"$ "+o(t.closeAmount),1)]),e("i",{class:"far fa-list-alt fa-lg ms-2",id:"records",onClick:B=>k(t.Records)},null,8,Zt)])):l("",!0)])])]))),128)),e("div",te,[f.value[a.value]<_(p).length?(s(),n("button",{key:0,type:"button",class:"btn btn-secondary",onClick:d[0]||(d[0]=t=>f.value[a.value]+=5)}," \u66F4\u591A\u7D00\u9304 ")):l("",!0)])])])]))}});var re=V(ee,[["__scopeId","data-v-e4c5480a"]]);export{re as default};