(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-009a8128","chunk-009a8128"],{bece:function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e._self._c;return t("a-modal",{style:e.fullScreenProps.style,attrs:{width:e.fullScreenProps.modalWidth,visible:e.visible,destroyOnClose:!0,maskClosable:!1,bodyStyle:e.fullScreenProps.bodyStyle,footer:null,closable:!e.forceFullScreen},on:{cancel:function(t){return e.close()}}},[t("template",{slot:"title"},[e.forceFullScreen?e._e():t("div",{staticStyle:{width:"100%",height:"20px","padding-right":"32px"}},[t("div",{staticStyle:{float:"left"}},[e._v(e._s(e.title))]),e.forceFullScreen?e._e():t("div",{staticStyle:{float:"right"}},[t("a-button",{staticStyle:{width:"56px",height:"100%",border:"0"},attrs:{icon:e.buttonIcon},on:{click:e.toggleFullScreen}})],1)])]),t("desform-view",{attrs:{mode:e.mode,desformCode:e.desformCode,dataId:e.dataId,height:e.fullScreenProps.height},on:{success:e.handleSuccess,dialogChange:e.handleDialogChange}})],2)},i=[],a=o("ec26"),s=o("ca00"),r={name:"AutoDesformDataModal",components:{DesformView:a["default"]},props:["dialogOptions"],data:function(){return{mode:"add",title:"操作",visible:!1,fullScreen:!1,buttonIcon:"fullscreen",modalWidth:"800px",desformCode:null,dataId:null,forceFullScreen:!1}},computed:{fullScreenProps:function(){var e={height:null,modalWidth:this.modalWidth,style:{top:"40px"},bodyStyle:{padding:"0"}},t=this.dialogOptions;return null!=t&&(this.fullScreen||(e.modalWidth=t.width+"px"),e.style.top=t.top+"px"),this.forceFullScreen?(e.height="100vh",e.style.top="0px",e.style.padding="0",e.bodyStyle.lineHeight="0",e.modalWidth="100%",Object(s["e"])(".ant-modal-wrap { overflow: initial !important; }","auto-desform-data-model")):Object(s["e"])("","auto-desform-data-model"),e}},methods:{open:function(e,t,o,n){this.mode=e,this.title=n,this.dataId=o,this.desformCode=t,this.visible=!0},close:function(){this.visible=!1,this.model=null,this.forceFullScreen=!1,this.$emit("close")},toggleFullScreen:function(){this.fullScreen?(this.modalWidth="800px",this.buttonIcon="fullscreen"):(this.modalWidth="100%",this.buttonIcon="fullscreen-exit"),this.fullScreen=!this.fullScreen},handleSuccess:function(){this.close()},handleDialogChange:function(e){this.forceFullScreen=e}}},l=r,d=o("2877"),c=Object(d["a"])(l,n,i,!1,null,"d18632cc",null);t["default"]=c.exports},ec26:function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e._self._c;return t("a-spin",{attrs:{spinning:e.pageLoading||e.loading}},[e.show?t("iframe",e._b({attrs:{height:e.height}},"iframe",e.iframeProps,!1)):e._e()])},i=[],a=o("2b0e"),s=o("0fea"),r=o("ca00"),l=o("9fb0");o("a18c");var d={form:"1",menu:"2",href:"3"},c="routeDataId";function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}var h={name:"DesformView",props:{mode:{type:String,required:!0},desformCode:{type:String,default:""},dataId:{type:String,default:null},alert:{type:Boolean,default:!0},height:{type:String,default:null},innerDialog:{type:Boolean,default:!1},isOnline:{type:Boolean,default:!1}},data:function(){return{show:!0,pageLoading:!0,loading:!1,messageId:Object(r["t"])("16"),iframeHeight:300,innerDesformCode:this.desformCode,otherParams:"",url:{add:"/desform/data/add",edit:"/desform/data/edit",online:"/online/cgform/api/crazyForm"}}},computed:{iframeProps:function(){var e=window._CONFIG["domianURL"],t=null==this.dataId?"add":this.dataId,o="";return o=this.isOnline?"".concat(e,"/desform/").concat(this.mode,"/online/").concat(this.innerDesformCode):"".concat(e,"/desform/").concat(this.mode,"/").concat(this.innerDesformCode),"edit"!==this.mode&&"detail"!==this.mode||(o+="/".concat(t)),o+="?messageId=".concat(this.messageId,"&token=").concat(a["default"].ls.get(l["a"])),o+="&innerDialog=".concat(this.innerDialog),this.innerDialog&&(o+="&skip=false"),o+="&innerRequest=false",o+="&disableScroll=true",o+=this.otherParams,{src:o,style:{width:"100%",height:this.height||this.iframeHeight+"px",overflow:"hidden",transition:this.height?null:"height 0.3s"},frameborder:"0"}}},watch:{desformCode:function(){this.innerDesformCode=this.desformCode}},created:function(){var e=this,t=this;window.addEventListener("message",(function(e){var o=e.data,n=o.messageId,i=o.type,a=o.data;if("".concat(t.messageId)===n)switch(i){case"close":t.handleClose();break;case"success":t.$emit("success",{target:t});break;case"reload":t.handleReload();break;case"route-jump":t.handleRouteJump(a);break;case"save":t.saveAllData(a);break;case"height-change":t.iframeHeight=a+10,t.pageLoading=!1;break;case"dialog-change":t.$emit("dialogChange",a);break;case"show-message":t.$message[a.type](a.message);break}}),!1),setTimeout((function(){e.pageLoading&&(e.pageLoading=!1)}),6e3)},methods:{reload:function(){var e=this;this.show=!1,this.$nextTick((function(){e.show=!0}))},saveAllData:function(e){var t=this,o=this,n=o.url.add,i="POST",a={desformCode:o.desformCode,desformDataJson:JSON.stringify(e.json)};null!=o.dataId&&(n=o.url.edit,i="PUT",a["id"]=o.dataId),o.loading=!0,function(){if(e.onlineForm){a["onlineFormCode"]=e.onlineForm,null!=o.dataId&&(e.json.id=e.onlineDataId);var t="".concat(o.url.online,"/").concat(e.onlineForm),n=Object(r["c"])(e.json);for(var l in n)if(n.hasOwnProperty(l)){var d=n[l];"object"===u(d)&&(n[l]=JSON.stringify(d))}return Object(s["q"])(t,n,i)}return Promise.resolve(null)}().then((function(e){if(null==e);else{if(!e.success)return!0===o.alert&&o.$error({title:"保存失败",content:e.message}),Promise.reject();null==o.dataId&&(a["onlineFormDataId"]=e.result)}return Object(s["q"])(n,a,i)})).then((function(t){if(t.success){var o=e.formConfig.customRequestURL;if(o instanceof Array&&o[0]&&o[0].url)return a.dataId=t.result,Object(s["q"])(o[0].url,a,i)}return t})).then((function(e){e.success?(t.$emit("success",{res:e,dataId:e.result,target:o}),!0===o.alert&&o.$message.success("保存成功")):(o.$emit("error",{res:e,target:o}),!0===o.alert&&o.$error({title:"保存失败",content:e.message}))})).finally((function(){o.loading=!1}))},handleClose:function(e){this.$emit("close",{target:this})},handleReload:function(e){this.$emit("reload",{target:this})},handleRouteJump:function(e){var t=this;this.handleReload();var o=e.nextRouteConfig,n=o.routeType,i=o.routePath,a=e.dataId,s="?".concat(c,"=").concat(a);n===d.form?(this.innerDesformCode=i,this.otherParams="&"+s.substring(1)):n===d.menu?this.routeJumpNextTick((function(){t.$router.push(i+s)})):n===d.href&&this.routeJumpNextTick((function(){window.open(i+s,"_blank")}))},routeJumpNextTick:function(e){return this.handleClose(),this.$nextTick(e)}}},f=h,m=o("2877"),g=Object(m["a"])(f,n,i,!1,null,"1873ddc9",null);t["default"]=g.exports}}]);