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