(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6ec5c8f6"],{"0311":function(t,e,a){"use strict";a("57c2")},"0fee":function(t,e,a){},"17ea":function(t,e,a){},"1c4c":function(t,e,a){"use strict";a.d(e,"i",(function(){return r})),a.d(e,"b",(function(){return o})),a.d(e,"k",(function(){return s})),a.d(e,"d",(function(){return c})),a.d(e,"g",(function(){return i})),a.d(e,"h",(function(){return l})),a.d(e,"a",(function(){return u})),a.d(e,"j",(function(){return d})),a.d(e,"f",(function(){return m})),a.d(e,"c",(function(){return f})),a.d(e,"e",(function(){return p}));var n=a("b775");function r(t){return Object(n["a"])({url:"source/data/categories/",method:"post",data:t})}function o(t){return Object(n["a"])({url:"source/data/categories/create/",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/source/data/category/update",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/source/data/category/delete",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/source/data/category/info",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/source/data/search",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/source/data/create",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/source/data/update",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/source/data/info",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/source/data/delete",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/source/data/find",method:"post",data:t})}},"203e":function(t,e,a){"use strict";a("0fee")},"24d2":function(t,e,a){"use strict";a.d(e,"k",(function(){return r})),a.d(e,"b",(function(){return o})),a.d(e,"n",(function(){return s})),a.d(e,"f",(function(){return c})),a.d(e,"d",(function(){return i})),a.d(e,"l",(function(){return l})),a.d(e,"c",(function(){return u})),a.d(e,"o",(function(){return d})),a.d(e,"g",(function(){return m})),a.d(e,"e",(function(){return f})),a.d(e,"j",(function(){return p})),a.d(e,"m",(function(){return b})),a.d(e,"h",(function(){return h})),a.d(e,"i",(function(){return g})),a.d(e,"a",(function(){return v}));var n=a("b775");function r(t){return Object(n["a"])({url:"/project/category/search",method:"post",data:t})}function o(t){return Object(n["a"])({url:"/project/category/create",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/project/category/update",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/project/category/info",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/project/category/delete",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/project/search",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/project/create",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/project/update",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/project/info",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/project/delete",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/project/relate",method:"post",data:t})}function b(t){return Object(n["a"])({url:"/template/searchTemplateList",method:"post",data:t})}function h(t){return Object(n["a"])({url:"/project/getphases",method:"post",data:t})}function g(t){return Object(n["a"])({url:"/project/getstatus",method:"post",data:t})}function v(t){return Object(n["a"])({url:"/project/calculate",method:"post",data:t})}},"35d5":function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"editor"},[a("draggable",{style:t.draggableStyle,attrs:{group:"itxst",animation:"300",handle:".drag-handle",scroll:!0,scrollSensitivity:100,scrollSpeed:20},on:{add:t.onAdd,update:t.onDragEnd,end:t.onDragComplete},model:{value:t.comList,callback:function(e){t.comList=e},expression:"comList"}},[a("transition-group",{staticStyle:{display:"block","min-height":"100vh"}},[t._l(t.comList,(function(e,n){return[a("div",{key:n,staticClass:"layers",class:t.comIndex==n?"active-layer":""},[a("div",{staticClass:"drag-handle",attrs:{draggable:""}},[a("svg-icon",{attrs:{"icon-class":"drag"}})],1),a("div",{staticStyle:{padding:"10px 0"}},[a("el-form",{staticClass:"inline-form",attrs:{"label-position":"left"}},[a("el-row",{staticStyle:{"margin-left":"0","margin-right":"0"},attrs:{gutter:24}},[a("el-col",{attrs:{xs:24,sm:24,md:12,lg:4,xl:4}},[a("el-form-item",{attrs:{label:"模块分类:"}},[a("span",{staticStyle:{cursor:"pointer"},on:{click:function(a){return t.enableSelect(e)}}},[t._v(t._s(t.getCategory(e.category_id)))])])],1),a("el-col",{attrs:{xs:24,sm:24,md:12,lg:12,xl:12}},[a("el-form-item",{attrs:{label:"模块名称:"}},[a("div",{staticStyle:{cursor:"pointer","max-width":"400px","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},attrs:{title:e.name},on:{click:function(a){return t.enableName(e)}}},[t._v(" "+t._s(e.name)+" ")])])],1),a("el-col",{attrs:{xs:24,sm:24,md:12,lg:8,xl:8}},[1==t.$store.state.user.roleInfo.id?a("el-form-item",[a("div",{staticClass:"btn-save"},["document"!==t.type?a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"保存模块",placement:"top"}},[a("el-button",{attrs:{size:"mini",icon:"el-icon-document-add",circle:""},on:{click:function(a){return t.onSaveTemplate(e)}}})],1):t._e(),1!==e.isEdit&&"document"!==t.type?a("el-button",{attrs:{circle:"",size:"mini"},on:{click:function(e){return t.onEdit(n,1)}}},[a("svg-icon",{attrs:{"icon-class":"edit"}})],1):a("el-button",{attrs:{circle:"",size:"mini",icon:"el-icon-view"},on:{click:function(e){return t.onEdit(n,2)}}}),t.templateId||"document"===t.type?t._e():a("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"删除",placement:"top"}},[a("el-button",{attrs:{circle:"",size:"mini"},on:{click:function(e){return t.onRemove(n)}}},[a("svg-icon",{attrs:{"icon-class":"delete"}})],1)],1)],1)]):t._e()],1)],1)],1)],1),a("div",{staticClass:"main",on:{click:function(e){return t.onSetActive(n)}}},[a(e.type,{tag:"component",attrs:{com:e,coms:t.comList,currentIndex:n,isAdmin:t.isAdmin,insertCmd:t.insertCmd,isEdit:e.isEdit},on:{onUpdate:t.onUpdate,onUpdateAttr:t.onUpdateAttr,onUpdata:t.onUpdata,onUpdateProdAttr:t.onUpdateProdAttr,updateComContent:t.handleComContentUpdate}})],1)])]})),t.comList.length<=0?[a("div",{key:-1,staticClass:"editor-empty"},[a("el-empty",{attrs:{description:"请拖放组件至当前页面"}})],1)]:t._e()],2)],1)],1)},r=[],o=a("c7eb"),s=a("1da1"),c=a("b85c"),i=a("2909"),l=a("53ca"),u=a("5530"),d=(a("4de4"),a("caad"),a("a15b"),a("d81d"),a("fb6a"),a("b0c0"),a("e9c4"),a("4ec9"),a("a9e3"),a("b64b"),a("d3b7"),a("ac1f"),a("2532"),a("3ca3"),a("466d"),a("498a"),a("159b"),a("ddb0"),a("b76a")),m=a.n(d),f=function(){var t=this,e=t.$createElement,a=t._self._c||e;return null!=t.com?a("div",{staticClass:"template-table"},[a("div",{staticClass:"table"},[a("hot-table",{ref:"hotTable",staticStyle:{width:"100%"},attrs:{settings:t.settings,licenseKey:"non-commercial-and-evaluation"}})],1)]):t._e()},p=[],b=a("ade3"),h=(a("5319"),a("e437"),a("c24d")),g=a("8c7e"),v=a("cc6f");a("8033"),a("c1cf"),v["a"].buildEmpty({licenseKey:"internal-use-in-handsontable",precisionRounding:10,nullDate:{year:1900,month:1,day:1}});var y,j={name:"table",components:{HotTable:h["a"]},emits:["onUploadAttr","onUploadItemIndex"],props:{isActive:{type:Boolean,default:!1},currentIndex:{type:Number,default:0},com:{type:Object,default:null},insertCmd:{type:Object,default:null}},watch:{com:{handler:function(t){if(null!=t&&void 0!=t){var e=this;console.log("watch com",t),e.initSetting()}},immediate:!0,deep:!0},isActive:{handler:function(t){void 0==t&&null!=t||(this.settings.readOnly=!t,this.settings.colHeaders=t,this.settings.rowHeaders=t)},immediate:!0,deep:!0},insertCmd:{handler:function(t){null!=t&&this.isActive&&console.log("insertCmd table val",t)},immediate:!0,deep:!0}},data:function(){return{cellStyle:[],settings:{language:"zh-CN",startRows:5,startCols:3},currentFocus:{row:0,col:0}}},created:function(){},methods:{onExport:function(t){var e=this.$refs.hotTable.hotInstance.getPlugin("exportFile"),a=e.exportAsString("csv",{filename:"MyFile"});console.log("str",a)},initSetting:function(){var t,e=this,a=this;a.settings=(t={language:"zh-CN",startRows:1,startCols:6,height:"auto",stretchH:"all",customBorders:!0,licenseKey:"non-commercial-and-evaluation",comments:!0,mergeCells:!0,allowRemoveColumn:!0,allowRemoveRow:!0,copyPaste:{columnsLimit:25,rowsLimit:50,pasteMode:"shift_down",uiContainer:document.body},cell:a.cellStyle,contextMenu:{callback:function(t,e,n){if(console.log("callback",t,e,n),void 0==a.cellStyle&&(a.cellStyle=[]),"importExcel"!=t)if("clearColor"!=t){if(t.length>=8){if("bgColor"==t.substr(0,7)){var r=t.replace("bgColor:",""),o="whiteBg";switch(r){case"red":o="redBg";break;case"gray":o="grayBg";break}for(u=e[0].start.col;u<=e[0].end.col;u++)for(d=e[0].start.row;d<=e[0].end.row;d++){var s=a.cellStyle.filter((function(t){return t.col==u&&t.row==d}));s.length>0?s[0].className.indexOf(o)<0&&(s[0].className+=" "+o):a.cellStyle.push({col:u,row:d,className:o})}return}if("fontColor"==t.substr(0,9)){var c=t.replace("fontColor:",""),i="blackFont";switch(c){case"white":i="whiteFont";break;case"black":i="blackFont";break}void 0==a.cellStyle&&(a.cellStyle=[]);for(u=e[0].start.col;u<=e[0].end.col;u++)for(d=e[0].start.row;d<=e[0].end.row;d++){var l=a.cellStyle.filter((function(t){return t.col==u&&t.row==d}));l.length>0?l[0].className.indexOf(i)<0&&(l[0].className+=" "+i):a.cellStyle.push({col:u,row:d,className:i})}return}}}else{for(var u=e[0].start.col;u<=e[0].end.col;u++)for(var d=e[0].start.row;d<=e[0].end.row;d++)a.cellStyle=a.cellStyle.filter((function(t){return t.col!=u&&t.row!=d}));a.initSetting()}},items:{row_above:{name:"上方插入行",disabled:function(){return 0===this.getSelectedLast()[0]}},row_below:{name:"下方插入行"},col_left:{name:"左侧插入列"},col_right:{name:"右侧插入列"},remove_row:{name:"删除行"},remove_col:{name:"删除列"},sp1:"---------",mergeCells:{name:"合并单元格"},alignment:{name:"对齐"},borders:{name:"边框"},sp2:"---------",importExcel:{name:"导入Excel",key:"importExcel"},sp3:"---------",clearColor:{name:"清除样式",key:"clearColor"},bgColor:{name:"背景颜色",submenu:{items:[{key:"bgColor:red",name:"红色"},{key:"bgColor:gray",name:"灰色"}]}},fontColor:{name:"文字颜色",submenu:{items:[{key:"fontColor:white",name:"白色"},{key:"fontColor:black",name:"黑色"}]}}}},colHeaders:!0,rowHeaders:!0,width:"100%"},Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(t,"height","auto"),"colWidths","auto"),"allowHtml",!0),"filters",!0),"manualRowResize",!0),"manualColumnResize",!0),"manualRowMove",!0),"manualColumnMove",!0),"formulas",{engine:v["a"]}),"tableClassName","tb-class"),Object(b["a"])(t,"afterOnCellMouseDown",(function(t,a,n){e.currentFocus=a}))),Object(g["a"])()}}},x=j,O=(a("924b"),a("2877")),k=Object(O["a"])(x,f,p,!1,null,null,null),w=k.exports,C=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"template-textarea"},[1==t.isEdit?[a("div",{staticClass:"editor-area sticky-editor"},[a("ckeditor",{ref:"editor",attrs:{config:t.editorConfig,editorUrl:t.editorUrl},on:{focus:t.onFocus,blur:t.onBlur,input:t.onInputText,ready:t.onEditorReady},model:{value:t.com.content,callback:function(e){t.$set(t.com,"content",e)},expression:"com.content"}})],1)]:[a("div",{ref:"richEditor",staticClass:"rich-editor",domProps:{innerHTML:t._s(t.content)},on:{click:t.handleImageClick}})],t.loading?a("div",{staticClass:"overlay"},[a("el-progress",{staticClass:"full-width-progress",attrs:{percentage:t.progress}})],1):t._e()],2)},_=[],F=a("4478"),$=(a("99af"),a("b680"),a("07ac"),a("4d63"),a("2c3e"),a("25f0"),a("1c4c")),L=a("bc3a"),I=a.n(L),S=(a("1157"),{name:"app",emits:["onUpdate","onUpdateAttr","onUpdateProdAttr"],compnents:{},props:{coms:{type:Array,default:function(){return[]}},isEdit:{type:Number,default:2},isAdmin:{type:Number,default:2},currentIndex:{type:Number,default:0},com:{type:Object,default:null},insertCmd:{type:Object,default:null}},watch:{isEdit:{handler:function(t){var e=this;null==e.com&&e.replaceData(e.com.content).then((function(t){e.content=t,e.$nextTick((function(){e.bindEvents()}))}))},immediate:!0,deep:!0},com:{handler:function(t){var e=this;return Object(s["a"])(Object(o["a"])().mark((function a(){var n,r;return Object(o["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(n=e,null!=t){a.next=3;break}return a.abrupt("return");case 3:if(void 0!=t.content&&null!=t.content){a.next=5;break}return a.abrupt("return");case 5:return a.prev=5,a.next=8,n.replaceData(t.content);case 8:r=a.sent,n.content=r,n.$nextTick((function(){n.bindEvents(),n.initializeInputWidths()})),a.next=16;break;case 13:a.prev=13,a.t0=a["catch"](5),console.error("处理 com 时出错:",a.t0);case 16:case"end":return a.stop()}}),a,null,[[5,13]])})))()},immediate:!0,deep:!0},insertCmd:{handler:function(t){if(null!=t&&1==this.isEdit){var e=this.$refs.editor.instance.getSelection().getSelectedText();t.content.indexOf("Directory",0)>=0&&(this.$emit("onUpdateAttr",this.currentIndex,this.com.attrs.length-1,e),this.$refs.editor.instance.execCommand("delete")),this.$refs.editor.instance.insertHtml(t.content)}},immediate:!0,deep:!0}},data:function(){return{editorUrl:"/ckeditor/ckeditor.js",editorConfig:{language:"zh-cn",height:"650px"},content:"",editor:null,loading:!1,progress:0,isEditing:!1,focusedInputId:null,variableNullInputs:{}}},mounted:function(){var t=this;this.$nextTick((function(){t.initializeInputWidths()}))},beforeDestroy:function(){this.$el.removeEventListener("input",this.handleInputChange),this.$el.removeEventListener("input",this.handleVariableNullInput),this.$el.removeEventListener("blur",this.handleVariableNullBlur,!0)},methods:(y={replaceData:function(t){var e=this;return Object(s["a"])(Object(o["a"])().mark((function a(){var n,r,s,l,u;return Object(o["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:n=e,r={abs:Math.abs,ceil:Math.ceil,floor:Math.floor,max:Math.max,min:Math.min,round:Math.round,sqrt:Math.sqrt,IF:function(t,e,a){return t?e:a}},s=Object(o["a"])().mark((function a(){var s,d,m,f,p,b,h,g,v,y,j,x,O,k,w,C,_,$,L,I,S,E,N,A,z;return Object(o["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(s=n.com.attrs[u].id,"variable"!=n.com.attrs[u].type){a.next=6;break}if(d=n.com.attrs[u],2==d.data.value_type){for(m=d.data.value_item.split(","),f='",t=t.replace("{{"+d.id+"}}",f)}else t=t.replace("{{"+s+"}}",'');a.next=43;break;case 6:if("variableNull"!=n.com.attrs[u].type){a.next=12;break}p=n.com.attrs[u],e.variableNullInputs[s]=p.content,t=t.replace("{{"+s+"}}",''),a.next=43;break;case 12:if("ProductAttr"!=n.com.attrs[u].type){a.next=19;break}if(b=n.com.attrs[u],h=b.id+"_"+u,""==b.content&&(b.content=b.attrs.value),1==b.attrs.type)t=t.replace("{{"+b.id+"}}",'');else{for(g=b.attrs.valueItems.split(","),v='",t=t.replace("{{"+b.id+"}}",v)}a.next=43;break;case 19:if("formual"!=n.com.attrs[u].type){a.next=35;break}return a.next=22,n.analysisFormual(n.com.attrs[u]);case 22:return y=a.sent,j=n.com.attrs[u].data.point,a.next=26,n.getRemote(y);case 26:if(y=a.sent,x={},O=/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g,k=y.match(O),k){w=Object(c["a"])(k);try{for(w.s();!(C=w.n()).done;)_=C.value,"IF"===_||Object.keys(r).includes(_)||(x[_]="".concat(_))}catch(o){w.e(o)}finally{w.f()}}$=function(t,e){var a=Object(F["a"])(Function,Object(i["a"])(Object.keys(r)).concat(Object(i["a"])(Object.keys(e)),["return ".concat(t)]));return a.apply(void 0,Object(i["a"])(Object.values(r)).concat(Object(i["a"])(Object.values(e))))};try{L=$(y,x),I="number"!==typeof L||isNaN(L)?"boolean"===typeof L?L?"1":"0":String(L):L.toFixed(j),n.com.attrs[u].content=I,t=t.replace("{{"+n.com.attrs[u].id+"}}",I)}catch(D){console.error("处理公式时出错:",D),console.error("错误的公式:",y),n.com.attrs[u].content="计算错误",t=t.replace("{{"+n.com.attrs[u].id+"}}","计算错误")}a.next=43;break;case 35:if("sourceData"!=n.com.attrs[u].type){a.next=42;break}return a.next=38,n.getRemote1(n.com.attrs[u].formula);case 38:S=a.sent,t=t.replace("{{"+s+"}}",S),a.next=43;break;case 42:"Directory"==n.com.attrs[u].type?(E=n.com.attrs[u].number+". "+n.com.attrs[u].content,N=n.com.attrs[u].level||1,A=n.com.attrs[u].id,z=new RegExp("]*>\\s*{{\\s*".concat(A,"\\s*}}\\s*|{{\\s*").concat(A,"\\s*}}"),"g"),t=t.replace(z,(function(t,e,a){var n="h".concat(Math.min(N,6)),r="directory-level-".concat(N);return"<".concat(n,' class="').concat(r,'">').concat(E,"")}))):t=t.replace("{{"+s+"}}",n.com.attrs[u].content);case 43:case"end":return a.stop()}}),a)})),u=0;case 4:if(!(u3&&void 0!==arguments[3]&&arguments[3];this.com&&this.com.attrs&&this.com.attrs[t]&&this.com.attrs[t].id===e&&(this.$set(this.com.attrs[t],"content",a),this.$nextTick((function(){var t=n.$el.querySelector("#".concat(e));t&&(t.value=a)})),r&&this.$emit("onUpdata",this.currentIndex,t,e,a))},addInputListeners:function(){this.$el.addEventListener("blur",this.handleInputChange,!0),this.$el.addEventListener("input",this.adjustInputWidth,!0)},initializeInputWidths:function(){var t=this,e=this.$el.querySelectorAll(".text-input-box, .text-input-boxs");e.forEach((function(e){return t.adjustInputWidth({target:e})}))},adjustInputWidth:function(t){if(t.target.classList.contains("text-input-box")||t.target.classList.contains("text-input-boxs")){var e=t.target,a=document.createElement("span");a.className="size-calculator",a.textContent=e.value||e.placeholder||"0",document.body.appendChild(a);var n=window.getComputedStyle(e);a.style.font=n.font,a.style.fontSize=n.fontSize,a.style.fontWeight=n.fontWeight,a.style.letterSpacing=n.letterSpacing;var r=a.offsetWidth;e.style.width="".concat(r+10,"px"),document.body.removeChild(a)}},handleInputChange:function(t){var e=this;if(t.target.classList.contains("text-input-box")||t.target.classList.contains("text-input-boxs")){t.target.id;var a=t.target.name,n=parseInt(t.target.dataset.index,10),r=t.target.value;this.com&&this.com.attrs&&this.com.attrs[n]?(this.$set(this.com.attrs[n],"content",r),this.com.attrs.forEach((function(t){t.name===a&&e.$set(t,"content",r)})),this.$emit("onUpdateAttr",this.currentIndex,n,r)):console.warn("Unable to find attribute at index ".concat(n))}},bindEvents:function(){for(var t=this,e=0;e1?e-1:0),o=1;o1?e-1:0),o=1;o0)){n.next=6;break}if(c=s[0].attrs.filter((function(t){return t.name==e})),!(c.length>0)){n.next=6;break}return n.abrupt("return",c[0].content);case 6:return n.abrupt("return","");case 7:case"end":return n.stop()}}),n)})))()})),"handleChangeProduct",(function(t){var e=t.target.dataset.index;this.$emit("onUpdateProdAttr",this.currentIndex,e,t.target.value)})),"handleInputProduct",(function(t){var e=t.target.dataset.index;this.$emit("onUpdateProdAttr",this.currentIndex,e,t.target.value)})),Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(Object(b["a"])(y,"handleInput",(function(t){var e=t.target.dataset.index;this.$emit("onUpdateAttr",this.currentIndex,e,t.target.value)})),"onEditorReady",(function(t){})),"onInputText",(function(t){this.$emit("onUpdate",this.currentIndex,t)})),"handleImageClick",(function(t){"IMG"===t.target.tagName&&this.replaceImage(t.target)})),"selectImage",(function(){return new Promise((function(t){var e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=function(e){return t(e.target.files[0])},e.click()}))})),"uploadImage",(function(t){return Object(s["a"])(Object(o["a"])().mark((function e(){var a;return Object(o["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.a.post("http://58.246.234.210:8084/upload/image",t,{headers:{"Content-Type":"multipart/form-data"}});case 3:if(a=e.sent,console.log("Upload response:",a),200!==a.status||!a.data||!a.data.url){e.next=9;break}return e.abrupt("return",a.data.url);case 9:throw new Error("Invalid upload response");case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e["catch"](0),console.error("Error uploading image:",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,null,[[0,12]])})))()})),"replaceImage",(function(t){var e=this;return Object(s["a"])(Object(o["a"])().mark((function a(){var n,r,s;return Object(o["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,e.selectImage();case 3:if(n=a.sent,!n){a.next=12;break}return r=new FormData,r.append("upload",n),a.next=9,e.uploadImage(r);case 9:s=a.sent,t.src=s,e.$nextTick((function(){e.updateContentWithNewImage(t,s)}));case 12:a.next=17;break;case 14:a.prev=14,a.t0=a["catch"](0),console.error("Error replacing image:",a.t0);case 17:case"end":return a.stop()}}),a,null,[[0,14]])})))()})),"updateContentWithNewImage",(function(t,e){var a=this.$refs.richEditor,n=document.createElement("img");n.src=e;var r,o=Object(c["a"])(t.attributes);try{for(o.s();!(r=o.n()).done;){var s=r.value;"src"!==s.name&&n.setAttribute(s.name,s.value)}}catch(i){o.e(i)}finally{o.f()}t.parentNode.replaceChild(n,t),this.content=a.innerHTML,this.com.content=this.content,this.$emit("updateComContent",this.currentIndex,this.com)})))}),E=S,N=(a("754e"),Object(O["a"])(E,C,_,!1,null,"100acbfb",null)),A=N.exports,z=a("37de"),D=a("c621"),R={name:"editor",emits:["onSetActiveIndex","onDelete","onInsert","onLoadArticle","onRebuild","onSetComs"],components:{Table:w,TextArea:A,draggable:m.a,Empty:z["default"]},props:{coms:{type:Array,default:null},comIndex:{type:Number,default:0},templateCate:{type:Array,default:function(){return[]}},insertCmd:{type:Object,default:null},isAdmin:{type:Number,default:2}},watch:{coms:{handler:function(t){null!=t&&(console.log("val",t),this.comList=JSON.parse(JSON.stringify(t)),console.log("comList",this.comList))},immediate:!0,deep:!0},comIndex:{handler:function(t){t<=0||(this.comList=this.comList.map((function(t){return t.isEdit=2,t.selDisabled=!0,t.valDisabled=!0,"string"===typeof t.category_id&&t.category_id.includes(" ")?t.category_id=t.category_id.split(" "):Array.isArray(t.category_id)||(t.category_id=[t.category_id].filter(Boolean)),t})))},immediate:!0,deep:!0}},data:function(){return{showEditor:!1,operation:"",id:0,comList:[],categoryList:[],props:{value:"id",label:"name",children:"children",checkStrictly:!0},saveAs:!1,draggableStyle:{width:"100%",overflowY:"auto"},type:""}},mounted:function(){var t=this;console.log(this.$store.state),this.initCategoryList(),this.type=this.$route.query.type,this.templateId=this.$route.query.templateId,this.$nextTick((function(){t.updateDirectoryNumbers()}))},methods:{onDragComplete:function(){var t=this;console.log("拖动结束"),this.$nextTick((function(){t.updateDirectoryNumbers(),t.$emit("onRebuild",t.comList)}))},updateDirectoryNumbers:function(){var t=this,e={};this.comList.forEach((function(a,n){a.attrs&&a.attrs.forEach((function(a){if("Directory"===a.type){var r=t.generateNumberedContent(n,a.level,e);a.hasOwnProperty("number")?a.number=r:t.$set(a,"number",r)}}))}))},generateNumberedContent:function(t,e,a){return this.generateLevelPrefix(t,e,a)},generateLevelPrefix:function(t,e,a){for(var n=[],r=1;r<=e;r++)1===r?n.push(t+1):(a[r]?a[r]++:a[r]=1,n.push(a[r]));return n.join(".")},carefulCopy:function(t){return t.map((function(t){var e=Object(u["a"])({},t);return Array.isArray(e.attrs)&&(e.attrs=e.attrs.map((function(t){return Object(u["a"])({},t)}))),"object"===Object(l["a"])(e.content)&&null!==e.content&&(e.content=JSON.parse(JSON.stringify(e.content))),"Table"===e.type&&(e.tableHeader=Object(i["a"])(e.tableHeader),e.tableData=e.tableData.map((function(t){return Object(u["a"])({},t)}))),e}))},handleComContentUpdate:function(t,e){this.$set(this.coms,t,e),this.$emit("onRebuild",this.coms)},showCategoryName:function(t){return"module"==this.type&&1==this.$store.state.user.roleInfo.id&&!t.valDisabled},enableName:function(t){t.valDisabled=!1,this.$forceUpdate()},showCategorySelect:function(t){return"module"===this.type&&1===this.$store.state.user.roleInfo.id&&!t.selDisabled},enableSelect:function(t){t.selDisabled=!0,console.log(t),this.$forceUpdate()},getCategory:function(t){var e=function t(e,a){var n,r=Object(c["a"])(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.id===a)return o.name;if(o.children){var s=t(o.children,a);if(s)return s}}}catch(i){r.e(i)}finally{r.f()}return null};return e(this.categoryList,t)||"请选择分类"},onSaveAs:function(t){this.saveAs=!0,this.onSaveTemplate(t)},onSaveTemplate:function(t){var e=this,a=this,n=JSON.parse(JSON.stringify(t));console.log(n),n.category&&delete n.category,n.attrs=JSON.stringify(n.attrs),n.code=n.name,n.status=5,Array.isArray(t.category_id)?n.category_id=t.category_id[t.category_id.length-1]:n.category_id=t.category_id,void 0==n.id||this.saveAs?Object(D["a"])(n).then((function(r){200==r.status&&(n.id=r.data,t.id=r.data,a.$alert("模板信息保存成功"),a.$emit("onRefresh"),e.saveAs=!1,n.selDisabled=!1,n.valDisabled=!1,e.$forceUpdate())})):Object(D["l"])(n).then((function(t){200==t.status&&(a.$alert("模板信息更新成功"),a.$emit("onRefresh"),n.selDisabled=!1,n.valDisabled=!1,e.$forceUpdate())}))},initCategoryList:function(){var t=this;return Object(s["a"])(Object(o["a"])().mark((function e(){var a;return Object(o["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t,e.next=3,Object(D["k"])();case 3:a=e.sent,console.log(a),t.categoryList=a.data;case 6:case"end":return e.stop()}}),e)})))()},processDataForCascader:function(t){console.log("Raw data:",t);var e=new Map,a=[];return t.forEach((function(t){var a=Object(u["a"])(Object(u["a"])({},t),{},{children:[]});e.set(t.id,a)})),t.forEach((function(t){if("0"===t.parent_id||0===t.parent_id)a.push(e.get(t.id));else{var n=e.get(parseInt(t.parent_id));n?n.children.push(e.get(t.id)):(console.warn("Parent with id ".concat(t.parent_id," not found for item:"),t),a.push(e.get(t.id)))}})),console.log("Processed data:",a),a},onChangeCategory:function(t,e){var a=e[e.length-1];t.category_id=a},onUpdateProdAttr:function(t,e,a){this.comList[t].attrs[e].content=a;for(var n=this.comList[t].attrs[e].attrs.name,r=this.comList[t].attrs[e].attrs.type,o=0;o0},btnDelete:function(t){var e=this,a={id:t};e.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(t){Object(v["c"])(a).then((function(t){e.search()}))})).catch((function(){}))},searchData:function(){var t=this;t.dialogVisible=!1,t.search()},btnEdit:function(t){var e=document.createElement("a");e.href="#/document/create?templateId="+t+"&type=module",e.target="_blank",e.click()},handleClose:function(){var t=this;t.currentDataId=0,t.dialogVisible=!1,t.search()},search:function(){var t=this;Object(v["h"])(t.queryForm).then((function(e){e&&(t.dataList=e.data.dataList,t.recordCount=e.data.totalRecord,t.pageTotal=e.data.totalPage)}))},ChangePage:function(t){var e=this;e.queryForm.page=t,e.search()}}}),L=$,I=(a("f2e1"),Object(p["a"])(L,k,w,!1,null,null,null)),S=I.exports,E={components:{dataSearch:O,dataList:S},data:function(){return{queryForm:{page:1,pageSize:10,name:"",parent_id:0,status:""}}},mounted:function(){this.queryForm.parent_id=void 0==this.$route.query.parent_id?0:this.$route.query.parent_id},methods:{setQuery:function(t){this.queryForm=t}}},N=E,A=(a("5930"),Object(p["a"])(N,n,r,!1,null,null,null));e["default"]=A.exports},c621:function(t,e,a){"use strict";a.d(e,"j",(function(){return r})),a.d(e,"b",(function(){return o})),a.d(e,"m",(function(){return s})),a.d(e,"f",(function(){return c})),a.d(e,"d",(function(){return i})),a.d(e,"h",(function(){return l})),a.d(e,"i",(function(){return u})),a.d(e,"g",(function(){return d})),a.d(e,"c",(function(){return m})),a.d(e,"a",(function(){return f})),a.d(e,"l",(function(){return p})),a.d(e,"e",(function(){return b})),a.d(e,"k",(function(){return h}));var n=a("b775");function r(t){return Object(n["a"])({url:"/template/category/search",method:"post",data:t})}function o(t){return Object(n["a"])({url:"/template/category/create",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/template/category/update",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/template/category/info",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/template/category/delete",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/template/pageTemplate",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/template/search",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/template/info",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/template/delete",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/template/create",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/template/update",method:"post",data:t})}function b(t){return Object(n["a"])({url:"/template/category/allList",method:"post",data:t})}function h(t){return Object(n["a"])({url:"/template/category/treeCategory",method:"post",data:t})}},c9e6:function(t,e){},d3fb:function(t,e,a){"use strict";a("a307")},f2e1:function(t,e,a){"use strict";a("17ea")},f3c2:function(t,e,a){"use strict";a.d(e,"a",(function(){return n})),a.d(e,"b",(function(){return r}));var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"com-empty"})},r=[]},f746:function(t,e,a){"use strict";var n=a("c9e6"),r=a.n(n);e["default"]=r.a}}]);