index.ead8bee4.js 5.9 KB

12
  1. import{L as S,i as j,a2 as A,al as a,o as r,a as c,Z as l,T as t,F as h,ac as V,u as M,b as q,X as U,U as W,S as n,W as w,_ as X}from"./vue.e1d8f8c6.js";import{E as Z,_ as G}from"./index.6ed0cd31.js";const k=[{label:"姓名",prop:"name",placeholder:"请输入姓名",clearable:!0,disabled:!1,required:!0,type:"input",i18n:!1,i18nText:"",isShow:!0,xs:24,sm:12,md:8,lg:6,xl:4},{label:"邮箱",prop:"email",placeholder:"请输入用户邮箱",clearable:!0,disabled:!1,required:!0,type:"input",i18n:!1,i18nText:"",isShow:!0,xs:24,sm:12,md:8,lg:6,xl:4},{label:"登陆时间",prop:"autograph",placeholder:"选择时间",clearable:!0,disabled:!1,required:!0,type:"date",i18n:!1,i18nText:"",isShow:!0,xs:24,sm:12,md:8,lg:6,xl:4},{label:"职务",prop:"occupation",placeholder:"请选择职务",clearable:!0,disabled:!1,required:!0,type:"select",i18n:!1,i18nText:"",options:[{label:"计算机 / 互联网 / 通信",value:"1"},{label:"生产 / 工艺 / 制造",value:"2"},{label:"医疗 / 护理 / 制药",value:"3"}],isShow:!0,xs:24,sm:12,md:8,lg:6,xl:4},{label:"",prop:"",placeholder:"",clearable:!0,disabled:!1,required:!0,type:"",i18n:!1,i18nText:"",isShow:!0,xs:24,sm:24,md:24,lg:24,xl:24},{label:"备注",prop:"remarks",placeholder:"请输入",clearable:!0,disabled:!1,required:!0,type:"textarea",i18n:!1,i18nText:"",isShow:!0,xs:24,sm:24,md:24,lg:24,xl:24}],H={class:"dynamic-form-container layout-pd"},J=q("span",{class:"ml10"},"年度",-1),K={class:"flex-margin"},Q=S({name:"pagesDynamicForm"}),Y=S({...Q,setup(v){const y=j(),o=A({formData:k,form:{name:"",email:"",autograph:"",occupation:"",list:[{year:"",month:"",day:""}],remarks:""}}),R=()=>{o.form.list.push({year:"",month:"",day:""})},C=u=>{o.form.list.splice(u,1)},T=u=>{u&&u.validate(p=>{if(p)Z.success("验证成功");else return!1})},F=u=>{u&&u.resetFields()};return(u,p)=>{const m=a("el-input"),$=a("el-date-picker"),z=a("el-option"),D=a("el-select"),f=a("el-form-item"),B=a("ele-Plus"),x=a("el-icon"),_=a("el-button"),N=a("ele-Delete"),b=a("el-col"),g=a("el-row"),E=a("el-form"),I=a("el-card"),L=a("ele-RefreshRight"),O=a("SvgIcon");return r(),c("div",H,[l(I,{shadow:"hover",header:"动态复杂表单"},{default:t(()=>[l(E,{model:o.form,ref_key:"formRulesOneRef",ref:y,size:"default","label-width":"100px",class:"mt35"},{default:t(()=>[l(g,{gutter:35},{default:t(()=>[(r(!0),c(h,null,V(M(k),(e,P)=>W((r(),n(b,{xs:e.xs,sm:e.sm,md:e.md,lg:e.md,xl:e.xl,class:"mb20",key:P},{default:t(()=>[e.type!==""?(r(),c(h,{key:0},[e.type!==""?(r(),n(f,{key:0,label:e.label,prop:e.prop,rules:[{required:e.required,message:`${e.label}不能为空`,trigger:e.type==="input"?"blur":"change"}]},{default:t(()=>[e.type==="input"?(r(),n(m,{key:0,modelValue:o.form[e.prop],"onUpdate:modelValue":s=>o.form[e.prop]=s,placeholder:e.placeholder,clearable:"",style:{width:"100%"},disabled:e.disabled},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.type==="date"?(r(),n($,{key:1,modelValue:o.form[e.prop],"onUpdate:modelValue":s=>o.form[e.prop]=s,type:"date",placeholder:e.placeholder,style:{width:"100%"},disabled:e.disabled},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.type==="select"?(r(),n(D,{key:2,modelValue:o.form[e.prop],"onUpdate:modelValue":s=>o.form[e.prop]=s,placeholder:e.placeholder,style:{width:"100%"},disabled:e.disabled},{default:t(()=>[(r(!0),c(h,null,V(e.options,s=>(r(),n(z,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):w("v-if",!0),e.type==="textarea"?(r(),n(m,{key:3,type:"textarea",modelValue:o.form[e.prop],"onUpdate:modelValue":s=>o.form[e.prop]=s,placeholder:e.placeholder,clearable:"",style:{width:"100%"},disabled:e.disabled},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):w("v-if",!0)]),_:2},1032,["label","prop","rules"])):w("v-if",!0)],64)):(r(!0),c(h,{key:1},V(o.form.list,(s,d)=>(r(),n(g,{gutter:35,key:d},{default:t(()=>[l(b,{xs:24,sm:12,md:8,lg:8,xl:6,class:"mb20"},{default:t(()=>[l(f,{label:"年度",prop:`list[${d}].year`,rules:[{required:!0,message:"年度不能为空",trigger:"blur"}]},{label:t(()=>[d===0?(r(),n(_,{key:0,type:"primary",circle:"",size:"small",onClick:R},{default:t(()=>[l(x,null,{default:t(()=>[l(B)]),_:1})]),_:1})):(r(),n(_,{key:1,type:"danger",circle:"",size:"small",onClick:i=>C(d)},{default:t(()=>[l(x,null,{default:t(()=>[l(N)]),_:1})]),_:2},1032,["onClick"])),J]),default:t(()=>[l(m,{modelValue:o.form.list[d].year,"onUpdate:modelValue":i=>o.form.list[d].year=i,style:{width:"100%"},placeholder:"请输入"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l(b,{xs:24,sm:12,md:8,lg:8,xl:6,class:"mb20"},{default:t(()=>[l(f,{label:"月度",prop:`list[${d}].month`,rules:[{required:!0,message:"月度不能为空",trigger:"blur"}]},{default:t(()=>[l(m,{modelValue:o.form.list[d].month,"onUpdate:modelValue":i=>o.form.list[d].month=i,style:{width:"100%"},placeholder:"请输入"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l(b,{xs:24,sm:12,md:8,lg:8,xl:6,class:"mb20"},{default:t(()=>[l(f,{label:"日度",prop:`list[${d}].day`,rules:[{required:!0,message:"日度不能为空",trigger:"blur"}]},{default:t(()=>[l(m,{modelValue:o.form.list[d].day,"onUpdate:modelValue":i=>o.form.list[d].day=i,style:{width:"100%"},placeholder:"请输入"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1032,["xs","sm","md","lg","xl"])),[[X,e.isShow]])),128))]),_:1})]),_:1},8,["model"])]),_:1}),l(g,{class:"flex mt15"},{default:t(()=>[q("div",K,[l(_,{size:"default",onClick:p[0]||(p[0]=e=>F(y.value))},{default:t(()=>[l(x,null,{default:t(()=>[l(L)]),_:1}),U(" 重置表单 ")]),_:1}),l(_,{size:"default",type:"primary",onClick:p[1]||(p[1]=e=>T(y.value))},{default:t(()=>[l(O,{name:"iconfont icon-shuxing"}),U(" 验证表单 ")]),_:1})])]),_:1})])}}}),te=G(Y,[["__file","E:/code/wwwroot/local81.lzj/simple_storage/vue-next-admin/src/views/pages/dynamicForm/index.vue"]]);export{te as default};