vue2-client 1.2.3 → 1.2.6

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.
Files changed (38) hide show
  1. package/docs/notice.md +22 -22
  2. package/package.json +1 -1
  3. package/src/base-client/components/iot/DataAnalysisView/DataAnalysisView.vue +244 -244
  4. package/src/base-client/plugins/AppData.js +1 -2
  5. package/src/router/async/router.map.js +57 -59
  6. package/src/services/api/manage.js +3 -1
  7. package/src/utils/routerUtil.js +366 -366
  8. package/src/pages/system/applyInstallView/Core.vue +0 -570
  9. package/src/pages/system/applyInstallView/LFComponents/AddPanel.vue +0 -52
  10. package/src/pages/system/applyInstallView/LFComponents/Control.vue +0 -78
  11. package/src/pages/system/applyInstallView/LFComponents/DataDialog.vue +0 -24
  12. package/src/pages/system/applyInstallView/LFComponents/NodePanel.vue +0 -103
  13. package/src/pages/system/applyInstallView/PropertySetting/Base.vue +0 -124
  14. package/src/pages/system/applyInstallView/PropertySetting/CommonProperty.vue +0 -104
  15. package/src/pages/system/applyInstallView/PropertySetting/PropertyDialog.vue +0 -43
  16. package/src/pages/system/applyInstallView/background/base.png +0 -0
  17. package/src/pages/system/applyInstallView/background/click.png +0 -0
  18. package/src/pages/system/applyInstallView/background/download.png +0 -0
  19. package/src/pages/system/applyInstallView/background/end.png +0 -0
  20. package/src/pages/system/applyInstallView/background/push.png +0 -0
  21. package/src/pages/system/applyInstallView/background/start.png +0 -0
  22. package/src/pages/system/applyInstallView/background/step.png +0 -0
  23. package/src/pages/system/applyInstallView/background/time.png +0 -0
  24. package/src/pages/system/applyInstallView/config.js +0 -22
  25. package/src/pages/system/applyInstallView/data.json +0 -1284
  26. package/src/pages/system/applyInstallView/index.vue +0 -34
  27. package/src/pages/system/applyInstallView/registerNode/Connect.vue +0 -43
  28. package/src/pages/system/applyInstallView/registerNode/index.js +0 -16
  29. package/src/pages/system/applyInstallView/registerNode/registerBackEdge.js +0 -44
  30. package/src/pages/system/applyInstallView/registerNode/registerBase.js +0 -139
  31. package/src/pages/system/applyInstallView/registerNode/registerConnect.js +0 -60
  32. package/src/pages/system/applyInstallView/registerNode/registerDownload.js +0 -92
  33. package/src/pages/system/applyInstallView/registerNode/registerEnd.js +0 -110
  34. package/src/pages/system/applyInstallView/registerNode/registerPolyline.js +0 -14
  35. package/src/pages/system/applyInstallView/registerNode/registerPush.js +0 -127
  36. package/src/pages/system/applyInstallView/registerNode/registerStart.js +0 -105
  37. package/src/pages/system/applyInstallView/registerNode/registerStep.js +0 -209
  38. package/src/pages/system/applyInstallView/registerNode/registerTask.js +0 -29
