vue2server7 7.0.110 → 7.0.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/2 CHANGED
@@ -1,30 +1,6 @@
1
- name: Internal Qwen Proxy
2
- version: 1.0.0
3
- schema: v1
4
-
5
- models:
6
- - name: qwen15-32b
7
- provider: openai
8
- model: qwen15-32b
9
- apiKey: anything
10
- apiBase: http://127.0.0.1:3000/v1
11
-
12
- defaultCompletionOptions:
13
- temperature: 0.1
14
- maxTokens: 20000
15
-
16
-
17
- PORT=3000
18
-
19
- TARGET_URL=http://maasapp.aip.bj.bob.test8080/apis/ais-v2/chat/completions
20
- TARGET_API_KEY=你在ProxyAI顶部填写的那个真实API_KEY
21
- TARGET_APP_TAG=proxyai
22
- TARGET_MODEL=qwen15-32b
23
- TARGET_TEMPERATURE=0.1
24
- TARGET_MAX_TOKENS=20000
25
-
26
-
27
-
28
- curl -X POST "http://127.0.0.1:3000/v1/chat/completions" ^
29
- -H "Content-Type: application/json" ^
30
- -d "{\"model\":\"qwen15-32b\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}"
1
+ .el-button + .el-button,
2
+ .el-button + .my-button,
3
+ .my-button + .el-button,
4
+ .my-button + .my-button {
5
+ margin-left: 12px;
6
+ }
@@ -29,10 +29,14 @@ export default {
29
29
  },
30
30
  watch: {
31
31
  modelValue(val) {
32
- this.selected = [...val]
32
+ if (JSON.stringify(val) !== JSON.stringify(this.selected)) {
33
+ this.selected = [...val]
34
+ }
33
35
  },
34
36
  selected(val) {
35
- this.$emit('update:modelValue', val)
37
+ if (JSON.stringify(val) !== JSON.stringify(this.modelValue)) {
38
+ this.$emit('update:modelValue', val)
39
+ }
36
40
  }
37
41
  }
38
42
  }
