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,disabled:e.disabled,min:1,max:999,size:"default","controls-position":"right",style:c({width:e.width+"px"}),placeholder:e.placeholder||"\u8BF7\u8F93\u5165\u6570\u5B57"},null,8,["modelValue","onUpdate:modelValue","disabled","style","placeholder"])):e.type=="image"?(d(),p(O,{key:6,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,style:c({width:e.width,height:e.height}),src:o(a)[e.prop],fit:e.fit,placeholder:e.placeholder,disabled:e.disabled},null,8,["modelValue","onUpdate:modelValue","style","src","fit","placeholder","disabled"])):e.type=="date"?(d(),p(F,{key:7,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,style:c({width:e.width+"px"}),disabled:e.disabled,type:e.dateType,placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",size:e.size,format:e.format,"value-format":e.valueFormat,disabledDate:e.disabledDate},null,8,["modelValue","onUpdate:modelValue","style","disabled","type","size","format","value-format","disabledDate"])):e.type=="datetime"?(d(),p(F,{key:8,modelValue:o(a)[e.prop],"onUpdate:modelValue":l=>o(a)[e.prop]=l,style:c({width:e.width+"px"}),disabled:e.disabled,type:e.dateType,placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",size:e.size,format:e.format,"value-format":e.valueFormat},null,8,["modelValue","onUpdate:modelValue","style","disabled","type","size","format","value-format"])):G("",!0)]),_:2},1032,["label","style","prop"]))),128))]),_:3},8,["model","rules"])]),_:2},[n.details?{name:"footer",fn:r(()=>[f(v,{type:"primary",onClick:u[0]||(u[0]=e=>b.value=!1)},{default:r(()=>[_(" \u5173\u95ED ")]),_:1})]),key:"0"}:{name:"footer",fn:r(()=>[f(v,{class:"cancelButtonStyle",onClick:u[1]||(u[1]=e=>b.value=!1)},{default:r(()=>[_("\u53D6\u6D88")]),_:1}),f(v,{type:"primary",onClick:u[2]||(u[2]=e=>z(m.value))},{default:r(()=>[_(" \u4FDD\u5B58 ")]),_:1})]),key:"1"}]),1032,["modelValue","fullscreen","draggable","title","width"])])}}});const X=K(Q,[["__scopeId","data-v-a02e12ff"]]);export{X as D};
|