@@ -1,570 +0,0 @@
1
- <template>
2
- <div class="logic-flow-view">
3
- <!-- 辅助工具栏 -->
4
- <Control
5
- class="demo-control"
6
- v-if="lf"
7
- :lf="lf"
8
- @catData="$_catData"
9
- @catRealData="$_catRealData"
10
- ></Control>
11
- <a-card
12
- class="demo-card"
13
- title="属性预览"
14
- size="small"
15
- v-if="Object.keys(selectNodeProperties).length > 0"
16
- >
17
- <a-descriptions :column="1" :title="'节点:' + selectNodeProperties.text" >
18
- <a-descriptions-item v-if="key !== 'formData'" v-for="key of Object.keys(selectNodeProperties)" :key="key" :label="key">
19
- {{ selectNodeProperties[key] }}
20
- </a-descriptions-item>
21
- </a-descriptions>
22
-
23
- </a-card>
24
- <!-- 节点面板 -->
25
- <NodePanel v-if="lf" :lf="lf" :nodeList="nodeList"></NodePanel>
26
- <!-- 画布 -->
27
- <div id="LF-view"></div>
28
- <!-- 步骤节点自定义操作面板 -->
29
- <AddPanel
30
- v-if="showAddPanel"
31
- class="add-panel"
32
- :style="addPanelStyle"
33
- :lf="lf"
34
- :nodeData="addClickNode"
35
- :node-list="addNodeList"
36
- @addNodeFinish="hideAddPanel"
37
- >
38
- </AddPanel>
39
- <!-- 属性面板 -->
40
- <a-drawer
41
- title="设置节点属性"
42
- :visible="dialogVisible"
43
- width="40%"
44
- @close="closeDialog">
45
- <PropertyDialog
46
- v-if="dialogVisible"
47
- :nodeData="clickNode"
48
- :lf="lf"
49
- @setPropertiesFinish="closeDialog"
50
- ></PropertyDialog>
51
- </a-drawer>
52
- <!-- 表单构建面板 -->
53
- <create-simple-form-query
54
- :visible.sync="createSimpleFormVisible"
55
- :to-edit-json="createFormNodeJson"
56
- @saveSimpleFormQueryParams="saveSimpleFormQueryParams"
57
- />
58
- <!-- 数据查看面板 -->
59
- <a-modal
60
- title="原始数据"
61
- v-model="dataVisible"
62
- width="50%">
63
- <DataDialog :graphData="graphData"></DataDialog>
64
- </a-modal>
65
- <!-- 实际数据查看面板 -->
66
- <a-modal
67
- title="实际数据"
68
- v-model="realDataVisible"
69
- width="50%"
70
- @ok="saveData"
71
- >
72
- <a-tabs default-active-key="99999">
73
- <a-tab-pane key="99999" tab="报装流程配置">
74
- <pre>{{ graphRealData }}</pre>
75
- </a-tab-pane>
76
- <a-tab-pane v-for="item of hasFormNodeList" :key="item.id" :tab="'表单:' + item.properties.formData.describe">
77
- <json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="item.properties.formData" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
78
- </a-tab-pane>
79
- </a-tabs>
80
- </a-modal>
81
- </div>
82
- </template>
83
- <script>
84
- import LogicFlow from '@logicflow/core'
85
- // const LogicFlow = window.LogicFlow
86
- import { Menu, SelectionSelect, Snapshot } from '@logicflow/extension'
87
- import '@logicflow/core/dist/style/index.css'
88
- import '@logicflow/extension/lib/style/index.css'
89
- import NodePanel from './LFComponents/NodePanel'
90
- import AddPanel from './LFComponents/AddPanel'
91
- import Control from './LFComponents/Control'
92
- import PropertyDialog from './PropertySetting/PropertyDialog'
93
- import DataDialog from './LFComponents/DataDialog'
94
- import { nodeList } from './config'
95
- import { showXml } from '@vue2-client/utils/util'
96
- import FileSaver from 'file-saver'
97
- import JsonViewer from 'vue-json-viewer'
98
-
99
- import {
100
- registerBackEdge,
101
- registerConnect,
102
- registerDownload,
103
- registerEnd,
104
- registerPolyline,
105
- registerPush,
106
- registerStart,
107
- registerStep,
108
- registerTask,
109
- registerBase
110
- } from './registerNode'
111
-
112
- const demoData = require('./data.json')
113
-
114
- export default {
115
- name: 'LF',
116
- components: { NodePanel, AddPanel, Control, PropertyDialog, DataDialog, JsonViewer },
117
- computed: {
118
- hasFormNodeList () {
119
- return this.allNodeList.filter(item => item.type === 'step' && item.properties.formData)
120
- }
121
- },
122
- data () {
123
- return {
124
- lf: null,
125
- showAddPanel: false,
126
- addPanelStyle: {
127
- top: 0,
128
- left: 0
129
- },
130
- nodeData: null,
131
- addClickNode: null,
132
- clickNode: null,
133
- dialogVisible: false,
134
- graphData: null,
135
- graphRealData: null,
136
- dataVisible: false,
137
- realDataVisible: false,
138
- config: {
139
- background: {
140
- backgroundColor: '#f7f9ff'
141
- },
142
- grid: {
143
- size: 10,
144
- visible: false
145
- },
146
- keyboard: {
147
- enabled: true
148
- },
149
- style: {
150
- rect: {
151
- radius: 6
152
- },
153
- edgeText: { // 边文本样式
154
- background: {
155
- fill: '#fff'
156
- }
157
- }
158
- },
159
- edgeTextDraggable: true,
160
- hoverOutline: false,
161
- guards: {
162
- beforeClone (data) {
163
- console.log('beforeClone', data)
164
- return true
165
- },
166
- beforeDelete (data) {
167
- // 可以根据data数据判断是否允许删除,允许返回true,不允许返回false
168
- // 文档: http://logic-flow.org/guide/basic/keyboard.html#%E5%A6%82%E4%BD%95%E9%98%BB%E6%AD%A2%E5%88%A0%E9%99%A4%E6%88%96%E8%80%85%E6%8B%B7%E8%B4%9D%E8%A1%8C%E4%B8%BA
169
- console.log('beforeDelete', data)
170
- // _this.$message('不允许删除', 'error')
171
- return true
172
- }
173
- }
174
- },
175
- moveData: {},
176
- nodeList,
177
- addNodeList: [],
178
- baseNodeName: '',
179
- createSimpleFormVisible: false,
180
- createFormNodeJson: {},
181
- nodeFormJsonArray: [],
182
- allNodeList: [],
183
- selectNodeProperties: {}
184
- }
185
- },
186
- mounted () {
187
- this.$_initLf()
188
- },
189
- methods: {
190
- $_initLf () {
191
- // 画布配置
192
-
193
- // 使用插件
194
- LogicFlow.use(Menu)
195
- LogicFlow.use(Snapshot)
196
- LogicFlow.use(SelectionSelect)
197
- const lf = new LogicFlow({
198
- ...this.config,
199
- container: document.querySelector('#LF-view'),
200
- stopMoveGraph: true
201
- })
202
- this.lf = lf
203
- // 1.1.0新增用法
204
- lf.extension.selectionSelect.openSelectionSelect()
205
- lf.zoom(false)
206
- lf.zoom(false)
207
- lf.zoom(false)
208
- lf.zoom(false)
209
- lf.zoom(false)
210
- // 菜单配置文档:http://logic-flow.org/guide/extension/extension-components.html#%E8%8F%9C%E5%8D%95
211
- // 重置,增加,节点自由配置(以base节点为示例)
212
- // lf.setMenuConfig({
213
- // nodeMenu: [],
214
- // edgeMenu: []
215
- // })
216
- // lf.addMenuConfig({
217
- // nodeMenu: [
218
- // {
219
- // text: '分享',
220
- // callback () {
221
- // alert('分享成功!')
222
- // }
223
- // },
224
- // {
225
- // text: '属性',
226
- // callback (node) {
227
- // alert(`
228
- // 节点id:${node.id}
229
- // 节点类型:${node.type}
230
- // 节点坐标:(x: ${node.x}, y: ${node.y})`
231
- // )
232
- // }
233
- // }
234
- // ],
235
- // edgeMenu: [
236
- // {
237
- // text: '属性',
238
- // callback (edge) {
239
- // alert(`
240
- // 边id:${edge.id}
241
- // 边类型:${edge.type}
242
- // 边坐标:(x: ${edge.x}, y: ${edge.y})
243
- // 源节点id:${edge.sourceNodeId}
244
- // 目标节点id:${edge.targetNodeId}`
245
- // )
246
- // }
247
- // }
248
- // ]
249
- // })
250
- // 设置主题
251
- lf.setTheme({
252
- circle: {
253
- stroke: '#000000',
254
- strokeWidth: 1,
255
- outlineColor: '#88f'
256
- },
257
- rect: {
258
- outlineColor: '#88f',
259
- strokeWidth: 1
260
- },
261
- polygon: {
262
- strokeWidth: 1
263
- },
264
- polyline: {
265
- stroke: '#000000',
266
- hoverStroke: '#000000',
267
- selectedStroke: '#000000',
268
- outlineColor: '#88f',
269
- strokeWidth: 1
270
- },
271
- nodeText: {
272
- fontSize: 16,
273
- color: '#000000'
274
- },
275
- baseEdge: {
276
- stroke: '#999',
277
- strokeWidth: 2
278
- },
279
- edgeText: {
280
- fontSize: 14,
281
- color: '#000000',
282
- background: {
283
- fill: '#f7f9ff'
284
- }
285
- }
286
- })
287
- this.$_registerNode()
288
- },
289
- // 自定义
290
- $_registerNode () {
291
- registerStart(this.lf)
292
- registerBase(this.lf, this.clickPlus, this.mouseDownPlus, this.showPropView)
293
- registerEnd(this.lf)
294
- registerStep(this.lf, this.clickPlus, this.mouseDownPlus, this.showPropView, this.showSimpleFormView)
295
- registerPush(this.lf, this.clickPlus, this.mouseDownPlus)
296
- registerDownload(this.lf)
297
- registerPolyline(this.lf)
298
- registerTask(this.lf)
299
- registerConnect(this.lf)
300
-
301
- registerBackEdge(this.lf)
302
- this.$_render()
303
- },
304
- $_render () {
305
- this.lf.render(demoData)
306
- this.$_LfEvent()
307
- },
308
- $_getData () {
309
- const data = this.lf.getGraphData()
310
- console.log(JSON.stringify(data))
311
- },
312
- showPropView (node) {
313
- this.$data.clickNode = node
314
- this.$data.dialogVisible = true
315
- },
316
- showSimpleFormView (node) {
317
- this.$data.clickNode = node
318
- if (node.properties.formData) {
319
- this.createFormNodeJson = node.properties.formData
320
- } else {
321
- this.createFormNodeJson = {
322
- group: this.baseNodeName ? this.baseNodeName : '',
323
- describe: node.text ? node.text.value : ''
324
- }
325
- }
326
- this.$data.createSimpleFormVisible = true
327
- },
328
- $_LfEvent () {
329
- this.lf.on('node:click', ({ data }) => {
330
- this.selectNodeProperties = data.properties
331
- })
332
- this.lf.on('node:dbclick', ({ data }) => {})
333
- this.lf.on('edge:dbclick', ({ data }) => {})
334
- this.lf.on('element:click', () => {
335
- this.hideAddPanel()
336
- })
337
- this.lf.on('edge:add', ({ data }) => {
338
- console.log('edge:add', data)
339
- })
340
- this.lf.on('node:mousemove', ({ data }) => {
341
- console.log('node:mousemove')
342
- this.moveData = data
343
- })
344
- this.lf.on('blank:click', () => {
345
- this.hideAddPanel()
346
- })
347
- this.lf.on('connection:not-allowed', (data) => {
348
- this.$message.error(data.msg)
349
- })
350
- this.lf.on('node:mousemove', () => {
351
- console.log('on mousemove')
352
- })
353
- },
354
- clickPlus (e, attributes, addNodeList) {
355
- e.stopPropagation()
356
- const { clientX, clientY } = e
357
- console.log(clientX, clientY)
358
- this.$data.addPanelStyle.top = (clientY - 180) + 'px'
359
- this.$data.addPanelStyle.left = (clientX - 260) + 'px'
360
- this.$data.addNodeList = addNodeList
361
- this.$data.showAddPanel = true
362
- this.$data.addClickNode = attributes
363
- },
364
- mouseDownPlus (e, attributes) {
365
- e.stopPropagation()
366
- console.log('mouseDownPlus', e, attributes)
367
- },
368
- hideAddPanel () {
369
- this.$data.showAddPanel = false
370
- this.$data.addPanelStyle.top = 0
371
- this.$data.addPanelStyle.left = 0
372
- // this.$data.addClickNode = null
373
- console.warn(this.$data)
374
- },
375
- closeDialog () {
376
- this.$data.dialogVisible = false
377
- },
378
- $_catData () {
379
- this.$data.graphData = this.$data.lf.getGraphData()
380
- this.$data.dataVisible = true
381
- },
382
- $_catRealData () {
383
- const data = this.$data.lf.getGraphData()
384
- const nodeMap = {}
385
- this.allNodeList = []
386
- let baseNode = null
387
- for (const node of data.nodes) {
388
- if (node.type === 'step' && !node.properties.id) {
389
- if (node.text) {
390
- this.$message.error('节点[' + node.text.value + ']没有设置ID')
391
- } else {
392
- this.$message.error('节点需要设置名称')
393
- }
394
- return
395
- }
396
- const item = {
397
- id: node.properties.id,
398
- type: node.type,
399
- properties: node.properties,
400
- name: node.text ? node.text.value : ''
401
- }
402
- if (item.type === 'base') {
403
- baseNode = item
404
- continue
405
- }
406
- nodeMap[node.id] = item
407
- if (node.properties.id) {
408
- this.allNodeList[node.properties.id] = item
409
- }
410
- }
411
- if (!baseNode) {
412
- this.$message.error('请设置流程根节点[基础]')
413
- return
414
- }
415
- this.allNodeList.shift()
416
- const submitList = []
417
- const backList = []
418
- const skipList = []
419
- for (const edge of data.edges) {
420
- const id = nodeMap[edge.sourceNodeId].properties.id
421
- const toId = nodeMap[edge.targetNodeId].properties.id
422
- let type
423
- if (id && toId) {
424
- if (toId - id === 1) {
425
- type = 'submit'
426
- } else if (id - toId === 1) {
427
- type = 'back'
428
- } else if (toId - id > 1) {
429
- type = 'skip'
430
- } else if (id - toId > 1) {
431
- this.$message.error('错误的流程连接[id:' + id + ', to_id:' + toId + '],每次只能退回一个步骤')
432
- return
433
- } else {
434
- this.$message.error('错误的流程连接[id:' + id + ', to_id:' + toId + ']')
435
- return
436
- }
437
- const item = {
438
- id: id,
439
- to: toId
440
- }
441
- if (type === 'submit') {
442
- submitList.push(item)
443
- } else if (type === 'back') {
444
- backList.push(item)
445
- } else {
446
- skipList.push(item)
447
- }
448
- }
449
- }
450
-
451
- this.baseNodeName = baseNode.properties.text
452
-
453
- let xml = '<?xml version="1.0" encoding="utf-8"?>'
454
- xml += '<WorkflowDiagram id="' + baseNode.properties.id + '" name="' + baseNode.properties.text + '">'
455
-
456
- for (const item of baseNode.properties.propArray) {
457
- xml += '<Var name="' + item.name + '" id="' + item.id + '" description="' + item.description + '" />'
458
- }
459
-
460
- xml += '<Actor id="' + baseNode.properties.personId + '" name="' + baseNode.properties.personName + '">'
461
-
462
- for (const node of this.allNodeList) {
463
- let personexpression
464
- if (node.properties.name.length === 1) {
465
- personexpression = 'R(' + node.properties.name[0] + ')'
466
- } else if (node.properties.name.length > 1) {
467
- personexpression = 'RS('
468
- for (const nameItem of node.properties.name) {
469
- personexpression += (nameItem + ',')
470
- }
471
- personexpression = personexpression.substring(0, personexpression.length - 1)
472
- personexpression += ')'
473
- } else {
474
- personexpression = ''
475
- }
476
- let timeoutExp
477
- if (node.properties.timeout) {
478
- timeoutExp = 'timeout="HH(' + node.properties.timeout + ')" '
479
- } else {
480
- timeoutExp = ''
481
- }
482
- const activity = '<Activity id="' + node.id + '" name="' + node.name + '" personexpression="' + personexpression + '" ' + timeoutExp + '/>'
483
- xml += activity
484
- }
485
- xml += '</Actor>'
486
- xml += '<!-- 报建流程 -->'
487
- for (const id in submitList) {
488
- const edge = submitList[id]
489
- const diversion = '<Diversion id="' + edge.id + '" head="' + edge.id + '" tail="' + edge.to + '" expression="subedp == $提交$" />'
490
- xml += diversion
491
- }
492
- for (const id in skipList) {
493
- const edge = skipList[id]
494
- const diversion = '<Diversion id="' + edge.id + '" head="' + edge.id + '" tail="' + edge.to + '" expression="subedp == $跳过$" />'
495
- xml += diversion
496
- }
497
- for (const id in backList) {
498
- const edge = backList[id]
499
- const diversion = '<Diversion id="' + edge.to + '" head="' + edge.id + '" tail="' + edge.to + '" expression="subedp == $退回$" />'
500
- xml += diversion
501
- }
502
-
503
- xml += '</WorkflowDiagram>'
504
- this.$data.graphRealData = showXml(xml)
505
- this.$data.realDataVisible = true
506
- },
507
- saveData () {
508
- // 存储流程
509
- const blob = new Blob([this.graphRealData], { type: 'application/xml' })
510
- FileSaver.saveAs(blob, this.baseNodeName + `.xml`)
511
- },
512
- // 存储基础表单配置信息
513
- saveSimpleFormQueryParams (source) {
514
- const properties = Object.assign(this.lf.getProperties(this.clickNode.id), {
515
- formData: source
516
- })
517
- this.lf.setProperties(this.clickNode.id, properties)
518
- this.$message.success('保存表单成功!')
519
- }
520
- }
521
- }
522
- </script>
523
- <style>
524
- .logic-flow-view {
525
- height: 100vh;
526
- position: relative;
527
- }
528
- .demo-title{
529
- text-align: center;
530
- margin: 20px;
531
- }
532
- .demo-control{
533
- position: absolute;
534
- top: 50px;
535
- right: 0;
536
- z-index: 2;
537
- }
538
- .demo-card{
539
- background-color: rgba(255,255,255,0.2);
540
- position: absolute;
541
- width: 250px;
542
- top: 85px;
543
- right: 10px;
544
- z-index: 2;
545
- }
546
- #LF-view{
547
- width: calc(100%);
548
- height: 100%;
549
- outline: none;
550
- }
551
- .time-plus{
552
- cursor: pointer;
553
- }
554
- .add-panel {
555
- position: absolute;
556
- z-index: 11;
557
- background-color: white;
558
- padding: 10px 5px;
559
- }
560
- .el-drawer__body {
561
- height: 80%;
562
- overflow: auto;
563
- margin-top: -30px;
564
- z-index: 3;
565
- }
566
- .lf-element-text {
567
- font-weight: bold;
568
- z-index: 99999;
569
- }
570
- </style>
@@ -1,52 +0,0 @@
1
- <template>
2
- <a-tabs tab-position="left">
3
- <a-tab-pane tab="操作">
4
- <div v-for="item in nodeList" :key="item.type">
5
- <a-button class="add-node-btn" type="primary" size="small" @click="$_addNode(item)">{{ item.label }}</a-button>
6
- </div>
7
- </a-tab-pane>
8
- </a-tabs>
9
- </template>
10
- <script>
11
- export default {
12
- name: 'AddPanel',
13
- props: {
14
- nodeData: {
15
- type: Object,
16
- default: null
17
- },
18
- lf: {
19
- type: Object || String,
20
- default: null
21
- },
22
- nodeList: {
23
- type: Array,
24
- default: null
25
- }
26
- },
27
- data () {
28
- return {
29
- }
30
- },
31
- methods: {
32
- $_addNode (item) {
33
- const { lf, nodeData } = this.$props
34
- const { id, x, y } = nodeData
35
- const nextNode = lf.addNode({
36
- type: item.type,
37
- x: x + 0,
38
- y: y + 120
39
- })
40
- const nextId = nextNode.id
41
- lf.addEdge({ sourceNodeId: id, targetNodeId: nextId })
42
- this.$emit('addNodeFinish')
43
- }
44
- }
45
- }
46
- </script>
47
- <style scoped>
48
- .add-node-btn{
49
- margin-bottom: 10px;
50
- margin-right: 20px;
51
- }
52
- </style>
@@ -1,78 +0,0 @@
1
- <template>
2
- <div>
3
- <a-button-group>
4
- <a-button type="plain" size="small" @click="$_zoomIn">放大</a-button>
5
- <a-button type="plain" size="small" @click="$_zoomOut">缩小</a-button>
6
- <a-button type="plain" size="small" @click="$_zoomReset">大小适应</a-button>
7
- <a-button type="plain" size="small" @click="$_translateRest">定位还原</a-button>
8
- <a-button type="plain" size="small" @click="$_reset">还原(大小&定位)</a-button>
9
- <a-button type="plain" size="small" @click="$_undo" :disabled="undoDisable">上一步(ctrl+z)</a-button>
10
- <a-button type="plain" size="small" @click="$_redo" :disabled="redoDisable">下一步(ctrl+y)</a-button>
11
- <a-button type="plain" size="small" @click="$_download">下载图片</a-button>
12
- <a-button type="plain" size="small" @click="$_catData">查看数据</a-button>
13
- <a-button type="plain" size="small" @click="$_catRealData">查看实际数据</a-button>
14
- <a-button v-if="catTurboData" type="plain" size="small" @click="$_catTurboData">查看turbo数据</a-button>
15
- </a-button-group>
16
- </div>
17
- </template>
18
- <script>
19
- export default {
20
- name: 'Control',
21
- props: {
22
- lf: Object || String,
23
- catTurboData: Boolean
24
- },
25
- data () {
26
- return {
27
- undoDisable: true,
28
- redoDisable: true,
29
- graphData: null,
30
- dataVisible: false
31
- }
32
- },
33
- mounted () {
34
- this.$props.lf.on('history:change', ({ data: { undoAble, redoAble } }) => {
35
- this.$data.undoDisable = !undoAble
36
- this.$data.redoDisable = !redoAble
37
- })
38
- },
39
- methods: {
40
- $_zoomIn () {
41
- this.$props.lf.zoom(true)
42
- },
43
- $_zoomOut () {
44
- this.$props.lf.zoom(false)
45
- },
46
- $_zoomReset () {
47
- this.$props.lf.resetZoom()
48
- },
49
- $_translateRest () {
50
- this.$props.lf.resetTranslate()
51
- },
52
- $_reset () {
53
- this.$props.lf.resetZoom()
54
- this.$props.lf.resetTranslate()
55
- },
56
- $_undo () {
57
- this.$props.lf.undo()
58
- },
59
- $_redo () {
60
- this.$props.lf.redo()
61
- },
62
- $_download () {
63
- this.$props.lf.getSnapshot()
64
- },
65
- $_catData () {
66
- this.$emit('catData')
67
- },
68
- $_catRealData () {
69
- this.$emit('catRealData')
70
- },
71
- $_catTurboData () {
72
- this.$emit('catTurboData')
73
- }
74
- }
75
- }
76
- </script>
77
- <style scoped>
78
- </style>