index.d2bf0a6d.js 5.8 KB

1
  1. import{d as y,U as b,ai as T,r as S,ak as l,a1 as C,c as e,B as O,t as d,am as _,P as f,b4 as D,an as E,n as Y,al as k}from"./ResizeObserver.es.7b3c8c20.js";import{O as M}from"./index.4676d40a.js";import{O as P}from"./index.47c9072c.js";import{L as V}from"./index.44e270b6.js";import{C as N}from"./index.931071c6.js";import{D as x}from"./index.37d4b655.js";import{P as I}from"./index.1a102cff.js";import{T as z,a as g}from"./index.acee245e.js";import"./index.601919da.js";import"./index.ef638512.js";import"./use-tab-status.299f907f.js";import"./utils.94131bce.js";import"./Picker.40859110.js";import"./index.3845f5b9.js";import"./index.0cdfaa50.js";const H="_train_6zu3g_1",R="_cellGroup_6zu3g_6",W="_select_6zu3g_11",K="_icon_6zu3g_14",U="_reportList_6zu3g_30",B="_itemChild_6zu3g_47";var n={train:H,cellGroup:R,select:W,icon:K,reportList:U,itemChild:B};function G(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!E(o)}var v=y({name:"train-list",props:{type:{type:String,default:"WEEKLY"},orchestraList:{type:Array,default:()=>[]}},setup(o){const r=b(["year","month"]),p=T(),t=S({showPopoverTime:!1,timeName:l().format("YYYY")+"\u5E74"+l().format("MM")+"\u6708",currentDate:[l().format("YYYY"),l().format("MM")],orchestraStatus:!1,selectOrchestra:{},isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1,refreshing:!1,height:0},params:{page:1,rows:20}}),c=async()=>{try{if(t.isClick)return;t.isClick=!0;const s=l(t.currentDate[0]+"-"+t.currentDate[1]+"01"),a=s.startOf("month").format("YYYY-MM-DD"),m=s.endOf("month").format("YYYY-MM-DD"),{data:h}=await Y.post("/api-school/orchestraReport/page",{data:{reportType:o.type,page:t.params.page,rows:t.params.rows,orchestraId:t.selectOrchestra.value,startTime:a,endTime:m}});if(t.listState.loading=!1,t.listState.refreshing=!1,t.list.length>0&&h.current===1)return;t.list=t.list.concat(h.rows||[]),t.listState.finished=h.current>=h.pages,t.params.page=h.current+1,t.listState.dataShow=t.list.length>0,t.isClick=!1}catch{t.listState.dataShow=!1,t.listState.finished=!0,t.listState.refreshing=!1,t.isClick=!1}},i=()=>{t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,c()},u=s=>{const a=o.type==="WEEKLY"?"/train-week-report":"/train-month-report";p.push({path:a,query:{id:s.id}})},w=s=>{t.timeName=s.selectedValues[0]+"\u5E74"+s.selectedValues[1]+"\u6708",t.showPopoverTime=!1,i()},L=s=>{if(s&&s.length>13){const a=s.substring(0,8),m=s.substring(s.length-5,s.length);return a+"..."+m}else return s};return C(async()=>{try{o.orchestraList.length>0&&(t.selectOrchestra=o.orchestraList[0]),await c()}catch{}}),()=>{let s;return e("div",{style:{minHeight:"calc(100vh - var(--van-tabs-line-height) - var(--header-height))",overflow:"hidden"}},[e("div",{class:"searchGroup",style:"background: transparent"},[e("div",{class:["searchItem",n.itemChild,t.showPopoverTime&&"searchItem-active"],onClick:()=>{t.showPopoverTime=!0}},[t.timeName,e("i",{class:"arrow"},null)]),e("div",{class:["searchItem",n.itemChild,t.orchestraStatus&&"searchItem-active"],onClick:()=>{t.orchestraStatus=!0}},[e("span",null,[t.selectOrchestra.text||" "]),e("i",{class:"arrow"},null)])]),e("div",{style:{overflowY:"auto",height:"calc(100vh - var(--van-tabs-line-height) - var(--header-height) - 1.17333rem)"}},[t.listState.dataShow?e(P,{modelValue:t.listState.refreshing,"onUpdate:modelValue":a=>t.listState.refreshing=a,onRefresh:i,style:{minHeight:"calc(100vh - var(--van-tabs-line-height) - var(--header-height) - 1.17333rem)"}},{default:()=>[e(V,{finished:t.listState.finished,finishedText:" ",style:{overflow:"hidden"},onLoad:c,immediateCheck:!1},G(s=t.list.map(a=>e(N,{center:!0,class:n.reportList},{title:()=>e("div",null,[L(a.orchestraName)]),value:()=>e(O,{type:"primary",round:!0,size:"small",onClick:()=>u(a)},{default:()=>[d("\u67E5\u770B\u62A5\u544A")]}),label:()=>o.type==="WEEKLY"?e("div",{class:n.time},[l(a.startTime).format("YYYY/MM/DD"),d("-"),l(a.endTime).format("YYYY/MM/DD")]):e("div",{class:n.time},[a.monthlyTime])})))?s:{default:()=>[s]})]}):e(_,{btnStatus:!1,tips:"\u6682\u65E0\u8BAD\u7EC3\u62A5\u544A"},null)]),e(f,{show:t.showPopoverTime,"onUpdate:show":a=>t.showPopoverTime=a,position:"bottom",round:!0,teleport:"body",class:"popupBottomSearch"},{default:()=>[e(x,{onCancel:()=>{t.showPopoverTime=!1},onConfirm:w,modelValue:t.currentDate,"onUpdate:modelValue":a=>t.currentDate=a,formatter:D,columnsType:r.value},null)]}),e(f,{show:t.orchestraStatus,"onUpdate:show":a=>t.orchestraStatus=a,position:"bottom",round:!0,class:"popupBottomSearch",teleport:"body"},{default:()=>[e(I,{columns:o.orchestraList,onCancel:()=>t.orchestraStatus=!1,onConfirm:a=>{t.selectOrchestra=a.selectedOptions[0],t.orchestraStatus=!1,i()}},null)]})])}}}),it=y({name:"train-report",setup(){const o=sessionStorage.getItem("train-report-tab"),r=S({loading:!0,tabValue:o||"WEEKLY",orchestraList:[],height:"auto"});return(async()=>{try{r.loading=!0;const{data:t}=await Y.post("/api-school/orchestra/page",{data:{page:1,rows:100,status:"DONE",type:"DELIVERY"}}),c=t.rows||[],i=[];c.forEach(u=>{i.push({text:u.name,value:u.id})}),i.unshift({text:"\u5168\u90E8\u4E50\u56E2",value:""}),r.orchestraList=[...i],r.loading=!1}catch{r.loading=!1}})(),()=>e("div",{class:n.train},[e(M,{position:"top",onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px"),r.height=t}},{default:()=>[e(k,{border:!1},null)]}),!r.loading&&e(z,{sticky:!0,lineWidth:20,lineHeight:4,offsetTop:r.height,swipeable:!0,animated:!0,active:r.tabValue,"onUpdate:active":t=>r.tabValue=t,onChange:t=>{sessionStorage.setItem("train-report-tab",t)}},{default:()=>[e(g,{title:"\u5468\u62A5",name:"WEEKLY"},{default:()=>[e(v,{type:"WEEKLY",orchestraList:r.orchestraList},null)]}),e(g,{title:"\u6708\u62A5",name:"MONTHLY"},{default:()=>[e(v,{type:"MONTHLY",orchestraList:r.orchestraList},null)]})]})])}});export{it as default};