import{d as N,ag as P,r as O,R as i,$ as W,m as p,o as c,_ as y,c as a,aj as G,a5 as d,q as n,P as v,F as E}from"./index.27735e87.js";import{O as L}from"./index.71a5f9d3.js";import{C as x}from"./index.5a2d3ded.js";import{F as h}from"./index.c2431b87.js";import{P as g}from"./index.48d9d4f7.js";import"./index.18f2dec1.js";import"./index.d02ae1ba.js";import"./index.997909e4.js";import"./Picker.17d614ab.js";import"./index.b3b4f4a0.js";import"./use-tab-status.d6e8df54.js";import"./index.d691a7aa.js";import"./index.915902eb.js";const B="_schoolEidtWrap_595gl_1",b="_eidtWrap_595gl_1",k="_orchestraName_595gl_10",F="_wall_595gl_13",D="_bottomWrap_595gl_16",S="_addP_595gl_30",V="_schoolDtailWrap_595gl_35",U="_schoolICon_595gl_42",q="_schoolBtnWrap_595gl_46",A="_upload_595gl_57";var r={schoolEidtWrap:B,eidtWrap:b,orchestraName:k,wall:F,bottomWrap:D,addP:S,schoolDtailWrap:V,schoolICon:U,schoolBtnWrap:q,upload:A},aa=N({name:"unit-create",setup(){const w=P(),o=O({actions:[],classList:[],showPopoverOrchestra:!1,showPopoverClass:!1}),s=i({orchestraId:"",orchestraName:"",classGroupName:"",classGroupId:"",emergencyContact:"",addressLongitudeLatitude:"",unitName:"",unitId:""});i();const u=i(!1),_=()=>{if(!s.value.classGroupId){c("\u8BF7\u9009\u62E9\u6D4B\u9A8C\u73ED\u7EA7");return}sessionStorage.setItem("unit-create",JSON.stringify(s.value)),w.push({path:"/unit-Lesson",query:{classGroupId:s.value.classGroupId}})};W(async()=>{var e,t;if(s.value={...JSON.parse(sessionStorage.getItem("unit-create")||"{}")},f(),(e=s.value)!=null&&e.orchestraId)try{const l=await p.post("/api-teacher/classGroup/page",{data:{page:1,rows:9999,orchestraId:(t=s.value)==null?void 0:t.orchestraId}});o.classList=l.data.rows.map(m=>({name:m.name,value:m.id})),o.classList.length<1&&c("\u5F53\u524D\u4E50\u56E2\u6682\u65E0\u73ED\u7EA7")}catch(l){console.log(l,"cuowu")}});const f=async()=>{try{const e=await p.post("/api-teacher/orchestra/page",{data:{page:1,rows:9999,status:"DONE"}});o.actions=e.data.rows.map(t=>({name:t.name,value:t.id})),y(()=>{u.value=!0})}catch(e){u.value=!0;const t=e.message;c(t)}},C=async e=>{if(console.log(e.selectedOptions),s.value.orchestraId=e.selectedOptions[0].value,s.value.orchestraName=e.selectedOptions[0].name,s.value.classGroupName="",s.value.classGroupId="",e.selectedOptions[0].value)try{const t=await p.post("/api-teacher/classGroup/page",{data:{page:1,rows:9999,orchestraId:e.selectedOptions[0].value}});o.classList=t.data.rows.map(l=>({name:l.name,value:l.id})),o.classList.length<1&&c("\u5F53\u524D\u4E50\u56E2\u6682\u65E0\u73ED\u7EA7")}catch(t){console.log(t,"cuowu")}else o.classList=[];o.showPopoverOrchestra=!1},I=async e=>{s.value.classGroupName=e.selectedOptions[0].name,s.value.classGroupId=e.selectedOptions[0].value,o.showPopoverClass=!1};return()=>a(E,null,[u.value?a("div",{class:r.schoolEidtWrap},[a(G,null,null),a("div",{class:r.eidtWrap},[a(x,{inset:!0},{default:()=>[a(h,{placeholder:"\u8BF7\u9009\u62E9\u4E50\u56E2",readonly:!0,"input-align":"right",onClick:()=>{if(o.actions.length<=0){c("\u6682\u65E0\u4E50\u56E2");return}o.showPopoverOrchestra=!0}},{extra:()=>a("div",{class:r.loctionIconWrap},[a(d,{name:"arrow",color:"#d8d8d8"},null)]),label:()=>a("p",{class:r.addP},[n("\u9009\u62E9\u4E50\u56E2")]),input:()=>s.value.orchestraName?a("div",{class:[r.orchestraName,"van-ellipsis"]},[s.value.orchestraName]):a("div",{style:{color:"#c8c9cc"}},[n("\u8BF7\u9009\u62E9\u4E50\u56E2")])}),a(h,{rows:3,modelValue:s.value.classGroupName,"onUpdate:modelValue":e=>s.value.classGroupName=e,maxlength:50,placeholder:"\u8BF7\u9009\u62E9\u6D4B\u9A8C\u73ED\u7EA7",readonly:!0,"input-align":"right",onClick:()=>{s.value.orchestraId?o.showPopoverClass=!0:c("\u8BF7\u5148\u9009\u62E9\u4E50\u56E2")}},{extra:()=>a("div",{class:r.loctionIconWrap},[a(d,{name:"arrow",color:"#d8d8d8"},null)]),label:()=>a("p",{class:r.addP},[n("\u6D4B\u9A8C\u73ED\u7EA7")])}),a(h,{rows:3,modelValue:s.value.unitName,"onUpdate:modelValue":e=>s.value.unitName=e,maxlength:50,placeholder:"\u8BF7\u9009\u62E9\u6D4B\u9A8C\u5185\u5BB9",readonly:!0,"input-align":"right",onClick:_},{extra:()=>a("div",{class:r.loctionIconWrap},[a(d,{name:"arrow",color:"#d8d8d8"},null)]),label:()=>a("p",{class:r.addP},[n("\u6D4B\u9A8C\u5185\u5BB9")])})]})]),a(L,{position:"bottom"},null)]):null,a(v,{show:o.showPopoverOrchestra,"onUpdate:show":e=>o.showPopoverOrchestra=e,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[a(g,{columns:o.actions,columnsFieldNames:{text:"name",value:"value"},onCancel:()=>o.showPopoverOrchestra=!1,onConfirm:C},null)]}),a(v,{show:o.showPopoverClass,"onUpdate:show":e=>o.showPopoverClass=e,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[a(g,{columns:o.classList,columnsFieldNames:{text:"name",value:"value"},onCancel:()=>o.showPopoverClass=!1,onConfirm:I},null)]})])}});export{aa as default};
