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

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