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.332c7f08.js";import{O as L}from"./index.d7c1b6ac.js";import{C as x}from"./index.324108a5.js";import{F as h}from"./index.1ed6273e.js";import{P as g}from"./index.656e257f.js";import"./index.91135ff9.js";import"./Picker.e56f94bd.js";import"./index.7c580591.js";import"./use-tab-status.9d769af8.js";import"./index.1e2dfe6e.js";import"./index.4aa8e076.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 l={schoolEidtWrap:B,eidtWrap:b,orchestraName:k,wall:F,bottomWrap:D,addP:S,schoolDtailWrap:V,schoolICon:U,schoolBtnWrap:q,upload:A},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 u=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}})};W(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})),y(()=>{u.value=!0})}catch(e){u.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(E,null,[u.value?a("div",{class:l.schoolEidtWrap},[a(G,null,null),a("div",{class:l.eidtWrap},[a(x,{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},[n("\u9009\u62E9\u4E50\u56E2")]),input:()=>o.value.orchestraName?a("div",{class:[l.orchestraName,"van-ellipsis"]},[o.value.orchestraName]):a("div",{style:{color:"#c8c9cc"}},[n("\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},[n("\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},[n("\u6D4B\u9A8C\u5185\u5BB9")])})]})]),a(L,{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};