vue2-client 1.9.193 → 1.9.195
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
CHANGED
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
</a-button>
|
|
126
126
|
</a-tooltip>
|
|
127
127
|
<a-tooltip title="重新查询" placement="bottom">
|
|
128
|
-
<a-button @click="refresh(true)"
|
|
128
|
+
<a-button @click="refresh(true)">
|
|
129
129
|
<a-icon :style="iconStyle" type="reload"/>
|
|
130
130
|
</a-button>
|
|
131
131
|
</a-tooltip>
|
|
@@ -310,9 +310,9 @@
|
|
|
310
310
|
<div class="custom-chart-title" v-if="item.config.title">{{ item.config.title }}</div>
|
|
311
311
|
<div class="custom-chart-desc" v-if="item.config.description">{{ item.config.description }}</div>
|
|
312
312
|
<g2Charts
|
|
313
|
-
v-if="summaryDrawerVisible"
|
|
314
313
|
:key="index"
|
|
315
|
-
:
|
|
314
|
+
:is-dev="env === 'dev'"
|
|
315
|
+
:config="item.config"
|
|
316
316
|
:requestParameters="requestParameters"/>
|
|
317
317
|
</a-col>
|
|
318
318
|
</a-row>
|
|
@@ -820,8 +820,15 @@ export default {
|
|
|
820
820
|
this.eventState = eventState
|
|
821
821
|
this.showRightTools = showRightTools
|
|
822
822
|
this.printTemplate = printTemplate
|
|
823
|
-
this.chartsConfigArray = chartsConfigArray
|
|
824
823
|
this.summaryDrawerWidth = summaryDrawerWidth
|
|
824
|
+
this.chartsConfigArray = chartsConfigArray
|
|
825
|
+
if (this.chartsConfigArray.length > 0) {
|
|
826
|
+
// 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
|
|
827
|
+
this.chartsConfigArray.forEach(item => {
|
|
828
|
+
item.config.queryParams = JSON.parse(JSON.stringify(this.queryParams))
|
|
829
|
+
item.config.queryParamsName = this.queryParamsName
|
|
830
|
+
})
|
|
831
|
+
}
|
|
825
832
|
if (this.localEditMode) {
|
|
826
833
|
this.localEditModeDataSource = []
|
|
827
834
|
if (this.formSubmitTypeInLocalEditMode === 'append') {
|
|
@@ -15,10 +15,6 @@ defineProps({
|
|
|
15
15
|
height: {
|
|
16
16
|
type: String,
|
|
17
17
|
default: '500px'
|
|
18
|
-
},
|
|
19
|
-
isDev: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false
|
|
22
18
|
}
|
|
23
19
|
})
|
|
24
20
|
|
|
@@ -173,7 +169,7 @@ defineExpose({ init, config, resetConfig })
|
|
|
173
169
|
:body-style="{maxHeight:height,height:height}">
|
|
174
170
|
<div class="custom-chart-title" v-if="config.title">{{ config.title }}</div>
|
|
175
171
|
<div class="custom-chart-desc" v-if="config.description">{{ config.description }}</div>
|
|
176
|
-
<g2Charts ref="g2ChartsRef"
|
|
172
|
+
<g2Charts ref="g2ChartsRef"></g2Charts>
|
|
177
173
|
</a-card>
|
|
178
174
|
</a-col>
|
|
179
175
|
<a-col :span="8">
|
|
@@ -14,11 +14,11 @@ let plot = null
|
|
|
14
14
|
const props = defineProps({
|
|
15
15
|
config: {
|
|
16
16
|
type: Object,
|
|
17
|
-
default: {}
|
|
17
|
+
default: () => {}
|
|
18
18
|
},
|
|
19
19
|
requestParameters: {
|
|
20
20
|
type: Object,
|
|
21
|
-
default: {}
|
|
21
|
+
default: () => {}
|
|
22
22
|
},
|
|
23
23
|
isDev: {
|
|
24
24
|
type: Boolean,
|
|
@@ -27,7 +27,6 @@ const props = defineProps({
|
|
|
27
27
|
})
|
|
28
28
|
// 添加验证函数
|
|
29
29
|
const validateConfig = (config, requestParameters) => {
|
|
30
|
-
console.log(requestParameters, '===')
|
|
31
30
|
const errors = []
|
|
32
31
|
// 基础验证
|
|
33
32
|
if (!config.type || !config.dataSource) {
|
|
@@ -105,7 +104,6 @@ const createPlot = (type, container, options) => {
|
|
|
105
104
|
|
|
106
105
|
// 修改错误边界处理
|
|
107
106
|
const handleError = (error) => {
|
|
108
|
-
console.error('Chart error:', error)
|
|
109
107
|
errorMsg.value = Array.isArray(error) ? error : ['图表渲染失败']
|
|
110
108
|
// 出错时销毁图表实例
|
|
111
109
|
if (plot) {
|
|
@@ -132,8 +130,19 @@ const init = (config = {}, requestParameters = {}) => {
|
|
|
132
130
|
return
|
|
133
131
|
}
|
|
134
132
|
|
|
133
|
+
// 处理请求参数,移除循环引用
|
|
134
|
+
const sanitizedConfig = JSON.parse(JSON.stringify({
|
|
135
|
+
...config,
|
|
136
|
+
chartsConfigArray: undefined // 移除可能导致循环引用的属性
|
|
137
|
+
}))
|
|
138
|
+
|
|
139
|
+
const sanitizedParams = JSON.parse(JSON.stringify({
|
|
140
|
+
...requestParameters,
|
|
141
|
+
chartsConfigArray: undefined
|
|
142
|
+
}))
|
|
143
|
+
|
|
135
144
|
// 验证通过后进行数据请求和图表渲染
|
|
136
|
-
queryChartsData({ config, requestParameters, preview: true }, config.serviceName, props.isDev)
|
|
145
|
+
queryChartsData({ config: sanitizedConfig, requestParameters: sanitizedParams, preview: true }, config.serviceName, props.isDev)
|
|
137
146
|
.then((res) => {
|
|
138
147
|
const xField =
|
|
139
148
|
config.dataSource === 'curCrud'
|
|
@@ -242,6 +251,28 @@ const init = (config = {}, requestParameters = {}) => {
|
|
|
242
251
|
colors10: config.colorIndex !== undefined ? colorItems[config.colorIndex].map(item => item.color) : undefined,
|
|
243
252
|
},
|
|
244
253
|
}
|
|
254
|
+
// 如果data 超过 50 增加缩略图
|
|
255
|
+
if (sortedData.length > 500) {
|
|
256
|
+
baseOptions.slider = {
|
|
257
|
+
start: 0,
|
|
258
|
+
end: 0.2,
|
|
259
|
+
}
|
|
260
|
+
} else if (sortedData.length > 200) {
|
|
261
|
+
baseOptions.slider = {
|
|
262
|
+
start: 0,
|
|
263
|
+
end: 0.4,
|
|
264
|
+
}
|
|
265
|
+
} else if (sortedData.length > 100) {
|
|
266
|
+
baseOptions.slider = {
|
|
267
|
+
start: 0,
|
|
268
|
+
end: 0.6,
|
|
269
|
+
}
|
|
270
|
+
} else if (sortedData.length > 50) {
|
|
271
|
+
baseOptions.slider = {
|
|
272
|
+
start: 0,
|
|
273
|
+
end: 0.8,
|
|
274
|
+
}
|
|
275
|
+
}
|
|
245
276
|
if (config.type !== 'pie') {
|
|
246
277
|
baseOptions.isGroup = true
|
|
247
278
|
}
|