import{d as N,ag as P,r as O,R as p,$ as W,m as i,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.d1dca38b.js";import{O as L}from"./index.3aa1e6eb.js";import{C as x}from"./index.1383acec.js";import{F as h}from"./index.a5f38096.js";import{P as g}from"./index.dae33edc.js";import"./index.2f930c00.js";import"./Picker.7620f03c.js";import"./index.06e8d826.js";import"./use-tab-status.03ea8dd0.js";import"./index.c324c166.js";import"./index.3b296605.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(),o=O({actions:[],classList:[],showPopoverOrchestra:!1,showPopoverClass:!1}),s=p({orchestraId:"",orchestraName:"",classGroupName:"",classGroupId:"",emergencyContact:"",addressLongitudeLatitude:"",unitName:"",unitId:""});p();const u=p(!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 r=await i.post("/api-teacher/classGroup/page",{data:{page:1,rows:9999,orchestraId:(t=s.value)==null?void 0:t.orchestraId}});o.classList=r.data.rows.map(m=>({name:m.name,value:m.id})),o.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 i.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 i.post("/api-teacher/classGroup/page",{data:{page:1,rows:9999,orchestraId:e.selectedOptions[0].value}});o.classList=t.data.rows.map(r=>({name:r.name,value:r.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: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:()=>{o.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:()=>s.value.orchestraName?a("div",{class:[l.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: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: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: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: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{Y as default};
