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 lines
8.4 KiB
1 lines
8.4 KiB
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.setActiveKey(""),i.setControlAttr({})):m({message:t.msg||"保存失败!",type:"error"})}).finally(()=>{e.loading=!1}).catch(t=>{m.error(t.message||"保存异常"),e.loading=!1})}const x=o=>{var R;const{type:t,direction:r,codeType:u,title:_,callback:k,content:s}=o;a.direction=r,a.type=t,a.codeType=u||"",a.title=_?`提示:${_}`:"",a.visible=!0,a.callback=k;let f=u==="json"?w(s,!0):p(s,!0);switch(t){case"css":f=((R=e.formData.config)==null?void 0:R.style)||"";break;case"dict":f=w(e.formDict,!0);break;case"beforeRequest":case"beforeSubmit":case"afterResponse":case"afterSubmit":case"change":const K=e.formData.events||{};K[t]?f=p(K[t],!0):["afterResponse","afterSubmit"].includes(t)?f=H:t==="change"?f=be:f=M;break;case"optionsParams":s||(f=M);break;case"optionsResult":s||(f=H);break}a.content=f},ee=()=>{B()},B=()=>{a.visible=!1,a.type="",a.title="",a.codeType="",a.callback="",a.content=""},j=y(),te=()=>{j.value.validate((o,t)=>{if(o)m.success("校验通过");else return m.error("校验不通过"),!1})},oe=o=>{e.formData=g(p(o))},ae=o=>{e.formData.list.push(o)};ce(()=>{d.source&&S.value.getFormFieldBySource(d.source),e.formOtherData.formName=n.formconfigcont.formName,e.formData.form.name=n.formconfigcont.formlogo,e.formData.form.formName=n.formconfigcont.formName,V()}),O(()=>n.formconfigcont,o=>{e.formOtherData.formName=o.formName,e.formData.form.name=o.formlogo,e.formData.form.formName=o.formName,V()},{deep:!0}),O(()=>e.formData.list,o=>{o.length>0&&(v.value=!0,D("judgeFormIsEdit",!0))},{deep:!0});const V=()=>{const o=n.formKey;o&&(e.loading=!0,le({id:o.toString()}).then(t=>{if(e.loading=!1,t.code==0){const r=t.data;r.mastesform&&(e.formData=g(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"&&S.value.getFormFieldBySource(r.source)}else m.error(t.msg||"加载异常")}).finally(()=>{v.value=!0,I({id:e.formData.form.name}).then(({data:t})=>{b.value=t,t.length>0&&t.forEach(r=>{r.status==1&&(l.value=r.id.toString())})})}).catch(t=>{m.error(t.msg||"加载异常"),e.loading=!1}))};O(()=>l.value,()=>{b.value.length>0&&b.value.forEach(o=>{o.id.toString()==l.value&&(o.mastesform&&(e.formData=g(o.mastesform)),e.formDict=C(o.dict))})});const re=o=>{pe({id:o.toString()}).then(()=>{I({id:e.formData.form.name}).then(({data:t})=>{b.value=t,t.length>0&&t.forEach(r=>{r.status==1&&(l.value=r.id.toString())})})})};return(o,t)=>{const r=ke,u=De,_=ve,k=ye;return h(),F("div",Oe,[c(Ne,{versionid:l.value,"onUpdate:versionid":t[0]||(t[0]=s=>l.value=s),formid:e.formOtherData.source,versioncont:b.value,onClickCheck:ae,onClick:oe,onEditversionstaus:re},null,8,["versionid","formid","versioncont"]),$("div",Fe,[q(c(we,{customerformid:n.formKey,onClick:G},null,8,["customerformid"]),[[k,e.loading]]),q((h(),F("div",Te,[e.formData.list.length===0?(h(),F("div",Ae," 从左侧拖拽来添加组件 ")):T("",!0),c(U,{issave:v.value,"onUpdate:issave":t[1]||(t[1]=s=>v.value=s),type:5,"form-data":e.formData,dict:e.formDict},null,8,["issave","form-data","dict"])])),[[k,e.loading]])]),c(r,{ref_key:"formControlAttrEl",ref:S,formOtherData:e.formOtherData,"onUpdate:formOtherData":t[2]||(t[2]=s=>e.formOtherData=s),"form-data":e.formData.form,"form-config":e.formData.config,customerformid:n.formKey,"form-list":e.formData.list,onOpenDialog:x},null,8,["formOtherData","form-data","form-config","customerformid","form-list"]),c(Se,{modelValue:a.visible,"onUpdate:modelValue":t[3]||(t[3]=s=>a.visible=s),title:a.title,direction:a.direction,content:a.content,"code-type":a.codeType,onBeforeClose:ee,onConfirm:Q},null,8,["modelValue","title","direction","content","code-type"]),["search"].includes(e.designType)?T("",!0):(h(),z(_e,{key:0,ref_key:"vueFileEl",ref:A},null,512)),c(_,{modelValue:e.previewVisible,"onUpdate:modelValue":t[5]||(t[5]=s=>e.previewVisible=s),title:"预览","append-to-body":!0,size:"50%"},{footer:N(()=>[$("div",Ee,[c(u,{size:"small",type:"primary",onClick:te},{default:N(()=>[W(" 提交 ")]),_:1}),c(u,{size:"small",onClick:t[4]||(t[4]=s=>e.previewVisible=!1)},{default:N(()=>[W(" 取消 ")]),_:1})])]),default:N(()=>[e.previewVisible?(h(),z(U,{key:0,ref_key:"previewForm",ref:j,"form-data":e.formDataPreview,dict:e.formDict,type:1},null,8,["form-data","dict"])):T("",!0)]),_:1},8,["modelValue"])])}}});const Me=he(xe,[["__scopeId","data-v-5cffd3aa"]]);export{Me as default};
|
|
|