You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.1KB

  1. import{E as P,r as k,o as z,b as a,c as n,L as u,h as s,f as d,d as f,F as _,H as c,N as x,i as v,t as b,u as i,e as A,j as G,k as I}from"./index-dd5fae99.js";import{h as J,f as K,b as g,c as O,e as Q}from"./uploadAction-3962500e.js";const W={class:"el-upload__tip"},X=I({name:"newModuleForm"}),F=Object.assign(X,{props:{data:{type:Object,default:null}},setup(w,{expose:U}){const N=P.dictStore.uploadUrl,r=w,l=k({formList:[]}),y=k(),M=V=>{y.value.validate(p=>{V(p)})};return z(()=>{l.value=r.data}),U({validForm:M,formData:l}),(V,p)=>{var L;const j=a("el-input"),B=a("el-input-number"),C=a("el-radio"),S=a("el-radio-group"),h=a("el-checkbox"),D=a("el-checkbox-group"),q=a("el-button"),E=a("el-upload"),R=a("el-form-item"),T=a("el-col"),$=a("el-row"),H=a("el-form");return l.value&&((L=l.value.formList)!=null&&L.length)?(n(),u(H,{key:0,ref_key:"formRef",ref:y,model:l.value,"label-position":"right","label-width":"180px","label-suffix":":","scroll-to-error":"",onSubmit:p[1]||(p[1]=x(()=>{},["prevent"]))},{default:s(()=>[d($,{gutter:40},{default:s(()=>[(n(!0),f(_,null,c(r.data&&r.data.formList,(t,o)=>(n(),u(T,{key:o,span:12},{default:s(()=>[d(R,{label:t.name,prop:`formList[${o}].value`,rules:[{required:t.props.required,message:"请完善必填内容"}]},{default:s(()=>[t.props.type==="输入"?(n(),u(j,{key:0,modelValue:l.value.formList[o].value,"onUpdate:modelValue":e=>l.value.formList[o].value=e,placeholder:"请输入",maxlength:t.props.maxLength},null,8,["modelValue","onUpdate:modelValue","maxlength"])):t.props.type==="数值输入"?(n(),u(B,{key:1,modelValue:l.value.formList[o].value,"onUpdate:modelValue":e=>l.value.formList[o].value=e,placeholder:"请输入",min:t.props.minNumber,max:t.props.maxNumber,controls:!1,onMousewheel:p[0]||(p[0]=x(()=>{},["prevent"]))},null,8,["modelValue","onUpdate:modelValue","min","max"])):t.props.type==="单选"?(n(),u(S,{key:2,modelValue:l.value.formList[o].value,"onUpdate:modelValue":e=>l.value.formList[o].value=e},{default:s(()=>[(n(!0),f(_,null,c(t.props.options,(e,m)=>(n(),u(C,{key:m,label:e.name},{default:s(()=>[v(b(e.name),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):t.props.type==="多选"?(n(),u(D,{key:3,modelValue:l.value.formList[o].value,"onUpdate:modelValue":e=>l.value.formList[o].value=e},{default:s(()=>[(n(!0),f(_,null,c(t.props.options,(e,m)=>(n(),u(h,{key:m,label:e.name},{default:s(()=>[v(b(e.name),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(n(),u(E,{key:4,"file-list":l.value.formList[o].value,"onUpdate:fileList":e=>l.value.formList[o].value=e,class:"w-full",limit:t.props.fileNumber,action:i(N),"on-success":e=>i(J)(e,l.value.formList[o].value,!1),"before-upload":e=>i(K)(e,{types:i(g)}),accept:i(g).map(e=>`.${e}`).join(","),"on-preview":i(O)},{tip:s(()=>[A("div",W," 支持"+b(i(Q))+"文件 ",1)]),default:s(()=>[d(q,{type:"primary",plain:""},{default:s(()=>p[2]||(p[2]=[v("选择文件")])),_:1})]),_:2},1032,["file-list","onUpdate:fileList","limit","action","on-success","before-upload","accept","on-preview"]))]),_:2},1032,["label","prop","rules"])]),_:2},1024))),128))]),_:1})]),_:1},8,["model"])):G("",!0)}}});export{F as default};