import{A as H}from"./AddFormItemLine-259ea6b2-1782729249161v=1.0.0.js";import{f as J,H as Q,I as G,J as W}from"./index-b309bf9f-1782729249161v=1.0.0.js";import{E as U}from"./eleVendor-5008d1ec-1782729249161v=1.0.0.js";import{y as X,r as V,c as p,m as Y,al as c,ar as Z,z as f,I as m,J as d,R as _,O as B,u as s,K as ee,M as y,k as L,A as q,Q as j,a4 as x}from"./vendor-1e24e3ad-1782729249161v=1.0.0.js";function le(F){return F?F.replace(/\_(\w)/g,function(T,t){return t.toUpperCase()}):""}const ne=X({__name:"SignUpUserDialog",props:{visible:{type:Boolean,default:!1},title:{default:""},loading:{type:Boolean,default:!1},questionList:{default:[]},eventTermProjectOptions:{default:[]},rules:{default:{}},value:{default:{}},editType:{default:""},dialogType:{default:"add"},eventProjectType:{default:null},eventApplyMode:{default:null},initForm:{default:{}},eventTermId:{default:null}},emits:["update:visible","update:value","submit","update:loading"],setup(F,{emit:T}){const t=F,v=T,A=V(),o=p({get:()=>t.value,set:e=>{v("update:value",e)}}),P=p(()=>({tsNo:[{required:!0,message:"\u8BF7\u9009\u62E9\u8FD0\u52A8\u5458",trigger:"change"}],...t.rules})),k=p({get:()=>t.visible,set:e=>{v("update:visible",e)}}),S=p({get:()=>t.loading,set:e=>{v("update:loading",e)}});Y(()=>{});const w=p(()=>t.eventProjectType==="much"&&t.editType=="register"&&t.eventApplyMode!=="group"&&t.eventApplyMode!=="double"),M=p(()=>{const e=t.questionList;return e.forEach(l=>{l.commonUseFieldVal==="avatar"&&(l.prop={limit:1})}),e.map(l=>{let a=!0;return(!l.commonUseFieldVal||h.value[l.fieldValue])&&(a=!1),{...l,disabled:a}})}),h=V({}),I=V(!1),O=async e=>{if(!!(e!=null&&e.tsId)){I.value=!0;try{const l=await Q({tsId:e.tsId,eventTermId:t.eventTermId});l.code===0&&(l.data.avatar=l.data.avatar||"",e={...e,...l.data}),o.value=t.initForm,o.value.tsNo=e.tsNo,t.questionList,o.value,h.value={},t.questionList.forEach(a=>{var i,r,D;let u=le(a.commonUseFieldVal),g=`isUp${u.charAt(0).toUpperCase()+u.slice(1)}`;if(a.isCommonUseField)switch(e[g]&&(h.value[a.fieldValue]=!0),a.fieldType){case"img":case"image":o.value[a.fieldValue]=((i=e[u])==null?void 0:i.length)>0?(r=e[u])==null?void 0:r.split(",").map(b=>({url:b})):[];break;case"checkbox":o.value[a.fieldValue]=(D=e[u])==null?void 0:D.split(",").map(b=>Number(b));break;case"radio":o.value[a.fieldValue]=Number(e[u]);break;default:o.value[a.fieldValue]=e[u];break}}),h.value}catch(l){console.error(l)}finally{I.value=!1}o.value}},C=()=>{var e;v("update:visible",!1),(e=A.value)==null||e.resetFields(),t.initForm,o.value=t.initForm},R=()=>{var e;(e=A.value)==null||e.validate(l=>{l&&v("submit",o.value)})},N=V([]),$=async(e,l,a)=>{l.loading=!0;try{let u={page:l.page,sporterStatus:"confirmed",size:10,eventId:sessionStorage.getItem("eventId")};a&&(u.tsNo=a.tsNo),e&&(u.keyword=e);const i=await(t.editType==="register"?G:W)(u);if(i.code===0)return N.value=i.data.listData.map(r=>({label:`${r.tsNo}-${r.name}-${r.collegeName}`,value:r})),[N.value,i.data.total];U.error(i.msg)}catch{U.error("\u83B7\u53D6\u8FD0\u52A8\u5458\u5931\u8D25")}finally{l.loading=!1}};return(e,l)=>{const a=c("el-form-item"),u=c("el-checkbox"),g=c("el-checkbox-group"),i=c("el-form"),r=c("el-button"),D=c("el-dialog"),b=Z("loading");return f(),m(D,{modelValue:s(k),"onUpdate:modelValue":l[2]||(l[2]=E=>L(k)?k.value=E:null),width:"800px",title:t.title,onClose:C},{footer:d(()=>[_(r,{onClick:C},{default:d(()=>l[3]||(l[3]=[B("\u53D6\u6D88",-1)])),_:1,__:[3]}),_(r,{type:"primary",loading:s(S),onClick:R},{default:d(()=>l[4]||(l[4]=[B("\u786E\u5B9A",-1)])),_:1,__:[4]},8,["loading"])]),default:d(()=>[ee((f(),m(i,{model:s(o),ref_key:"formRef",ref:A,rules:s(P),"element-loading-text":"\u52A0\u8F7D\u4EBA\u5458\u4FE1\u606F\u4E2D..."},{default:d(()=>{var E;return[y(" \u5355\u4F4D\u4E0D\u9700\u8981\u9009\u62E9\u8FD0\u52A8\u5458 "),e.editType!=="unit"?(f(),m(a,{key:0,label:"\u8FD0\u52A8\u5458",prop:"tsNo"},{default:d(()=>[y(` {{ form }}form\r
				{{ form.tsNo }} `),_(J,{ref:"pageSelectRef",value:s(o),"onUpdate:value":l[0]||(l[0]=n=>L(o)?o.value=n:null),placeholder:"\u8BF7\u8F93\u5165\u5B66\u5DE5\u53F7/\u624B\u673A\u53F7/\u59D3\u540D\u641C\u7D22",disabled:e.dialogType!=="add","remote-method":$,onChange:O,"value-key":"tsNo"},null,8,["value","disabled"])]),_:1})):y("v-if",!0),y(" \u62A5\u540D\u9879\u76EE\u5217\u8868 "),s(w)&&((E=t.eventTermProjectOptions)==null?void 0:E.length)>0?(f(),m(a,{key:1,label:"\u62A5\u540D\u9879\u76EE",prop:"eventProjectIdsList",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u62A5\u540D\u9879\u76EE",trigger:"change"}]},{default:d(()=>[_(g,{modelValue:s(o).eventProjectIdsList,"onUpdate:modelValue":l[1]||(l[1]=n=>s(o).eventProjectIdsList=n),placeholder:"\u8BF7\u9009\u62E9\u62A5\u540D\u9879\u76EE"},{default:d(()=>[(f(!0),q(j,null,x(t.eventTermProjectOptions,n=>(f(),m(u,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):y("v-if",!0),(f(!0),q(j,null,x(s(M),(n,K)=>(f(),m(a,{key:K,label:n.fieldName+":",prop:n.fieldValue,required:Boolean(n.isFill)},{default:d(()=>[_(H,{info:n,value:s(o)[n.fieldValue],"onUpdate:value":z=>s(o)[n.fieldValue]=z},null,8,["info","value","onUpdate:value"])]),_:2},1032,["label","prop","required"]))),128))]}),_:1},8,["model","rules"])),[[b,s(I)]])]),_:1},8,["modelValue","title"])}}});export{ne as _};
