2 lines
5.9 KiB
JavaScript
2 lines
5.9 KiB
JavaScript
|
|
import{d as L,a as g,r as x,w,b as q,c as s,e as d,f as i,h as f,v as B,i as r,l as _,x as U,y as o,F as y,j as h,k as p,z as c,t as D,p as G,E as J,_ as K}from"./index-ccab2584.js";const P={class:"penk-form-container"},Q=L({__name:"index",props:{formData:Object,formConfig:{type:[Object,String]},visible:Boolean,width:{type:[String,Number]},details:Boolean,title:String,fullscreen:Boolean,draggable:Boolean,"append-to-body":Boolean,"close-on-click-modal":Boolean},emits:["update:visible","confirm"],setup(C,{emit:k}){const n=C;let a=g({});const b=x(!0),m=x();w(()=>n.visible,(t,u)=>{b.value=t}),w(b,(t,u)=>{k("update:visible",t)}),w(()=>n.formData,(t,u)=>{E(m.value),a=g(t)});const z=async t=>{!t||await t.validate((u,V)=>{u?k("confirm",a):J({showClose:!0,message:"\u8BF7\u5B8C\u5584\u8868\u5355\u4FE1\u606F\uFF01",type:"error"})})},E=t=>{!t||t.resetFields()};return q(()=>{b.value=n.visible,a=g(n.formData)}),(t,u)=>{const V=s("el-input"),S=s("el-option"),I=s("el-select"),$=s("el-checkbox"),N=s("el-checkbox-group"),T=s("el-radio"),j=s("el-radio-group"),M=s("el-input-number"),O=s("el-image"),F=s("el-date-picker"),R=s("el-form-item"),A=s("el-form"),v=s("el-button"),H=s("el-dialog");return d(),i("div",P,[f(H,{modelValue:b.value,"onUpdate:modelValue":u[3]||(u[3]=e=>b.value=e),fullscreen:n.fullscreen,draggable:n.draggable,title:n.title,width:n.width||"40%",class:"dialogForm"},B({header:r(()=>[U(t.$slots,"header",{class:"diaHeader"},void 0,!0)]),default:r(()=>[f(A,{ref_key:"ruleFormRef",ref:m,"label-width":"180px",style:{margin:"0 auto"},size:"default",model:o(a),rules:n.formConfig.rules},{default:r(()=>[(d(!0),i(y,null,h(n.formConfig.formItemConfig,e=>(d(),p(R,{key:e.prop,label:e.label+"\uFF1A",style:c([{display:e.hidden==!0?"none":""},{width:"90%",display:"flex","align-items":"center"}]),prop:e.prop},{default:r(()=>[e.type=="input"?(d(),p(V,{key:0,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,placeholder:e.placeholder||"\u8BF7\u8F93\u5165",clearable:e.clearable,disabled:e.disabled,row:e.row,style:c({width:e.width+"px"}),mapIcon:e.mapIcon},B({_:2},[e.mapIcon?{name:"suffix",fn:r(()=>[U(t.$slots,"mapIcon",{},void 0,!0)]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder","clearable","disabled","row","style","mapIcon"])):e.type=="textarea"?(d(),p(V,{key:1,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,placeholder:e.placeholder||"\u8BF7\u8F93\u5165",clearable:e.clearable,disabled:e.disabled,type:e.inputType,row:e.row,style:c({width:e.width+"px"})},null,8,["modelValue","onUpdate:modelValue","placeholder","clearable","disabled","type","row","style"])):e.type=="select"?(d(),p(I,{key:2,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,placeholder:e.placeholder||"\u8BF7\u9009\u62E9",clearable:e.clearable,disabled:e.disabled,style:c({width:e.width+"px"})},{default:r(()=>[(d(!0),i(y,null,h(e.data,l=>(d(),p(S,{key:l.value,label:l.label,value:l.value,disabled:l.disabled},null,8,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","clearable","disabled","style"])):e.type=="checkbox"?(d(),p(N,{key:3,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,style:c({width:e.width+"px"})},{default:r(()=>[(d(!0),i(y,null,h(e.data,l=>(d(),p($,{label:l.value,disabled:l.disabled},{default:r(()=>[_(D(l.label),1)]),_:2},1032,["label","disabled"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","clearable","disabled","style"])):e.type=="radio"?(d(),p(j,{key:4,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,style:c({width:e.width+"px"})},{default:r(()=>[(d(!0),i(y,null,h(e.data,l=>(d(),p(T,{label:l.value,size:"large"},{default:r(()=>[_(D(l.label),1)]),_:2},1032,["label"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","clearable","disabled","style"])):e.type=="number"?(d(),p(M,{key:5,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l
|