Explorar el Código

修复流程图再次进入修改时不加载默认资源的情况

kuaifan hace 4 años
padre
commit
420033d472

+ 4 - 6
resources/assets/js/main/components/docs/flow/index.vue

@@ -98,7 +98,6 @@
             return {
                 loadIng: true,
 
-                flow: null,
                 url: window.location.origin + '/js/grapheditor/' + (this.readOnly ? 'viewer' : 'index') + '.html',
 
                 zoom: -1,
@@ -109,7 +108,6 @@
         },
         mounted() {
             window.addEventListener('message', this.handleMessage)
-            this.flow = this.$refs.myFlow.contentWindow;
         },
         beforeDestroy() {
             window.removeEventListener('message', this.handleMessage)
@@ -126,7 +124,7 @@
                 deep: true
             },
             zoom(val) {
-                this.flow.postMessage({
+                this.$refs.myFlow.contentWindow.postMessage({
                     act: 'zoom',
                     params: {
                         zoom: val / 100
@@ -141,7 +139,7 @@
 
             updateContent() {
                 this.zoom = Math.max(1, (typeof this.value.scale === "number" ? this.value.scale : 1) * 100)
-                this.flow.postMessage({
+                this.$refs.myFlow.contentWindow.postMessage({
                     act: 'setXml',
                     params: Object.assign(this.value, typeof this.value.xml === "undefined" ? {
                         xml: this.value.content
@@ -177,7 +175,7 @@
             },
 
             exportPNG(name, scale = 10) {
-                this.flow.postMessage({
+                this.$refs.myFlow.contentWindow.postMessage({
                     act: 'exportPNG',
                     params: {
                         name: name || this.$L('无标题'),
@@ -188,7 +186,7 @@
             },
 
             exportPDF(name, scale = 10) {
-                this.flow.postMessage({
+                this.$refs.myFlow.contentWindow.postMessage({
                     act: 'exportPNG',
                     params: {
                         name: name || this.$L('无标题'),

+ 3 - 0
resources/assets/statics/public/js/grapheditor/index.html

@@ -141,6 +141,9 @@
                     if (randTmp != randXml) {
                         return;
                     }
+                    if (!backupParams) {
+                        return;
+                    }
                     newPos = getPos();
                     newXml = mxUtils.getPrettyXml(editorUi.editor.getGraphXml());
                     if (backupParams.xml && backupParams.xml.replace(/^<mxGraphModel(.*?)>/, '') == newXml.replace(/^<mxGraphModel(.*?)>/, '')) {