全栈小学生 eff269ab88 up
2025-09-20 09:12:11 +08:00

2 lines
3.8 KiB
JavaScript

import{d as I,f as O,r as v,l as x,k as o,h as g,c as F,e as n,w as d,J as $,m as w,a as i,t as m,u as s,bn as L,F as P,T as S,i as H,Y as T,D as U,G as Y,a3 as j,ah as q,H as z,L as A,E as G,M as J}from"./index-9f163f98.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";import{a1 as K,a2 as Z}from"./member-6dbdeb9b.js";import{v as Q}from"./diy_form-8a6dfb58.js";/* empty css */const W={class:"main-container"},X={class:"panel-title !text-sm"},ee={class:"form-tip"},te={class:"text-lg"},oe={class:"panel-title"},le={class:"ml-[10px]"},re={class:"fixed-footer-wrap"},ae={class:"fixed-footer"},Ee=I({__name:"member",setup(se){const E=O(),f=v(!0),p=v({}),b=v(""),V=x({prefix:[{validator:(r,e,a)=>{e&&!/^[a-zA-Z]*$/g.test(e)?a(new Error(o("prefixHint"))):a()},trigger:"blur"}],length:[{required:!0,message:o("lengthPlaceholder"),trigger:["blur","change"]},{validator:(r,e,a)=>{parseInt(e)>30||parseInt(e)-l.prefix.length<4?a(new Error(o("lengthHint"))):a()},trigger:"blur"}]}),l=x({prefix:"",length:10,form_id:""});(async()=>{const r=await(await K()).data;Object.keys(l).forEach(e=>{r[e]!=null&&(l[e]=r[e])}),c(p.value),f.value=!1})();const c=async r=>{await r.validate(e=>{if(e){let a="";const u=l.length-l.prefix.length-1;for(let _=1;_<=u;_++)a+="0";b.value=l.prefix+a+"1"}})},h=x([]),D=()=>{const r=E.resolve({path:"/diy_form/list"});window.open(r.href)},y=(r=!1)=>{Q({type:"DIY_FORM_MEMBER_INFO",status:1}).then(e=>{const a=e.data;a&&(h.splice(0,h.length,...a),r&&T({message:o("refreshSuccess"),type:"success"}))})};y();const C=async r=>{f.value||!r||await r.validate(e=>{e&&Z(l).then(()=>{f.value=!1,c(p.value)}).catch(()=>{f.value=!1})})};return(r,e)=>{const a=U,u=Y,_=j,M=q,N=z,B=A,R=G,k=J;return g(),F("div",W,[n(B,{class:"box-card !border-none",shadow:"never"},{default:d(()=>[$((g(),w(N,{class:"page-form",model:l,"label-width":"150px",ref_key:"ruleFormRef",ref:p,rules:V},{default:d(()=>[i("h3",X,m(s(o)("memberNoRule")),1),n(u,{label:s(o)("prefix"),prop:"prefix"},{default:d(()=>[n(a,{modelValue:l.prefix,"onUpdate:modelValue":e[0]||(e[0]=t=>l.prefix=t),modelModifiers:{trim:!0},placeholder:s(o)("prefixPlaceholder"),class:"input-width",clearable:"",maxlength:"20",onChange:e[1]||(e[1]=t=>c(p.value))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(u,{label:s(o)("length"),prop:"length"},{default:d(()=>[n(a,{modelValue:l.length,"onUpdate:modelValue":e[2]||(e[2]=t=>l.length=t),modelModifiers:{trim:!0},placeholder:s(o)("lengthPlaceholder"),class:"input-width",clearable:"",onKeyup:e[3]||(e[3]=t=>s(L)(t)),onChange:e[4]||(e[4]=t=>c(p.value)),onBlur:e[5]||(e[5]=t=>l.length=t.target.value)},null,8,["modelValue","placeholder"]),i("div",ee,m(s(o)("lengthTips")),1)]),_:1},8,["label"]),n(u,null,{default:d(()=>[i("div",te,m(b.value),1)]),_:1}),i("h3",oe,m(s(o)("diyForm")),1),n(u,{label:s(o)("personalForm")},{default:d(()=>[n(M,{modelValue:l.form_id,"onUpdate:modelValue":e[6]||(e[6]=t=>l.form_id=t),placeholder:s(o)("diyFormPlaceholder"),clearable:""},{default:d(()=>[(g(!0),F(P,null,S(h,t=>(g(),w(_,{key:t.form_id,label:t.page_title,value:t.form_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i("div",le,[i("span",{class:"cursor-pointer text-primary mr-[10px]",onClick:e[7]||(e[7]=t=>y(!0))},m(s(o)("refresh")),1),i("span",{class:"cursor-pointer text-primary",onClick:D},m(s(o)("addDiyForm")),1)])]),_:1},8,["label"])]),_:1},8,["model","rules"])),[[k,f.value]])]),_:1}),i("div",re,[i("div",ae,[n(R,{type:"primary",onClick:e[8]||(e[8]=t=>C(p.value))},{default:d(()=>[H(m(s(o)("save")),1)]),_:1})])])])}}});export{Ee as default};