index.6baee68f.js 5.7 KB

12
  1. import{d as y,R as b,ag as T,r as S,ai as l,$ as O,c as e,B as D,q as d,ak as E,P as f,a_ as k,al as _,m as Y,aj as C}from"./index.1c621181.js";import{O as M}from"./index.b491c24a.js";import{O as P}from"./index.b0685ec5.js";import{L as V}from"./index.d5ee0b18.js";import{C as N}from"./index.fd5ae97b.js";import{D as q}from"./index.d270485b.js";import{P as x}from"./index.53518914.js";import{T as I,a as g}from"./index.88a00aa9.js";import"./use-tab-status.40058c51.js";import"./utils.3d9f83cd.js";import"./Picker.9bc4331c.js";import"./index.78a302c3.js";import"./index.d5b73933.js";const R="_train_8q9to_1",H="_cellGroup_8q9to_6",W="_select_8q9to_11",K="_icon_8q9to_14",j="_reportList_8q9to_30";var u={train:R,cellGroup:H,select:W,icon:K,reportList:j};function B(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!_(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 O(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},B(s=t.list.map(a=>e(N,{center:!0,class:u.reportList},{title:()=>e("div",null,[L(a.orchestraName)]),value:()=>e(D,{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(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(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(C,{border:!1},null)]}),!r.loading&&e(I,{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};