

<script>
/* eslint-disable */
// sd-skip-auto-import
import{message}from"ant-design-vue";import crossWindowWatcher from"@/common/services/cross-window-watcher";import sdLoading from"@/common/pages/sd-loading.vue";import PageService from"@/common/services/page-service";import FormService from"./form-service";import components from"./_import-components/sd-designer-template-page-import";var _render=function e(){var t=this,a=t._self._c;return a("div",{class:t.$style.wrapper},[t.designerData?a("sd-designer",{ref:"designer",attrs:{value:t.designerData,"show-table-name":false},scopedSlots:t._u([{key:"toolbar",fn:function(){return[a("sd-full-page-editor-util",{ref:"editorUtil"}),0!==t.designerData.head.attrFD.type?a("span",[a("sd-preview-mobile-btn"),a("sd-preview-btn")],1):a("sd-preview-non-flow-btn"),a("a-button",{attrs:{icon:"save",type:"link",loading:t.saving},on:{click:t.save}},[t._v("保存")])]},proxy:true}],null,false,3789139298)}):a("sd-loading")],1)};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdDesignerTemplatePage",components:{...components,sdLoading:sdLoading},metaInfo(){return{title:this.designerData?.head.tableTxt}},props:{id:{type:String,default:void 0}},data(){return{designerData:void 0,saving:false,templateInfo:{}}},created(){if(this.id)this.loadForm().then((e=>{this.designerData=e.data}))},methods:{loadForm(){return FormService.getFormTemplateData({id:this.id}).then((e=>{this.templateInfo={id:e.id,templateCategory:e.templetCategory,templetType:e.templetType};return{data:{fields:e.fields,head:{attrFD:e.attrFd,tableTxt:e.templetName}}}})).catch((e=>Promise.reject(e)))},save(){this.saving=true;this.getPageParamInfo("online/templet/onlFormTemplet").then((e=>{const t=this.$refs.designer.getSaveData();const a=[{name:"id",value:this.templateInfo.id},{name:"templetName",value:t.head.tableTxt},{name:"templetCategory",value:this.templateInfo.templateCategory},{name:"templetType",value:this.templateInfo.templetType},{name:"attrFd",value:JSON.stringify(t.head.attrFD)},{name:"fieldsJson",value:JSON.stringify(t.fields)}];const r={eventId:"save",inputs:a,pageFlowId:e.pageflowId,pagePath:e.pagePath};PageService.save(r).then((e=>{if(200===e.status){crossWindowWatcher.notifyChange(true);message.success("保存成功");this.$refs.editorUtil.updateDataSaved()}else message.error(e.data?.message||"保存模板失败")})).catch((()=>message.error("保存失败"))).finally((()=>{this.saving=false}))})).catch((()=>{message.error("获取模板表单参数失败");this.saving=false}))},getPageParamInfo(e){return PageService.get({},e).then((e=>{if(200===e.status)return{pageflowId:e.data.attrs.pageflowId,pagePath:e.data.attrs.pagePath}}))}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
.wrapper {
  height: 100%;
}
</style>
