var M=Object.defineProperty,P=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var j=(l,a,o)=>a in l?M(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o,N=(l,a)=>{for(var o in a||(a={}))K.call(a,o)&&j(l,o,a[o]);if(S)for(var o of S(a))Q.call(a,o)&&j(l,o,a[o]);return l},V=(l,a)=>P(l,J(a));var y=(l,a,o)=>new Promise((C,I)=>{var b=c=>{try{v(o.next(c))}catch(d){I(d)}},F=c=>{try{v(o.throw(c))}catch(d){I(d)}},v=c=>c.done?C(c.value):Promise.resolve(c.value).then(b,F);v((o=o.apply(l,a)).next())});import{_ as G,av as s,bN as H,aG as W,c as L,w as _,c3 as U,f as $,c4 as z,bQ as X,C as Y,E as Z,o as k,k as h,j as ee,i as te,p as ae,c5 as oe,P as A,ap as re}from"./index-CZJgrp0v.js";import{p as se}from"./paForm.BSb8laCe.js";import{C as ne}from"./CardContainer.D782Fvoa.js";import{_ as le}from"./bottomButton.DlIqw7or.js";import{u as ue}from"./useUnitFormStore.ARxaPk1w.js";import{d as ce}from"./alova-shared.esm.BOR7OeRZ.js";import{r as ie}from"./reg.CZVA-VD8.js";import"./imgs.-NjrNgib.js";import"./imgs.vue_vue_type_style_index_0_scoped_e5ff6870_lang.CnmSM4Oi.js";import"./eventJava.C13-6nEn.js";import"./uv-input.Ch8KxUbS.js";import"./uv-radio-group.p2BG-V-I.js";import"./uv-checkbox-group.6EMz15dv.js";import"./uv-textarea.DacViCPM.js";import"./uv-datetime-picker.DTzTqYNR.js";import"./uv-form.Cyxopp_J.js";import"./themeMixins.C76yI6bA.js";import"./uv-button.DwAMxj01.js";/* empty css                                                                     */const me={__name:"commonUserAdd",setup(l){X();const a=ue(),o=s(""),C=s(""),I=s(""),b=s(""),F=s(""),v=s(""),c=s(""),d=s(!1),i=s({questionList:[],formRules:{},form:{},tableConfig:[],tableData:[]}),f=s({}),E=e=>y(this,null,function*(){e==="leader"&&(i.value=a.leaderInfo),e==="coach"&&(i.value=a.coachInfo),e==="doctor"&&(i.value=a.doctorInfo),e==="judge"&&(i.value=a.judgeInfo),e==="register"&&(i.value=a.registerInfo);let t={};try{t=JSON.parse(sessionStorage.getItem("commonUser")||"{}")}catch(r){t={}}const n=yield B(t.tsId);n&&(t=n.data),i.value.questionList.forEach(r=>{var g,w;const u=U(r.commonUseFieldVal);if(console.log({commonUseFieldKey:u,questionItem:r}),r.commonUseFieldVal)switch(Object.keys(t).forEach(m=>{let p=m;m.startsWith("isUp")&&(p=m.slice(4),p=p.slice(0,1).toLowerCase()+p.slice(1),(t[m]===1||t[m]===0&&!t[p])&&(q.value[p]=1))}),r.type){case"img":case"image":f.value[u]=((g=t[u])==null?void 0:g.split(",").map(m=>({url:m})))||[];break;case"checkbox":f.value[u]=((w=t[u])==null?void 0:w.split(",").map(m=>Number(m)))||[];break;case"radio":f.value[u]=Number(t[u]);break;default:f.value[u]=t[u];break}}),console.log({commonUserForm:f,commonUser:t,unitFormStore:a,currentInfo:i.value})}),T=s(null),x=H(()=>{const e=i.value.questionList;return console.log({currentInfo:i.value}),e.forEach(t=>{t.commonUseFieldVal==="avatar"&&(t.maxCount=1)}),e==null?void 0:e.filter(t=>t.commonUseFieldVal).map(t=>V(N({},t),{prop:U(t.commonUseFieldVal),disabled:!q.value[U(t.commonUseFieldVal)]}))}),R=s({name:[{required:!0,message:"请输入姓名",trigger:"blur"}],gender:[{required:!0,message:"请选择性别"}],tsNo:[{required:!0,message:"请选输入学号"}],avatar:[{required:!0,message:"请上传头像"}],identityCard:[{required:!0,message:"请输入证件号码"},{pattern:ie,transform(e){return String(e)},message:"请输入正确的身份证号码"}],unitType:[{required:!0,message:"请输入所在单位名"}],birth:[{required:!0,message:"请输入生日"}]});s({});const q=s({}),B=e=>y(this,null,function*(){const t=yield z({tsId:e,eventTermId:b.value});return t.code===0?t:null}),O=()=>{var t;const e=ce(f.value);return(t=Object.keys(e))==null||t.forEach(n=>{if(Array.isArray(e[n])){const r=e[n];(r==null?void 0:r.length)>0&&typeof r[0]=="object"?e[n]=JSON.stringify(r):e[n]=e[n].join(",")}}),e},D=()=>y(this,null,function*(){try{if(d.value=!0,!(yield T.value.validate())){d.value=!1;return}let t=O();const n=yield oe(t);if(n.code!==0){A({title:n.msg,icon:"none"});return}A({title:"修改成功",icon:"success"}),sessionStorage.setItem("setCurrentInfo","set"),setTimeout(()=>{re()},500)}catch(e){}finally{d.value=!1}});return W(e=>{o.value=e.type,C.value=e.eventProjectType,I.value=e.eventId,b.value=e.eventTermId,F.value=e.pageType,v.value=e.editIndex,c.value=e.eventApplyMainId,E(o.value)}),(e,t)=>{const n=Y(Z("paForm"),se),r=ee,u=$("layout-default-uni");return k(),L(u,null,{default:_(()=>[h(r,{class:"common-user-add page-common-container"},{default:_(()=>{var g;return[((g=x.value)==null?void 0:g.length)>0?(k(),L(ne,{key:0,title:"常用报名人添加"},{default:_(()=>[h(n,{optionList:x.value,rules:R.value,value:f.value,ref_key:"paFormRef",ref:T},null,8,["optionList","rules","value"])]),_:1})):te("",!0),h(r,{class:"footer"},{default:_(()=>[h(le,{onCustomClick:D,loading:d.value,loadingText:"提交中"},{default:_(()=>[ae(" 提交 ")]),_:1},8,["loading"])]),_:1})]}),_:1})]),_:1})}}},Ve=G(me,[["__scopeId","data-v-b4ad8946"]]);export{Ve as default};
