vue2-client 1.8.96 → 1.8.98

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.96",
3
+ "version": "1.8.98",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -8,21 +8,30 @@
8
8
  </a-select>
9
9
  </a-col>
10
10
  <a-col>
11
- 数值列:
11
+ 汇总数值列:
12
12
  <a-select v-model="selectedValues" mode="multiple" style="width: 200px" @change="updateCharts">
13
13
  <a-select-option v-for="option in valueOptions" :key="option" :value="option">{{ option }}</a-select-option>
14
14
  </a-select>
15
15
  </a-col>
16
+ <a-col>
17
+ 对比项:
18
+ <a-select v-model="selectedProjectColumn" style="width: 200px" @change="updateCharts">
19
+ <a-select-option v-for="project in projectOptions" :key="project" :value="project">{{ project }}</a-select-option>
20
+ </a-select>
21
+ </a-col>
22
+
16
23
  </a-row>
17
24
  <a-divider/>
18
25
  <a-row align="middle" justify="space-around" :gutter="24">
19
- <a-col :span="8">
20
- <div ref="pieChart" class="chart-content"></div>
21
- </a-col>
22
- <a-col :span="8">
26
+ <a-col :span="24">
23
27
  <div ref="columnChart" class="chart-content"></div>
24
28
  </a-col>
25
- <a-col :span="8">
29
+ </a-row>
30
+ <a-row align="middle" justify="space-around" :gutter="24">
31
+ <a-col :span="12">
32
+ <div ref="pieChart" class="chart-content"></div>
33
+ </a-col>
34
+ <a-col :span="12">
26
35
  <div id="lineChart" ref="lineChart" class="chart-content"></div>
27
36
  </a-col>
28
37
  </a-row>
@@ -38,7 +47,10 @@ export default {
38
47
  selectedGroup: null,
39
48
  groupOptions: [],
40
49
  valueOptions: [],
50
+ projectOptions: [],
41
51
  selectedValues: [], // 更新为数组,支持多选
52
+ selectedProjects: [],
53
+ selectedProjectColumn: undefined,
42
54
  pieChart: null,
43
55
  columnChart: null,
44
56
  lineChart: null,
@@ -54,9 +66,6 @@ export default {
54
66
  containLabel: true
55
67
  },
56
68
  legend: {},
57
- color: ['#5DB1FF', '#59D4D4', '#FFD700', '#FF7F50', '#87CEFA',
58
- '#32CD32', '#DA70D6', '#6495ED', '#DC143C', '#00FFFF',
59
- '#00008B', '#008B8B', '#B8860B', '#A9A9A9']
60
69
  }
61
70
  }
62
71
  },
