mirror of
https://gitee.com/myxzgzs/boyue-kfcode-hasfj.git
synced 2025-06-21 18:09:36 +08:00
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
import{u as h,a as _,g as b}from"./form-BgAHKV8_.js";import{S as C}from"./StrUtil-DZsLURBF.js";import{_ as F,c as k,e as r,w as t,j as m,m as i,o as v}from"./index-CrAWI0wi.js";const N={name:"flowForm",data(){return{formTitle:"",formOpen:!1,rules:{formName:[{required:!0,message:"表单名称不能为空",trigger:"blur"}]},form:{formId:null,formName:null,formSchema:null,remark:null},designerConfig:{generateSFCButton:!1,exportCodeButton:!1,toolbarMaxWidth:320,toolbarMinWidth:300,formHeader:!1}}},mounted(){const l=this.$route.query&&this.$route.query.formId;C.isNotBlank(l)?b(l).then(e=>{this.$nextTick(()=>{this.$refs.vfDesigner.setFormJson(JSON.parse(e.data.formSchema))}),this.form=e.data}):this.$nextTick(()=>{this.$refs.vfDesigner.setFormJson({widgetList:[],formConfig:{modelName:"formData",refName:"vForm",rulesName:"rules",labelWidth:80,labelPosition:"left",size:"",labelAlign:"label-left-align",cssCode:"",customClass:"",functions:"",layoutType:"PC",onFormCreated:"",onFormMounted:"",onFormDataChange:"",onFormValidate:""}})})},methods:{saveFormJson(){let l=this.$refs.vfDesigner.getFormJson();this.form.formSchema=JSON.stringify(l),this.formOpen=!0},submitForm(){this.$refs.form.validate(l=>{if(l){this.form.formId!=null?h(this.form).then(a=>{this.$modal.msgSuccess("修改成功"),this.formOpen=!1}):_(this.form).then(a=>{this.$modal.msgSuccess("新增成功"),this.formOpen=!1});const e={path:"/flowable/form",query:{t:Date.now()}};this.$tab.closeOpenPage(e)}})},cancel(){this.formOpen=!1,this.reset()}}};function x(l,e,a,V,o,s){const f=m("el-button"),p=m("v-form-designer"),u=m("el-input"),d=m("el-form-item"),c=m("el-form"),g=m("el-dialog");return v(),k("div",null,[r(p,{ref:"vfDesigner","designer-config":o.designerConfig},{customSaveButton:t(()=>[r(f,{type:"primary",link:"",onClick:s.saveFormJson,icon:"promotion"},{default:t(()=>e[3]||(e[3]=[i("保存")])),_:1},8,["onClick"])]),_:1},8,["designer-config"]),r(g,{title:o.formTitle,modelValue:o.formOpen,"onUpdate:modelValue":e[2]||(e[2]=n=>o.formOpen=n),width:"500px","append-to-body":""},{footer:t(()=>[r(f,{type:"primary",onClick:s.submitForm},{default:t(()=>e[4]||(e[4]=[i("确 定")])),_:1},8,["onClick"]),r(f,{onClick:s.cancel},{default:t(()=>e[5]||(e[5]=[i("取 消")])),_:1},8,["onClick"])]),default:t(()=>[r(c,{ref:"form",model:o.form,rules:o.rules,"label-width":"80px"},{default:t(()=>[r(d,{label:"表单名称",prop:"formName"},{default:t(()=>[r(u,{modelValue:o.form.formName,"onUpdate:modelValue":e[0]||(e[0]=n=>o.form.formName=n),placeholder:"请输入表单名称"},null,8,["modelValue"])]),_:1}),r(d,{label:"备注",prop:"remark"},{default:t(()=>[r(u,{modelValue:o.form.remark,"onUpdate:modelValue":e[1]||(e[1]=n=>o.form.remark=n),placeholder:"请输入备注"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}const w=F(N,[["render",x],["__scopeId","data-v-3c0955fb"]]);export{w as default};
|