zydx-plus 1.33.371 → 1.33.372
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/mind/src/mind.vue +35 -21
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -114,8 +114,10 @@
|
|
|
114
114
|
import Select from '../../select/src/select.vue'
|
|
115
115
|
import Coloring from '../../coloring/src/coloring.vue'
|
|
116
116
|
import MindMap from "simple-mind-map";
|
|
117
|
+
import TouchEvent from 'simple-mind-map/src/plugins/TouchEvent.js'
|
|
117
118
|
import AssociativeLine from 'simple-mind-map/src/plugins/AssociativeLine.js'
|
|
118
119
|
MindMap.usePlugin(AssociativeLine)
|
|
120
|
+
MindMap.usePlugin(TouchEvent)
|
|
119
121
|
|
|
120
122
|
export default {
|
|
121
123
|
components: {Select, Coloring},
|
|
@@ -197,7 +199,8 @@ export default {
|
|
|
197
199
|
},
|
|
198
200
|
"children": []
|
|
199
201
|
},
|
|
200
|
-
fullShow: true
|
|
202
|
+
fullShow: true,
|
|
203
|
+
layoutList: ''
|
|
201
204
|
}
|
|
202
205
|
},
|
|
203
206
|
props: {
|
|
@@ -228,11 +231,12 @@ export default {
|
|
|
228
231
|
immediate: true
|
|
229
232
|
},
|
|
230
233
|
data: {
|
|
231
|
-
handler: function (val
|
|
234
|
+
handler: function (val) {
|
|
232
235
|
if(Object.keys(val).length === 0) {
|
|
233
236
|
this.mindMap?.setData(this.defaultData)
|
|
234
237
|
}else {
|
|
235
|
-
this.mindMap?.setData(val)
|
|
238
|
+
this.mindMap?.setData(this.msgFun(val))
|
|
239
|
+
this.mindMap?.setLayout(val.layoutList || 'logicalStructure')
|
|
236
240
|
}
|
|
237
241
|
},
|
|
238
242
|
immediate: true
|
|
@@ -281,8 +285,8 @@ export default {
|
|
|
281
285
|
mounted() {
|
|
282
286
|
this.id = this.randomId()
|
|
283
287
|
setTimeout(() => {
|
|
284
|
-
|
|
285
|
-
},
|
|
288
|
+
this.init()
|
|
289
|
+
},0)
|
|
286
290
|
window.onresize = () => {
|
|
287
291
|
if (!document.fullscreenElement) {
|
|
288
292
|
this.fullShow = true
|
|
@@ -296,13 +300,13 @@ export default {
|
|
|
296
300
|
return id.replace(/[0-9]/g, '')
|
|
297
301
|
},
|
|
298
302
|
fullScreen(element) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
if (element.requestFullScreen) {
|
|
304
|
+
element.requestFullScreen()
|
|
305
|
+
} else if (element.webkitRequestFullScreen) {
|
|
306
|
+
element.webkitRequestFullScreen()
|
|
307
|
+
} else if (element.mozRequestFullScreen) {
|
|
308
|
+
element.mozRequestFullScreen()
|
|
309
|
+
}
|
|
306
310
|
},
|
|
307
311
|
cancelFullscreen() {
|
|
308
312
|
if (document.exitFullscreen) {
|
|
@@ -324,6 +328,13 @@ export default {
|
|
|
324
328
|
this.fullShow = false
|
|
325
329
|
this.fullScreen(this.$refs[this.id])
|
|
326
330
|
},
|
|
331
|
+
msgFun(e) {
|
|
332
|
+
if(e.msg) {
|
|
333
|
+
return Object.keys(e.msg).length === 0 ? this.defaultData : e.msg
|
|
334
|
+
}else {
|
|
335
|
+
return Object.keys(e).length === 0 ? this.defaultData : e
|
|
336
|
+
}
|
|
337
|
+
},
|
|
327
338
|
// 初始化
|
|
328
339
|
init() {
|
|
329
340
|
const that = this
|
|
@@ -331,13 +342,13 @@ export default {
|
|
|
331
342
|
el: document.getElementById(that.id),
|
|
332
343
|
enableFreeDrag: false, // 是否开启自由拖拽
|
|
333
344
|
enableNodeTransitionMove: false, // 是否开启节点过渡动画
|
|
334
|
-
layout: 'logicalStructure', // 节点布局方式
|
|
345
|
+
layout: that.data.layoutList || 'logicalStructure', // 节点布局方式
|
|
335
346
|
maxHistoryCount: 100, // 最大历史记录数
|
|
336
347
|
maxNodeCacheCount: 100, // 最大节点缓存数
|
|
337
|
-
data:
|
|
348
|
+
data: that.msgFun(that.data)
|
|
338
349
|
});
|
|
339
350
|
this.mindMap.setMode(this.readOnly ? 'readonly' : 'edit')
|
|
340
|
-
this.mindMap.on('node_active', (node
|
|
351
|
+
this.mindMap.on('node_active', (node) => {
|
|
341
352
|
this.mindShow = node === null;
|
|
342
353
|
})
|
|
343
354
|
this.mindMap.on('back_forward', (index, len) => {
|
|
@@ -393,22 +404,25 @@ export default {
|
|
|
393
404
|
this.top = parent
|
|
394
405
|
},
|
|
395
406
|
structure() {
|
|
396
|
-
|
|
407
|
+
this.layoutList = 'logicalStructure'
|
|
397
408
|
const layout = this.mindMap.getLayout()
|
|
398
409
|
if (layout === 'mindMap') {
|
|
399
|
-
|
|
410
|
+
this.layoutList = 'organizationStructure'
|
|
400
411
|
} else if (layout === 'organizationStructure') {
|
|
401
|
-
|
|
412
|
+
this.layoutList = 'logicalStructure'
|
|
402
413
|
} else {
|
|
403
|
-
|
|
414
|
+
this.layoutList = 'mindMap'
|
|
404
415
|
}
|
|
405
|
-
this.mindMap.setLayout(layoutList)
|
|
416
|
+
this.mindMap.setLayout(this.layoutList)
|
|
406
417
|
},
|
|
407
418
|
// 保存
|
|
408
419
|
preservation() {
|
|
409
420
|
let that = this
|
|
410
421
|
that.$emit('preservation', {
|
|
411
|
-
data:
|
|
422
|
+
data: {
|
|
423
|
+
msg: that.mindMap.getData(),
|
|
424
|
+
layoutList: this.layoutList
|
|
425
|
+
},
|
|
412
426
|
url: ''
|
|
413
427
|
})
|
|
414
428
|
// that.mindMap.doExport.png().then((data) => {
|