@@ -80,7 +89,11 @@ export default {
80
89
  methods: {
81
90
  initData () {
82
91
  this.initializeOptions()
83
- this.selectedGroup = this.groupOptions[0]
92
+ if (this.groupOptions.includes('year')) {
93
+ this.selectedGroup = 'year'
94
+ } else {
95
+ this.selectedGroup = this.groupOptions[0]
96
+ }
84
97
  if (this.valueOptions.length > 0) {
85
98
  this.selectedValues = [this.valueOptions[0]] // 默认选择第一个数值列
86
99
  }
@@ -89,12 +102,13 @@ export default {
89
102
  initializeOptions () {
90
103
  if (this.rawData.length > 0) {
91
104
  const row = this.rawData[0]
92
- this.groupOptions = Object.keys(row).filter(key => typeof row[key] === 'string' ||
105
+ const columns = Object.keys(row)
106
+ this.groupOptions = columns.filter(key => typeof row[key] === 'string' ||
93
107
  this.isYearArray(this.rawData, key))
94
- this.valueOptions = Object.keys(row).filter(key => {
108
+ this.valueOptions = columns.filter(key => {
95
109
  return !isNaN(parseFloat(row[key])) && isFinite(row[key]) && !this.isYear(row[key])
96
110
  })
97
- console.warn(this.valueOptions)
111
+ this.projectOptions = columns.filter(key => typeof row[key] === 'string')
98
112
  }
99
113
  },
100
114
  isYearArray (arr, key) {
@@ -123,7 +137,6 @@ export default {
123
137
  },
124
138
  renderPieChart () {
125
139
  const transformedData = this.transformDataForChart('pie')
126
- console.log(transformedData)
127
140
  const options = {
128
141
  series: [
129
142
  {
@@ -149,16 +162,41 @@ export default {
149
162
  )
150
163
  )
151
164
  },
165
+ getProjectList () {
166
+ let selectedProjects
167
+ if (this.selectedProjectColumn) {
168
+ selectedProjects = [...new Set(this.rawData.map(item => item[this.selectedProjectColumn]))]
169
+ } else {
170
+ selectedProjects = []
171
+ }
172
+ return selectedProjects
173
+ },
152
174
  renderColumnChart () {
175
+ const selectedProjects = this.getProjectList()
176
+ let items
177
+ if (selectedProjects.length > 0) {
178
+ items = selectedProjects
179
+ } else {
180
+ items = this.selectedValues
181
+ }
153
182
  const transformedData = this.transformDataForChart()
154
183
  const options = {
184
+ dataZoom: [
185
+ {
186
+ type: 'inside'
187
+ },
188
+ {
189
+ type: 'slider'
190
+ }
191
+ ],
192
+ legend: false,
155
193
  dataset: {
156
- dimensions: ['category', ...this.selectedValues],
194
+ dimensions: ['category', ...items],
157
195
  source: transformedData
158
196
  },
159
197
  xAxis: { type: 'category' },
160
198
  yAxis: {},
161
- series: this.selectedValues.map(item => {
199
+ series: items.map(item => {
162
200
  return { type: 'bar' }
163
201
  })
164
202
  }
@@ -174,7 +212,6 @@ export default {
174
212
  },
175
213
  renderLineChart () {
176
214
  const transformedData = this.transformDataForChart('line')
177
- console.log(transformedData)
178
215
  const options = {
179
216
  tooltip: {
180
217
  trigger: 'axis'
@@ -244,17 +281,41 @@ export default {
244
281
  data: this.rawData.map(item => item[valueKey]),
245
282
  }))
246
283
  } else {
247
- // 柱状图数据转换逻辑:为每个分组条件和选中的数值列创建条目
284
+ const selectedProjects = this.getProjectList()
248
285
  const transformedData = []
249
- this.rawData.forEach(item => {
250
- const tempData = {
251
- category: item[this.selectedGroup]
252
- }
253
- this.selectedValues.forEach(valueKey => {
254
- tempData[valueKey] = item[valueKey]
286
+ if (selectedProjects.length > 0 && this.selectedValues.length > 0) {
287
+ // 柱状图的数据转换逻辑
288
+ const categoryMap = {}
289
+ this.rawData.forEach(item => {
290
+ const category = item[this.selectedGroup]
291
+ const key = item[this.selectedProjectColumn]
292
+ if (item[this.selectedValues[0]] > 0) {
293
+ if (!categoryMap[category]) {
294
+ categoryMap[category] = {}
295
+ }
296
+ categoryMap[category][key] = item[this.selectedValues[0]]
297
+ }
255
298
  })
256
- transformedData.push(tempData)
257
- })
299
+
300
+ Object.keys(categoryMap).forEach(category => {
301
+ const tempData = { category }
302
+ Object.keys(categoryMap[category]).forEach(key => {
303
+ tempData[key] = categoryMap[category][key]
304
+ })
305
+ transformedData.push(tempData)
306
+ })
307
+ } else {
308
+ // 柱状图数据转换逻辑:为每个分组条件和选中的数值列创建条目
309
+ this.rawData.forEach(item => {
310
+ const tempData = {
311
+ category: item[this.selectedGroup]
312
+ }
313
+ this.selectedValues.forEach(valueKey => {
314
+ tempData[valueKey] = item[valueKey]
315
+ })
316
+ transformedData.push(tempData)
317
+ })
318
+ }
258
319
  return transformedData
259
320
  }
260
321
  },
@@ -264,7 +325,7 @@ export default {
264
325
  <style lang="less" scoped>
265
326
  .chart-card {
266
327
  .chart-content {
267
- height: 250px;
328
+ height: 400px;
268
329
  }
269
330
  }
270
331
  </style>
@@ -5,19 +5,19 @@
5
5
  <a-list item-layout="horizontal" :data-source="questions">
6
6
  <a-list-item
7
7
  slot="renderItem"
8
- :class="item.sql ? (item.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive') : (item.uuid === currentuuid ? 'question-history-active-bug' : 'question-history-inactive-bug')"
9
- slot-scope="item,index"
10
- @click="handleOpenFavorite(item)">
8
+ :class="renderItem.sql ? (renderItem.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive') : (renderItem.uuid === currentuuid ? 'question-history-active-bug' : 'question-history-inactive-bug')"
9
+ slot-scope="renderItem,index"
10
+ @click="handleOpenFavorite(renderItem)">
11
11
  <a-list-item-meta
12
- :title="item.question"
13
- :description="item.date"
12
+ :title="renderItem.question"
13
+ :description="renderItem.date"
14
14
  />
15
15
  <a-space>
16
16
  <a-tooltip title="查看元数据">
17
17
  <a-icon
18
- v-if="item.data"
18
+ v-if="renderItem.data"
19
19
  type="eye"
20
- @click.stop="openMetaDataModal(item)"/>
20
+ @click.stop="openMetaDataModal(renderItem)"/>
21
21
  </a-tooltip>
22
22
  <span>&emsp;</span>
23
23
  <a-tooltip title="删除对话">
@@ -25,20 +25,20 @@
25
25
  type="delete"
26
26
  theme="filled"
27
27
  class="delClass"
28
- @click.stop="delQuestion(item,index)"/>
28
+ @click.stop="delQuestion(renderItem,index)"/>
29
29
  </a-tooltip>
30
30
  <span>&emsp;</span>
31
- <a-tooltip :title="item.isFavorite ? '取消收藏' : '收藏'" v-if="item.sql">
31
+ <a-tooltip :title="renderItem.isFavorite ? '取消收藏' : '收藏'" v-if="renderItem.sql">
32
32
  <a-icon
33
33
  type="star"
34
- :class="item.isFavorite ? 'startActive' : 'startInactive'"
35
- @click.stop="toFavorites(item,index)"
36
- :theme=" item.isFavorite ? 'filled': 'twoTone'"
34
+ :class="renderItem.isFavorite ? 'startActive' : 'startInactive'"
35
+ @click.stop="toFavorites(renderItem,index)"
36
+ :theme=" renderItem.isFavorite ? 'filled': 'twoTone'"
37
37
  two-tone-color="#FFD700"/>
38
38
  </a-tooltip>
39
39
  <a-tooltip title="重新查询" v-else>
40
40
  <a-icon
41
- @click.stop="reTrySearch(item, index)"
41
+ @click.stop="reTrySearch(renderItem, index)"
42
42
  type="sync"
43
43
  class="reSearch"
44
44
  title="重新查询"/>
@@ -51,26 +51,26 @@
51
51
  <a-list item-layout="horizontal" :data-source="favorites">
52
52
  <a-list-item
53
53
  slot="renderItem"
54
- slot-scope="item, index"
55
- :class="item.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive'"
56
- @click="handleOpenFavorite(item)">
54
+ slot-scope="renderItem, index"
55
+ :class="renderItem.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive'"
56
+ @click="handleOpenFavorite(renderItem)">
57
57
  <a-list-item-meta
58
- :title="item.question"
59
- :description="item.date"
58
+ :title="renderItem.question"
59
+ :description="renderItem.date"
60
60
  />
61
61
  <a-space>
62
62
  <a-tooltip title="查看元数据">
63
63
  <a-icon
64
- v-if="item.data"
64
+ v-if="renderItem.data"
65
65
  type="eye"
66
- @click.stop="openMetaDataModal(item)"/>
66
+ @click.stop="openMetaDataModal(renderItem)"/>
67
67
  </a-tooltip>
68
68
  <span>&emsp;</span>
69
69
  <a-icon
70
70
  type="star"
71
- :class="item.isFavorite ? 'startActive' : 'startInactive'"
72
- @click.stop="delFavorites(item,index)"
73
- :theme=" item.isFavorite ? 'filled': 'twoTone'"
71
+ :class="renderItem.isFavorite ? 'startActive' : 'startInactive'"
72
+ @click.stop="delFavorites(renderItem,index)"
73
+ :theme=" renderItem.isFavorite ? 'filled': 'twoTone'"
74
74
  two-tone-color="#FFD700"/>
75
75
  </a-space>
76
76
  </a-list-item>
@@ -108,6 +108,9 @@
108
108
  <a-descriptions-item label="sql">
109
109
  {{ item.sql }}
110
110
  </a-descriptions-item>
111
+ <a-descriptions-item label="oldSql">
112
+ {{ item.oldSql }}
113
+ </a-descriptions-item>
111
114
  <a-descriptions-item label="查询日期">
112
115
  {{ item.date }}
113
116
  </a-descriptions-item>
@@ -120,6 +120,7 @@ export default {
120
120
  }).then(res => {
121
121
  this.loading = false
122
122
  const sql = res.sql ? res.sql.replace(/'/g, "''") : null
123
+ const oldSql = res.old_sql ? res.old_sql.replace(/'/g, "''") : null
123
124
  const questionInfo = {
124
125
  uuid: uuid,
125
126
  question: value,
@@ -129,6 +130,7 @@ export default {
129
130
  relationTable: res.relation_table,
130
131
  similarTable: res.similar_table,
131
132
  sql: sql,
133
+ oldSql: oldSql,
132
134
  date: formatDate('now'),
133
135
  data: res.result,
134
136
  isFavorite: false
@@ -350,8 +350,9 @@ function parsefunc (func) {
350
350
  route.router = row.link.split('$')[1]
351
351
  route.params = row.link.split('$')[0]
352
352
  }
353
- if (route.router.includes('?hideInMenu')) {
354
- route.router = route.router.replace('?hideInMenu', '')
353
+ if (route.router.includes('?')) {
354
+ // 把问号后面的都删了
355
+ route.router = route.router.split('?')[0]
355
356
  }
356
357
  if (row.children && row.children.length > 0) {
357
358
  route.children = parsefunc(row.children)