jw项目windows环境软件安装
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.

1 line
6.3 KiB

1 year ago
  1. import{_ as P,G,a2 as I,C as K,r as U,d as H,aa as J,e as n,o,c as i,g as h,w as s,aT as V,R as v,S as k,z as t,K as u,m as b,D as y,A as C,h as w,L as Q,b3 as X}from"./index-9b4667b6.js";const Z={key:0,class:"flex-center"},ee=G({name:"commonForm"}),le=Object.assign(ee,{props:{fromData:{type:Array,default:[]},model:{type:Object,default:()=>({})},labelWidth:{Number,default:"auto"},labelPosition:{validator(l){const c=["left","right","top"];for(let r=0;r<c.length;r++)if(l===c[r])return!0;return!1},default:"right"},inline:{type:Boolean,default:!0},footer:{type:Boolean,default:!0},submitText:{type:String,default:"\u786E\u5B9A"},cancelText:{type:String,default:"\u53D6\u6D88"},showCancel:{type:Boolean,default:!0}},emits:["onSubmit","onCancel"],setup(l,{emit:c}){const r=l,S=I(),Y=K(()=>S.sideTheme==="theme-dark"),p=U();H(()=>{F()}),J(()=>{f.value={},p.value.resetFields()});const f=U({}),F=()=>{r.fromData.forEach(d=>{d.required&&(d.rules?f.value[d.prop]=[...d.rules]:f.value[d.prop]=[{required:!0,message:d.rulesMsg||`${d.label}\u4E0D\u80FD\u4E3A\u7A7A`,trigger:d.trigger||"blur"}])}),setTimeout(()=>{p.value.resetFields()},0)},O=async()=>{Object.keys(f.value).length!==0&&!await p.value.validate().catch(()=>{})||c("onSubmit",X(r.model))},D=()=>{p.value.resetFields(),c("onCancel")};return(d,ae)=>{const T=n("el-input-number"),M=n("el-option"),W=n("el-select"),B=n("el-select-v2"),R=n("el-cascader"),z=n("el-date-picker"),$=n("el-time-picker"),N=n("el-radio"),j=n("el-radio-group"),L=n("el-checkbox"),q=n("el-input"),g=n("el-form-item"),x=n("el-button"),A=n("el-form");return o(),i("div",{class:Q(["ruleForm",{"ruleForm-dark":w(Y)}])},[h(A,{ref_key:"ruleFormRef",ref:p,model:l.model,rules:w(f),inline:l.inline,"label-width":l.labelWidth,"label-position":l.labelPosition},{default:s(()=>[V(d.$slots,"head",{},void 0,!0),(o(!0),i(v,null,k(l.fromData,(e,E)=>(o(),t(g,{key:E,prop:e.prop,label:e.label,"label-width":e.labelWidth,style:u(e.width)},{default:s(()=>{var _;return[e.type==="inputNumber"?(o(),t(T,{key:0,max:e.max,min:e.min,modelValue:l.model[e.prop],"onUpdate:modelValue":a=>l.model[e.prop]=a,placeholder:"\u8BF7\u8F93\u5165"+e.label,size:e.size,disabled:e.disabled,style:u(e.elemWidth)},null,8,["max","min","modelValue","onUpdate:modelValue","placeholder","size","disabled","style"])):e.type==="select"&&!e.fieldsCount?(o(),t(W,{key:1,clearable:"",modelValue:l.model[e.prop],"onUpdate:modelValue":a=>l.model[e.prop]=a,placeholder:"\u8BF7\u9009\u62E9"+e.label,size:e.size,disabled:e.disabled,filterable:e.filterable,multiple:e.multiple,style:u(e.elemWidth),onOnChange:a=>d.$emit(`on-${e.events}`,a)},{default:s(()=>[(o(!0),i(v,null,k(e.filterOptions,(a,m)=>(o(),t(M,{key:m,label:a.label,value:a.value,disabled:a.disabled},{default:s(()=>[b(y(a.label),1)]),_:2},1032,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","size","disabled","filterable","multiple","style","onOnChange"])):e.type==="select-v2"&&!e.fieldsCount?(o(),t(B,{key:2,modelValue:l.model[e.prop],"onUpdate:modelValue":a=>l.model[e.prop]=a,options:e.filterOptions,placeholder:"\u8BF7\u9009\u62E9"+e.label,filterable:"",teleported:!1},null,8,["modelValue","onUpdate:modelValue","options","placeholder"])):e.type==="cascader"?(o(),t(R,{key:3,data:e.data,placeholder:"\u8BF7\u9009\u62E9"+e.label,modelValue:l.model[e.prop],"onUpdate:modelValue":a=>l.model[e.prop]=a,disabled:e.disabled,filterable:e.filterable},null,8,["data","placeholder","modelValue","onUpdate:modelValue","disabled","filterable"])):["date-picker","date","date_range"].includes(e.type)?(o(),t(z,{key:4,clearable:"",type:(e==null?void 0:e.formOptions.type)||"date",modelValue:l.model[e.prop],"onUpdate:modelValue":a=>l.model[e.prop]=a,format:(e==null?void 0:e.formOptions.valueFormat)||"YYYY-MM-DD",placeholder:"\u8BF7\u9009\u62E9\u65E5\u671F",size:e.size,disabled:e.disabled,style:u(e.elemWidth),"value-format":(e==null?void 0:e.formOptions.valueFormat)||"YYYY-MM-DD",teleported:!1},null,8,["type","modelValue","onUpdate:modelValue","format","size","disabled","style","value-format"])):e.type==="month