1 |
- import{d as y,R as b,ag as T,r as S,ai as l,$ as E,c as e,B as O,q as d,ak as D,P as f,b2 as k,al as C,m as Y,aj as _}from"./index.5f7ffb46.js";import{O as M}from"./index.7790de2a.js";import{O as P}from"./index.1d6ac2c5.js";import{L as V}from"./index.9ef28852.js";import{C as N}from"./index.abd668f7.js";import{D as q}from"./index.af85409e.js";import{P as x}from"./index.de1f78a6.js";import{T as A,a as g}from"./index.6bbd7daa.js";import"./use-tab-status.69b57a37.js";import"./utils.0f86fc1f.js";import"./Picker.148c9d83.js";import"./index.99e0cf1f.js";import"./index.61ab9823.js";const I="_train_8q9to_1",R="_cellGroup_8q9to_6",H="_select_8q9to_11",W="_icon_8q9to_14",B="_reportList_8q9to_30";var u={train:I,cellGroup:R,select:H,icon:W,reportList:B};function K(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!C(o)}var v=y({name:"train-list",props:{type:{type:String,default:"WEEKLY"},orchestraList:{type:Array,default:()=>[]}},setup(o){const r=b(["year","month"]),m=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}}),n=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"),p=s.endOf("month").format("YYYY-MM-DD"),{data:c}=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:p}});if(t.listState.loading=!1,t.listState.refreshing=!1,t.list.length>0&&c.current===1)return;t.list=t.list.concat(c.rows||[]),t.listState.finished=c.current>=c.pages,t.params.page=c.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,n()},h=s=>{const a=o.type==="WEEKLY"?"/train-week-report":"/train-month-report";m.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),p=s.substring(s.length-5,s.length);return a+"..."+p}else return s};return E(async()=>{try{o.orchestraList.length>0&&(t.selectOrchestra=o.orchestraList[0]),await n()}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",t.showPopoverTime&&"searchItem-active"],onClick:()=>{t.showPopoverTime=!0}},[t.timeName,e("i",{class:"arrow"},null)]),e("div",{class:["searchItem",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:n,immediateCheck:!1},K(s=t.list.map(a=>e(N,{center:!0,class:u.reportList},{title:()=>e("div",null,[L(a.orchestraName)]),value:()=>e(O,{type:"primary",round:!0,size:"small",onClick:()=>h(a)},{default:()=>[d("\u67E5\u770B\u62A5\u544A")]}),label:()=>o.type==="WEEKLY"?e("div",{class:u.time},[l(a.startTime).format("YYYY/MM/DD"),d("-"),l(a.endTime).format("YYYY/MM/DD")]):e("div",{class:u.time},[a.monthlyTime])})))?s:{default:()=>[s]})]}):e(D,{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(q,{onCancel:()=>{t.showPopoverTime=!1},onConfirm:w,modelValue:t.currentDate,"onUpdate:modelValue":a=>t.currentDate=a,formatter:k,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(x,{columns:o.orchestraList,onCancel:()=>t.orchestraStatus=!1,onConfirm:a=>{t.selectOrchestra=a.selectedOptions[0],t.orchestraStatus=!1,i()}},null)]})])}}}),st=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"}}),n=t.rows||[],i=[];n.forEach(h=>{i.push({text:h.name,value:h.id})}),i.unshift({text:"\u5168\u90E8\u4E50\u56E2",value:""}),r.orchestraList=[...i],r.loading=!1}catch{r.loading=!1}})(),()=>e("div",{class:u.train},[e(M,{position:"top",onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px"),r.height=t}},{default:()=>[e(_,{border:!1},null)]}),!r.loading&&e(A,{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{st as default};
|