1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
| <script setup lang="ts">
| import { computed, toRefs, PropType, CSSProperties } from 'vue'
| import Chart from '@/views/chart/components/views/index.vue'
| import { isISOMobile } from '@/utils/utils'
|
| const props = defineProps({
| // 公共参数集
| commonParams: {
| type: Object,
| required: false
| },
| active: {
| type: Boolean,
| default: false
| },
| propValue: {
| type: Object,
| required: true
| },
| element: {
| type: Object,
| default() {
| return {
| propValue: null
| }
| }
| },
| view: {
| type: Object as PropType<ChartObj>,
| default() {
| return {
| propValue: null
| }
| }
| },
| showPosition: {
| type: String,
| required: false,
| default: 'canvas'
| },
| // 仪表板刷新计时器
| searchCount: {
| type: Number,
| required: false,
| default: 0
| },
| scale: {
| type: Number,
| required: false,
| default: 1
| },
| dvType: {
| type: String,
| required: false,
| default: 'dashboard'
| },
| disabled: {
| type: Boolean,
| required: false,
| default: false
| },
| suffixId: {
| type: String,
| required: false,
| default: 'common'
| },
| fontFamily: {
| type: String,
| required: false,
| default: 'inherit'
| },
| optType: {
| type: String,
| required: false
| }
| })
|
| const { element, view, active, searchCount, scale } = toRefs(props)
| const autoStyle = computed(() => {
| if (element.value.innerType === 'rich-text') {
| if (isISOMobile()) {
| return {
| position: 'absolute',
| height: 100 / scale.value + '%!important',
| width: 100 / scale.value + '%!important',
| left: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2
| top: 50 * (1 - 1 / scale.value) + '%', // 放大余量 除以 2
| transform: 'scale(' + scale.value + ') translateZ(0)'
| } as CSSProperties
| } else {
| return { zoom: scale.value }
| }
| } else {
| return {}
| }
| })
| const emits = defineEmits(['onPointClick', 'onComponentEvent'])
|
| const onPointClick = param => {
| emits('onPointClick', param)
| }
| </script>
|
| <template>
| <div class="bash-shape" :style="autoStyle">
| <chart
| :scale="scale"
| :active="active"
| :view="view"
| :element="element"
| :show-position="showPosition"
| :search-count="searchCount"
| :disabled="disabled"
| :suffixId="suffixId"
| :font-family="fontFamily"
| :common-params="commonParams"
| @onPointClick="onPointClick"
| @onComponentEvent="() => emits('onComponentEvent')"
| :opt-type="optType"
| ></chart>
| </div>
| </template>
|
| <style lang="less" scoped>
| .bash-shape {
| width: 100%;
| height: 100%;
| transform: translate(0);
| }
| </style>
|
|