import{d as I,ag as Y,r as C,$ as x,c as s,aj as D,F as b,q as n,ai as m,o as c,B as L,P as V,m as f,g as _}from"./index.3b0304e1.js";import{O as E}from"./index.a20d72f1.js";import{O as P}from"./index.454c666f.js";import{f as S}from"./index.b28db9f5.js";import{v as k}from"./toolsValidate.4388d7ee.js";import{f as r}from"./create.8b51aaf6.js";import{P as N}from"./index.8c35293c.js";import{C as v}from"./index.ead63c4f.js";import{F as p}from"./index.f8e9940f.js";import{C as w}from"./index.ff3f298b.js";import{T as F}from"./index.f72a2c9d.js";import"./icon_teacher.df08d662.js";import"./index.179b8d2a.js";import"./use-tab-status.e36e4d74.js";import"./index.ff2bdbbe.js";import"./index.7070fc63.js";import"./Checker.d1c194b4.js";import"./index.710cd200.js";import"./index.1e205a49.js";import"./index.53bfa96a.js";import"./index.49feb9e9.js";import"./Picker.66dfa715.js";import"./index.c9ab1bb5.js";import"./index.ce8d626c.js";import"./index.409ae793.js";import"./utils.bc1af02b.js";const A="_title_wbqc3_1",B="_cellGroup_wbqc3_17",G="_tips_wbqc3_29";var u={title:A,cellGroup:B,tips:G},dt=I({name:"practice-detail",setup(){const T=Y(),e=C({selectItem:{},currentTime:[],minHour:0,minMinute:0,maxHour:24,maxMinute:60,firstTime:null,lastTime:null}),g=async()=>{const{data:t}=await f.get("/api-school/sysParamConfig/queryByParamNameList",{params:{paramNames:"course_start_time,course_end_time"}});(t||[]).forEach(o=>{console.log(o.paramValue,"paramValue");const l=m(r.trainStartDate).format("YYYY-MM-DD");if(o.paramName==="course_start_time"){const i=m(l+" "+o.paramValue);e.minHour=Number(i.format("HH")),e.minMinute=Number(i.format("mm")),e.firstTime=i}else if(o.paramName==="course_end_time"){const i=m(l+" "+o.paramValue);e.maxHour=Number(i.format("HH")),e.lastTime=i}})},h=t=>{if(t.columnIndex===1)return;const a=Number(t.selectedValues[0]);a===e.minHour?(e.minMinute=Number(e.firstTime.format("mm")),e.maxMinute=60):a===e.maxHour?(console.log(a,"hour"),e.minMinute=0,e.maxMinute=Number(e.lastTime.format("mm"))):(e.minMinute=0,e.maxMinute=60)},y=t=>{const a=m(m(e.lastTime).format("YYYY-MM-DD")+" "+t.selectedValues.join(":")+":00").add(e.selectItem.trainTimer,"minute");if(a.isAfter(e.lastTime)){c("\u5F00\u59CB\u65F6\u95F4\u8D85\u8FC7\u53EF\u9009\u65F6\u95F4\u8303\u56F4");return}e.selectItem.startTime=m(m(e.lastTime).format("YYYY-MM-DD")+" "+t.selectedValues.join(":")+":00").format("YYYY-MM-DD HH:mm:ss"),e.selectItem.endTime=a.format("YYYY-MM-DD HH:mm:ss"),r.timerStatus=!1},H=()=>{const t=r.classPracticeList;let a=!1,o="";return t.forEach(l=>{console.log(l),!a&&!l.trainTimer&&(a=!0,o="\u8BF7\u8F93\u5165\u8BAD\u7EC3\u65F6\u957F"),!a&&!l.startTime&&(a=!0,o="\u8BF7\u9009\u62E9\u5F00\u59CB\u65F6\u95F4"),!a&&!l.times&&(a=!0,o="\u8BF7\u8F93\u5165\u8BFE\u65F6\u6570"),!a&&l.classIdList.length<=0&&(a=!0,o="\u8BF7\u9009\u62E9\u8BAD\u7EC3\u73ED\u7EA7")}),a&&c(o),a},M=async()=>{if(!H())try{const t=r.classPracticeList,a=[];t.forEach(i=>{a.push({classGroupIdList:i.classIdList,courseNum:i.times,startTime:m(i.startTime).format("HH:mm:ss"),endTime:m(i.endTime).format("HH:mm:ss"),singleCourseTime:i.trainTimer})});const o={week:r.week,schoolId:_.user.data.school.id,skipHoliday:!!r.skipHoliday,type:"PRACTISE",startDate:m(r.trainStartDate).format("YYYY-MM-DD"),trainingPlanClassList:a};console.log(o);const{data:l}=await f.post("/api-school/orchestra/trainingPlanList",{hideLoading:!1,data:{...o}});r.selectOrchestraId=null,r.selectClassGroupId=null,r.planList={orchestra:[],classes:{},course:{}},console.log(l,"date"),T.push({path:"/course-preview",query:{cacheId:l}})}catch{}},d=t=>t&&t>=1?k(t):"";return x(()=>{g()}),()=>s("div",{class:u.practiceDetail},[s(D,null,null),r.classPracticeList.map(t=>s(b,null,[s("div",{class:u.title},[s("i",null,null),S[t.classType]]),s(v,{inset:!0,class:u.cellGroup},{default:()=>[s(p,{label:"\u8BAD\u7EC3\u65F6\u957F",placeholder:"\u8BF7\u8F93\u5165\u8BAD\u7EC3\u65F6\u957F",inputAlign:"right",modelValue:t.trainTimer,"onUpdate:modelValue":[a=>t.trainTimer=a,a=>{console.log(a),t.startTime=null}],formatter:d,maxlength:3,type:"tel",center:!0},{extra:()=>s("span",{style:{paddingLeft:"6px"}},[n("\u5206\u949F")])}),s(p,{label:"\u5F00\u59CB\u65F6\u95F4",placeholder:"\u8BF7\u9009\u62E9\u5F00\u59CB\u65F6\u95F4",inputAlign:"right",readonly:!0,isLink:!0,center:!0,modelValue:t.startTime?m(t.startTime).format("HH:mm"):"",onClick:()=>{if(!t.trainTimer){c("\u8BF7\u8F93\u5165\u8BAD\u7EC3\u65F6\u957F");return}e.selectItem=t,r.timerStatus=!0}},null),s(p,{label:"\u8BFE\u65F6\u6570",placeholder:"\u8BF7\u8F93\u5165\u8BFE\u65F6\u6570",inputAlign:"right",modelValue:t.times,"onUpdate:modelValue":a=>t.times=a,formatter:d,maxlength:2,center:!0,type:"tel"},{extra:()=>s("span",{style:{paddingLeft:"6px"}},[n("\u8BFE\u65F6")])}),s(w,{title:"\u8BAD\u7EC3\u73ED\u7EA7",isLink:!0,center:!0,onClick:()=>{e.selectItem=t,r.classStatus=!0}},{value:()=>s("div",{class:u.value},[t.classIdList.length<=0?s("div",{class:u.tips},[n("\u8BF7\u9009\u62E9\u8BAD\u7EC3\u73ED\u7EA7")]):s("div",null,[n("\u5DF2\u9009"),s("span",{style:{padding:"0 4px"}},[t.classIdList.length]),n("\u4E2A\u73ED\u7EA7")])])})]})])),s(P,{position:"bottom"},{default:()=>[s("div",{class:"btnGroup"},[s(L,{type:"primary",block:!0,round:!0,onClick:M},{default:()=>[n("\u4E0B\u4E00\u6B65")]})])]}),s(E,{modelValue:r.classStatus,"onUpdate:modelValue":t=>r.classStatus=t,position:"bottom",style:{background:"#f6f6f6"},destroy:!0},{default:()=>[s(N,{onClose:()=>r.classStatus=!1,classType:e.selectItem.classType,selectItem:e.selectItem.classIdList,onConfirm:t=>{e.selectItem.classIdList=t}},null)]}),s(V,{show:r.timerStatus,"onUpdate:show":t=>r.timerStatus=t,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[s(F,{modelValue:e.currentTime,"onUpdate:modelValue":t=>e.currentTime=t,minHour:e.minHour,minMinute:e.minMinute,maxHour:e.maxHour,maxMinute:e.maxMinute,onChange:h,onCancel:()=>r.timerStatus=!1,onConfirm:t=>y(t)},null)]})])}});export{dt as default};