@@ -0,0 +1,337 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ computed,
4
+ ref,
5
+ useAttrs,
6
+ useSlots,
7
+ cloneVNode,
8
+ type VNode,
9
+ } from 'vue'
10
+ import { useRoute } from 'vue-router'
11
+
12
+ defineOptions({
13
+ name: 'ElTablePlus',
14
+ inheritAttrs: false,
15
+ })
16
+
17
+ const props = withDefaults(
18
+ defineProps<{
19
+ data: any[]
20
+ rowKey?: string
21
+ loading?: boolean
22
+
23
+ tableKey?: string
24
+ columnStorageKey?: string
25
+ columnConfig?: boolean
26
+ columnStorage?: boolean
27
+
28
+ pagination?: boolean
29
+ total?: number
30
+ page?: number
31
+ pageSize?: number
32
+ pageSizes?: number[]
33
+ layout?: string
34
+ }>(),
35
+ {
36
+ data: () => [],
37
+ loading: false,
38
+ columnConfig: true,
39
+ columnStorage: true,
40
+ pagination: true,
41
+ page: 1,
42
+ pageSize: 10,
43
+ pageSizes: () => [10, 20, 50, 100],
44
+ layout: 'total, sizes, prev, pager, next, jumper',
45
+ },
46
+ )
47
+
48
+ const emit = defineEmits<{
49
+ 'update:page': [value: number]
50
+ 'update:pageSize': [value: number]
51
+ 'pagination-change': [value: { page: number; pageSize: number }]
52
+ }>()
53
+
54
+ const route = useRoute()
55
+ const attrs = useAttrs()
56
+ const slots = useSlots()
57
+
58
+ const dialogVisible = ref(false)
59
+ const tableRef = ref()
60
+ const isAllChecked = computed(() => columnOptions.value.length > 0 && columnOptions.value.every(c => c.visible))
61
+ const isIndeterminate = computed(() => columnOptions.value.some(c => c.visible) && !isAllChecked.value)
62
+
63
+ type ColumnOption = {
64
+ key: string
65
+ label: string
66
+ visible: boolean
67
+ vnode: VNode
68
+ }
69
+
70
+ const columnOptions = ref<ColumnOption[]>([])
71
+
72
+ const storageKey = computed(() => {
73
+ if (props.columnStorageKey) {
74
+ return props.columnStorageKey
75
+ }
76
+
77
+ if (props.tableKey) {
78
+ return `el-table-plus:${route.path}:${props.tableKey}`
79
+ }
80
+
81
+ return `el-table-plus:${route.path}`
82
+ })
83
+
84
+ const currentPage = computed({
85
+ get: () => props.page,
86
+ set: value => {
87
+ emit('update:page', value)
88
+ emit('pagination-change', {
89
+ page: value,
90
+ pageSize: props.pageSize,
91
+ })
92
+ },
93
+ })
94
+
95
+ const currentPageSize = computed({
96
+ get: () => props.pageSize,
97
+ set: value => {
98
+ emit('update:pageSize', value)
99
+ emit('pagination-change', {
100
+ page: props.page,
101
+ pageSize: value,
102
+ })
103
+ },
104
+ })
105
+
106
+ const getColumnKey = (vnode: VNode, index: number) => {
107
+ const columnProps = vnode.props as Record<string, any> | null
108
+
109
+ return (
110
+ columnProps?.columnKey ||
111
+ columnProps?.prop ||
112
+ columnProps?.label ||
113
+ columnProps?.type ||
114
+ `column_${index}`
115
+ )
116
+ }
117
+
118
+ const getColumnLabel = (vnode: VNode, index: number) => {
119
+ const columnProps = vnode.props as Record<string, any> | null
120
+
121
+ return (
122
+ columnProps?.label ||
123
+ columnProps?.prop ||
124
+ columnProps?.type ||
125
+ `列 ${index + 1}`
126
+ )
127
+ }
128
+
129
+ const restoreColumnConfig = () => {
130
+ if (!props.columnStorage) return
131
+
132
+ const cache = localStorage.getItem(storageKey.value)
133
+ if (!cache) return
134
+
135
+ try {
136
+ const cacheColumns = JSON.parse(cache) as Array<{
137
+ key: string
138
+ visible: boolean
139
+ }>
140
+
141
+ columnOptions.value.forEach(column => {
142
+ const match = cacheColumns.find(item => item.key === column.key)
143
+ if (match) {
144
+ column.visible = match.visible
145
+ }
146
+ })
147
+ } catch {
148
+ localStorage.removeItem(storageKey.value)
149
+ }
150
+ }
151
+
152
+ const saveColumnConfig = () => {
153
+ if (!props.columnStorage) return
154
+
155
+ const cacheColumns = columnOptions.value.map(column => ({
156
+ key: column.key,
157
+ visible: column.visible,
158
+ }))
159
+
160
+ localStorage.setItem(storageKey.value, JSON.stringify(cacheColumns))
161
+ }
162
+
163
+ const resetColumnConfig = () => {
164
+ columnOptions.value.forEach(column => {
165
+ column.visible = true
166
+ })
167
+
168
+ saveColumnConfig()
169
+ }
170
+
171
+ const initColumns = () => {
172
+ const children = slots.default?.() || []
173
+
174
+ columnOptions.value = children.map((vnode, index) => {
175
+ return {
176
+ key: getColumnKey(vnode, index),
177
+ label: getColumnLabel(vnode, index),
178
+ visible: true,
179
+ vnode,
180
+ }
181
+ })
182
+
183
+ restoreColumnConfig()
184
+ }
185
+
186
+ const visibleColumns = computed(() => {
187
+ return columnOptions.value
188
+ .filter(column => column.visible)
189
+ .map(column => cloneVNode(column.vnode))
190
+ })
191
+
192
+ const toggleAllColumns = (val: boolean) => {
193
+ columnOptions.value.forEach(column => {
194
+ column.visible = val
195
+ })
196
+ saveColumnConfig()
197
+ }
198
+
199
+ initColumns()
200
+
201
+ defineExpose({
202
+ tableRef,
203
+ })
204
+ </script>
205
+
206
+ <template>
207
+ <div class="el-table-plus">
208
+ <div
209
+ v-if="columnConfig"
210
+ class="el-table-plus__toolbar"
211
+ >
212
+ <div class="el-table-plus__toolbar-left">
213
+ <slot name="toolbar" />
214
+ </div>
215
+
216
+ <div class="el-table-plus__toolbar-right">
217
+ <slot name="toolbar-right" />
218
+
219
+ <el-button
220
+ size="small"
221
+ @click="dialogVisible = true"
222
+ >
223
+ 列配置
224
+ </el-button>
225
+ </div>
226
+ </div>
227
+
228
+ <el-table
229
+ ref="tableRef"
230
+ v-bind="attrs"
231
+ v-loading="loading"
232
+ :data="data"
233
+ :row-key="rowKey"
234
+ >
235
+ <component
236
+ :is="column"
237
+ v-for="column in visibleColumns"
238
+ :key="column.key"
239
+ />
240
+ </el-table>
241
+
242
+ <div
243
+ v-if="pagination"
244
+ class="el-table-plus__pagination"
245
+ >
246
+ <el-pagination
247
+ v-model:current-page="currentPage"
248
+ v-model:page-size="currentPageSize"
249
+ :total="total ?? data?.length ?? 0"
250
+ :page-sizes="pageSizes"
251
+ :layout="layout"
252
+ background
253
+ />
254
+ </div>
255
+
256
+ <el-dialog
257
+ v-model="dialogVisible"
258
+ title="列配置"
259
+ width="420px"
260
+ >
261
+ <div class="el-table-plus__column-list">
262
+ <div class="el-table-plus__column-item el-table-plus__column-item--all">
263
+ <el-checkbox
264
+ :model-value="isAllChecked"
265
+ :indeterminate="isIndeterminate"
266
+ @change="toggleAllColumns"
267
+ >
268
+ 全选
269
+ </el-checkbox>
270
+ </div>
271
+
272
+ <el-divider style="margin: 8px 0" />
273
+
274
+ <div
275
+ v-for="column in columnOptions"
276
+ :key="column.key"
277
+ class="el-table-plus__column-item"
278
+ >
279
+ <el-checkbox
280
+ v-model="column.visible"
281
+ @change="saveColumnConfig"
282
+ >
283
+ {{ column.label }}
284
+ </el-checkbox>
285
+ </div>
286
+ </div>
287
+
288
+ <template #footer>
289
+ <el-button @click="resetColumnConfig">
290
+ 重置
291
+ </el-button>
292
+
293
+ <el-button
294
+ type="primary"
295
+ @click="dialogVisible = false"
296
+ >
297
+ 确定
298
+ </el-button>
299
+ </template>
300
+ </el-dialog>
301
+ </div>
302
+ </template>
303
+
304
+ <style scoped>
305
+ .el-table-plus {
306
+ width: 100%;
307
+ }
308
+
309
+ .el-table-plus__toolbar {
310
+ display: flex;
311
+ align-items: center;
312
+ justify-content: space-between;
313
+ margin-bottom: 12px;
314
+ }
315
+
316
+ .el-table-plus__toolbar-left,
317
+ .el-table-plus__toolbar-right {
318
+ display: flex;
319
+ align-items: center;
320
+ gap: 8px;
321
+ }
322
+
323
+ .el-table-plus__pagination {
324
+ display: flex;
325
+ justify-content: flex-end;
326
+ margin-top: 16px;
327
+ }
328
+
329
+ .el-table-plus__column-list {
330
+ max-height: 400px;
331
+ overflow-y: auto;
332
+ }
333
+
334
+ .el-table-plus__column-item {
335
+ margin-bottom: 8px;
336
+ }
337
+ </style>
@@ -0,0 +1,165 @@
1
+ <template>
2
+ <el-button @click="visible = true">
3
+ <el-icon><Setting /></el-icon>
4
+ 列配置
5
+ </el-button>
6
+
7
+ <el-dialog
8
+ v-model="visible"
9
+ title="表格列配置"
10
+ width="760px"
11
+ append-to-body
12
+ >
13
+ <div class="desc">请选择需要在表格中显示的数据列</div>
14
+
15
+ <div class="column-box">
16
+ <div class="check-all-row">
17
+ <el-checkbox
18
+ v-model="checkAll"
19
+ :indeterminate="isIndeterminate"
20
+ @change="handleCheckAllChange"
21
+ >
22
+ 全选
23
+ </el-checkbox>
24
+ </div>
25
+
26
+ <el-checkbox-group
27
+ v-model="checkedKeys"
28
+ class="column-list"
29
+ @change="updateCheckAllStatus"
30
+ >
31
+ <el-checkbox
32
+ v-for="item in columns"
33
+ :key="item.prop"
34
+ :label="item.prop"
35
+ :disabled="item.disabled"
36
+ >
37
+ {{ item.label }}
38
+ </el-checkbox>
39
+ </el-checkbox-group>
40
+ </div>
41
+
42
+ <template #footer>
43
+ <el-button @click="visible = false">取消</el-button>
44
+ <el-button type="primary" @click="handleConfirm">确认</el-button>
45
+ </template>
46
+ </el-dialog>
47
+ </template>
48
+
49
+ <script setup lang="ts">
50
+ import { ref, computed, watch } from 'vue'
51
+ import { Setting } from '@element-plus/icons-vue'
52
+
53
+ interface ColumnOption {
54
+ prop: string
55
+ label: string
56
+ disabled?: boolean
57
+ }
58
+
59
+ const props = defineProps({
60
+ columns: {
61
+ type: Array as () => ColumnOption[],
62
+ default: () => []
63
+ },
64
+ selectedKeys: {
65
+ type: Array as () => string[],
66
+ default: () => []
67
+ },
68
+ buttonText: {
69
+ type: String,
70
+ default: '列配置'
71
+ },
72
+ storageKey: {
73
+ type: String,
74
+ default: ''
75
+ }
76
+ })
77
+
78
+ const emit = defineEmits<{
79
+ (e: 'confirm', keys: string[]): void
80
+ }>()
81
+
82
+ const visible = ref(false)
83
+ const checkedKeys = ref<string[]>([])
84
+ const checkAll = ref(false)
85
+ const isIndeterminate = ref(false)
86
+
87
+ const enabledKeys = computed(() => {
88
+ return props.columns
89
+ .filter(item => !item.disabled)
90
+ .map(item => item.prop)
91
+ })
92
+
93
+ watch(visible, val => {
94
+ if (val) {
95
+ if (props.storageKey) {
96
+ const stored = localStorage.getItem(props.storageKey)
97
+ if (stored) {
98
+ try {
99
+ checkedKeys.value = JSON.parse(stored)
100
+ } catch {
101
+ checkedKeys.value = [...props.selectedKeys]
102
+ }
103
+ } else {
104
+ checkedKeys.value = [...props.selectedKeys]
105
+ }
106
+ } else {
107
+ checkedKeys.value = [...props.selectedKeys]
108
+ }
109
+ updateCheckAllStatus()
110
+ }
111
+ })
112
+
113
+ function handleCheckAllChange(val: boolean) {
114
+ const disabledCheckedKeys = props.columns
115
+ .filter(item => item.disabled && checkedKeys.value.includes(item.prop))
116
+ .map(item => item.prop)
117
+
118
+ checkedKeys.value = val
119
+ ? [...new Set([...disabledCheckedKeys, ...enabledKeys.value])]
120
+ : disabledCheckedKeys
121
+
122
+ updateCheckAllStatus()
123
+ }
124
+
125
+ function updateCheckAllStatus() {
126
+ const count = checkedKeys.value.filter(key =>
127
+ enabledKeys.value.includes(key)
128
+ ).length
129
+
130
+ checkAll.value = count === enabledKeys.value.length
131
+ isIndeterminate.value = count > 0 && count < enabledKeys.value.length
132
+ }
133
+
134
+ function handleConfirm() {
135
+ if (props.storageKey) {
136
+ localStorage.setItem(props.storageKey, JSON.stringify(checkedKeys.value))
137
+ }
138
+ emit('confirm', checkedKeys.value)
139
+ visible.value = false
140
+ }
141
+ </script>
142
+
143
+ <style scoped>
144
+ .desc {
145
+ margin-bottom: 22px;
146
+ color: #666;
147
+ font-size: 16px;
148
+ }
149
+ .column-box {
150
+ border: 1px solid #dcdfe6;
151
+ }
152
+ .check-all-row {
153
+ padding: 18px 24px;
154
+ border-bottom: 1px solid #dcdfe6;
155
+ }
156
+ .column-list {
157
+ padding: 22px 24px;
158
+ display: flex;
159
+ flex-wrap: wrap;
160
+ gap: 22px 28px;
161
+ }
162
+ :deep(.el-checkbox) {
163
+ margin-right: 0;
164
+ }
165
+ </style>