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.
184 lines
58 KiB
184 lines
58 KiB
import{d as se,ar as ve,f as B,o as p,b as U,g as O,F as q,e as X,j as A,t as pe,y as we,N as I,bp as Le,r as te,C as ie,n as xe,bq as be,br as re,c as P,w as r,a as n,bs as je,bt as $e,bu as Fe,a3 as Je,G as he,as as Ge,bv as Ie,bw as Se,M as We,b7 as Ze,E as le,aP as Qe,aQ as Xe,$ as Ye,ai as et,aj as tt,b6 as lt,b4 as ot,ap as at,az as nt,P as rt,ag as it,aK as st,aL as ct,bx as ut,a1 as dt,by as oe,a9 as de,bz as _e,H as Be,X as qe,bA as pt,bB as ft,B as mt,J as vt,m as bt,bC as ht,a7 as yt,bD as Ue,bE as Ve,bF as ge,aM as gt,bG as Ne,bH as Re,bI as kt}from"./index-b0696d90.js";/* empty css *//* empty css *//* empty css */const Ce=[],ke={optionsType:0},Ae=[{title:"基础字段",children:[{type:"input",label:"单行文本",icon:"input",control:{modelValue:""},config:{}},{type:"textarea",label:"多行文本",icon:"textarea",control:{modelValue:""},config:{}},{type:"radio",label:"单选框组",icon:"radio",control:{modelValue:""},options:Ce,config:ke},{type:"checkbox",label:"多选框组",icon:"checkbox",control:{modelValue:[]},options:Ce,config:ke},{type:"select",label:"下拉选择框",icon:"select",control:{modelValue:"",appendToBody:!0},options:Ce,config:ke},{type:"datePicker",label:"日期选择器",icon:"date",control:{modelValue:"",type:"date"},config:{}},{type:"timePicker",label:"时间选择器",icon:"time",control:{modelValue:""},config:{}},{type:"colorPicker",label:"取色器",icon:"color",control:{modelValue:""},config:{}},{type:"switch",label:"开关",icon:"switch",control:{modelValue:!1},config:{}},{type:"inputNumber",label:"计数器",icon:"number",control:{modelValue:0},config:{}},{type:"cascader",label:"级联选择器",icon:"cascader",control:{modelValue:[]},options:[],config:ke},{type:"rate",label:"评分",icon:"rate",control:{modelValue:0},config:{}},{type:"slider",label:"滑块",icon:"slider",control:{modelValue:0},config:{}},{type:"treeSelect",label:"树形控件",icon:"tree2",control:{modelValue:"",data:[],renderAfterExpand:!1},config:{optionsType:0}},{type:"txt",label:"文字",icon:"text",control:{modelValue:""},config:{}},{type:"title",label:"标题",icon:"title",control:{modelValue:"标题"},config:{}},{type:"button",label:"按钮",icon:"button",control:{label:"保存"},config:{}}]},{title:"高级字段",children:[{type:"table",label:"子表",icon:"table",list:[],tableData:[],control:{border:!0},config:{addBtnText:"添加一行"}},{type:"component",label:"自定义组件",icon:"component",control:{modelValue:""},config:{}},{type:"upload",label:"图片/文件",icon:"image",control:{modelValue:""},config:{}},{type:"tinymce",label:"富文本",icon:"tinymce",control:{modelValue:""},config:{}}]},{title:"布局字段",children:[{type:"grid",label:"格栅布局",icon:"grid",columns:[{attr:{span:12},list:[]},{attr:{span:12},list:[]}],control:{},config:{}},{type:"tabs",label:"标签页",icon:"tabs",columns:[{label:"Tab1",list:[]}],control:{},config:{}},{type:"card",label:"卡片布局",icon:"card",list:[],control:{},config:{},item:{}},{type:"flex",label:"弹性布局",icon:"flex",list:[],tableData:[],control:{},config:{addBtnText:"添加一行"}},{type:"divider",label:"分割线",icon:"divider",control:{},config:{}},{type:"div",label:"容器",icon:"div",control:{},config:{},list:[]}]},{title:"扩展组件",children:[{type:"expand-user",label:"选择用户",icon:"user",control:{modelValue:""},config:{}}]}],_t={key:0,class:"no-date"},wt={key:1,class:"list"},St=["onClick"],Vt=["src"],Ct=se({__name:"template",emits:["click"],setup(z,{expose:H,emit:N}){const $=ve({visible:!1,list:[]}),w=()=>{$.visible=!0,t()},t=()=>{const e=Object.assign({});console.log(e),$.list=[],Object.keys(e).forEach(d=>{const y=e[d];$.list.push({imgPath:y.imgPath,title:y.title,formData:y.formData})})},c=e=>{N("click",e.formData),$.visible=!1};return H({open:w}),(e,d)=>B($).visible?(p(),U("div",{key:0,class:we(["use-template",{active:B($).visible}])},[O("span",{class:"close icon-close",onClick:d[0]||(d[0]=y=>B($).visible=!1)}),B($).list.length===0?(p(),U("div",_t,"暂无可用模板")):(p(),U("div",wt,[(p(!0),U(q,null,X(B($).list,(y,f)=>(p(),U("div",{key:f,class:"item",onClick:_=>c(y)},[O("img",{src:y.imgPath,alt:""},null,8,Vt),A(pe(y.title),1)],8,St))),128))]))],2)):I("",!0)}}),xt={class:"components-list"},Dt={key:0},Et=O("div",{class:"title"},"快速选择表单字段",-1),Tt={class:"content"},$t={class:"title"},Ut=["title"],Nt=se({__name:"dragControl",props:{formId:{}},emits:["clickCheck","click"],setup(z,{emit:H}){const N=z,$=["input","radio","checkbox","select","datePicker","timePicker","inputNumber","cascader","component","button"],w=Le("formDesignType"),t=te([]),c=ie(()=>w==="search"),e=(h,g)=>{if(h){const R=$e(g);delete R.rules,delete R.customRules,H("clickCheck",R)}},d=ie(()=>{if(w==="search"){const h=[];return Ae.forEach(g=>{if(g.children){const R=g.children.filter(Z=>$.includes(Z.type));R&&R.length&&h.push({title:g.title,children:R})}}),h}else return Ae}),y=te(),f=()=>{y.value.open()},_=h=>{H("click",h)},u=h=>$e(h);xe(()=>N.formId,h=>{h&&c.value&&T(h)});const T=h=>{be("designById",{id:h}).then(g=>{const R=re(g.data.data);R&&R.list&&k(R.list)})},k=h=>{h.forEach(g=>{g.type==="grid"||g.type==="tabs"?g.columns.forEach(R=>{k(R.list)}):g.type==="card"?k(g.list):$.includes(g.type)&&g.type!=="button"&&t.value.push(g)})};return(h,g)=>{var Z;const R=Fe;return p(),U("div",xt,[B(c)&&((Z=B(t))!=null&&Z.length)?(p(),U("div",Dt,[Et,O("div",Tt,[(p(!0),U(q,null,X(B(t),K=>(p(),P(R,{key:K.name,onChange:C=>e(C,K)},{default:r(()=>{var C;return[A(pe((C=K.item)==null?void 0:C.label),1)]}),_:2},1032,["onChange"]))),128))])])):I("",!0),(p(!0),U(q,null,X(B(d),(K,C)=>(p(),U("div",{key:C},[O("div",$t,[A(pe(K.title)+" ",1),C===0&&!B(c)?(p(),U("div",{key:0,class:"template",onClick:f}," 使用模板 ")):I("",!0)]),n(B(je),{itemKey:"key123",tag:"ul",modelValue:K.children,"onUpdate:modelValue":V=>K.children=V,group:{name:"form",pull:"clone",put:!1},"ghost-class":"ghost",sort:!1,clone:u},{item:r(({element:V})=>[O("li",{class:we([V.type])},[O("i",{class:we(`icon-${V.icon}`)},null,2),O("span",{title:V.label},pe(V.label),9,Ut)],2)]),_:2},1032,["modelValue","onUpdate:modelValue"])]))),128)),B(c)?I("",!0):(p(),P(Ct,{key:1,ref_key:"useTemplateEl",ref:y,onClick:_},null,512))])}}}),Rt={class:"main-tools"},At=se({__name:"headTools",props:{showKey:{default:()=>[]},hideKey:{default:()=>[]}},emits:["click"],setup(z,{emit:H}){const N=z,$=t=>{H("click",t)},w=ie(()=>{var c,e;const t=[{icon:"del",label:"清空",key:1},{icon:"eye",label:"预览",key:2},{icon:"json",label:"生成脚本预览",key:3},{icon:"vue",label:"导出vue文件",key:4},{icon:"save",label:"保存",key:5}];return(c=N.showKey)!=null&&c.length?t.filter(d=>N.showKey.includes(d.key)):(e=N.hideKey)!=null&&e.length?t.filter(d=>!N.hideKey.includes(d.key)):t});return(t,c)=>{const e=he;return p(),U("div",Rt,[Je(t.$slots,"default"),(p(!0),U(q,null,X(w.value,d=>(p(),P(e,{link:"",type:"primary",onClick:y=>$(d.icon),key:d.icon},{default:r(()=>[O("i",{class:we(["icon-"+d.icon])},null,2),A(pe(d.label),1)]),_:2},1032,["onClick"]))),128))])}}}),Ot=[{type:"required",label:"必填",regExp:/^\s*$/,message:"必填项"},{type:"mobile",label:"手机号码",regExp:/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/,message:"请输入手机号码"},{type:"tel",label:"固话",regExp:/^0\d{2,3}-\d{7,8}$/,message:"请输入固定电话号码"},{type:"phone",label:"固话或手机",regExp:/^((0\d{2,3}(-?)\d{7,8})|(1[3456789]\d{9}))$/,message:"请输入固定电话号码或手机号"},{type:"email",label:"邮箱",regExp:/^[a-z0-9A-Z._%-]+@([a-z0-9A-Z-]+\.)+[a-zA-Z]{2,4}$/,message:"请输入邮箱地址"},{type:"int",label:"正整数",regExp:/^[0-9]*[1-9][0-9]*$/,message:"请输入正整数"},{type:"number",label:"数字",regExp:/^\d+(\.\d+)?$/,message:"请输入数字"},{type:"money",label:"金额",regExp:/^[0-9]+\.?[0-9]{0,2}$/,message:"请输入正确的金额,最多两位小数"},{type:"card",label:"身份证",regExp:/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/,message:"请输入身份证号"},{type:"cn",label:"中文",regExp:/[\u4e00-\u9fa5]+/,message:"请输入中文"},{type:"numberLetter",label:"数字字母",regExp:/[0-9a-zA-Z]$/,message:"请输入数字或字母"},{type:"url",label:"网址",regExp:/^https?:\/\/((.)+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?.(\?)?)*)*$/,message:"请输入网址"},{type:"longitude",label:"经度",regExp:/^[-+]?(0?\d{1,2}\.\d{1,10}|1[0-7]?\d\.\d{1,10}|180\.0{1,10})$/,message:"请输入正确的经度"},{type:"latitude",label:"纬度",regExp:/^[-+]?([0-8]?\d{1}\.\d{1,10}|90\.0{1,10})$/,message:"请输入正确的纬度"}],Oe=Ot,Pt={class:"sidebar-tools"},Lt=O("div",{class:"h3"},[O("h3",null,"通用属性")],-1),Ft=O("div",{class:"h3"},[O("h3",null,"标签配置项")],-1),It=["onClick"],Bt={key:2},qt=O("div",{class:"h3"},[O("h3",null,"选项配置")],-1),zt={key:0},Mt=["onClick"],Ht=O("div",{class:"h3"},[O("h3",null,"校验设置")],-1),Kt={key:0},jt=["onClick"],Jt={key:4},Gt=O("div",{class:"h3"},[O("h3",null,"其他属性")],-1),Wt=O("div",{class:"h3"},[O("h3",null,"接口数据事件")],-1),Zt=se({__name:"formControlAttr",props:{formData:{},formConfig:{default:()=>({})},formOtherData:{default:()=>({})}},emits:["openDialog","update:formOtherData"],setup(z,{expose:H,emit:N}){const $=z,{formConfig:w,formData:t}=Ge($),c=Ie(),e=ie(()=>c.controlAttr),d=te([]),y=ie(()=>{var o;const a=u.isSearch;return[{label:"表单名称",placeholder:"用于保存的表单名称",value:$.formOtherData.formName,key:"formName",hide:a},{label:"数据源",placeholder:"请选择数据源",value:Se($.formOtherData.source),type:"select",options:d.value,key:"source",hide:a||!((o=d.value)!=null&&o.length),clearable:!0},{label:"表单标识",value:t.value.name,placeholder:"表单唯一标识,可为空",key:"name",hide:a},{label:"表单标签宽度",value:t.value.labelWidth,placeholder:"表单label宽,如180px",key:"labelWidth"},{label:"表单样式名称",value:t.value.class,placeholder:"额外添加的表单class类名",key:"class",type:"select",options:[{label:"无样式",value:"",name:"",id:""},{label:"每行两列",value:"form-row-2",name:"",id:""},{label:"每行三列",value:"form-row-3",name:"",id:""},{label:"每行四列",value:"form-row-4",name:"",id:""}],hide:a,clearable:!0},{label:"字段名后添加冒号",value:t.value.showColon,key:"showColon",type:"switch"},{label:"组件尺寸",value:t.value.size,type:"select",key:"size",options:[{label:"large",value:"large",name:"",id:""},{label:"default",value:"default",name:"",id:""},{label:"small",value:"small",name:"",id:""}]}]}),f=ie(()=>{if(Object.keys(e.value).length){const{control:a={},type:o,name:x,config:E={},item:m={},attr:s={}}=e.value;let i=!1;if(o==="table"){const b=e.value&&e.value.list;b&&b.length>0&&(i=b[0].type==="index")}return ve([{label:"自定义Class",value:E.className,placeholder:"样式类名",path:"config.className"},{label:"字段标识",value:x,type:Object.keys(u.dataSourceList).length>0?"select":"text",placeholder:"字段唯一标识,对应数据库",dict:u.dataSourceList,path:"name",vHide:["grid","tabs","card","title","gridChild","tableColumn","divider","txt","div","button"],eventName:"filedNameKey"},{label:"占位内容",value:a.placeholder,placeholder:"placeholder",path:"control.placeholder",vShow:["password","input","textarea","select","date","number","datePicker","tinymce","timePicker","treeSelect"]},{label:"按钮类型",value:a.type,path:"control.type",type:"select",dict:{primary:"primary",success:"success",info:"info",warning:"warning",danger:"danger"},vShow:["button"],clearable:!0},{label:"按钮名称",value:a.label,path:"control.label",vShow:["button"]},{label:"按钮事件",value:a.key,path:"control.key",type:"select",dict:{submit:"提交表单",reset:"重置表单",cancel:"取消返回",none:"无动作(自定义)"},vShow:["button"]},{label:"对齐方式",value:E.textAlign,path:"config.textAlign",type:"select",dict:{left:"left",right:"right",center:"center"},vShow:["button","div"]},{label:"label值",value:m.label,path:"item.label",vHide:["table","grid","tabs","title","gridChild","div","inputSlot","flex","button","txt"]},{label:"隐藏label",value:m.showLabel,path:"item.showLabel",type:"switch",vHide:["table","grid","tabs","title","gridChild","divider","card","div","inputSlot","flex","button","txt"]},{label:"帮助信息",value:E.help,path:"config.help",vHide:["table","grid","tabs","gridChild","divider","div","inputSlot","flex","button","txt"]},{label:"表单栅格",value:E.span,placeholder:"表单区域栅格宽,0为自动宽",path:"config.span",vHide:["gridChild"],isNum:!0},{label:"文本值",value:a.modelValue,placeholder:"支持html",path:"control.modelValue",vShow:["txt"],inputStyle:"textarea"},{label:"设为密码",value:o,type:"select",dict:{input:"文本",password:"密码"},path:"type",vShow:["input","password"],vIf:u.isSearch},{label:"文本域高度",value:a.rows,placeholder:"输入框行数",path:"control.rows",vShow:["textarea"],isNum:!0},{label:"前缀",value:E.prepend,placeholder:"文本前缀",path:"config.prepend",vShow:["input","password"]},{label:"后缀",value:E.append,placeholder:"文本后缀",path:"config.append",vShow:["input","password"]},{label:"状态打开时的值",value:a.activeValue,placeholder:"状态打开时的值",path:"control.activeValue",vShow:["switch"],isNum:!0},{label:"状态关闭时的值",value:a.inactiveValue,placeholder:"状态关闭时的值",path:"control.inactiveValue",vShow:["switch"],isNum:!0},{label:"增加按钮文案",value:E.addBtnText,path:"config.addBtnText",type:"text",vShow:["flex","table"]},{label:"删除按钮文案",value:E.delBtnText,path:"config.delBtnText",type:"text",vShow:["flex","table"]},{label:"是否多选",value:a.multiple,path:"control.multiple",type:"switch",vShow:["select","treeSelect"],eventName:"selectMultiple"},{label:"可清空",value:a.clearable,path:"control.clearable",type:"switch",vShow:["select"]},{label:"是否禁用",value:a.disabled,path:"control.disabled",type:"switch",vShow:["input","password","textarea","radio","checkbox","select","date","switch","number","cascader","upload","rate","tinymce","treeSelect"],vIf:u.isSearch},{label:"是否禁用编辑",value:E.editDisabled,path:"config.editDisabled",type:"switch",vShow:["input","password","textarea","radio","checkbox","select","date","switch","number","cascader","upload","treeSelect","table","flex"],vIf:u.isSearch},{label:"添加页隐藏",value:E.disabledAdd,path:"config.disabledAdd",type:"switch",vIf:u.isSearch,vHide:["inputSlot"]},{label:"编辑页隐藏",value:E.disabledEdit,path:"config.disabledEdit",type:"switch",vIf:u.isSearch,vHide:["inputSlot"]},{label:"详情页隐藏",value:E.disabledDetail,path:"config.disabledDetail",type:"switch",vIf:u.isSearch,vHide:["inputSlot"]},{label:"设为Input输入框的前/后缀",value:o==="inputSlot",path:"",type:"switch",vShow:["select","inputSlot"],eventName:"setInputSlot"},{label:"标题",value:a.modelValue,path:"control.modelValue",vShow:["title"]},{label:"占据的列数span",value:s.span,path:"attr.span",vShow:["gridChild"],eventName:"formatNumber",isNum:!0},{label:"左侧的间隔格数offset",value:s.offset,path:"attr.offset",vShow:["gridChild"],eventName:"formatNumber",isNum:!0},{label:"向右移动格数push",value:s.push,path:"attr.push",vShow:["gridChild"],eventName:"formatNumber",isNum:!0},{label:"向左移动格数pull",value:s.pull,path:"attr.pull",vShow:["gridChild"],eventName:"formatNumber",isNum:!0},{label:"序号列",value:i,type:"switch",vShow:["table"],eventName:"tableColumn1"},{label:"组件名",value:E.componentName,placeholder:"全局注册的组件名称",path:"config.componentName",vShow:["component"]},{label:"上传地址",value:a.action,placeholder:"图片/文件上传地址,可不填有默认值",path:"control.action",vShow:["upload"]},{label:"文件字段名",value:a.name,placeholder:"上传的文件字段名,默认file",path:"control.name",vShow:["upload"]},{label:"列表类型",value:a.listType,type:"select",dict:{text:"text",picture:"picture","picture-card":"picture-card"},path:"control.listType",vShow:["upload"]},{label:"提示文字",value:E.tip,placeholder:"提示说明文字",path:"config.tip",vShow:["upload"]},{label:"按钮文本",value:E.btnText,placeholder:"上传按钮文本",path:"config.btnText",vShow:["upload"]},{label:"direction",type:"select",dict:{horizontal:"horizontal",vertical:"vertical"},placeholder:"分割线方向,默认horizontal",value:a.direction,path:"control.direction",vShow:["divider"]},{label:"border-style",placeholder:"分隔符样式,默认solid",value:a.borderStyle,path:"control.borderStyle",vShow:["divider"]},{label:"content-position",type:"select",dict:{left:"left",right:"right",center:"center"},value:a.contentPosition,path:"control.contentPosition",vShow:["divider"]},{label:"最小值",value:a.min,path:"control.min",vShow:["slider"],eventName:"formatNumber",isNum:!0},{label:"最大值",value:a.max,path:"control.max",vShow:["rate","slider"],eventName:"formatNumber",isNum:!0},{label:"步长",value:a.step,path:"control.step",vShow:["slider"],eventName:"formatNumber",isNum:!0},{label:"type",value:a.type,path:"control.type",vShow:["datePicker"],type:"select",placeholder:"显示类型",dict:{year:"year",month:"month",date:"date",datetime:"datetime",week:"week",datetimerange:"datetimerange",daterange:"daterange",monthrange:"monthrange"}},{label:"format",value:a.format,path:"control.format",vShow:["datePicker","timePicker"],placeholder:"显示在输入框中的格式"},{label:"color-format",value:a.colorFormat,path:"control.colorFormat",type:"select",placeholder:"写入 v-model 的颜色的格式",dict:{hsl:"hsl",hsv:"hsv",hex:"hex",rgb:"rgb"},vShow:["colorPicker"]},{label:"文本高度",value:a.height,path:"control.height",placeholder:"文本高度(预览查看效果)",vShow:["tinymce"]},{label:"文本宽度",value:a.width,path:"control.width",placeholder:"文本宽度(预览查看效果)",vShow:["tinymce"]},{label:"图片上传地址",value:a.imgUrl,path:"control.imgUrl",placeholder:"图片上传地址",vShow:["tinymce"]},{label:"附件上传地址",value:a.blobUrl,path:"control.blobUrl",placeholder:"附件上传地址",vShow:["tinymce"]},{label:"显示模式",value:E.style,path:"config.style",placeholder:"显示风格(预览查看效果)",type:"select",dict:{default:"default",simple:"simple",label:"",name:""},vShow:["tinymce"]}]).filter(b=>{let D=!0;return b.vShow&&(D=b.vShow.includes(o)),b.vHide&&(D=!b.vHide.includes(o)),b.vIf&&(D=!1),D})}else return[]}),_=Le("formDesignType"),u=ve({dataSourceList:[],customRulesList:[...Oe,{type:"rules",label:"自定义正则"},{type:"methods",label:"自定义方法"}],isSearch:_==="search",tooltip:{css:"当前表单应用页的样式,类似于.vue文件中的style scoped中的样式",dict:'数据字典,用于匹配多选组、下拉选择等,提供动态获取Options接口字典数据,一般不设置,从接口dict获取。json格式:"sex":{"0":"男","1":"女"}',rules:"可参考UI组件表单校验,<a href='https://element-plus.gitee.io/zh-CN/component/form.html#%E8%A1%A8%E5%8D%95%E6%A0%A1%E9%AA%8C' target='_blank' style='color:red'>详情点击</a>",props:"可添加当前组件所有prop属性及事件方法"},tabsName:"second"});xe(()=>c.activeKey,a=>{a&&(u.tabsName="first")});const T=(a,o)=>{switch(a.eventName){case"selectMultiple":o?e.value.control.modelValue=[]:e.value.control.modelValue="";break;case"tableColumn1":V(o);break;case"formatNumber":break;case"filedNameKey":a.type==="select"&&u.dataSourceList.forEach(x=>{x.name===o&&(e.value.item&&(e.value.item.label=x.label),e.value.name=x.label)});break;case"setInputSlot":o?(e.value.type="inputSlot",le.success(`请在对应的Input输入框属性前后缀设置key:${e.value.name}`)):e.value.type="select";break}if(a.path){const x=a.isNum?Se(o):o;a.path&&k(e.value,a.path,x)}},k=(a,o,x)=>{let E=a;const m=o.split(".");let s=0;for(s;s<m.length-1;s++){const b=m[s];if(b in E)E=E[b];else throw new Error(`${b} is undefined`)}const i=m[s],S=E[m[s]];return x!==void 0&&(E[i]=x),{obj:E,key:i,value:S}},h=(a,o)=>{o==="tabs"?e.value.columns.splice(a,1):e.value.options.splice(a,1)},g=a=>{e.value.type==="cascader"?R("cascader"):e.value.type==="treeSelect"?R("treeSelect","编辑组件下拉选项数据"):a==="tabs"?e.value.columns.push({label:"标签名称",list:[]}):e.value.options.push({label:"",value:""})},R=(a,o)=>{let x=e.value.control;switch(e.value.type==="button"&&(x=e.value.config,a="button"),a){case"treeSelect":x=e.value.control.data;break;case"cascader":x=e.value.options;break;case"optionsParams":x=e.value.config.beforeRequest;break;case"optionsResult":x=e.value.config.afterResponse;break}N("openDialog",{content:x,title:o,type:a,direction:"ltr",callback:m=>{switch(a){case"treeSelect":e.value.control.data=m;break;case"cascader":e.value.options=m;break;case"optionsParams":e.value.config.beforeRequest=m;break;case"optionsResult":e.value.config.afterResponse=m;break;case"button":e.value.config=m;break;default:e.value.control={},Object.assign(e.value.control,m)}}})},Z=a=>{var o;(o=e.value.item)!=null&&o.rules||(e.value.item.rules=[]),a?e.value.item.rules.push({required:!0,message:"必填项",trigger:"change"}):e.value.item.rules.splice(0,1)},K=a=>{var x,E;(x=e.value.item)!=null&&x.rules||(e.value.item.rules=[]);const o={content:(E=e.value.item)==null?void 0:E.rules,title:a,direction:"ltr",callback:m=>{Object.assign(e.value.item.rules,m)}};N("openDialog",o)},C=(a,o)=>{if(a&&a.length===0||Object.keys(e.value).length===0)return!1;const x=a.indexOf(e.value.type);return o?x!==-1:x===-1},V=a=>{const o={name:"index",type:"index",item:{label:"序号"},control:{},config:{}};a?e.value.list.unshift(o):e.value.list.splice(0,1)},F=ie(()=>{var o;const a=e.value&&((o=e.value.item)==null?void 0:o.rules);return a&&a.length>0}),G=()=>{e.value.customRules||(e.value.customRules=[]),e.value.customRules.push({type:"required",message:"必填项",trigger:"blur"})},J=a=>{e.value.customRules&&e.value.customRules.splice(a,1)},j=a=>{N("openDialog",{codeType:"css",direction:"ltr",type:"css",title:a})},Y=a=>{N("openDialog",{type:"dict",direction:"ltr",codeType:"json",title:a})},M=a=>{if(u.isSearch)return;const o=a;o&&be("sourceById",{id:o}).then(x=>{var m;const E=(m=x.data.result)==null?void 0:m.tableData;E&&E.length&&(u.dataSourceList=E.filter(s=>s.enterable))}).catch(x=>{console.log(x)})},ae=()=>{u.isSearch||be("sourceList").then(a=>{d.value=a.data.list})},Q=(a,o)=>{if(a.key==="source"&&(M(a.value),c.setActiveKey(""),c.setControlAttr({})),["formName","source"].includes(a.key)){N("update:formOtherData",Object.assign($.formOtherData,{[a.key]:a.value}));return}a.path==="config"?w.value[a.key]=a.value||o:t.value[a.key]=a.value},fe=a=>{switch(a){case 1:return"数据源接口URL,可带参数";case 2:return"字典key,默认为字段标识"}return""},ce=(a,o)=>{const x=Oe.filter(E=>E.type===o);x&&x.length&&(a.message=x[0].message)},ye=(a,o)=>{R(a,o)},ne=(a,o)=>{N("openDialog",{type:a,title:o,direction:"ltr"})};return ae(),H({getFormFieldBySource:M}),(a,o)=>{const x=Qe,E=Xe,m=Ye,s=et,i=tt,S=lt,b=ot,D=at,L=he,ee=We("QuestionFilled"),ue=nt,me=rt,He=Fe,De=it,Ee=st,Ke=ct;return p(),U("div",Pt,[n(Ke,{modelValue:u.tabsName,"onUpdate:modelValue":o[29]||(o[29]=l=>u.tabsName=l)},{default:r(()=>[n(Ee,{label:"字段配置",name:"first"},{default:r(()=>[n(De,{size:"small",class:"form"},{default:r(()=>[Lt,(p(!0),U(q,null,X(f.value,(l,W)=>(p(),P(i,{key:W,label:l.label},{default:r(()=>[l.type==="select"?(p(),P(E,{key:0,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,placeholder:l.placeholder,filterable:l.path==="name","allow-create":l.path==="name",clearable:l.clearable,onChange:v=>T(l,v)},{default:r(()=>[(p(!0),U(q,null,X(l.dict,(v,Te)=>(p(),P(x,{key:Te,value:l.path==="name"?v.name:Te,label:l.path==="name"?`${v.label}(${v.name})`:v},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable","allow-create","clearable","onChange"])):l.type==="switch"?(p(),P(m,{key:1,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,onChange:v=>T(l,v)},null,8,["modelValue","onUpdate:modelValue","onChange"])):(p(),P(s,{key:2,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,type:l.inputStyle,placeholder:l.placeholder,onInput:v=>T(l,v)},null,8,["modelValue","onUpdate:modelValue","type","placeholder","onInput"]))]),_:2},1032,["label"]))),128)),e.value.config?(p(),U(q,{key:0},[n(i,{label:"联动条件"},{default:r(()=>[n(m,{modelValue:e.value.config.linkKey,"onUpdate:modelValue":o[0]||(o[0]=l=>e.value.config.linkKey=l)},null,8,["modelValue"])]),_:1}),e.value.config.linkKey?(p(),U(q,{key:0},[n(i,null,{default:r(()=>[n(s,{modelValue:e.value.config.linkValue,"onUpdate:modelValue":o[1]||(o[1]=l=>e.value.config.linkValue=l),type:"textarea",placeholder:"表达式如: $.input>1 $表示为当前表单数据,input为字段标识"},null,8,["modelValue"])]),_:1}),C(["input","textarea","radio","checkbox","select","date","switch","number","cascader","slider","datePicker","timePicker","colorPicker","inputNumber","rate","treeSelect"],!0)?(p(),P(i,{key:0,label:"联动结果"},{default:r(()=>[n(b,{modelValue:e.value.config.linkResult,"onUpdate:modelValue":o[2]||(o[2]=l=>e.value.config.linkResult=l),class:"option-radio"},{default:r(()=>[n(S,{label:"hidden"},{default:r(()=>[A("隐藏(默认)")]),_:1}),n(S,{label:"disabled"},{default:r(()=>[A("禁用")]),_:1})]),_:1},8,["modelValue"])]),_:1})):I("",!0)],64)):I("",!0)],64)):I("",!0),C(["tabs"],!0)?(p(),U(q,{key:1},[Ft,(p(!0),U(q,null,X(e.value.columns,(l,W)=>(p(),P(i,{key:W},{default:r(()=>[n(D,{span:12},{default:r(()=>[n(s,{modelValue:l.label,"onUpdate:modelValue":v=>l.label=v,placeholder:"标签配置项"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(D,{span:2,offset:1},{default:r(()=>[O("i",{class:"icon-del",onClick:v=>h(W,"tabs")},null,8,It)]),_:2},1024)]),_:2},1024))),128)),n(i,null,{default:r(()=>[n(L,{onClick:o[3]||(o[3]=l=>g("tabs"))},{default:r(()=>[A("增加标签")]),_:1})]),_:1})],64)):I("",!0),C(["radio","select","checkbox","cascader","inputSlot","treeSelect"],!0)?(p(),U("div",Bt,[qt,C(["select"],!0)?(p(),P(i,{key:0,label:"添加全部项"},{default:r(()=>[n(s,{modelValue:e.value.config.addAll,"onUpdate:modelValue":o[4]||(o[4]=l=>e.value.config.addAll=l),placeholder:"请输入全部项文案"},null,8,["modelValue"])]),_:1})):I("",!0),n(i,{label:"选项数据源"},{default:r(()=>[n(E,{modelValue:e.value.config.optionsType,"onUpdate:modelValue":o[5]||(o[5]=l=>e.value.config.optionsType=l),onChange:o[6]||(o[6]=l=>e.value.config.optionsFun="")},{default:r(()=>[n(x,{value:0,label:"固定选项"}),n(x,{value:1,label:"数据源"}),n(x,{value:2,label:"接口字典"})]),_:1},8,["modelValue"])]),_:1}),e.value.config.optionsType===0?(p(),U(q,{key:1},[e.value.type!=="cascader"?(p(),U("div",zt,[(p(!0),U(q,null,X(e.value.options,(l,W)=>(p(),P(i,{key:W},{default:r(()=>[n(D,{span:10},{default:r(()=>[n(s,{modelValue:l.label,"onUpdate:modelValue":v=>l.label=v,placeholder:"选项标签"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(D,{span:10,offset:1},{default:r(()=>[n(s,{modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,placeholder:"选项值"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(D,{span:2,offset:1},{default:r(()=>[O("i",{class:"icon-del",onClick:v=>h(W)},null,8,Mt)]),_:2},1024)]),_:2},1024))),128))])):I("",!0),n(i,null,{default:r(()=>[n(L,{onClick:g},{default:r(()=>[A(pe(e.value.type==="cascader"?"编辑":"新增"),1)]),_:1})]),_:1})],64)):(p(),U(q,{key:2},[n(i,null,{default:r(()=>[n(s,{modelValue:e.value.config.optionsFun,"onUpdate:modelValue":o[8]||(o[8]=l=>e.value.config.optionsFun=l),placeholder:fe(e.value.config.optionsType)},Ze({_:2},[e.value.config.optionsType===1?{name:"prepend",fn:r(()=>[n(E,{modelValue:e.value.config.method,"onUpdate:modelValue":o[7]||(o[7]=l=>e.value.config.method=l),style:{width:"80px"}},{default:r(()=>[n(x,{label:"get",value:"get"}),n(x,{label:"post",value:"post"})]),_:1},8,["modelValue"])]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1}),e.value.config.optionsType===1?(p(),U(q,{key:0},[n(i,{label:"指定label属性值"},{default:r(()=>[n(s,{modelValue:e.value.config.label,"onUpdate:modelValue":o[9]||(o[9]=l=>e.value.config.label=l),placeholder:"返回数据中没有label时可设置"},null,8,["modelValue"])]),_:1}),n(i,{label:"指定value属性值"},{default:r(()=>[n(s,{modelValue:e.value.config.value,"onUpdate:modelValue":o[10]||(o[10]=l=>e.value.config.value=l),placeholder:"返回数据中没有value时可设置"},null,8,["modelValue"])]),_:1})],64)):I("",!0),e.value.config.optionsType===1?(p(),P(i,{key:1},{default:r(()=>[n(L,{onClick:o[11]||(o[11]=l=>ye("optionsParams","请求前处理事件,参数(data,route,form) data请求参数,route页面路由,form表单值"))},{default:r(()=>[A("beforeRequest ")]),_:1}),n(L,{onClick:o[12]||(o[12]=l=>ye("optionsResult","请求返回结束处理;,也可为字符串,如opt=formatTest"))},{default:r(()=>[A("afterResponse ")]),_:1})]),_:1})):I("",!0)],64)),n(i,{label:"尝试转换value值为"},{default:r(()=>[n(E,{modelValue:e.value.config.transformData,"onUpdate:modelValue":o[13]||(o[13]=l=>e.value.config.transformData=l),placeholder:"默认为number"},{default:r(()=>[n(x,{value:"none"},{default:r(()=>[A("不转换")]),_:1}),n(x,{value:"number"},{default:r(()=>[A("number")]),_:1}),n(x,{value:"string"},{default:r(()=>[A("string")]),_:1})]),_:1},8,["modelValue"])]),_:1})])):I("",!0),!u.isSearch&&C(["txt","title","table","grid","tabs","card","switch","gridChild","tableColumn","divider","div","button"])?(p(),U(q,{key:3},[Ht,C(["input","password","component"],!0)?(p(),U("div",Kt,[(p(!0),U(q,null,X(e.value.customRules,(l,W)=>(p(),P(i,{key:l.type},{default:r(()=>[n(s,{modelValue:l.message,"onUpdate:modelValue":v=>l.message=v,placeholder:"校验提示信息"},{prepend:r(()=>[n(E,{modelValue:l.type,"onUpdate:modelValue":v=>l.type=v,style:{width:"80px"},onChange:v=>ce(l,v)},{default:r(()=>[(p(!0),U(q,null,X(u.customRulesList,v=>(p(),P(x,{key:v.type,label:v.label,value:v.type},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),append:r(()=>[O("i",{class:"icon-del",onClick:v=>J(W)},null,8,jt)]),_:2},1032,["modelValue","onUpdate:modelValue"]),l.type==="rules"?(p(),P(s,{key:0,modelValue:l.rules,"onUpdate:modelValue":v=>l.rules=v,placeholder:"正则表达式"},null,8,["modelValue","onUpdate:modelValue"])):I("",!0),l.type==="methods"?(p(),P(s,{key:1,modelValue:l.methods,"onUpdate:modelValue":v=>l.methods=v,placeholder:"方法名称,此方法仅适用于导出vue文件"},null,8,["modelValue","onUpdate:modelValue"])):I("",!0)]),_:2},1024))),128)),n(i,null,{default:r(()=>[n(L,{onClick:G},{default:r(()=>[A("快速添加")]),_:1}),n(L,{onClick:o[14]||(o[14]=l=>K(u.tooltip.rules))},{default:r(()=>[A("编写校验规则 "),n(me,{content:u.tooltip.rules,placement:"top","raw-content":""},{default:r(()=>[n(ue,null,{default:r(()=>[n(ee)]),_:1})]),_:1},8,["content"])]),_:1})]),_:1})])):(p(),P(i,{key:1},{default:r(()=>{var l,W;return[n(He,{"model-value":F.value,onChange:Z},{default:r(()=>[A("必填 ")]),_:1},8,["model-value"]),(l=e.value.item)!=null&&l.rules&&((W=e.value.item)!=null&&W.rules[0])?(p(),P(s,{key:0,modelValue:e.value.item.rules[0].message,"onUpdate:modelValue":o[15]||(o[15]=v=>e.value.item.rules[0].message=v),placeholder:"自定义必填错误提示"},null,8,["modelValue"])):I("",!0)]}),_:1}))],64)):I("",!0),C(["grid","card","gridChild","divider","div"])?(p(),U("div",Jt,[Gt,n(L,{size:"small",onClick:o[16]||(o[16]=l=>R("",u.tooltip.props))},{default:r(()=>[A("编辑属性 "),n(me,{content:u.tooltip.props,placement:"top"},{default:r(()=>[n(ue,null,{default:r(()=>[n(ee)]),_:1})]),_:1},8,["content"])]),_:1})])):I("",!0)]),_:1})]),_:1}),n(Ee,{label:"表单配置",name:"second"},{default:r(()=>[n(De,{size:"small",class:"form"},{default:r(()=>[(p(!0),U(q,null,X(y.value.filter(l=>!l.hide),(l,W)=>(p(),P(i,{key:W,label:l.label},{default:r(()=>[l.type==="select"?(p(),P(E,{key:0,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,filterable:l.key==="class","allow-create":l.key==="class",placeholder:l.placeholder,clearable:l.clearable,onChange:v=>Q(l)},{default:r(()=>[(p(!0),U(q,null,X(l.options,v=>(p(),P(x,{key:v.label||v.name,label:v.label||v.name,value:B(Se)(v.value??v.id)},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","filterable","allow-create","placeholder","clearable","onChange"])):l.type==="switch"?(p(),P(m,{key:1,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,onInput:v=>Q(l)},null,8,["modelValue","onUpdate:modelValue","onInput"])):(p(),P(s,{key:2,modelValue:l.value,"onUpdate:modelValue":v=>l.value=v,placeholder:l.placeholder,onInput:v=>Q(l)},null,8,["modelValue","onUpdate:modelValue","placeholder","onInput"]))]),_:2},1032,["label"]))),128)),u.isSearch?I("",!0):(p(),P(i,{key:0},{label:r(()=>[A("添加时获取请求 "),n(me,{content:"新增表单数据时,从接口获取新增初始数据",placement:"top"},{default:r(()=>[n(ue,null,{default:r(()=>[n(ee)]),_:1})]),_:1})]),default:r(()=>[n(m,{modelValue:B(w).addLoad,"onUpdate:modelValue":o[17]||(o[17]=l=>B(w).addLoad=l),onChange:o[18]||(o[18]=l=>Q({key:"addLoad",path:"config"},l))},null,8,["modelValue"])]),_:1})),n(i,null,{default:r(()=>[n(L,{onClick:o[19]||(o[19]=l=>j(u.tooltip.css))},{default:r(()=>[A("编辑表单样式 "),n(me,{content:u.tooltip.css,placement:"top"},{default:r(()=>[n(ue,null,{default:r(()=>[n(ee)]),_:1})]),_:1},8,["content"])]),_:1}),n(L,{onClick:o[20]||(o[20]=l=>Y(u.tooltip.dict))},{default:r(()=>[A("设置数据字典 "),n(me,{content:u.tooltip.dict,placement:"top"},{default:r(()=>[n(ue,null,{default:r(()=>[n(ee)]),_:1})]),_:1},8,["content"])]),_:1})]),_:1}),u.isSearch?I("",!0):(p(),U(q,{key:1},[Wt,n(i,{label:"新增数据保存url"},{default:r(()=>[n(s,{modelValue:B(w).addUrl,"onUpdate:modelValue":o[21]||(o[21]=l=>B(w).addUrl=l),placeholder:"表单提交的url,非特殊不需要设置"},null,8,["modelValue"])]),_:1}),n(i,{label:"修改数据保存url"},{default:r(()=>[n(s,{modelValue:B(w).editUrl,"onUpdate:modelValue":o[22]||(o[22]=l=>B(w).editUrl=l),placeholder:"修改提交的url,非特殊不需要设置"},null,8,["modelValue"])]),_:1}),n(i,{label:"获取表单数据url"},{default:r(()=>[n(s,{modelValue:B(w).requestUrl,"onUpdate:modelValue":o[23]||(o[23]=l=>B(w).requestUrl=l),placeholder:"获取表单数据url,非特殊不需要设置"},null,8,["modelValue"])]),_:1}),n(i,{class:"event-btn"},{default:r(()=>[n(L,{onClick:o[24]||(o[24]=l=>ne("beforeRequest","获取表单初始数据前事件,可修改请求参数"))},{default:r(()=>[A("beforeRequest ")]),_:1}),n(L,{onClick:o[25]||(o[25]=l=>ne("afterResponse","获取表单初始数据后事件,可对请求返回数据进行处理;也可为字符串,如opt=formatTest"))},{default:r(()=>[A("afterResponse ")]),_:1}),n(L,{onClick:o[26]||(o[26]=l=>ne("beforeSubmit","表单数据提交前事件,可对提交数据进行处理;也可为字符串,如opt=formatTest"))},{default:r(()=>[A("beforeSubmit ")]),_:1}),n(L,{onClick:o[27]||(o[27]=l=>ne("afterSubmit","表单数据提交成功事件"))},{default:r(()=>[A("afterSubmit ")]),_:1}),n(L,{onClick:o[28]||(o[28]=l=>ne("change","表单组件值改变事件。当表单某值改变时,可修改其他组件的值;也可为字符串,如opt=formChange,字符串即为/utils/formChangeValue(name,model,key)中的key值"))},{default:r(()=>[A("表单组件改变事件change ")]),_:1})]),_:1})],64))]),_:1})]),_:1})]),_:1},8,["modelValue"])])}}});var ze={exports:{}};/*!
|
|
* clipboard.js v2.0.11
|
|
* https://clipboardjs.com/
|
|
*
|
|
* Licensed MIT © Zeno Rocha
|
|
*/(function(z,H){(function($,w){z.exports=w()})(ut,function(){return function(){var N={686:function(t,c,e){e.d(c,{default:function(){return E}});var d=e(279),y=e.n(d),f=e(370),_=e.n(f),u=e(817),T=e.n(u);function k(m){try{return document.execCommand(m)}catch{return!1}}var h=function(s){var i=T()(s);return k("cut"),i},g=h;function R(m){var s=document.documentElement.getAttribute("dir")==="rtl",i=document.createElement("textarea");i.style.fontSize="12pt",i.style.border="0",i.style.padding="0",i.style.margin="0",i.style.position="absolute",i.style[s?"right":"left"]="-9999px";var S=window.pageYOffset||document.documentElement.scrollTop;return i.style.top="".concat(S,"px"),i.setAttribute("readonly",""),i.value=m,i}var Z=function(s,i){var S=R(s);i.container.appendChild(S);var b=T()(S);return k("copy"),S.remove(),b},K=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},S="";return typeof s=="string"?S=Z(s,i):s instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(s==null?void 0:s.type)?S=Z(s.value,i):(S=T()(s),k("copy")),S},C=K;function V(m){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?V=function(i){return typeof i}:V=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},V(m)}var F=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=s.action,S=i===void 0?"copy":i,b=s.container,D=s.target,L=s.text;if(S!=="copy"&&S!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(D!==void 0)if(D&&V(D)==="object"&&D.nodeType===1){if(S==="copy"&&D.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(S==="cut"&&(D.hasAttribute("readonly")||D.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(L)return C(L,{container:b});if(D)return S==="cut"?g(D):C(D,{container:b})},G=F;function J(m){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(i){return typeof i}:J=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},J(m)}function j(m,s){if(!(m instanceof s))throw new TypeError("Cannot call a class as a function")}function Y(m,s){for(var i=0;i<s.length;i++){var S=s[i];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(m,S.key,S)}}function M(m,s,i){return s&&Y(m.prototype,s),i&&Y(m,i),m}function ae(m,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(s&&s.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),s&&Q(m,s)}function Q(m,s){return Q=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},Q(m,s)}function fe(m){var s=ne();return function(){var S=a(m),b;if(s){var D=a(this).constructor;b=Reflect.construct(S,arguments,D)}else b=S.apply(this,arguments);return ce(this,b)}}function ce(m,s){return s&&(J(s)==="object"||typeof s=="function")?s:ye(m)}function ye(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function ne(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function a(m){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},a(m)}function o(m,s){var i="data-clipboard-".concat(m);if(s.hasAttribute(i))return s.getAttribute(i)}var x=function(m){ae(i,m);var s=fe(i);function i(S,b){var D;return j(this,i),D=s.call(this),D.resolveOptions(b),D.listenClick(S),D}return M(i,[{key:"resolveOptions",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof b.action=="function"?b.action:this.defaultAction,this.target=typeof b.target=="function"?b.target:this.defaultTarget,this.text=typeof b.text=="function"?b.text:this.defaultText,this.container=J(b.container)==="object"?b.container:document.body}},{key:"listenClick",value:function(b){var D=this;this.listener=_()(b,"click",function(L){return D.onClick(L)})}},{key:"onClick",value:function(b){var D=b.delegateTarget||b.currentTarget,L=this.action(D)||"copy",ee=G({action:L,container:this.container,target:this.target(D),text:this.text(D)});this.emit(ee?"success":"error",{action:L,text:ee,trigger:D,clearSelection:function(){D&&D.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(b){return o("action",b)}},{key:"defaultTarget",value:function(b){var D=o("target",b);if(D)return document.querySelector(D)}},{key:"defaultText",value:function(b){return o("text",b)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(b){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return C(b,D)}},{key:"cut",value:function(b){return g(b)}},{key:"isSupported",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],D=typeof b=="string"?[b]:b,L=!!document.queryCommandSupported;return D.forEach(function(ee){L=L&&!!document.queryCommandSupported(ee)}),L}}]),i}(y()),E=x},828:function(t){var c=9;if(typeof Element<"u"&&!Element.prototype.matches){var e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}function d(y,f){for(;y&&y.nodeType!==c;){if(typeof y.matches=="function"&&y.matches(f))return y;y=y.parentNode}}t.exports=d},438:function(t,c,e){var d=e(828);function y(u,T,k,h,g){var R=_.apply(this,arguments);return u.addEventListener(k,R,g),{destroy:function(){u.removeEventListener(k,R,g)}}}function f(u,T,k,h,g){return typeof u.addEventListener=="function"?y.apply(null,arguments):typeof k=="function"?y.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(R){return y(R,T,k,h,g)}))}function _(u,T,k,h){return function(g){g.delegateTarget=d(g.target,T),g.delegateTarget&&h.call(u,g)}}t.exports=f},879:function(t,c){c.node=function(e){return e!==void 0&&e instanceof HTMLElement&&e.nodeType===1},c.nodeList=function(e){var d=Object.prototype.toString.call(e);return e!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in e&&(e.length===0||c.node(e[0]))},c.string=function(e){return typeof e=="string"||e instanceof String},c.fn=function(e){var d=Object.prototype.toString.call(e);return d==="[object Function]"}},370:function(t,c,e){var d=e(879),y=e(438);function f(k,h,g){if(!k&&!h&&!g)throw new Error("Missing required arguments");if(!d.string(h))throw new TypeError("Second argument must be a String");if(!d.fn(g))throw new TypeError("Third argument must be a Function");if(d.node(k))return _(k,h,g);if(d.nodeList(k))return u(k,h,g);if(d.string(k))return T(k,h,g);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(k,h,g){return k.addEventListener(h,g),{destroy:function(){k.removeEventListener(h,g)}}}function u(k,h,g){return Array.prototype.forEach.call(k,function(R){R.addEventListener(h,g)}),{destroy:function(){Array.prototype.forEach.call(k,function(R){R.removeEventListener(h,g)})}}}function T(k,h,g){return y(document.body,k,h,g)}t.exports=f},817:function(t){function c(e){var d;if(e.nodeName==="SELECT")e.focus(),d=e.value;else if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){var y=e.hasAttribute("readonly");y||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),y||e.removeAttribute("readonly"),d=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var f=window.getSelection(),_=document.createRange();_.selectNodeContents(e),f.removeAllRanges(),f.addRange(_),d=f.toString()}return d}t.exports=c},279:function(t){function c(){}c.prototype={on:function(e,d,y){var f=this.e||(this.e={});return(f[e]||(f[e]=[])).push({fn:d,ctx:y}),this},once:function(e,d,y){var f=this;function _(){f.off(e,_),d.apply(y,arguments)}return _._=d,this.on(e,_,y)},emit:function(e){var d=[].slice.call(arguments,1),y=((this.e||(this.e={}))[e]||[]).slice(),f=0,_=y.length;for(f;f<_;f++)y[f].fn.apply(y[f].ctx,d);return this},off:function(e,d){var y=this.e||(this.e={}),f=y[e],_=[];if(f&&d)for(var u=0,T=f.length;u<T;u++)f[u].fn!==d&&f[u].fn._!==d&&_.push(f[u]);return _.length?y[e]=_:delete y[e],this}},t.exports=c,t.exports.TinyEmitter=c}},$={};function w(t){if($[t])return $[t].exports;var c=$[t]={exports:{}};return N[t](c,c.exports,w),c.exports}return function(){w.n=function(t){var c=t&&t.__esModule?function(){return t.default}:function(){return t};return w.d(c,{a:c}),c}}(),function(){w.d=function(t,c){for(var e in c)w.o(c,e)&&!w.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:c[e]})}}(),function(){w.o=function(t,c){return Object.prototype.hasOwnProperty.call(t,c)}}(),w(686)}().default})})(ze);var Qt=ze.exports;const Xt=dt(Qt),Yt=O("div",{id:"editJsonCopy"},null,-1),el={class:"dialog-footer"},tl=se({__name:"vueFile",setup(z,{expose:H}){const N=te(!1),$=te(),w=f=>{let _="";const u="";return f&&f.list.forEach(T=>{var k;(k=T.customRules)!=null&&k.length&&T.customRules.forEach(h=>{h.type==="methods"&&h.methods&&(_+=`// todo 请完善${T.item.label}校验方法
|
|
provide("${h.methods}", (rule, value, callback) => {
|
|
if (value === '') {
|
|
callback(new Error('Please input the password again'))
|
|
} else if (value !== 'abc') {
|
|
callback(new Error("Two inputs don't match!"))
|
|
} else {
|
|
callback()
|
|
}
|
|
})`)})}),{rulesMethods:_,sourceFun:u}},t=f=>{N.value=!0;const _=w(f),{addUrl:u,editUrl:T,requestUrl:k}=f.config;k&&delete f.config.requestUrl,T&&delete f.config.editUrl,u&&delete f.config.addUrl;const h=`<template>
|
|
<div>
|
|
<ak-form
|
|
ref="formNameEl"
|
|
:type="formType"
|
|
:formData="formData"
|
|
requestUrl="${k}"
|
|
addUrl="${u}"
|
|
editUrl="${T}"
|
|
:beforeSubmit="beforeSubmit">
|
|
</ak-form>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { ref, computed, provide } from 'vue'
|
|
const formNameEl = ref()
|
|
const formData = ref(${oe(f)})
|
|
// todo 存在编辑时,可根据路由等参数设置当前表单模式 1新增 2编辑
|
|
const formType = computed(() => {
|
|
return 1
|
|
})
|
|
${_.rulesMethods}
|
|
${_.sourceFun}
|
|
// 表单提交时参数处理
|
|
const beforeSubmit = (params)=>{
|
|
// 如编辑时添加参数
|
|
// params.id='xxx'
|
|
return params
|
|
}
|
|
|
|
<\/script>`;de(()=>{$.value=_e(h,"editJsonCopy","html")})},c=f=>{var K,C,V,F;const _=((K=f.config)==null?void 0:K.openType)==="dialog",u=((C=f.config)==null?void 0:C.dialogWidth)||"600px",T=(V=f.config)==null?void 0:V.requestUrl;T&&delete f.config.requestUrl;const k=(F=f.config)==null?void 0:F.deleteUrl;k&&delete f.config.deleteUrl;let h="",g="",R="";_&&(R='@btn-click="listBtnClick"',h=`<el-dialog
|
|
destroy-on-close
|
|
v-model="dialog.visible"
|
|
:title="dialog.title"
|
|
width="${u}"
|
|
>
|
|
<ak-form
|
|
ref="formEl"
|
|
:formData="formData"
|
|
:dict="dialog.dict"
|
|
:type="dialog.formType"
|
|
requestUrl=""
|
|
addUrl=""
|
|
editUrl=""
|
|
:beforeSubmit="beforeSubmit"
|
|
:afterSubmit="afterSubmit"
|
|
@btn-click="dialogBtnClick"
|
|
></ak-form>
|
|
</el-dialog>`,g=`const formEl = ref()
|
|
// todo 表单数据可从设计表单导出vue文件或保存生成脚本
|
|
const formData = ref({list:[],form:{},config:{}})
|
|
const dialog = reactive({
|
|
visible: false,
|
|
title: '',
|
|
formType: 1,
|
|
dict: {},
|
|
editId: ''
|
|
})
|
|
const listBtnClick = (btn, row) => {
|
|
// 使用弹窗方式打开新增编辑
|
|
if (btn.key === 'add' || btn.key === 'edit') {
|
|
// 打开弹窗
|
|
dialog.visible = true
|
|
dialog.title = btn.key === 'add' ? '新增' : '编辑'
|
|
dialog.formType = btn.key === 'add' ? 1 : 2
|
|
dialog.editId = row && row.id
|
|
|
|
if (btn.key === 'add' && formData.value.config?.addLoad) {
|
|
// 添加时需要加载数据
|
|
nextTick(() => {
|
|
formEl.value.getData()
|
|
})
|
|
}
|
|
// 编辑,根据id加载
|
|
if (btn.key === 'edit') {
|
|
nextTick(() => {
|
|
// eslint-disable-next-line no-irregular-whitespace
|
|
// todo 当表单内容字段比较少,所需值从列表数据就可以获取
|
|
// formEl.value.setValue(row)
|
|
formEl.value.getData({ id: row.id })
|
|
})
|
|
}
|
|
}
|
|
}
|
|
// 提交表单前事件
|
|
const beforeSubmit = (params) => {
|
|
if(dialog.formType===2){ // 编辑模式下添加参数
|
|
params.id = dialog.editId
|
|
}
|
|
return params
|
|
}
|
|
// 提交表单后事件
|
|
const afterSubmit = (type) => {
|
|
if (type === 'success') {
|
|
// 添加成功,刷新列表数据
|
|
closeResetDialog()
|
|
tableListEl.value.getListData()
|
|
}
|
|
}
|
|
// 关闭弹窗并重置表单,否则下次打开会保留上次数据
|
|
const closeResetDialog = () => {
|
|
dialog.visible = false
|
|
dialog.editId = ''
|
|
// formEl.value.resetFields() // 重置表单
|
|
}
|
|
// 点击弹窗取消按钮时
|
|
const dialogBtnClick = (type) => {
|
|
if (type === 'reset') {
|
|
closeResetDialog()
|
|
}
|
|
}
|
|
`),N.value=!0;const Z=`<template>
|
|
<div>
|
|
<ak-list
|
|
ref="tableListEl"
|
|
requestUrl="${T}"
|
|
deleteUrl="${k}"
|
|
:searchData="searchData"
|
|
:tableData="tableData"
|
|
${R}>
|
|
</ak-list>
|
|
${h}
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
// import {useRoute, useRouter} from 'vue-router'
|
|
import { ref, nextTick,reactive } from 'vue'
|
|
// const route = useRoute()
|
|
// const router = useRouter()
|
|
const tableListEl = ref()
|
|
const searchData = ref({})
|
|
const tableData = ref(${oe(f)})
|
|
${g}
|
|
<\/script>`;de(()=>{$.value=_e(Z,"editJsonCopy","html")})},e=f=>{N.value=!0;let _="",u="",T="";const k=f.config.style;k&&(_=`<style>
|
|
${k}
|
|
</style>`),f.config.requestUrl&&(T="import { getGlobalData } from '@/views/design/dataScreen/getData'",u=`const globalScreen = ref({})
|
|
provide('globalScreen', globalScreen)
|
|
const {requestUrl, afterResponse, beforeRequest, method} = screenData.value.config
|
|
getGlobalData(requestUrl, afterResponse, beforeRequest, method)
|
|
.then((res: any) => {
|
|
globalScreen.value = res
|
|
})`);const h=`<template>
|
|
<div :style="screenStyle" class="design-canvas">
|
|
<ak-screen
|
|
v-for="(element, index) in screenData.list"
|
|
:key="index"
|
|
:data="element"
|
|
></ak-screen>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, computed, provide } from 'vue'
|
|
${T}
|
|
const loading = ref(true)
|
|
const screenData = ref(${oe(f)})
|
|
const screenStyle = computed(() => {
|
|
const { width, height, background, primary } = screenData.value.config
|
|
return {
|
|
width: width,
|
|
height: height,
|
|
background: background,
|
|
color: primary,
|
|
position: 'relative'
|
|
}
|
|
})
|
|
${u}
|
|
<\/script>
|
|
${_}`;de(()=>{$.value=_e(h,"editJsonCopy","html")})},d=f=>{de(()=>{const _=new Xt(f.target,{text:()=>$.value.getValue()});_.on("success",function(){le({message:"复制成功!",type:"success"}),_.destroy()}),_.on("error",function(){le.error("复制失败"),_.destroy()}),_.onClick(f)})},y=()=>{var k;const f="data:text/csv;charset=utf-8,"+((k=$.value)==null?void 0:k.getValue()),_=new Date().getTime()+".vue",u=encodeURI(f),T=document.createElement("a");T.setAttribute("href",u),T.setAttribute("download",_),T.click()};return H({open:t,openTable:c,openScreen:e}),(f,_)=>{const u=he,T=Be;return p(),P(T,{modelValue:N.value,"onUpdate:modelValue":_[0]||(_[0]=k=>N.value=k),title:"导出vue文件",class:"export-dialog",width:"80%"},{footer:r(()=>[O("div",el,[n(u,{size:"small",type:"primary",onClick:d},{default:r(()=>[A(" 复制数据 ")]),_:1}),n(u,{type:"primary",size:"small",onClick:y},{default:r(()=>[A(" 导出代码 ")]),_:1})])]),default:r(()=>[Yt]),_:1},8,["modelValue"])}}});const ll=["innerHTML"],ol=["id"],al={class:"dialog-footer"},nl=se({__name:"aceDrawer",props:{modelValue:{type:Boolean},title:{},direction:{default:"ltr"},content:{default:""},id:{default:"editJson"},codeType:{}},emits:["beforeClose","confirm","update:modelValue"],setup(z,{emit:H}){const N=z,$=te({}),w=te(!1);xe(()=>N.modelValue,d=>{w.value=d,d&&t()});const t=()=>{de(()=>{$.value=_e(N.content,N.id,N.codeType)})},c=()=>{const d=$.value.getValue();H("confirm",d)},e=()=>{H("update:modelValue",!1),H("beforeClose")};return qe(()=>{}),pt(()=>{Object.keys($.value).length!==0&&($.value.destroy(),$.value.container.remove())}),(d,y)=>{const f=he,_=ft;return p(),P(_,{modelValue:w.value,"onUpdate:modelValue":y[0]||(y[0]=u=>w.value=u),size:"60%",title:d.title,direction:d.direction,class:"ace-dialog","append-to-body":!0,"before-close":e},{header:r(()=>[O("div",{innerHTML:d.title},null,8,ll)]),default:r(()=>[w.value?(p(),U("div",{key:0,id:d.id},null,8,ol)):I("",!0),O("div",al,[n(f,{type:"primary",size:"small",onClick:c},{default:r(()=>[A(" 确定 ")]),_:1})])]),_:1},8,["modelValue","title","direction"])}}}),Pe=window.sessionStorage.getItem("tagViews");let Me=[];Pe&&(Me=JSON.parse(Pe));const rl=mt("layout",{state:()=>({breadcrumb:[],tabs:Me,reloadFlag:!0}),actions:{changeBreadcrumb(z){this.breadcrumb=z},setTabsViews(z){this.tabs=z,window.sessionStorage.setItem("tagViews",JSON.stringify(z))},setReloadRouter(){this.reloadFlag=!1,de(()=>{this.reloadFlag=!0})}}}),il={class:"design-container"},sl={class:"main-body"},cl={class:"main-form"},ul={key:0,class:"empty-tips"},dl={class:"dialog-footer"},bl=se({__name:"index",setup(z){rl().changeBreadcrumb([{label:"系统工具"},{label:"表单设计"}]);const N=Ie(),$=vt(),w=bt().query||{},t=ve({formData:{list:[],form:{size:"default",name:""},config:{}},editor:{},loading:!1,formDataPreview:{},previewVisible:!1,designType:w.type,formDict:{},formOtherData:{source:w.source||"",formName:"未命名表单"}}),c=ve({visible:!1,type:"",title:"",codeType:"",direction:void 0,callback:""}),e=te(),d=te();ht("formDesignType",t.designType);const y=()=>{const C=w.id;C&&(t.loading=!0,be("designById",{id:C}).then(V=>{const F=V.data;F.data&&(t.formData=re(F.data)),t.formDict=Ve(F.dict),t.formOtherData.source=F.source,t.formOtherData.formName=F.name,F.source&&t.designType!=="search"&&d.value.getFormFieldBySource(F.source),t.loading=!1}).catch(V=>{le.error(V.message||"加载异常"),t.loading=!1}))},f=C=>{switch(C){case"del":t.formData.list=[],N.setActiveKey(""),N.setControlAttr({});break;case"eye":N.setActiveKey(""),N.setControlAttr({}),t.previewVisible=!0;let V=oe(t.formData);const F=t.formData.form.name,G=new RegExp(`get${F}ControlByName`,"g");V=V.replace(G,`getPreview${F}ControlByName`),t.formDataPreview=re(V),t.formDataPreview.form.name=`Preview${F}`;break;case"json":T({direction:"rtl",content:t.formData,title:"可编辑修改或将已生成的脚本粘贴进来"});break;case"save":u();break;case"vue":e.value.open(t.formData);break}},_=C=>{try{if(typeof c.callback=="function"){const V=c.codeType==="json"?Ve(C):re(C);c.callback(V)}else switch(c.type){case"css":t.formData.config||(t.formData.config={}),t.formData.config.style=C;break;case"dict":t.formDict=Ve(C);break;case"beforeRequest":case"beforeSubmit":case"afterResponse":case"afterSubmit":case"change":t.formData.events||(t.formData.events={}),t.formData.events[c.type]=re(C);break;default:t.formData=re(C)}h()}catch{}},u=()=>{const{addUrl:C,editUrl:V,requestUrl:F}=t.formData.config;if(!t.formOtherData.source&&(!C||!V||!F)&&t.designType!=="search"){le.error("请选择数据源或配置接口url地址,否则表单无法提交保存");return}let G={data:oe(t.formData),source:t.formOtherData.source,name:t.formOtherData.formName,type:1,dict:ge(t.formDict)},J="designSave";w.id&&(Object.assign(G,{id:w.id}),J="designEdit"),t.designType==="search"&&(G={data:oe(t.formData),dict:ge(t.formDict),id:w.id}),t.loading=!0,be(J,G).then(j=>{le({message:j.message||"保存成功!",type:"success"});const Y=w.redirect||"/design/form/list",M={};w.redirect&&w.redirect.indexOf("?")!==-1&&w.redirect.split("?")[1].split("&").forEach(fe=>{const ce=fe.split("=");M[ce[0]]=ce[1]}),$.push({path:Y,query:M}),t.loading=!1}).catch(j=>{le.error(j.message||"保存异常"),t.loading=!1}),w.id||window.sessionStorage.removeItem("formMenuList"),N.setActiveKey(""),N.setControlAttr({})},T=C=>{var ae;const{type:V,direction:F,codeType:G,title:J,callback:j,content:Y}=C;c.direction=F,c.type=V,c.codeType=G||"",c.title=J?`提示:${J}`:"",c.visible=!0,c.callback=j;let M=G==="json"?ge(Y,!0):oe(Y,!0);switch(V){case"css":M=((ae=t.formData.config)==null?void 0:ae.style)||"";break;case"dict":M=ge(t.formDict,!0);break;case"beforeRequest":case"beforeSubmit":case"afterResponse":case"afterSubmit":case"change":const Q=t.formData.events||{};Q[V]?M=oe(Q[V],!0):["afterResponse","afterSubmit"].includes(V)?M=Ne:V==="change"?M=kt:M=Re;break;case"optionsParams":Y||(M=Re);break;case"optionsResult":Y||(M=Ne);break}c.content=M},k=()=>{h()},h=()=>{c.visible=!1,c.type="",c.title="",c.codeType="",c.callback="",c.content=""},g=te(),R=()=>{g.value.validate((C,V)=>{if(C)le.success("校验通过"),console.log(V);else return le.error("校验不通过"),!1})},Z=C=>{t.formData=re(oe(C))},K=C=>{t.formData.list.push(C)};return y(),qe(()=>{w.source&&d.value.getFormFieldBySource(w.source)}),(C,V)=>{const F=he,G=Be,J=gt;return p(),U("div",il,[n(Nt,{formid:t.formOtherData.source,onClickCheck:K,onClick:Z},null,8,["formid"]),O("div",sl,[n(At,{onClick:f}),yt((p(),U("div",cl,[t.formData.list.length===0?(p(),U("div",ul," 从左侧拖拽来添加字段 ")):I("",!0),n(Ue,{type:5,"form-data":t.formData,dict:t.formDict},null,8,["form-data","dict"])])),[[J,t.loading]])]),n(Zt,{ref_key:"formControlAttrEl",ref:d,formOtherData:t.formOtherData,"onUpdate:formOtherData":V[0]||(V[0]=j=>t.formOtherData=j),"form-data":t.formData.form,"form-config":t.formData.config,onOpenDialog:T},null,8,["formOtherData","form-data","form-config"]),n(nl,{modelValue:c.visible,"onUpdate:modelValue":V[1]||(V[1]=j=>c.visible=j),title:c.title,direction:c.direction,content:c.content,"code-type":c.codeType,onBeforeClose:k,onConfirm:_},null,8,["modelValue","title","direction","content","code-type"]),["search"].includes(t.designType)?I("",!0):(p(),P(tl,{key:0,ref_key:"vueFileEl",ref:e},null,512)),n(G,{modelValue:t.previewVisible,"onUpdate:modelValue":V[3]||(V[3]=j=>t.previewVisible=j),title:"预览",fullscreen:!0},{footer:r(()=>[O("div",dl,[n(F,{size:"small",type:"primary",onClick:R},{default:r(()=>[A(" 提交 ")]),_:1}),n(F,{size:"small",onClick:V[2]||(V[2]=j=>t.previewVisible=!1)},{default:r(()=>[A(" 取消 ")]),_:1})])]),default:r(()=>[t.previewVisible?(p(),P(Ue,{key:0,ref_key:"previewForm",ref:g,"form-data":t.formDataPreview,dict:t.formDict,type:1},null,8,["form-data","dict"])):I("",!0)]),_:1},8,["modelValue"])])}}});export{bl as default};
|
|
|