swordpass-ui 1.0.6 → 1.0.7

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.
@@ -45,787 +45,784 @@
45
45
  </template>
46
46
 
47
47
  <script>
48
- import { decode } from '@/util/base64'
49
- import utils from '@/utils.js'
50
- import permission from '@/mixins/permission.js'
51
- export default {
52
- name: 'ClChart',
53
- mixins: [permission],
54
- props: {
55
- id: {
56
- type: [String, Number],
57
- required: true,
58
- },
59
- width: {
60
- type: String,
61
- default: '',
62
- },
63
- height: {
64
- type: String,
65
- default: '',
48
+ import { decode } from '@/util/base64'
49
+ import utils from '@/utils.js'
50
+ import permission from '@/mixins/permission.js'
51
+ export default {
52
+ name: 'ClChart',
53
+ mixins: [permission],
54
+ props: {
55
+ id: {
56
+ type: [String, Number],
57
+ required: true,
58
+ },
59
+ width: {
60
+ type: String,
61
+ default: '',
62
+ },
63
+ height: {
64
+ type: String,
65
+ default: '',
66
+ },
67
+ selectList: {
68
+ type: String,
69
+ default: '',
70
+ },
71
+ },
72
+ data() {
73
+ return {
74
+ showTable: false,
75
+ customChart: {},
76
+ pageResult: {
77
+ page: 1,
78
+ pageSize: 20,
79
+ total: 0,
66
80
  },
67
- selectList: {
68
- type: String,
69
- default: '',
81
+ data: [],
82
+ quickSearchProp: '',
83
+ defaultQuery: [],
84
+ queryOpTransObj: {
85
+ EQ: 'EQUAL',
86
+ BETWEEN: 'BETWEEN',
87
+ GE: 'GREAT_EQUAL',
88
+ LE: 'LESS_EQUAL',
89
+ LK: 'LIKE',
90
+ IN: 'IN',
70
91
  },
92
+ querrySelectList: [],
93
+ }
94
+ },
95
+ computed: {
96
+ charWidth() {
97
+ if (this.width) {
98
+ return this.width + 'px'
99
+ }
100
+ return '100%'
71
101
  },
72
- data() {
73
- return {
74
- showTable: false,
75
- customChart: {},
76
- pageResult: {
77
- page: 1,
78
- pageSize: 20,
79
- total: 0,
80
- },
81
- data: [],
82
- quickSearchProp: '',
83
- defaultQuery: [],
84
- queryOpTransObj: {
85
- EQ: 'EQUAL',
86
- BETWEEN: 'BETWEEN',
87
- GE: 'GREAT_EQUAL',
88
- LE: 'LESS_EQUAL',
89
- LK: 'LIKE',
90
- IN: 'IN',
91
- },
92
- querrySelectList: [],
102
+ charHeight() {
103
+ if (this.height) {
104
+ return this.height + 'px'
93
105
  }
106
+ return this.customChart.height + 'px'
94
107
  },
95
- computed: {
96
- charWidth() {
97
- if (this.width) {
98
- return this.width + 'px'
99
- }
100
- return '100%'
101
- },
102
- charHeight() {
103
- if (this.height) {
104
- return this.height + 'px'
105
- }
106
- return this.customChart.height + 'px'
107
- },
108
+ },
109
+ watch: {
110
+ id: function (newV) {
111
+ if (newV) {
112
+ this.customChart = []
113
+ this.data = []
114
+ this.quickSearchProp = ''
115
+ this.defaultQuery = []
116
+ this.showTable = false
117
+ this.initData()
118
+ }
108
119
  },
109
- watch: {
110
- id: function (newV) {
111
- if (newV) {
120
+ },
121
+ mounted() {
122
+ this.$nextTick(() => {
123
+ this.initData()
124
+ })
125
+ if (this.selectList) {
126
+ this.querrySelectList = JSON.parse(decode(this.selectList))
127
+ const pInst = utils.getOnlineFormInstance(this)
128
+ this.querrySelectList.forEach((obj) => {
129
+ let path = 'data.' + obj.selectField
130
+ pInst.$watch(path, () => {
112
131
  this.customChart = []
113
132
  this.data = []
114
133
  this.quickSearchProp = ''
115
134
  this.defaultQuery = []
116
135
  this.showTable = false
117
- this.initData()
118
- }
119
- },
120
- },
121
- mounted() {
122
- this.$nextTick(() => {
123
- this.initData()
136
+ this.$nextTick(() => {
137
+ this.initData()
138
+ })
139
+ })
124
140
  })
125
- if (this.selectList) {
126
- this.querrySelectList = JSON.parse(decode(this.selectList))
141
+ }
142
+ },
143
+ methods: {
144
+ initClick(tabVue) {
145
+ if (tabVue.index == '1') {
146
+ this.$refs.table.load()
147
+ }
148
+ },
149
+ loadData(param, cb) {
150
+ if (this.customChart.alias) {
151
+ param.pageBean.pageSize = parseInt(
152
+ this.customChart.conf.maxLength &&
153
+ this.customChart.conf.maxLength != '0'
154
+ ? this.customChart.conf.maxLength
155
+ : 20
156
+ )
127
157
  const pInst = utils.getOnlineFormInstance(this)
128
- this.querrySelectList.forEach((obj) => {
129
- let path = 'data.' + obj.selectField
130
- pInst.$watch(path, () => {
131
- this.customChart = []
132
- this.data = []
133
- this.quickSearchProp = ''
134
- this.defaultQuery = []
135
- this.showTable = false
136
- this.$nextTick(() => {
137
- this.initData()
138
- })
158
+ let conditions = this.customChart.conditionfield
159
+ let querrySelectList = this.querrySelectList
160
+ let queryFilter = []
161
+ querrySelectList.forEach((item) => {
162
+ let value = utils.getValueByPath(pInst.data, item.selectField)
163
+ let query = conditions.find((obj) => obj.field == item.bindSelectd)
164
+ queryFilter.push({
165
+ property: query.field,
166
+ value: value,
167
+ operation: this.queryOpTransObj[query.condition],
168
+ group: 'main',
139
169
  })
140
170
  })
171
+ param.querys = queryFilter
172
+ this.$requestConfig
173
+ .getChartListData(this.customChart.alias, param)
174
+ .then((response) => {
175
+ this.data = response.rows
176
+ this.pageResult = {
177
+ page: response.page,
178
+ pageSize: response.pageSize,
179
+ total: response.total,
180
+ }
181
+ this.customChart.rows = this.data
182
+ this.buildChart(this.customChart)
183
+ })
184
+ .finally(() => {
185
+ cb()
186
+ })
187
+ } else {
188
+ cb()
141
189
  }
142
190
  },
143
- methods: {
144
- initClick(tabVue) {
145
- if (tabVue.index == '1') {
146
- this.$refs.table.load()
191
+ initData() {
192
+ this.$requestConfig.getChartById(this.id).then((data) => {
193
+ if (data) {
194
+ data.conditionfield = JSON.parse(data.conditionfield)
195
+ data.displayfield = JSON.parse(data.displayfield)
196
+ data.xaxisField = JSON.parse(data.xaxisField)
197
+ data.sortfield = JSON.parse(data.sortfield)
198
+ data.conf = JSON.parse(data.conf)
199
+ this.customChart = data
200
+ this.initCondition()
201
+ this.showTable = true
147
202
  }
148
- },
149
- loadData(param, cb) {
150
- if (this.customChart.alias) {
151
- param.pageBean.pageSize = parseInt(
152
- this.customChart.conf.maxLength &&
153
- this.customChart.conf.maxLength != '0'
154
- ? this.customChart.conf.maxLength
155
- : 20
156
- )
157
- const pInst = utils.getOnlineFormInstance(this)
158
- let conditions = this.customChart.conditionfield
159
- let querrySelectList = this.querrySelectList
160
- let queryFilter = []
161
- querrySelectList.forEach((item) => {
162
- let value = utils.getValueByPath(pInst.data, item.selectField)
163
- let query = conditions.find((obj) => obj.field == item.bindSelectd)
164
- queryFilter.push({
165
- property: query.field,
166
- value: value,
167
- operation: this.queryOpTransObj[query.condition],
168
- group: 'main',
169
- })
170
- })
171
- param.querys = queryFilter
172
- this.$requestConfig
173
- .getChartListData(this.customChart.alias, param)
174
- .then((response) => {
175
- this.data = response.rows
176
- this.pageResult = {
177
- page: response.page,
178
- pageSize: response.pageSize,
179
- total: response.total,
180
- }
181
- this.customChart.rows = this.data
182
- this.buildChart(this.customChart)
183
- })
184
- .finally(() => {
185
- cb()
186
- })
203
+ })
204
+ },
205
+ initCondition() {
206
+ let conditions = this.customChart.conditionfield
207
+ for (let i = 0; i < conditions.length; i++) {
208
+ if (conditions[i].defaultType === '1') {
209
+ this.quickSearchProp += conditions[i].field.toUpperCase() + ','
187
210
  } else {
188
- cb()
189
- }
190
- },
191
- initData() {
192
- this.$requestConfig.getChartById(this.id).then((data) => {
193
- if (data) {
194
- data.conditionfield = JSON.parse(data.conditionfield)
195
- data.displayfield = JSON.parse(data.displayfield)
196
- data.xaxisField = JSON.parse(data.xaxisField)
197
- data.sortfield = JSON.parse(data.sortfield)
198
- data.conf = JSON.parse(data.conf)
199
- this.customChart = data
200
- this.initCondition()
201
- this.showTable = true
202
- }
203
- })
204
- },
205
- initCondition() {
206
- let conditions = this.customChart.conditionfield
207
- for (let i = 0; i < conditions.length; i++) {
208
- if (conditions[i].defaultType === '1') {
209
- this.quickSearchProp += conditions[i].field.toUpperCase() + ','
210
- } else {
211
- this.defaultQuery.push({
212
- property: conditions[i].field,
213
- value: conditions[i].defaultValue,
214
- operation: this.queryOpTransObj[conditions[i].condition],
215
- group: 'main',
216
- })
217
- }
218
- }
219
- },
220
- buildChart(data) {
221
- let myChart = this.$echarts.init(
222
- document.getElementById(this.id),
223
- 'default'
224
- )
225
- let grid = this.getGrid()
226
- data.conf.title.text = data.name
227
- data.conf.title.top = this.getTitlePosition()
228
- let option = {
229
- title: data.conf.title,
230
- tooltip: {},
231
- toolbox: { feature: { saveAsImage: {} } },
232
- legend: {},
233
- grid: grid,
234
- series: {},
235
- }
236
- switch (data.style) {
237
- case 1:
238
- option = this.buildLine(data, option)
239
- break
240
- case 3:
241
- option = this.buildPie(data, option)
242
- break
243
- case 4:
244
- option = this.buildRadar(data, option)
245
- break
246
- case 5:
247
- option = this.buildFunnel(data, option)
248
- break
249
- case 6:
250
- option = this.buildScatter(data, option)
251
- break
252
- case 7:
253
- option = this.buildHeatmap(data, option)
254
- break
255
- default:
256
- break
211
+ this.defaultQuery.push({
212
+ property: conditions[i].field,
213
+ value: conditions[i].defaultValue,
214
+ operation: this.queryOpTransObj[conditions[i].condition],
215
+ group: 'main',
216
+ })
257
217
  }
258
- this.adjustChatTitle(data, option)
259
- myChart.setOption(option)
260
- },
261
- buildLine(data, option) {
262
- let displayField = this.customChart.displayfield
263
- let legendData = []
264
- let xAxisData = []
265
- let seriesData = []
266
- let xAxisField = {}
267
- let series = this.customChart.conf.series
268
- if (this.customChart.xaxisField)
269
- xAxisField = this.customChart.xaxisField[0]
218
+ }
219
+ },
220
+ buildChart(data) {
221
+ let myChart = this.$echarts.init(
222
+ document.getElementById(this.id),
223
+ 'default'
224
+ )
225
+ let grid = this.getGrid()
226
+ data.conf.title.text = data.name
227
+ data.conf.title.top = this.getTitlePosition()
228
+ let option = {
229
+ title: data.conf.title,
230
+ tooltip: {},
231
+ toolbox: { feature: { saveAsImage: {} } },
232
+ legend: {},
233
+ grid: grid,
234
+ series: {},
235
+ }
236
+ switch (data.style) {
237
+ case 1:
238
+ option = this.buildLine(data, option)
239
+ break
240
+ case 3:
241
+ option = this.buildPie(data, option)
242
+ break
243
+ case 4:
244
+ option = this.buildRadar(data, option)
245
+ break
246
+ case 5:
247
+ option = this.buildFunnel(data, option)
248
+ break
249
+ case 7:
250
+ option = this.buildHeatmap(data, option)
251
+ break
252
+ default:
253
+ break
254
+ }
255
+ this.adjustChatTitle(data, option)
256
+ myChart.setOption(option)
257
+ },
258
+ buildLine(data, option) {
259
+ let displayField = this.customChart.displayfield
260
+ let legendData = []
261
+ let xAxisData = []
262
+ let seriesData = []
263
+ let xAxisField = {}
264
+ let series = this.customChart.conf.series
265
+ if (this.customChart.xaxisField)
266
+ xAxisField = this.customChart.xaxisField[0]
270
267
 
271
- for (let i = 0, d; (d = displayField[i++]); ) {
272
- if (d) {
273
- let arr = []
274
- let type = d.type
275
- legendData.push(d.comment)
276
- for (let j = 0, res; (res = data.rows[j++]); ) {
277
- if (i === 1) {
278
- let value = res[xAxisField.field.toUpperCase()]
279
- if (
280
- xAxisField.dbType === 'date' &&
281
- value &&
282
- typeof value === 'number'
283
- ) {
284
- value = new Date(value).format(this.defaultFormat)
285
- }
286
- xAxisData.push(value)
287
- }
288
- if (res) {
289
- let value = res[d.field.toUpperCase()]
290
- arr.push(value)
268
+ for (let i = 0, d; (d = displayField[i++]); ) {
269
+ if (d) {
270
+ let arr = []
271
+ let type = d.type
272
+ legendData.push(d.comment)
273
+ for (let j = 0, res; (res = data.rows[j++]); ) {
274
+ if (i === 1) {
275
+ let value = res[xAxisField.field.toUpperCase()]
276
+ if (
277
+ xAxisField.dbType === 'date' &&
278
+ value &&
279
+ typeof value === 'number'
280
+ ) {
281
+ value = new Date(value).format(this.defaultFormat)
291
282
  }
283
+ xAxisData.push(value)
292
284
  }
293
- let se = {
294
- name: d.comment,
295
- type: d.type,
296
- data: arr,
297
- stack: series.stack ? 'one' : null,
298
- }
299
- if (!series.doubleYAxis) {
300
- se.yAxisIndex = d.yAxis === 1 ? 0 : 1
301
- }
302
- if (type === 'line') {
303
- se.smooth = series.smooth
285
+ if (res) {
286
+ let value = res[d.field.toUpperCase()]
287
+ arr.push(value)
304
288
  }
305
- seriesData.push(se)
306
289
  }
290
+ let se = {
291
+ name: d.comment,
292
+ type: d.type,
293
+ data: arr,
294
+ stack: series.stack ? 'one' : null,
295
+ }
296
+ if (!series.doubleYAxis) {
297
+ se.yAxisIndex = d.yAxis === 1 ? 0 : 1
298
+ }
299
+ if (type === 'line') {
300
+ se.smooth = series.smooth
301
+ }
302
+ seriesData.push(se)
307
303
  }
308
- option.series = seriesData
309
- option.tooltip = {
310
- trigger: 'axis',
311
- }
312
- option.legend.y = 50
313
- if (series.showType || !series.doubleYAxis) {
314
- option.xAxis = [{ type: 'category', data: xAxisData }]
315
- option.yAxis = series.doubleYAxis
316
- ? [{ type: 'value' }]
317
- : [{ type: 'value' }, { type: 'value' }]
318
- } else {
319
- option.xAxis = [{ type: 'value' }]
320
- option.yAxis = [{ type: 'category', data: xAxisData }]
321
- }
304
+ }
305
+ option.series = seriesData
306
+ option.tooltip = {
307
+ trigger: 'axis',
308
+ }
309
+ option.legend.y = 50
310
+ if (series.showType || !series.doubleYAxis) {
311
+ option.xAxis = [{ type: 'category', data: xAxisData }]
312
+ option.yAxis = series.doubleYAxis
313
+ ? [{ type: 'value' }]
314
+ : [{ type: 'value' }, { type: 'value' }]
315
+ } else {
316
+ option.xAxis = [{ type: 'value' }]
317
+ option.yAxis = [{ type: 'category', data: xAxisData }]
318
+ }
322
319
 
323
- //柱状图的时候两端留空。避免柱状图挡住y轴。折线图则不留空,
324
- if (data.style === 2) option.xAxis[0]['boundaryGap'] = true
325
- if (data.conf) {
326
- let obj = data.conf
327
- if (obj.yMin === 2) option.yAxis[0]['min'] = 'dataMin'
328
- if (obj.xShowAll === 2)
329
- option.xAxis[0]['axisLabel'] = {
330
- interval: 0, //横轴信息全部显示
331
- rotate: 30,
332
- }
333
- }
334
- if (data.rows.length > 20 && !series.dataZoom) {
335
- option.dataZoom = [
336
- {
337
- start: 0,
338
- end: 10,
339
- handleIcon:
340
- 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
341
- handleSize: '80%',
342
- handleStyle: {
343
- color: '#fff',
344
- shadowBlur: 3,
345
- shadowColor: 'rgba(0, 0, 0, 0.6)',
346
- shadowOffsetX: 2,
347
- shadowOffsetY: 2,
348
- },
349
- },
350
- ]
351
- option.grid.bottom = 50
352
- } else {
353
- delete option.dataZoom
354
- }
355
- option.legend = data.conf.legend
356
- option.legend.data = legendData
357
- return option
358
- },
359
- buildPie(data, option) {
360
- let displayField = data.displayfield
361
- let legendData = []
362
- let seriesData = []
363
- let xAxisField = data.xaxisField
364
- let series = data.conf.series
365
- if (xAxisField) xAxisField = xAxisField[0]
366
- if (series.showType) {
367
- let duration = 100 / data.rows.length
368
- for (let j = 0; j < data.rows.length; j++) {
369
- let value = []
370
- for (let i = 0; i < displayField.length; i++) {
371
- value.push({
372
- name: displayField[i].comment,
373
- value: data.rows[j][displayField[i].field.toUpperCase()],
374
- })
375
- if (j === 0) {
376
- legendData.push(displayField[i].comment)
377
- }
378
- }
379
- seriesData.push({
380
- name: data.rows[j][xAxisField.field.toUpperCase()],
381
- type: 'pie',
382
- data: value,
383
- radius: [series.radius[0] + '%', series.radius[1] + '%'],
384
- center: [
385
- Number(series.center[0]) + j * duration + '%',
386
- series.center[1] + '%',
387
- ],
388
- roseType: series.roseType,
389
- selectedMode: series.selectedMode,
390
- label: {
391
- position: series.label.position,
392
- },
393
- itemStyle: {
394
- emphasis: {
395
- shadowBlur: 10,
396
- shadowOffsetX: 0,
397
- shadowColor: 'rgba(0, 0, 0, 0.5)',
398
- },
399
- },
400
- })
320
+ //柱状图的时候两端留空。避免柱状图挡住y轴。折线图则不留空,
321
+ if (data.style === 2) option.xAxis[0]['boundaryGap'] = true
322
+ if (data.conf) {
323
+ let obj = data.conf
324
+ if (obj.yMin === 2) option.yAxis[0]['min'] = 'dataMin'
325
+ if (obj.xShowAll === 2)
326
+ option.xAxis[0]['axisLabel'] = {
327
+ interval: 0, //横轴信息全部显示
328
+ rotate: 30,
401
329
  }
402
- } else {
403
- let duration = 100 / displayField.length
330
+ }
331
+ if (data.rows.length > 20 && !series.dataZoom) {
332
+ option.dataZoom = [
333
+ {
334
+ start: 0,
335
+ end: 10,
336
+ handleIcon:
337
+ 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
338
+ handleSize: '80%',
339
+ handleStyle: {
340
+ color: '#fff',
341
+ shadowBlur: 3,
342
+ shadowColor: 'rgba(0, 0, 0, 0.6)',
343
+ shadowOffsetX: 2,
344
+ shadowOffsetY: 2,
345
+ },
346
+ },
347
+ ]
348
+ option.grid.bottom = 50
349
+ } else {
350
+ delete option.dataZoom
351
+ }
352
+ option.legend = data.conf.legend
353
+ option.legend.data = legendData
354
+ return option
355
+ },
356
+ buildPie(data, option) {
357
+ let displayField = data.displayfield
358
+ let legendData = []
359
+ let seriesData = []
360
+ let xAxisField = data.xaxisField
361
+ let series = data.conf.series
362
+ if (xAxisField) xAxisField = xAxisField[0]
363
+ if (series.showType) {
364
+ let duration = 100 / data.rows.length
365
+ for (let j = 0; j < data.rows.length; j++) {
366
+ let value = []
404
367
  for (let i = 0; i < displayField.length; i++) {
405
- let value = []
406
- for (let j = 0; j < data.rows.length; j++) {
407
- value.push({
408
- name: data.rows[j][xAxisField.field.toUpperCase()],
409
- value: data.rows[j][displayField[i].field.toUpperCase()],
410
- })
411
- if (i === 0) {
412
- legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
413
- }
414
- }
415
- seriesData.push({
368
+ value.push({
416
369
  name: displayField[i].comment,
417
- type: 'pie',
418
- data: value,
419
- radius: [series.radius[0] + '%', series.radius[1] + '%'],
420
- center: [
421
- Number(series.center[0]) + i * duration + '%',
422
- series.center[1] + '%',
423
- ],
424
- roseType: series.roseType,
425
- selectedMode: series.selectedMode,
426
- label: {
427
- position: series.label.position,
428
- },
429
- itemStyle: {
430
- emphasis: {
431
- shadowBlur: 10,
432
- shadowOffsetX: 0,
433
- shadowColor: 'rgba(0, 0, 0, 0.5)',
434
- },
435
- },
370
+ value: data.rows[j][displayField[i].field.toUpperCase()],
436
371
  })
372
+ if (j === 0) {
373
+ legendData.push(displayField[i].comment)
374
+ }
437
375
  }
376
+ seriesData.push({
377
+ name: data.rows[j][xAxisField.field.toUpperCase()],
378
+ type: 'pie',
379
+ data: value,
380
+ radius: [series.radius[0] + '%', series.radius[1] + '%'],
381
+ center: [
382
+ Number(series.center[0]) + j * duration + '%',
383
+ series.center[1] + '%',
384
+ ],
385
+ roseType: series.roseType,
386
+ selectedMode: series.selectedMode,
387
+ label: {
388
+ position: series.label.position,
389
+ },
390
+ itemStyle: {
391
+ emphasis: {
392
+ shadowBlur: 10,
393
+ shadowOffsetX: 0,
394
+ shadowColor: 'rgba(0, 0, 0, 0.5)',
395
+ },
396
+ },
397
+ })
438
398
  }
439
-
440
- option.series = seriesData
441
- option.tooltip = {
442
- trigger: 'item',
443
- formatter: '{a} <br/>{b} : {c} ({d}%)',
444
- }
445
- option.legend = data.conf.legend
446
- option.legend.data = legendData
447
- return option
448
- },
449
- buildRadar(data, option) {
450
- let displayField = data.displayfield
451
- let legendData = []
452
- let xAxisField = data.xaxisField
453
- let arr = []
454
- let seriesData = []
455
- let indicator = []
456
- let series = data.conf.series
457
- if (xAxisField) xAxisField = xAxisField[0]
458
-
459
- if (series.showType) {
399
+ } else {
400
+ let duration = 100 / displayField.length
401
+ for (let i = 0; i < displayField.length; i++) {
402
+ let value = []
460
403
  for (let j = 0; j < data.rows.length; j++) {
461
- let value = []
462
- for (let i = 0; i < displayField.length; i++) {
463
- value.push(data.rows[j][displayField[i].field.toUpperCase()])
464
- if (j === 0) {
465
- indicator.push({
466
- name: displayField[i].comment,
467
- })
468
- }
469
- }
470
- legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
471
- arr.push({
404
+ value.push({
472
405
  name: data.rows[j][xAxisField.field.toUpperCase()],
473
- value: value,
474
- areaStyle: {
475
- opacity: '0',
476
- },
406
+ value: data.rows[j][displayField[i].field.toUpperCase()],
477
407
  })
478
- }
479
- seriesData = [
480
- {
481
- type: 'radar',
482
- data: arr,
483
- itemStyle: {
484
- emphasis: {
485
- areaStyle: {
486
- opacity: series.areaStyle ? '0' : '0.5',
487
- },
488
- },
489
- },
490
- },
491
- ]
492
- } else {
493
- for (let i = 0; i < displayField.length; i++) {
494
- let value = []
495
- for (let j = 0; j < data.rows.length; j++) {
496
- value.push(data.rows[j][displayField[i].field.toUpperCase()])
497
- if (i === 0) {
498
- indicator.push({
499
- name: data.rows[j][xAxisField.field.toUpperCase()],
500
- })
501
- }
408
+ if (i === 0) {
409
+ legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
502
410
  }
503
- legendData.push(displayField[i].comment)
504
- arr.push({
505
- name: displayField[i].comment,
506
- value: value,
507
- areaStyle: {
508
- opacity: '0',
509
- },
510
- })
511
411
  }
512
- seriesData = [
513
- {
514
- type: 'radar',
515
- data: arr,
516
- itemStyle: {
517
- emphasis: {
518
- areaStyle: {
519
- opacity: series.areaStyle ? '0' : '0.5',
520
- },
521
- },
412
+ seriesData.push({
413
+ name: displayField[i].comment,
414
+ type: 'pie',
415
+ data: value,
416
+ radius: [series.radius[0] + '%', series.radius[1] + '%'],
417
+ center: [
418
+ Number(series.center[0]) + i * duration + '%',
419
+ series.center[1] + '%',
420
+ ],
421
+ roseType: series.roseType,
422
+ selectedMode: series.selectedMode,
423
+ label: {
424
+ position: series.label.position,
425
+ },
426
+ itemStyle: {
427
+ emphasis: {
428
+ shadowBlur: 10,
429
+ shadowOffsetX: 0,
430
+ shadowColor: 'rgba(0, 0, 0, 0.5)',
522
431
  },
523
432
  },
524
- ]
433
+ })
525
434
  }
435
+ }
526
436
 
527
- option.series = seriesData
528
- option.radar = {
529
- center: [series.center[0] + '%', series.center[1] + '%'],
530
- radius: series.radius,
531
- indicator: indicator,
532
- }
533
- option.legend = data.conf.legend
534
- option.legend.data = legendData
535
- return option
536
- },
537
- buildFunnel(data, option) {
538
- let displayField = data.displayfield
539
- let legendData = []
540
- let xAxisField = data.xaxisField
541
- let seriesData = []
542
- let series = data.conf.series
543
- if (xAxisField) xAxisField = xAxisField[0]
437
+ option.series = seriesData
438
+ option.tooltip = {
439
+ trigger: 'item',
440
+ formatter: '{a} <br/>{b} : {c} ({d}%)',
441
+ }
442
+ option.legend = data.conf.legend
443
+ option.legend.data = legendData
444
+ return option
445
+ },
446
+ buildRadar(data, option) {
447
+ let displayField = data.displayfield
448
+ let legendData = []
449
+ let xAxisField = data.xaxisField
450
+ let arr = []
451
+ let seriesData = []
452
+ let indicator = []
453
+ let series = data.conf.series
454
+ if (xAxisField) xAxisField = xAxisField[0]
544
455
 
545
- //列数据展示
546
- if (series.showType) {
547
- let duration = 100 / data.rows.length
548
- for (let j = 0; j < data.rows.length; j++) {
549
- let value = []
550
- for (let i = 0; i < displayField.length; i++) {
551
- value.push({
456
+ if (series.showType) {
457
+ for (let j = 0; j < data.rows.length; j++) {
458
+ let value = []
459
+ for (let i = 0; i < displayField.length; i++) {
460
+ value.push(data.rows[j][displayField[i].field.toUpperCase()])
461
+ if (j === 0) {
462
+ indicator.push({
552
463
  name: displayField[i].comment,
553
- value: data.rows[j][displayField[i].field.toUpperCase()],
554
464
  })
555
- if (j === 0) {
556
- legendData.push(displayField[i].comment)
557
- }
558
465
  }
559
- seriesData.push({
560
- name: data.rows[j][xAxisField.field.toUpperCase()],
561
- type: 'funnel',
562
- data: value,
563
- width: duration - 5 + '%',
564
- left: j * duration + '%',
565
- funnelAlign: series.funnelAlign,
566
- sort: series.sort,
567
- label: {
568
- position: series.label.position,
569
- },
570
- })
571
466
  }
572
- } else {
573
- //行数据展示
574
- let duration = 100 / displayField.length
575
- for (let i = 0; i < displayField.length; i++) {
576
- let value = []
577
- for (let j = 0; j < data.rows.length; j++) {
578
- value.push({
467
+ legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
468
+ arr.push({
469
+ name: data.rows[j][xAxisField.field.toUpperCase()],
470
+ value: value,
471
+ areaStyle: {
472
+ opacity: '0',
473
+ },
474
+ })
475
+ }
476
+ seriesData = [
477
+ {
478
+ type: 'radar',
479
+ data: arr,
480
+ itemStyle: {
481
+ emphasis: {
482
+ areaStyle: {
483
+ opacity: series.areaStyle ? '0' : '0.5',
484
+ },
485
+ },
486
+ },
487
+ },
488
+ ]
489
+ } else {
490
+ for (let i = 0; i < displayField.length; i++) {
491
+ let value = []
492
+ for (let j = 0; j < data.rows.length; j++) {
493
+ value.push(data.rows[j][displayField[i].field.toUpperCase()])
494
+ if (i === 0) {
495
+ indicator.push({
579
496
  name: data.rows[j][xAxisField.field.toUpperCase()],
580
- value: data.rows[j][displayField[i].field.toUpperCase()],
581
497
  })
582
- if (i === 0) {
583
- legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
584
- }
585
498
  }
586
- seriesData.push({
587
- name: displayField[i].comment,
588
- type: 'funnel',
589
- data: value,
590
- width: duration - 5 + '%',
591
- left: i * duration + '%',
592
- funnelAlign: series.funnelAlign,
593
- sort: series.sort,
594
- label: {
595
- position: series.label.position,
596
- },
597
- })
598
499
  }
500
+ legendData.push(displayField[i].comment)
501
+ arr.push({
502
+ name: displayField[i].comment,
503
+ value: value,
504
+ areaStyle: {
505
+ opacity: '0',
506
+ },
507
+ })
599
508
  }
509
+ seriesData = [
510
+ {
511
+ type: 'radar',
512
+ data: arr,
513
+ itemStyle: {
514
+ emphasis: {
515
+ areaStyle: {
516
+ opacity: series.areaStyle ? '0' : '0.5',
517
+ },
518
+ },
519
+ },
520
+ },
521
+ ]
522
+ }
600
523
 
601
- option.series = seriesData
602
-
603
- option.legend = data.conf.legend
604
- option.legend.data = legendData
605
- return option
606
- },
607
- buildScatter(data, option) {
608
- let displayField = data.displayfield
609
- let legendData = []
610
- let xAxisData = []
611
- let xAxisField = data.xaxisField
612
- let seriesData = []
613
- let series = data.conf.series
614
- if (xAxisField) xAxisField = xAxisField[0]
524
+ option.series = seriesData
525
+ option.radar = {
526
+ center: [series.center[0] + '%', series.center[1] + '%'],
527
+ radius: series.radius,
528
+ indicator: indicator,
529
+ }
530
+ option.legend = data.conf.legend
531
+ option.legend.data = legendData
532
+ return option
533
+ },
534
+ buildFunnel(data, option) {
535
+ let displayField = data.displayfield
536
+ let legendData = []
537
+ let xAxisField = data.xaxisField
538
+ let seriesData = []
539
+ let series = data.conf.series
540
+ if (xAxisField) xAxisField = xAxisField[0]
615
541
 
616
- if (series.showType) {
617
- for (let j = 0; j < data.rows.length; j++) {
618
- let value = []
619
- for (let i = 0; i < displayField.length; i++) {
620
- if (j === 0) {
621
- xAxisData.push(displayField[i].comment)
622
- }
623
- value.push([
624
- displayField[i].comment,
625
- data.rows[j][displayField[i].field.toUpperCase()],
626
- ])
627
- }
628
- legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
629
- seriesData.push({
630
- name: data.rows[j][xAxisField.field.toUpperCase()],
631
- type: 'scatter',
632
- data: value,
633
- })
634
- }
635
- } else {
542
+ //列数据展示
543
+ if (series.showType) {
544
+ let duration = 100 / data.rows.length
545
+ for (let j = 0; j < data.rows.length; j++) {
546
+ let value = []
636
547
  for (let i = 0; i < displayField.length; i++) {
637
- let value = []
638
- for (let j = 0; j < data.rows.length; j++) {
639
- if (i === 0) {
640
- xAxisData.push(data.rows[j][xAxisField.field.toLocaleUpperCase()])
641
- }
642
- value.push([
643
- data.rows[j][xAxisField.field.toLocaleUpperCase()],
644
- data.rows[j][displayField[i].field.toLocaleUpperCase()],
645
- ])
646
- }
647
- legendData.push(displayField[i].comment)
648
- seriesData.push({
548
+ value.push({
649
549
  name: displayField[i].comment,
650
- type: 'scatter',
651
- data: value,
550
+ value: data.rows[j][displayField[i].field.toUpperCase()],
652
551
  })
653
- if (
654
- displayField[i].regression &&
655
- displayField[i].regression !== 'none'
656
- ) {
657
- let myRegression = this.$ecStat.regression(
658
- displayField[i].regression,
659
- value
660
- )
661
- myRegression.points.sort(function (a, b) {
662
- return a[0] - b[0]
663
- })
664
- seriesData.push({
665
- name: 'line',
666
- type: 'line',
667
- showSymbol: false,
668
- data: myRegression.points,
669
- markPoint: {
670
- itemStyle: {
671
- color: 'transparent',
672
- },
673
- label: {
674
- show: true,
675
- position: 'left',
676
- formatter: myRegression.expression,
677
- color: '#333',
678
- fontSize: 14,
679
- },
680
- data: [
681
- {
682
- coord: myRegression.points[myRegression.points.length - 1],
683
- },
684
- ],
685
- },
686
- })
552
+ if (j === 0) {
553
+ legendData.push(displayField[i].comment)
687
554
  }
688
555
  }
556
+ seriesData.push({
557
+ name: data.rows[j][xAxisField.field.toUpperCase()],
558
+ type: 'funnel',
559
+ data: value,
560
+ width: duration - 5 + '%',
561
+ left: j * duration + '%',
562
+ funnelAlign: series.funnelAlign,
563
+ sort: series.sort,
564
+ label: {
565
+ position: series.label.position,
566
+ },
567
+ })
689
568
  }
690
-
691
- option.series = seriesData
692
- option.xAxis = {
693
- type: data.conf.series.xAxisType,
694
- }
695
- if (data.conf.series.xAxisType === 'category') {
696
- option.xAxis.data = xAxisData
697
- }
698
- option.yAxis = {}
699
-
700
- option.legend = data.conf.legend
701
- option.legend.data = legendData
702
- return option
703
- },
704
- buildHeatmap(data, option) {
705
- let displayField = data.displayfield
706
- let legendData = []
707
- let rows = []
708
- let columns = []
709
- let arr = []
710
- let max = 0
711
- let xAxisField = data.xaxisField
712
- if (xAxisField) xAxisField = xAxisField[0]
713
-
714
- for (let i = 0; i < data.rows.length; i++) {
715
- for (let j = 0; j < displayField.length; j++) {
569
+ } else {
570
+ //行数据展示
571
+ let duration = 100 / displayField.length
572
+ for (let i = 0; i < displayField.length; i++) {
573
+ let value = []
574
+ for (let j = 0; j < data.rows.length; j++) {
575
+ value.push({
576
+ name: data.rows[j][xAxisField.field.toUpperCase()],
577
+ value: data.rows[j][displayField[i].field.toUpperCase()],
578
+ })
716
579
  if (i === 0) {
717
- columns.push(displayField[j].comment)
718
- }
719
- arr.push([i, j, data.rows[i][displayField[j].field.toUpperCase()]])
720
- if (data.rows[i][displayField[j].field.toUpperCase()] > max) {
721
- max = data.rows[i][displayField[j].field.toUpperCase()]
580
+ legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
722
581
  }
723
582
  }
724
- rows.push(data.rows[i][xAxisField.field.toUpperCase()])
725
- }
726
- option.series = [
727
- {
728
- name: 'sss',
729
- type: 'heatmap',
730
- data: arr,
583
+ seriesData.push({
584
+ name: displayField[i].comment,
585
+ type: 'funnel',
586
+ data: value,
587
+ width: duration - 5 + '%',
588
+ left: i * duration + '%',
589
+ funnelAlign: series.funnelAlign,
590
+ sort: series.sort,
731
591
  label: {
732
- normal: {
733
- show: true,
734
- },
592
+ position: series.label.position,
735
593
  },
736
- },
737
- ]
738
- option.xAxis = {
739
- type: 'category',
740
- data: rows,
741
- splitArea: {
742
- show: true,
743
- },
744
- }
745
- option.yAxis = {
746
- type: 'category',
747
- data: columns,
748
- splitArea: {
749
- show: true,
750
- },
751
- }
752
- option.visualMap = {
753
- min: 0,
754
- max: max,
755
- calculable: true,
756
- orient: 'horizontal',
757
- left: 'center',
758
- bottom: '0%',
759
- }
760
- option.tooltip = {
761
- position: 'top',
594
+ })
762
595
  }
596
+ }
763
597
 
764
- option.legend = data.conf.legend
765
- option.legend.data = legendData
766
- return option
767
- },
768
- getGrid() {
769
- let top = 0
770
- let bottom = 0
771
- let grid = {}
772
- if (this.customChart.conf.title.show) {
773
- if (this.customChart.conf.title.top === 'top') {
774
- top += 7
775
- if (this.customChart.conf.title.subtext) {
776
- top += 5
777
- }
778
- } else if (this.customChart.conf.title.top === 'bottom') {
779
- bottom += 16
598
+ option.series = seriesData
599
+
600
+ option.legend = data.conf.legend
601
+ option.legend.data = legendData
602
+ return option
603
+ },
604
+ // buildScatter(data, option) {
605
+ // let displayField = data.displayfield
606
+ // let legendData = []
607
+ // let xAxisData = []
608
+ // let xAxisField = data.xaxisField
609
+ // let seriesData = []
610
+ // let series = data.conf.series
611
+ // if (xAxisField) xAxisField = xAxisField[0]
612
+
613
+ // if (series.showType) {
614
+ // for (let j = 0; j < data.rows.length; j++) {
615
+ // let value = []
616
+ // for (let i = 0; i < displayField.length; i++) {
617
+ // if (j === 0) {
618
+ // xAxisData.push(displayField[i].comment)
619
+ // }
620
+ // value.push([
621
+ // displayField[i].comment,
622
+ // data.rows[j][displayField[i].field.toUpperCase()],
623
+ // ])
624
+ // }
625
+ // legendData.push(data.rows[j][xAxisField.field.toUpperCase()] + '')
626
+ // seriesData.push({
627
+ // name: data.rows[j][xAxisField.field.toUpperCase()],
628
+ // type: 'scatter',
629
+ // data: value,
630
+ // })
631
+ // }
632
+ // } else {
633
+ // for (let i = 0; i < displayField.length; i++) {
634
+ // let value = []
635
+ // for (let j = 0; j < data.rows.length; j++) {
636
+ // if (i === 0) {
637
+ // xAxisData.push(data.rows[j][xAxisField.field.toLocaleUpperCase()])
638
+ // }
639
+ // value.push([
640
+ // data.rows[j][xAxisField.field.toLocaleUpperCase()],
641
+ // data.rows[j][displayField[i].field.toLocaleUpperCase()],
642
+ // ])
643
+ // }
644
+ // legendData.push(displayField[i].comment)
645
+ // seriesData.push({
646
+ // name: displayField[i].comment,
647
+ // type: 'scatter',
648
+ // data: value,
649
+ // })
650
+ // if (
651
+ // displayField[i].regression &&
652
+ // displayField[i].regression !== 'none'
653
+ // ) {
654
+ // let myRegression = this.$ecStat.regression(
655
+ // displayField[i].regression,
656
+ // value
657
+ // )
658
+ // myRegression.points.sort(function (a, b) {
659
+ // return a[0] - b[0]
660
+ // })
661
+ // seriesData.push({
662
+ // name: 'line',
663
+ // type: 'line',
664
+ // showSymbol: false,
665
+ // data: myRegression.points,
666
+ // markPoint: {
667
+ // itemStyle: {
668
+ // color: 'transparent',
669
+ // },
670
+ // label: {
671
+ // show: true,
672
+ // position: 'left',
673
+ // formatter: myRegression.expression,
674
+ // color: '#333',
675
+ // fontSize: 14,
676
+ // },
677
+ // data: [
678
+ // {
679
+ // coord: myRegression.points[myRegression.points.length - 1],
680
+ // },
681
+ // ],
682
+ // },
683
+ // })
684
+ // }
685
+ // }
686
+ // }
687
+
688
+ // option.series = seriesData
689
+ // option.xAxis = {
690
+ // type: data.conf.series.xAxisType,
691
+ // }
692
+ // if (data.conf.series.xAxisType === 'category') {
693
+ // option.xAxis.data = xAxisData
694
+ // }
695
+ // option.yAxis = {}
696
+
697
+ // option.legend = data.conf.legend
698
+ // option.legend.data = legendData
699
+ // return option
700
+ // },
701
+ buildHeatmap(data, option) {
702
+ let displayField = data.displayfield
703
+ let legendData = []
704
+ let rows = []
705
+ let columns = []
706
+ let arr = []
707
+ let max = 0
708
+ let xAxisField = data.xaxisField
709
+ if (xAxisField) xAxisField = xAxisField[0]
710
+
711
+ for (let i = 0; i < data.rows.length; i++) {
712
+ for (let j = 0; j < displayField.length; j++) {
713
+ if (i === 0) {
714
+ columns.push(displayField[j].comment)
780
715
  }
781
- }
782
- if (this.customChart.conf.legend.show) {
783
- if (this.customChart.conf.legend.top === 'top') {
784
- top += 7
785
- } else if (this.customChart.conf.legend.top === 'bottom') {
786
- bottom += 10
716
+ arr.push([i, j, data.rows[i][displayField[j].field.toUpperCase()]])
717
+ if (data.rows[i][displayField[j].field.toUpperCase()] > max) {
718
+ max = data.rows[i][displayField[j].field.toUpperCase()]
787
719
  }
788
720
  }
789
- if (top !== 0) {
790
- grid.top = top + '%'
791
- } else {
792
- grid.top = '5%'
793
- }
794
- if (bottom !== 0) {
795
- grid.bottom = bottom + '%'
796
- }
797
- return grid
798
- },
799
- getTitlePosition() {
721
+ rows.push(data.rows[i][xAxisField.field.toUpperCase()])
722
+ }
723
+ option.series = [
724
+ {
725
+ name: 'sss',
726
+ type: 'heatmap',
727
+ data: arr,
728
+ label: {
729
+ normal: {
730
+ show: true,
731
+ },
732
+ },
733
+ },
734
+ ]
735
+ option.xAxis = {
736
+ type: 'category',
737
+ data: rows,
738
+ splitArea: {
739
+ show: true,
740
+ },
741
+ }
742
+ option.yAxis = {
743
+ type: 'category',
744
+ data: columns,
745
+ splitArea: {
746
+ show: true,
747
+ },
748
+ }
749
+ option.visualMap = {
750
+ min: 0,
751
+ max: max,
752
+ calculable: true,
753
+ orient: 'horizontal',
754
+ left: 'center',
755
+ bottom: '0%',
756
+ }
757
+ option.tooltip = {
758
+ position: 'top',
759
+ }
760
+
761
+ option.legend = data.conf.legend
762
+ option.legend.data = legendData
763
+ return option
764
+ },
765
+ getGrid() {
766
+ let top = 0
767
+ let bottom = 0
768
+ let grid = {}
769
+ if (this.customChart.conf.title.show) {
800
770
  if (this.customChart.conf.title.top === 'top') {
801
- return this.customChart.conf.legend.show &&
802
- this.customChart.conf.legend.top === 'top'
803
- ? '20'
804
- : 'auto'
771
+ top += 7
772
+ if (this.customChart.conf.title.subtext) {
773
+ top += 5
774
+ }
805
775
  } else if (this.customChart.conf.title.top === 'bottom') {
806
- return this.customChart.conf.legend.show &&
807
- this.customChart.conf.legend.top === 'bottom'
808
- ? '84%'
809
- : '88%'
810
- } else {
811
- return this.customChart.conf.title.top
776
+ bottom += 16
812
777
  }
813
- },
814
- adjustChatTitle(data, option) {
815
- option.legend.top = 30
816
- option.grid.top = 80
817
- if (data.conf && data.conf.title && data.conf.title.subtext) {
818
- option.legend.top = 50
819
- option.grid.top = 100
778
+ }
779
+ if (this.customChart.conf.legend.show) {
780
+ if (this.customChart.conf.legend.top === 'top') {
781
+ top += 7
782
+ } else if (this.customChart.conf.legend.top === 'bottom') {
783
+ bottom += 10
820
784
  }
821
- },
785
+ }
786
+ if (top !== 0) {
787
+ grid.top = top + '%'
788
+ } else {
789
+ grid.top = '5%'
790
+ }
791
+ if (bottom !== 0) {
792
+ grid.bottom = bottom + '%'
793
+ }
794
+ return grid
795
+ },
796
+ getTitlePosition() {
797
+ if (this.customChart.conf.title.top === 'top') {
798
+ return this.customChart.conf.legend.show &&
799
+ this.customChart.conf.legend.top === 'top'
800
+ ? '20'
801
+ : 'auto'
802
+ } else if (this.customChart.conf.title.top === 'bottom') {
803
+ return this.customChart.conf.legend.show &&
804
+ this.customChart.conf.legend.top === 'bottom'
805
+ ? '84%'
806
+ : '88%'
807
+ } else {
808
+ return this.customChart.conf.title.top
809
+ }
810
+ },
811
+ adjustChatTitle(data, option) {
812
+ option.legend.top = 30
813
+ option.grid.top = 80
814
+ if (data.conf && data.conf.title && data.conf.title.subtext) {
815
+ option.legend.top = 50
816
+ option.grid.top = 100
817
+ }
822
818
  },
823
- }
819
+ },
820
+ }
824
821
  </script>
825
822
 
826
823
  <style scoped>
827
- ::v-deep .el-table--scrollable-y {
828
- max-height: 100% !important;
829
- height: 100% !important;
830
- }
824
+ ::v-deep .el-table--scrollable-y {
825
+ max-height: 100% !important;
826
+ height: 100% !important;
827
+ }
831
828
  </style>