test_lgq/niucloud/public/admin/assets/member-4cb817a4.js

2 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{d as C,r as g,n as v,N as o,h as b,c as N,y as F,I,w as i,e as r,a as c,t as _,u as n,i as B,W as D,X as $,$ as M,Y as R,E as P,a0 as k,_ as H}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css */import{L,M as S}from"./member-97cfd04b.js";const T={class:"main-container"},U={class:"panel-title"},j={class:"form-tip"},q={class:"text-lg"},z={class:"fixed-footer-wrap"},A={class:"fixed-footer"},O=C({__name:"member",setup(W){const d=g(!0),p=g({}),h=g(""),x=v({prefix:[{validator:(l,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"},{validator:(l,e,a)=>{parseInt(e)>30||parseInt(e)-t.prefix.length<4?a(new Error(o("lengthHint"))):a()},trigger:"blur"}]}),t=v({prefix:"",length:10});(async()=>{const l=await(await L()).data;Object.keys(t).forEach(e=>{l[e]!=null&&(t[e]=l[e])}),f(p.value),d.value=!1})();const f=async l=>{await l.validate(e=>{if(e){let a="";const m=t.length-t.prefix.length-1;for(let u=1;u<=m;u++)a+="0";h.value=t.prefix+a+"1"}})},w=async l=>{d.value||!l||await l.validate(e=>{e&&S(t).then(()=>{d.value=!1,f()}).catch(()=>{d.value=!1})})};return(l,e)=>{const a=D,m=$,u=M,y=R,V=P,E=k;return b(),N("div",T,[F((b(),I(y,{model:t,"label-width":"150px",ref_key:"ruleFormRef",ref:p,rules:x,class:"page-form"},{default:i(()=>[r(u,{class:"box-card !border-none",shadow:"never"},{default:i(()=>[c("h3",U,_(n(o)("memberNoRule")),1),r(m,{label:n(o)("prefix"),prop:"prefix"},{default:i(()=>[r(a,{modelValue:t.prefix,"onUpdate:modelValue":e[0]||(e[0]=s=>t.prefix=s),placeholder:n(o)("prefixPlaceholder"),class:"input-width",clearable:"",maxlength:"20",onChange:e[1]||(e[1]=s=>f(p.value))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),r(m,{label:n(o)("length"),prop:"length"},{default:i(()=>[r(a,{modelValue:t.length,"onUpdate:modelValue":e[2]||(e[2]=s=>t.length=s),placeholder:n(o)("lengthPlaceholder"),class:"input-width",clearable:"",type:"number",onChange:e[3]||(e[3]=s=>f(p.value))},null,8,["modelValue","placeholder"]),c("div",j,_(n(o)("lengthTips")),1)]),_:1},8,["label"]),r(m,null,{default:i(()=>[c("div",q,_(h.value),1)]),_:1})]),_:1})]),_:1},8,["model","rules"])),[[E,d.value]]),c("div",z,[c("div",A,[r(V,{type:"primary",onClick:e[4]||(e[4]=s=>w(p.value))},{default:i(()=>[B(_(n(o)("save")),1)]),_:1})])])])}}});const le=H(O,[["__scopeId","data-v-48406bbd"]]);export{le as default};