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

4 months ago
import{d as se,r as y,eq as ie,V as ne,u as me,ax as P,er as fe,G as ce,w as O,ev as le,es as g,et as C,a7 as m,ew as I,a as h,f as F,e as c,q as $,Y as q,$ as T,eu as U,c as z,b as N,H as W,ae as de,ex as p,ey as w,eA as ue,eB as ge,eC as pe,ab as De,aQ as ve,at as ye,eD as H,eE as M,eF as be,_ as he}from"./index-e450010e.js";import{H as we,_ as _e,a as ke}from"./vueFile.vue_vue_type_script_setup_true_lang-0652262e.js";/* empty css *//* empty css */import{u as Ce,D as Ne}from"./layout-9d8fdf58.js";import{A as Se}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 Oe={class:"design_container"},Fe={class:"main-body"},Te={class:"main-form"},Ae={key:0,class:"empty-tips"},Ee={class:"dialog-footer"},xe=se({__name:"pageDesign",props:{formKey:{type:String,default:""},formconfigcont:{type:Object,default(){return{}}}},emits:["judgeFormIsEdit","closeDrawer","runNextWindows"],setup(J,{emit:L}){const n=J,D=L,v=y(!1),b=y([]),l=y("");Ce().changeBreadcrumb([{label:"系统工具"},{label:"表单设计"}]);const i=ie();ne();const d=me().query||{},e=P({formData:{list:[],form:{size:"default",name:"",formName:n.formconfigcont.formName},config:{},styles:{divStyle:{},labelStyle:{},inputStyle:{}}},editor:{},loading:!1,formDataPreview:{},previewVisible:!1,designType:d.type,formDict:{},formOtherData:{source:d.source||"",formName:n.formconfigcont.formName}}),a=P({visible:!1,type:"",title:"",codeType:"",direction:void 0,callback:""}),A=y(),S=y();fe("formDesignType",e.designType);const G=o=>{switch(o){case"del":e.formData.list=[],i.setActiveKey(""),i.setControlAttr({});break;case"eye":i.setActiveKey(""),i.setControlAttr({}),e.previewVisible=!0;let t=p(e.formData);const r=e.formData.form.name,u=new RegExp(`get${r}ControlByName`,"g");t=t.replace(u,`getPreview${r}ControlByName`),e.formDataPreview=g(t),e.formDataPreview.form.name=`Preview${r}`;break;case"json":x({direction:"rtl",content:e.formData,title:"可编辑修改或将已生成的脚本粘贴进来"});break;case"save":n.formid!=""?Y():E();break;case"branch":saveOtherData();break;case"vue":A.value.open(e.formData),D("runNextWindows",2);break;case"close":v.value?(e.formData.list=[],i.setActiveKey(""),i.setControlAttr({}),D("closeDrawer")):de.confirm("表单已做设计或修改!请问是否保存?","温馨提示!",{confirmButtonText:"保存",cancelButtonText:"不保存",type:"warning",draggable:!0}).then(()=>{E()}).catch(()=>{e.formData.list=[],i.setActiveKey(""),i.setControlAttr({}),D("closeDrawer")});break}},Q=o=>{try{if(typeof a.callback=="function"){const t=a.codeType==="json"?C(o):g(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]=g(o);break;default:e.formData=g(o)}B()}catch{}},Y=()=>{X()};function X(){let o={jsondata:JSON.stringify(e.formData),data:p(e.formData),source:e.formOtherData.source,name:e.formOtherData.formName,type:1,dict:w(e.formDict),id:n.formid.toString(),version:l.value.toString()};e.loading=!0,ue(o).then(t=>{t.code==0?(m({message:t.message||"保存成功!",type:"success"}),D("runNextWindows",2),i.setActiveKey(""),i.setControlAttr({})):m({message:t.msg||"保存失败!",type:"error"})}).finally(()=>{e.loading=!1}).catch(t=>{m.error(t.message||"保存异常"),e.loading=!1})}const E=()=>{v.value=!0,Z()};function Z(){let o={jsondata:JSON.stringify(e.formData),data:p(e.formData),source:e.formOtherData.source,name:e.formOtherData.formName,type:1,dict:w(e.formDict)};d.id&&Object.assign(o,{id:d.id}),e.designType==="search"&&(o={data:p(e.formData),dict:w(e.formDict),id:d.id}),e.loading=!0,ge(o).then(t=>{t.code==0?(m({message:t.message||"保存成功!",type:"success"}),D("runNextWindows",2),i.setActi