数通互联化工云平台
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
9.2 KiB

4 months ago
import{d as fe,r as y,y as me,eq as ce,V as le,u as de,ax as q,er as ue,G as P,w as K,es as v,et as C,a as w,f as O,e as l,q as $,Y as I,$ as A,eu as z,c as U,b as S,H as J,ev as pe,a7 as f,ew as H,ae as ge,ex as d,ey as b,ez as ve,eA as De,eB as ye,eC as be,ab as he,aQ as we,at as _e,eD as M,eE as L,eF as ke,_ as Ce}from"./index-e450010e.js";import{H as Se,_ as Ne,a as Oe}from"./vueFile.vue_vue_type_script_setup_true_lang-0652262e.js";/* empty css *//* empty css */import{u as Ae,D as Fe}from"./layout-9d8fdf58.js";import{A as Te}from"./aceDrawer-bed1e945.js";/* empty css */import"./index-75199847.js";import"./Editor-e214347c.js";import"./bianKuangYuanjiao-da7c4bc6.js";import"./siJiao-b8f63525.js";import"./v4-4a60fe23.js";const Be={class:"design-container"},Ee={class:"main-body"},Ve={class:"main-form"},je={key:0,class:"empty-tips"},xe={class:"dialog-footer"},Re=fe({__name:"createform",props:{draweropenclose:{type:Boolean,default:!0},formid:{type:String,default:""},formconfigcont:{type:Object,default(){return{}}}},emits:["update:draweropenclose","handlequery"],setup(G,{emit:Q}){const D=y(!1),h=y([]),u=y(""),s=G,m=Q;me({get:()=>s.draweropenclose,set:o=>{m("update:draweropenclose",o)}}),Ae().changeBreadcrumb([{label:"系统工具"},{label:"表单设计"}]);const n=ce();le();const p=de().query||{},e=q({formData:{list:[],form:{size:"default",name:"",formName:s.formconfigcont.formName},config:{},styles:{divStyle:{},labelStyle:{},inputStyle:{}}},editor:{},loading:!1,formDataPreview:{},previewVisible:!1,designType:p.type,formDict:{},formOtherData:{source:p.source||"",formName:s.formconfigcont.formName}}),a=q({visible:!1,type:"",title:"",codeType:"",direction:void 0,callback:""}),F=y(),N=y();ue("formDesignType",e.designType);const T=()=>{const o=s.formid;o&&(e.loading=!0,pe({id:o.toString()}).then(t=>{if(e.loading=!1,t.code==0){const r=t.data;r.mastesform&&(e.formData=v(r.mastesform)),e.formDict=C(r.dict),e.formOtherData.source=r.source,e.formOtherData.formName=r.name,e.formOtherData.formName=r.name,e.formData.form.name=r.tablekey,e.formData.form.formName=r.name,r.source&&e.designType!=="search"&&N.value.getFormFieldBySource(r.source)}else f.error(t.msg||"加载异常")}).finally(()=>{D.value=!0,H({id:e.formData.form.name}).then(({data:t})=>{h.value=t,t.length>0&&t.forEach(r=>{r.status==1&&(u.value=r.id.toString())})})}).catch(t=>{f.error(t.msg||"加载异常"),e.loading=!1}))},Y=o=>{switch(o){case"del":e.formData.list=[],n.setActiveKey(""),n.setControlAttr({});break;case"eye":n.setActiveKey(""),n.setControlAttr({}),e.previewVisible=!0;let t=d(e.formData);const r=e.formData.form.name,g=new RegExp(`get${r}ControlByName`,"g");t=t.replace(g,`getPreview${r}ControlByName`),e.formDataPreview=v(t),e.formDataPreview.form.name=`Preview${r}`;break;case"json":E({direction:"rtl",content:e.formData,title:"可编辑修改或将已生成的脚本粘贴进来"});break;case"save":s.formid!=""?ee():B();break;case"branch":X();break;case"vue":F.value.open(e.formData),m("update:draweropenclose",!1);break;case"close":D.value?(e.formData.list=[],n.setActiveKey(""),n.setControlAttr({}),m("update:draweropenclose",!1)):ge.confirm("表单已做设计或修改!请问是否保存?","温馨提示!",{confirmButtonText:"保存",cancelButtonText:"不保存",type:"warning",draggable:!0}).then(()=>{B()}).catch(()=>{e.formData.list=[],n.setActiveKey(""),n.setControlAttr({}),m("update:draweropenclose",!1)});break}},W=o=>{try{if(typeof a.callback=="function"){const t=a.codeType==="json"?C(o):v(o);a.callback(t)}else switch(a.type){case"css":e.formData.config||(e.formData.config={}),e.formData.config.style=o;break;case"dict":e.formDict=C(o);break;case"beforeRequest":case"beforeSubmit":case"afterResponse":case"afterSubmit":case"closeSubmit":case"change":e.formData.events||(e.formData.events={}),e.formData.events[a.type]=v(o);break;default:e.formData=v(o)}V()}catch{}},X=()=>{D.value=!0,JSON.stringify(e.formData),Z()};function Z(){let o={jsondata:JSON.stringify(e.formData),data:d(e.formData),source:e.formOtherData.