vue2-client 1.8.110 → 1.8.112

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.110",
3
+ "version": "1.8.112",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -8,6 +8,13 @@
8
8
  :columns="tableColumns"
9
9
  :dataSource="tableData"
10
10
  :rowKey="record => record.id">
11
+ <template slot="footer">
12
+ <a-space>
13
+ <span v-for="column in tableColumns" :key="column.key">
14
+ <strong v-if="column.sum !== undefined">{{ `${column.key} : ${column.sum}` }}</strong>
15
+ </span>
16
+ </a-space>
17
+ </template>
11
18
  </a-table>
12
19
  <a-result
13
20
  v-else
@@ -76,12 +83,22 @@ export default {
76
83
  return
77
84
  }
78
85
  const sample = this.tableData[0]
79
- this.tableColumns = Object.keys(sample).map(key => ({
80
- title: key, // 使用键名作为列标题
81
- dataIndex: key, // 数据索引与键名相同
82
- key: key,
83
- ellipsis: true,
84
- }))
86
+ this.tableColumns = Object.keys(sample).map(key => {
87
+ // 检查是否所有的值都是数字
88
+ const allNumbers = this.tableData.every(item => typeof item[key] === 'number')
89
+ let sum = 0
90
+ if (allNumbers) {
91
+ // 计算总和
92
+ sum = this.tableData.reduce((total, item) => total + item[key], 0)
93
+ }
94
+ return {
95
+ title: key, // 使用键名作为列标题
96
+ dataIndex: key, // 数据索引与键名相同
97
+ key: key,
98
+ ellipsis: true,
99
+ sum: allNumbers ? sum : undefined, // 如果所有的值都是数字,添加总和
100
+ }
101
+ })
85
102
  let totalWidth = 0
86
103
  // 设置表格宽度
87
104
  for (let i = 0; i < this.tableColumns.length; i++) {
@@ -11,8 +11,6 @@
11
11
  ref="autoComplete"
12
12
  placeholder="请输入查询的内容"
13
13
  option-label-prop="title"
14
- :open="true"
15
- @select="onSearch"
16
14
  @search="fetchFunction"
17
15
  >
18
16
  <a-spin v-if="searching" slot="notFoundContent" size="small" />
@@ -113,10 +113,10 @@ export default {
113
113
  isFavorite: false,
114
114
  date: formatDate('now')
115
115
  })
116
- let url = '/ai/question'
117
- if (queryType !== 'all') {
118
- url = '/' + url + queryType + '/'
119
- }
116
+ const url = '/ai/question/'
117
+ // if (queryType !== 'all') {
118
+ // url = '/' + url + queryType + '/'
119
+ // }
120
120
  post(url, {
121
121
  messages: [{
122
122
  content: value,