(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-43df3975"],{"025a":function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t._self._c;return e("div",[e("a-form-model",{ref:"form",attrs:{model:t.form,rules:t.rules,layout:"vertical"}},[e("a-spin",{staticStyle:{"background-color":"#fff",padding:"10px 16px","margin-bottom":"20px"},attrs:{spinning:t.spinning,delay:t.delayTime,tip:"Loading..."}},[e("a-row",{attrs:{gutter:32}},[e("a-col",{attrs:{span:12}},[e("a-form-model-item",{attrs:{label:"名称",prop:"name"}},[e("a-input",{attrs:{placeholder:"请输入名称",disabled:t.editDisabled},model:{value:t.form.fileName,callback:function(e){t.$set(t.form,"fileName",e)},expression:"form.fileName"}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-model-item",{attrs:{label:"扩展名",prop:"extension"}},[e("a-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择扩展名",disabled:t.editDisabled},model:{value:t.form.extension,callback:function(e){t.$set(t.form,"extension",e)},expression:"form.extension"}},t._l(t.extensionOptions,(function(n,i){return e("a-select-option",{key:i,attrs:{value:n.value}},[t._v(" "+t._s(n.value)+" ")])})),1)],1)],1),e("a-col",{attrs:{span:24}},[t.editorOpen?e("monaco-editor",{ref:"monacoRef",attrs:{monacoId:"monaco_editor_1",height:"40rem",language:t.sourceLanguage},on:{onchange:t.editorChange},model:{value:t.form.source,callback:function(e){t.$set(t.form,"source",e)},expression:"form.source"}}):t._e()],1)],1)],1),e("div",{staticClass:"bottom-control",staticStyle:{"z-index":"1"}},[e("a-space",[e("a-button",{attrs:{disabled:t.disabled},on:{click:t.cancel}},[t._v(" 取消 ")]),e("a-button",{attrs:{type:"primary",disabled:t.disabled},on:{click:t.submitForm}},[t._v(" 保存 ")])],1)],1)],1)],1)},o=[],a=(n("b0c0"),n("b64b"),n("63b1")),s=n("6954"),r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"m-e",attrs:{id:"m-e-id"}},[e("div",{staticClass:"m-e-main"},[e("div",{staticClass:"m-e-main_toolbar",class:t.isThemeLightOrBlack?"themeLight":"themeBlack"},[e("div",{staticClass:"m-e-main_toolbar_left"},[e("span",[t._v(t._s(t.title))])]),e("div",{staticClass:"m-e-main_toolbar_right",class:t.isThemeLightOrBlack?"themeLightToolbar":"themeBlackToolbar"},[e("a",{attrs:{title:"查找"},on:{click:t.findByKeyword}},[e("i",{staticClass:"fa fa-search"})]),e("a",{attrs:{title:"回到顶部"},on:{click:t.scrollToTop}},[e("i",{staticClass:"fa fa-chevron-circle-up"})]),e("a",{attrs:{title:"回到底部"},on:{click:t.scrollToBottom}},[e("i",{staticClass:"fa fa-chevron-circle-down"})]),e("a",{attrs:{title:"切换白天或暗夜模式"},on:{click:t.setEditorTheme}},[e("i",{staticClass:"fa fa-adjust"})]),e("select",{staticClass:"language-picker",class:t.isThemeLightOrBlack?"themeLightSelect":"themeBlackSelect",attrs:{title:"语言",id:"language-picker"},on:{change:t.languagePickerChange}},t._l(t.languageOptions,(function(n,i){return e("option",{key:i,domProps:{value:n.value}},[t._v(t._s(n.value))])})),0)])]),e("div",{staticClass:"m-e-main_container",style:{width:t.width,height:t.height},attrs:{id:t.monacoId}})])])},c=[],u=n("c7eb"),l=n("1da1"),d=(n("4de4"),n("d81d"),n("4e82"),n("4ec9"),n("a9e3"),n("d3b7"),n("3ca3"),n("ddb0"),n("1f54"),n("33f9")),m={name:"MonacoEditor",props:{monacoId:{type:String,default:"monacoEditor"},title:{type:String},value:{type:String,default:""},readOnly:{type:Boolean,default:!1},selectOnLineNumbers:{type:Boolean,default:!0},minimap:{type:Boolean,default:!0},language:{type:String,default:"html"},fontSize:{type:Number,default:12},theme:{type:String,default:"vs"},width:{type:String,default:"100%"},height:{type:String,default:"600px"}},data:function(){return{monacoEditor:null,isThemeLightOrBlack:!0,content:this.value,languageOptions:[]}},mounted:function(){this.getLanguageOptions(),this.initEditor()},beforeDestroy:function(){this.monacoEditor&&this.monacoEditor.dispose(),this.content=""},methods:{initEditor:function(){var t=this;return Object(l["a"])(Object(u["a"])().mark((function e(){var n;return Object(u["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t,e.next=3,document.getElementById(n.monacoId);case 3:n.monacoEditor=d.editor.create(document.getElementById(n.monacoId),{value:n.content,language:n.language,theme:n.theme,selectOnLineNumbers:n.selectOnLineNumbers,readOnly:n.readOnly,minimap:{enabled:n.minimap},fontSize:n.fontSize,scrollBeyondLastLine:!1,contextmenu:!1}),n.monacoEditor.onDidChangeModelContent((function(t){n.$emit("onchange",n.monacoEditor.getValue())})),n.scrollToTop();case 6:case"end":return e.stop()}}),e)})))()},setEditorContent:function(t){this.monacoEditor.setValue(t),this.scrollToTop()},getEditorContent:function(){return this.monacoEditor.getValue()},findByKeyword:function(){try{this.monacoEditor.focus(),this.monacoEditor.setSelection(new d.Range(1,9999,1,1e4)),this.monacoEditor.trigger("","actions.find")}catch(t){}},setEditorRW:function(){this.monacoEditor.updateOptions({readOnly:!1})},setEditorTheme:function(){this.isThemeLightOrBlack=!this.isThemeLightOrBlack,this.isThemeLightOrBlack?this.monacoEditor.updateOptions({theme:"vs"}):this.monacoEditor.updateOptions({theme:"vs-dark"})},setEditorLanguage:function(t){if(t){var e=this.monacoEditor.getModel(),n=this.monacoEditor.getValue(),i=d.editor.createModel(n,t);e&&e.dispose(),this.monacoEditor.setModel(i)}},scrollToTop:function(){this.monacoEditor.setScrollPosition({scrollTop:0})},scrollToBottom:function(){this.monacoEditor.revealLine(this.monacoEditor.getModel().getLineCount())},languagePickerChange:function(t){var e=t.target.value;this.setEditorLanguage(e)},getLanguageOptions:function(){var t=d.languages.getLanguages().map((function(t){return t.id}));t.sort();var e=[];t.map((function(t){e.push({value:t})}));var n=new Map;this.languageOptions=e.filter((function(t){return!n.has(t.value)&&n.set(t.value,1)}))}}},h=m,f=(n("c157"),n("2877")),p=Object(f["a"])(h,r,c,!1,null,"d4306b4a",null),g=p.exports,b={name:"CmsResourceForm",components:{MonacoEditor:g},data:function(){return{editorOpen:!1,spinning:!1,delayTime:100,loading:!1,disabled:!1,title:"新增",id:void 0,parentPath:void 0,resourceType:void 0,extensionOptions:[],editDisabled:!1,sourceLanguage:void 0,form:{},rules:{fileName:[{required:!0,message:"名称不能为空",trigger:"blur"}],extension:[{required:!0,message:"扩展名不能为空",trigger:"change"}]}}},created:function(){},activated:function(){var t=this.$route.params;if(t){this.id=t.resourcePath,this.resourceType=t.resourceType,this.parentPath=t.parentPath;var e="";this.extensionOptions=[],this.extensionOptions.push({value:"html"}),this.constants.TYPE_TEMPLATE===this.resourceType?e="模板":this.constants.TYPE_STATIC===this.resourceType&&(e="文件",this.extensionOptions.push({value:"css"},{value:"js"}));var n=t.operate||"add";"add"===n?(this.title="新增"+e,this.handleAdd()):"edit"===n&&(this.title="修改"+e,this.handleUpdate(this.id)),this.$route.meta.title=this.title}},computed:{},watch:{},mounted:function(){},methods:{handleAdd:function(){this.reset(),this.spinning=!1,this.editorOpen=!0},handleUpdate:function(t){var e,n=this;this.reset(),this.spinning=!this.spinning,this.constants.TYPE_TEMPLATE===this.resourceType?e=a["c"]:this.constants.TYPE_STATIC===this.resourceType&&(e=s["c"]),"function"===typeof e&&e({path:t}).then((function(t){var e=t.data;n.showFormData(e)}))},showFormData:function(t){var e=t.name;if(t&&e){var n=e.indexOf(t.extension);n>=1&&n<e.length&&(e=e.substring(0,n-1)),t.fileName=e}"js"===t.extension?this.sourceLanguage="javascript":this.sourceLanguage=t.extension,this.form=t,this.spinning=!this.spinning,this.editorOpen=!0,this.editDisabled=!0},submitForm:function(){var t=this;this.$refs.form.validate((function(e){if(e){var n,i;t.disabled=!0;var o=JSON.parse(JSON.stringify(t.form));o.name=o.fileName+"."+o.extension,t.constants.TYPE_TEMPLATE===t.resourceType?(n=a["a"],i=a["h"]):t.constants.TYPE_STATIC===t.resourceType&&(n=s["a"],i=s["h"]),void 0!==t.form.path?"function"===typeof i&&i(o).then((function(e){t.handleSuccess("更新成功")})):"function"===typeof n&&n(o).then((function(e){t.handleSuccess("新增成功")}))}}))},handleSuccess:function(t){this.$message.success(t,3),this.cancel("ok"),this.disabled=!1},cancel:function(t){this.reset(),this.editorOpen=!1;var e="";this.constants.TYPE_TEMPLATE===this.resourceType?e="CmsTemplate":this.constants.TYPE_STATIC===this.resourceType&&(e="CmsFile"),"ok"!==t&&(t="close"),this.$multiTab.closeCurrentPage(),this.$router.push({name:e,params:{operate:t}})},reset:function(){this.form={name:void 0,fileName:void 0,extension:void 0,path:this.path,parentPath:this.parentPath,source:""},this.disabled=!1,this.editDisabled=!1,this.sourceLanguage="html"},editorChange:function(t){this.form.source=t}}},v=b,T=Object(f["a"])(v,i,o,!1,null,null,null);e["default"]=T.exports},"1ff38":function(t,e,n){},"63b1":function(t,e,n){"use strict";n.d(e,"e",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"h",(function(){return r})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return u})),n.d(e,"f",(function(){return l})),n.d(e,"g",(function(){return d}));var i=n("b775");function o(t){return Object(i["b"])({url:"/cms/cmsTemplate/list",method:"get",params:t})}function a(t){return Object(i["b"])({url:"/cms/cmsTemplate/getOne",method:"get",params:t})}function s(t){return Object(i["b"])({url:"/cms/cmsTemplate",method:"post",data:t})}function r(t){return Object(i["b"])({url:"/cms/cmsTemplate/edit",method:"post",data:t})}function c(t){return Object(i["b"])({url:"/cms/cmsTemplate/remove",method:"post",params:t})}function u(t){return Object(i["b"])({url:"/cms/cmsTemplate/import",method:"post",data:t,headers:{"Content-Type":"multipart/form-data"}})}function l(t){return Object(i["b"])({url:"/cms/cmsTemplate/listTree",method:"get",params:t})}function d(t){return Object(i["b"])({url:"/cms/cmsTemplate/directory",method:"post",data:t})}},6954:function(t,e,n){"use strict";n.d(e,"e",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"h",(function(){return r})),n.d(e,"b",(function(){return c})),n.d(e,"d",(function(){return u})),n.d(e,"f",(function(){return l})),n.d(e,"g",(function(){return d}));var i=n("b775");function o(t){return Object(i["b"])({url:"/cms/cmsFile/list",method:"get",params:t})}function a(t){return Object(i["b"])({url:"/cms/cmsFile/getOne",method:"get",params:t})}function s(t){return Object(i["b"])({url:"/cms/cmsFile",method:"post",data:t})}function r(t){return Object(i["b"])({url:"/cms/cmsFile/edit",method:"post",data:t})}function c(t){return Object(i["b"])({url:"/cms/cmsFile/remove",method:"post",params:t})}function u(t){return Object(i["b"])({url:"/cms/cmsFile/import",method:"post",data:t,headers:{"Content-Type":"multipart/form-data"}})}function l(t){return Object(i["b"])({url:"/cms/cmsFile/listTree",method:"get",params:t})}function d(t){return Object(i["b"])({url:"/cms/cmsFile/directory",method:"post",data:t})}},c157:function(t,e,n){"use strict";n("1ff38")}}]);