vue2-client 1.12.24 → 1.12.25

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.
@@ -1,565 +1,565 @@
1
- <template>
2
- <div>
3
- <div v-if="render" class="XCard">
4
- <template v-for="(card, itemIndex) in data">
5
- <a-card :key="'card' + itemIndex" class="data-card">
6
- <div
7
- v-if="config && card[config.ribbon]"
8
- class="ribbon"
9
- :style="{ backgroundColor: getRibbonColor(card[config.ribbonColor]) }">
10
- {{ card[config.ribbon] }}
11
- </div>
12
- <!-- 自定义标题 -->
13
- <template #title>
14
- <div class="custom-title" @click="clickFooter(card, 'cardclick')">
15
- <a-tooltip placement="top">
16
- <template #title>{{ card[config.id] }}</template>
17
- <div class="title-id" v-if="card[config.id]">{{ card[config.id] }}</div>
18
- </a-tooltip>
19
- <div class="title-basic">
20
- <div class="title-main">
21
- <span class="title-name">{{ card[config.title] }}</span>
22
- <span class="title-info">{{ card[config.title2] }}</span>
23
- <span class="title-title3">{{ card[config.title3] }}</span>
24
- </div>
25
- <div class="additional-info" v-if="card[config.subtitle2] || card[config.subtitle3] || card[config.subtitle4]">
26
- <a-tooltip placement="top" v-if="card[config.subtitle2]">
27
- <template #title>{{ card[config.subtitle2] }}</template>
28
- <span class="subtitle2">{{ card[config.subtitle2] }}</span>
29
- </a-tooltip>
30
- <a-tooltip placement="top" v-if="card[config.subtitle3]">
31
- <template #title>{{ card[config.subtitle3] }}</template>
32
- <span class="subtitle3">{{ card[config.subtitle3] }}</span>
33
- </a-tooltip>
34
- <span class="subtitle4" v-if="card[config.subtitle4]">{{ card[config.subtitle4] }}</span>
35
- </div>
36
- </div>
37
- </div>
38
- </template>
39
- <!-- 主体 -->
40
- <div class="body">
41
- <div class="body-text" v-if="card[config.text]">
42
- <a-tooltip :title="card[config.text]">
43
- <span class="text-ellipsis">{{ card[config.text] }}</span>
44
- </a-tooltip>
45
- </div>
46
- <template v-for="(item, bodyIndex) in config.content" v-if="bodyIndex < 6">
47
- <div :key="'body' + bodyIndex" class="body-item">
48
- <span class="body-item-label">{{ item.label }}:</span>
49
- <template v-if="item.type === 'progress'">
50
- <div class="progress">
51
- <div class="progress-bar">
52
- <div class="progress-done" :style="'width:' + card[item.key] * 100 + '%;backgroundColor: ' + determineRatioColor(card[item.key] * 100)"></div>
53
- </div>
54
- </div>
55
- <div class="progress-num">{{ card[item.key] * 100 }}%</div>
56
- </template>
57
- <template v-else-if="item.type === 'custom' && tableColumns">
58
- <!-- 根据 tableColumns 显示自定义内容 -->
59
- <span v-for="column in tableColumns" v-if="column.dataIndex === item.key" :key="column.dataIndex">
60
- <template v-if="column.slotType === 'badge'">
61
- <x-badge
62
- :service-name="serviceName"
63
- :env="env"
64
- :dataCard="true"
65
- :badge-key="column.slotKeyMap"
66
- :value="card[item.key]" />
67
- </template>
68
- <template v-else>
69
- <slot :name="column.slots.customRender">{{ card[item.key] }}</slot>
70
- </template>
71
- </span>
72
- </template>
73
- <template v-else>
74
- <span class="body-item-value">{{ card[item.key] }}</span>
75
- </template>
76
- </div>
77
- <a-divider
78
- v-if="bodyIndex !== config.content.length - 1"
79
- dashed
80
- :key="'body' + bodyIndex + 'after'"
81
- class="body-split" />
82
- </template>
83
- </div>
84
- <!-- 下方按钮 -->
85
- <template #actions>
86
- <a-row align="middle" class="custom-actions" v-if="config && config.footer && config.footer.length > 0">
87
- <template v-for="(item, footerIndex) in config.footer">
88
- <a-col :key="'footer_' + footerIndex" class="footer-item" :span="11" @click="clickFooter(card, item.emit)">
89
- <span>
90
- <a-icon :type="item.icon" class="footer-icon" />
91
- <span>{{ item.label }}</span>
92
- </span>
93
- </a-col>
94
- <a-col
95
- v-if="footerIndex !== config.footer.length - 1"
96
- :span="1"
97
- :key="'footer_' + footerIndex + 'after'"
98
- class="footer-item-split">
99
- |
100
- </a-col>
101
- </template>
102
- </a-row>
103
- </template>
104
- </a-card>
105
- </template>
106
- </div>
107
- <div v-else>
108
- <a-skeleton />
109
- </div>
110
- <div v-if="this.showPagination">
111
- <a-divider />
112
- <a-pagination
113
- v-model="pageNum"
114
- style="float: right"
115
- :total="total"
116
- show-less-items
117
- :page-size="pageSize"
118
- :page-size-options="pageSizeOptions"
119
- show-size-changer
120
- @change="pageNumChange"
121
- :showTotal="paginationShowTotal"
122
- @showSizeChange="pageSizeChange">
123
- </a-pagination>
124
- </div>
125
- </div>
126
- </template>
127
-
128
- <script>
129
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
130
-
131
- export default {
132
- name: 'XDataCard',
133
- components: {
134
- XBadge,
135
- },
136
- props: {
137
- // 卡片数据更新方法
138
- cardData: {
139
- type: Function,
140
- default: undefined
141
- },
142
- // 卡片的配置
143
- cardConfig: {
144
- type: Object,
145
- default: undefined
146
- },
147
- showPagination: {
148
- type: Boolean,
149
- default: false
150
- },
151
- // 临时
152
- testData: {
153
- type: Array,
154
- default: undefined
155
- },
156
- tableColumns: {
157
- type: Array,
158
- default: undefined
159
- },
160
- // 服务名称
161
- serviceName: undefined,
162
- // 当前环境
163
- env: {
164
- type: String,
165
- default: 'prod'
166
- },
167
- // pageSize参数
168
- prePageSize: {
169
- type: Number,
170
- default: undefined
171
- },
172
- // 初始是否加载数据
173
- createdQuery: {
174
- type: Boolean,
175
- default: false
176
- }
177
- },
178
- data () {
179
- return {
180
- // 配置
181
- config: {},
182
- // 数据
183
- data: {},
184
- // 当前页码
185
- pageNum: 1,
186
- // 控制渲染
187
- render: true,
188
- // 分页大小
189
- pageSize: 10,
190
- // 分页大小选项
191
- pageSizeOptions: ['4', '6', '8', '10'],
192
- // 数据总数
193
- total: 0
194
- }
195
- },
196
- created () {
197
- // 根据参数初始化数据值
198
- if (this.prePageSize) {
199
- this.pageSize = this.prePageSize
200
- }
201
- },
202
- mounted () {
203
- // 配置初始化
204
- if (this.cardConfig) {
205
- this.config = this.cardConfig
206
- } else {
207
- this.config = {
208
- id: '未获取到配置',
209
- title: '未获取到配置',
210
- title2: '未获取到配置',
211
- title3: '未获取到配置',
212
- subtitle2: '未获取到配置',
213
- subtitle3: '未获取到配置',
214
- subtitle4: '未获取到配置',
215
- text: '未获取到配置',
216
- ribbon: '未获取到配置',
217
- ribbonColor: '未获取到配置',
218
- content: [
219
- {
220
- label: '未获取到配置',
221
- key: 'one'
222
- },
223
- {
224
- label: '未获取到配置',
225
- key: 'two'
226
- },
227
- {
228
- label: '未获取到配置',
229
- key: 'three'
230
- },
231
- {
232
- label: '未获取到配置',
233
- key: 'four'
234
- },
235
- {
236
- label: '未获取到配置',
237
- key: 'five'
238
- },
239
- {
240
- label: '未获取到配置',
241
- key: 'six',
242
- type: 'progress'
243
- }
244
- ],
245
- footer: [
246
- {
247
- icon: 'edit',
248
- label: '未获取到配置',
249
- emit: 'planEdit'
250
- },
251
- {
252
- icon: 'user',
253
- label: '未获取到配置',
254
- emit: 'user'
255
- }
256
- ]
257
- }
258
- console.warn(this.config)
259
- }
260
-
261
- // 数据初始化
262
- if (this.cardData) {
263
- // if (this.createdQuery) {
264
- // this.loadData()
265
- // }
266
- } else {
267
- this.data = {
268
- one: '未获取到配置',
269
- two: '未获取到配置',
270
- three: '未获取到配置',
271
- four: '未获取到配置',
272
- five: '未获取到配置',
273
- six: 70
274
- }
275
- }
276
- // 测试数据初始化
277
- if (this.testData) {
278
- this.data = this.testData
279
- }
280
- },
281
- methods: {
282
- // 根据比例计算出颜色
283
- determineRatioColor (ratio, isNum = false) {
284
- let result
285
- // 如果是数字,并且比例大于79,则将数字显示为黑色
286
- if (isNum && ratio > 79) {
287
- return 'rgb(0,0,0)'
288
- }
289
- if (ratio >= 90) {
290
- result = 'rgb( 1,245, 38 )'
291
- } else if (ratio >= 75) {
292
- result = 'rgb( 139,245, 0)'
293
- } else if (ratio >= 40) {
294
- result = 'rgb(245,163, 0)'
295
- } else if (ratio >= 20) {
296
- result = 'rgb(244, 96, 0)'
297
- } else {
298
- result = 'rgb(255, 0, 0)'
299
- }
300
- return result
301
- },
302
- // 点击按钮
303
- clickFooter (data, eventName) {
304
- this.$emit('cardEmit', data, eventName)
305
- },
306
- // 获取数据
307
- loadData () {
308
- this.render = false
309
- const parameter = Object.assign({
310
- querySummary: false, // 分页查询的情况不重新获取汇总数据
311
- pageNo: this.pageNum,
312
- pageSize: this.pageSize
313
- }
314
- )
315
- this.cardData(parameter).then(res => {
316
- this.data = res.data
317
- this.total = res.totalCount
318
- this.render = true
319
- })
320
- },
321
- // 页码改变
322
- pageNumChange (page, pageSize) {
323
- this.pageNum = page
324
- this.pageSize = pageSize
325
- this.loadData()
326
- },
327
- // 分页大小改变
328
- pageSizeChange (current, pageSize) {
329
- this.pageSize = pageSize
330
- this.loadData()
331
- },
332
- // 刷新
333
- refresh () {
334
- this.loadData()
335
- },
336
- // 分页前展示当前项和总数
337
- paginationShowTotal () {
338
- return `${(this.pageNum - 1) * this.pageSize + 1 } - ${ this.pageNum * this.pageSize } | 共 ${ this.total } 项`
339
- },
340
- getRibbonColor (color) {
341
- switch (color) {
342
- case 'red':
343
- return '#ff4d4f'
344
- case 'blue':
345
- return '#1890ff'
346
- case 'yellow':
347
- return '#fadb14'
348
- default:
349
- return '#ff4d4f' // 默认红色
350
- }
351
- }
352
- }
353
- }
354
- </script>
355
-
356
- <style lang="less" scoped>
357
- .hide-page-numbers /deep/ .ant-pagination-item,
358
- .hide-page-numbers /deep/ .ant-pagination-jump-next {
359
- display: none !important; /* 隐藏数字页码和多页跳转 */
360
- }
361
- .hide-page-numbers /deep/ .ant-pagination-prev,
362
- .hide-page-numbers /deep/ .ant-pagination-next {
363
- display: inline-block !important; /* 保留左右跳转按钮 */
364
- }
365
-
366
- .XCard {
367
- display: flex;
368
- flex-wrap: wrap;
369
- justify-content: flex-start;
370
- overflow-y: auto;
371
- overflow-x: hidden;
372
- max-height: 85vh;
373
- .data-card {
374
- width: 100%;
375
- max-width: 300px;
376
- border: 2px solid rgb(244,244,244);
377
- border-radius: 5px;
378
- margin: 2px;
379
- overflow: hidden;
380
-
381
- ::v-deep .ant-card-body {
382
- padding: 15px !important; // 使用 !important 确保样式覆盖
383
- }
384
-
385
- .header {
386
- width: 100%;
387
- background-color: rgb(244,244,244);
388
- padding: 5px 15px;
389
-
390
- span {
391
- font-weight: bold;
392
- font-size: 1.1em;
393
- }
394
- }
395
-
396
- .body {
397
- .body-text{
398
- width: 500px;
399
- font-weight: bold;
400
- font-size: 1.1em;
401
- .text-ellipsis{
402
- display: inline-block;
403
- max-width: 260px; /* 控制文本的最大宽度 */
404
- white-space: nowrap;
405
- overflow: hidden;
406
- text-overflow: ellipsis;
407
- }
408
- }
409
-
410
- .body-item {
411
- padding: 3px 5px;
412
- }
413
-
414
- .body-split {
415
- margin: 1px 0;
416
- }
417
-
418
- .body-item-label {
419
- color: rgba(117, 117, 117, 0.8);
420
- font-size: 0.95em;
421
- }
422
-
423
- .body-item-value {
424
- color: black;
425
- }
426
-
427
- .progress {
428
- display: inline-block;
429
- width: 60%;
430
- height: 60%;
431
- float: right;
432
- padding-right: 1.5%;
433
- margin-top: 0.5%;
434
-
435
- .progress-bar {
436
- width: 100%;
437
- height: 90%;
438
- display: inline-block;
439
- border-radius: 10%;
440
- background-color: rgba(212,217,218, 0.6);
441
-
442
- .progress-done {
443
- float: left;
444
- display: inline-block;
445
- height: 100%;
446
- border-radius: 10%;
447
- }
448
- }
449
- }
450
- .progress-num {
451
- position: relative;
452
- top: -83%;
453
- left: -3%;
454
- text-align: end;
455
- font-size: 0.9em;
456
- color: black;
457
- }
458
- }
459
- }
460
-
461
- .custom-title {
462
- display: flex;
463
- align-items: center;
464
- gap: 12px;
465
-
466
- &:hover {
467
- cursor: pointer;
468
- }
469
-
470
- .title-id {
471
- flex-shrink: 0;
472
- width: 65px;
473
- color: #1890ff;
474
- font-size: 16px;
475
- font-weight: bold;
476
- padding: 4px 8px;
477
- border: 1px solid #1890ff;
478
- border-radius: 4px;
479
- line-height: 1.4;
480
- text-align: center;
481
- white-space: nowrap;
482
- overflow: hidden;
483
- text-overflow: ellipsis;
484
- }
485
-
486
- .title-basic {
487
- display: flex;
488
- flex-direction: column;
489
- flex-grow: 1;
490
-
491
- .subtitle2, .subtitle3 {
492
- display: inline-block;
493
- max-width: 50px; /* 固定宽度 */
494
- white-space: nowrap;
495
- overflow: hidden;
496
- text-overflow: ellipsis;
497
- }
498
-
499
- .title-main {
500
- display: flex;
501
- align-items: center;
502
- gap: 8px;
503
- .title-info {
504
- margin-left: 6px;
505
- color: #808080;
506
- }
507
- .title-title3 {
508
- color: #808080;
509
- }
510
- }
511
-
512
- .additional-info {
513
- display: flex;
514
- gap: 8px;
515
- font-size: 13px;
516
- color: #808080;
517
- .subtitle4 {
518
- color: rgba(0, 0, 255, 0.8);
519
- }
520
- }
521
- }
522
- }
523
-
524
- .ribbon {
525
- position: absolute;
526
- top: 16px;
527
- right: -6px;
528
- background-color: #ff4d4f;
529
- color: white;
530
- padding: 5px 25px;
531
- font-size: 12px;
532
- transform: rotate(45deg) translateX(30%);
533
- transform-origin: top right;
534
- z-index: 1;
535
- }
536
-
537
- .custom-actions {
538
- .footer-icon {
539
- margin-right: 5px;
540
- }
541
-
542
- .footer-item-split {
543
- color: rgba(220, 220, 220, 0.59);
544
- }
545
-
546
- .footer-item {
547
- color: rgba(117, 117, 117, 0.8);
548
- font-size: 1em;
549
- }
550
-
551
- .footer-item:hover {
552
- color: rgb( 24,144,255 );
553
- cursor: pointer;
554
- }
555
- }
556
- }
557
-
558
- .ellipsis {
559
- display: inline-block;
560
- max-width: 60px;
561
- white-space: nowrap;
562
- overflow: hidden;
563
- text-overflow: ellipsis;
564
- }
565
- </style>
1
+ <template>
2
+ <div>
3
+ <div v-if="render" class="XCard">
4
+ <template v-for="(card, itemIndex) in data">
5
+ <a-card :key="'card' + itemIndex" class="data-card">
6
+ <div
7
+ v-if="config && card[config.ribbon]"
8
+ class="ribbon"
9
+ :style="{ backgroundColor: getRibbonColor(card[config.ribbonColor]) }">
10
+ {{ card[config.ribbon] }}
11
+ </div>
12
+ <!-- 自定义标题 -->
13
+ <template #title>
14
+ <div class="custom-title" @click="clickFooter(card, 'cardclick')">
15
+ <a-tooltip placement="top">
16
+ <template #title>{{ card[config.id] }}</template>
17
+ <div class="title-id" v-if="card[config.id]">{{ card[config.id] }}</div>
18
+ </a-tooltip>
19
+ <div class="title-basic">
20
+ <div class="title-main">
21
+ <span class="title-name">{{ card[config.title] }}</span>
22
+ <span class="title-info">{{ card[config.title2] }}</span>
23
+ <span class="title-title3">{{ card[config.title3] }}</span>
24
+ </div>
25
+ <div class="additional-info" v-if="card[config.subtitle2] || card[config.subtitle3] || card[config.subtitle4]">
26
+ <a-tooltip placement="top" v-if="card[config.subtitle2]">
27
+ <template #title>{{ card[config.subtitle2] }}</template>
28
+ <span class="subtitle2">{{ card[config.subtitle2] }}</span>
29
+ </a-tooltip>
30
+ <a-tooltip placement="top" v-if="card[config.subtitle3]">
31
+ <template #title>{{ card[config.subtitle3] }}</template>
32
+ <span class="subtitle3">{{ card[config.subtitle3] }}</span>
33
+ </a-tooltip>
34
+ <span class="subtitle4" v-if="card[config.subtitle4]">{{ card[config.subtitle4] }}</span>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </template>
39
+ <!-- 主体 -->
40
+ <div class="body">
41
+ <div class="body-text" v-if="card[config.text]">
42
+ <a-tooltip :title="card[config.text]">
43
+ <span class="text-ellipsis">{{ card[config.text] }}</span>
44
+ </a-tooltip>
45
+ </div>
46
+ <template v-for="(item, bodyIndex) in config.content" v-if="bodyIndex < 6">
47
+ <div :key="'body' + bodyIndex" class="body-item">
48
+ <span class="body-item-label">{{ item.label }}:</span>
49
+ <template v-if="item.type === 'progress'">
50
+ <div class="progress">
51
+ <div class="progress-bar">
52
+ <div class="progress-done" :style="'width:' + card[item.key] * 100 + '%;backgroundColor: ' + determineRatioColor(card[item.key] * 100)"></div>
53
+ </div>
54
+ </div>
55
+ <div class="progress-num">{{ card[item.key] * 100 }}%</div>
56
+ </template>
57
+ <template v-else-if="item.type === 'custom' && tableColumns">
58
+ <!-- 根据 tableColumns 显示自定义内容 -->
59
+ <span v-for="column in tableColumns" v-if="column.dataIndex === item.key" :key="column.dataIndex">
60
+ <template v-if="column.slotType === 'badge'">
61
+ <x-badge
62
+ :service-name="serviceName"
63
+ :env="env"
64
+ :dataCard="true"
65
+ :badge-key="column.slotKeyMap"
66
+ :value="card[item.key]" />
67
+ </template>
68
+ <template v-else>
69
+ <slot :name="column.slots.customRender">{{ card[item.key] }}</slot>
70
+ </template>
71
+ </span>
72
+ </template>
73
+ <template v-else>
74
+ <span class="body-item-value">{{ card[item.key] }}</span>
75
+ </template>
76
+ </div>
77
+ <a-divider
78
+ v-if="bodyIndex !== config.content.length - 1"
79
+ dashed
80
+ :key="'body' + bodyIndex + 'after'"
81
+ class="body-split" />
82
+ </template>
83
+ </div>
84
+ <!-- 下方按钮 -->
85
+ <template #actions>
86
+ <a-row align="middle" class="custom-actions" v-if="config && config.footer && config.footer.length > 0">
87
+ <template v-for="(item, footerIndex) in config.footer">
88
+ <a-col :key="'footer_' + footerIndex" class="footer-item" :span="11" @click="clickFooter(card, item.emit)">
89
+ <span>
90
+ <a-icon :type="item.icon" class="footer-icon" />
91
+ <span>{{ item.label }}</span>
92
+ </span>
93
+ </a-col>
94
+ <a-col
95
+ v-if="footerIndex !== config.footer.length - 1"
96
+ :span="1"
97
+ :key="'footer_' + footerIndex + 'after'"
98
+ class="footer-item-split">
99
+ |
100
+ </a-col>
101
+ </template>
102
+ </a-row>
103
+ </template>
104
+ </a-card>
105
+ </template>
106
+ </div>
107
+ <div v-else>
108
+ <a-skeleton />
109
+ </div>
110
+ <div v-if="this.showPagination">
111
+ <a-divider />
112
+ <a-pagination
113
+ v-model="pageNum"
114
+ style="float: right"
115
+ :total="total"
116
+ show-less-items
117
+ :page-size="pageSize"
118
+ :page-size-options="pageSizeOptions"
119
+ show-size-changer
120
+ @change="pageNumChange"
121
+ :showTotal="paginationShowTotal"
122
+ @showSizeChange="pageSizeChange">
123
+ </a-pagination>
124
+ </div>
125
+ </div>
126
+ </template>
127
+
128
+ <script>
129
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
130
+
131
+ export default {
132
+ name: 'XDataCard',
133
+ components: {
134
+ XBadge,
135
+ },
136
+ props: {
137
+ // 卡片数据更新方法
138
+ cardData: {
139
+ type: Function,
140
+ default: undefined
141
+ },
142
+ // 卡片的配置
143
+ cardConfig: {
144
+ type: Object,
145
+ default: undefined
146
+ },
147
+ showPagination: {
148
+ type: Boolean,
149
+ default: false
150
+ },
151
+ // 临时
152
+ testData: {
153
+ type: Array,
154
+ default: undefined
155
+ },
156
+ tableColumns: {
157
+ type: Array,
158
+ default: undefined
159
+ },
160
+ // 服务名称
161
+ serviceName: undefined,
162
+ // 当前环境
163
+ env: {
164
+ type: String,
165
+ default: 'prod'
166
+ },
167
+ // pageSize参数
168
+ prePageSize: {
169
+ type: Number,
170
+ default: undefined
171
+ },
172
+ // 初始是否加载数据
173
+ createdQuery: {
174
+ type: Boolean,
175
+ default: false
176
+ }
177
+ },
178
+ data () {
179
+ return {
180
+ // 配置
181
+ config: {},
182
+ // 数据
183
+ data: {},
184
+ // 当前页码
185
+ pageNum: 1,
186
+ // 控制渲染
187
+ render: true,
188
+ // 分页大小
189
+ pageSize: 10,
190
+ // 分页大小选项
191
+ pageSizeOptions: ['4', '6', '8', '10'],
192
+ // 数据总数
193
+ total: 0
194
+ }
195
+ },
196
+ created () {
197
+ // 根据参数初始化数据值
198
+ if (this.prePageSize) {
199
+ this.pageSize = this.prePageSize
200
+ }
201
+ },
202
+ mounted () {
203
+ // 配置初始化
204
+ if (this.cardConfig) {
205
+ this.config = this.cardConfig
206
+ } else {
207
+ this.config = {
208
+ id: '未获取到配置',
209
+ title: '未获取到配置',
210
+ title2: '未获取到配置',
211
+ title3: '未获取到配置',
212
+ subtitle2: '未获取到配置',
213
+ subtitle3: '未获取到配置',
214
+ subtitle4: '未获取到配置',
215
+ text: '未获取到配置',
216
+ ribbon: '未获取到配置',
217
+ ribbonColor: '未获取到配置',
218
+ content: [
219
+ {
220
+ label: '未获取到配置',
221
+ key: 'one'
222
+ },
223
+ {
224
+ label: '未获取到配置',
225
+ key: 'two'
226
+ },
227
+ {
228
+ label: '未获取到配置',
229
+ key: 'three'
230
+ },
231
+ {
232
+ label: '未获取到配置',
233
+ key: 'four'
234
+ },
235
+ {
236
+ label: '未获取到配置',
237
+ key: 'five'
238
+ },
239
+ {
240
+ label: '未获取到配置',
241
+ key: 'six',
242
+ type: 'progress'
243
+ }
244
+ ],
245
+ footer: [
246
+ {
247
+ icon: 'edit',
248
+ label: '未获取到配置',
249
+ emit: 'planEdit'
250
+ },
251
+ {
252
+ icon: 'user',
253
+ label: '未获取到配置',
254
+ emit: 'user'
255
+ }
256
+ ]
257
+ }
258
+ console.warn(this.config)
259
+ }
260
+
261
+ // 数据初始化
262
+ if (this.cardData) {
263
+ // if (this.createdQuery) {
264
+ // this.loadData()
265
+ // }
266
+ } else {
267
+ this.data = {
268
+ one: '未获取到配置',
269
+ two: '未获取到配置',
270
+ three: '未获取到配置',
271
+ four: '未获取到配置',
272
+ five: '未获取到配置',
273
+ six: 70
274
+ }
275
+ }
276
+ // 测试数据初始化
277
+ if (this.testData) {
278
+ this.data = this.testData
279
+ }
280
+ },
281
+ methods: {
282
+ // 根据比例计算出颜色
283
+ determineRatioColor (ratio, isNum = false) {
284
+ let result
285
+ // 如果是数字,并且比例大于79,则将数字显示为黑色
286
+ if (isNum && ratio > 79) {
287
+ return 'rgb(0,0,0)'
288
+ }
289
+ if (ratio >= 90) {
290
+ result = 'rgb( 1,245, 38 )'
291
+ } else if (ratio >= 75) {
292
+ result = 'rgb( 139,245, 0)'
293
+ } else if (ratio >= 40) {
294
+ result = 'rgb(245,163, 0)'
295
+ } else if (ratio >= 20) {
296
+ result = 'rgb(244, 96, 0)'
297
+ } else {
298
+ result = 'rgb(255, 0, 0)'
299
+ }
300
+ return result
301
+ },
302
+ // 点击按钮
303
+ clickFooter (data, eventName) {
304
+ this.$emit('cardEmit', data, eventName)
305
+ },
306
+ // 获取数据
307
+ loadData () {
308
+ this.render = false
309
+ const parameter = Object.assign({
310
+ querySummary: false, // 分页查询的情况不重新获取汇总数据
311
+ pageNo: this.pageNum,
312
+ pageSize: this.pageSize
313
+ }
314
+ )
315
+ this.cardData(parameter).then(res => {
316
+ this.data = res.data
317
+ this.total = res.totalCount
318
+ this.render = true
319
+ })
320
+ },
321
+ // 页码改变
322
+ pageNumChange (page, pageSize) {
323
+ this.pageNum = page
324
+ this.pageSize = pageSize
325
+ this.loadData()
326
+ },
327
+ // 分页大小改变
328
+ pageSizeChange (current, pageSize) {
329
+ this.pageSize = pageSize
330
+ this.loadData()
331
+ },
332
+ // 刷新
333
+ refresh () {
334
+ this.loadData()
335
+ },
336
+ // 分页前展示当前项和总数
337
+ paginationShowTotal () {
338
+ return `${(this.pageNum - 1) * this.pageSize + 1 } - ${ this.pageNum * this.pageSize } | 共 ${ this.total } 项`
339
+ },
340
+ getRibbonColor (color) {
341
+ switch (color) {
342
+ case 'red':
343
+ return '#ff4d4f'
344
+ case 'blue':
345
+ return '#1890ff'
346
+ case 'yellow':
347
+ return '#fadb14'
348
+ default:
349
+ return '#ff4d4f' // 默认红色
350
+ }
351
+ }
352
+ }
353
+ }
354
+ </script>
355
+
356
+ <style lang="less" scoped>
357
+ .hide-page-numbers /deep/ .ant-pagination-item,
358
+ .hide-page-numbers /deep/ .ant-pagination-jump-next {
359
+ display: none !important; /* 隐藏数字页码和多页跳转 */
360
+ }
361
+ .hide-page-numbers /deep/ .ant-pagination-prev,
362
+ .hide-page-numbers /deep/ .ant-pagination-next {
363
+ display: inline-block !important; /* 保留左右跳转按钮 */
364
+ }
365
+
366
+ .XCard {
367
+ display: flex;
368
+ flex-wrap: wrap;
369
+ justify-content: flex-start;
370
+ overflow-y: auto;
371
+ overflow-x: hidden;
372
+ max-height: 85vh;
373
+ .data-card {
374
+ width: 100%;
375
+ max-width: 300px;
376
+ border: 2px solid rgb(244,244,244);
377
+ border-radius: 5px;
378
+ margin: 2px;
379
+ overflow: hidden;
380
+
381
+ ::v-deep .ant-card-body {
382
+ padding: 15px !important; // 使用 !important 确保样式覆盖
383
+ }
384
+
385
+ .header {
386
+ width: 100%;
387
+ background-color: rgb(244,244,244);
388
+ padding: 5px 15px;
389
+
390
+ span {
391
+ font-weight: bold;
392
+ font-size: 1.1em;
393
+ }
394
+ }
395
+
396
+ .body {
397
+ .body-text{
398
+ width: 500px;
399
+ font-weight: bold;
400
+ font-size: 1.1em;
401
+ .text-ellipsis{
402
+ display: inline-block;
403
+ max-width: 260px; /* 控制文本的最大宽度 */
404
+ white-space: nowrap;
405
+ overflow: hidden;
406
+ text-overflow: ellipsis;
407
+ }
408
+ }
409
+
410
+ .body-item {
411
+ padding: 3px 5px;
412
+ }
413
+
414
+ .body-split {
415
+ margin: 1px 0;
416
+ }
417
+
418
+ .body-item-label {
419
+ color: rgba(117, 117, 117, 0.8);
420
+ font-size: 0.95em;
421
+ }
422
+
423
+ .body-item-value {
424
+ color: black;
425
+ }
426
+
427
+ .progress {
428
+ display: inline-block;
429
+ width: 60%;
430
+ height: 60%;
431
+ float: right;
432
+ padding-right: 1.5%;
433
+ margin-top: 0.5%;
434
+
435
+ .progress-bar {
436
+ width: 100%;
437
+ height: 90%;
438
+ display: inline-block;
439
+ border-radius: 10%;
440
+ background-color: rgba(212,217,218, 0.6);
441
+
442
+ .progress-done {
443
+ float: left;
444
+ display: inline-block;
445
+ height: 100%;
446
+ border-radius: 10%;
447
+ }
448
+ }
449
+ }
450
+ .progress-num {
451
+ position: relative;
452
+ top: -83%;
453
+ left: -3%;
454
+ text-align: end;
455
+ font-size: 0.9em;
456
+ color: black;
457
+ }
458
+ }
459
+ }
460
+
461
+ .custom-title {
462
+ display: flex;
463
+ align-items: center;
464
+ gap: 12px;
465
+
466
+ &:hover {
467
+ cursor: pointer;
468
+ }
469
+
470
+ .title-id {
471
+ flex-shrink: 0;
472
+ width: 65px;
473
+ color: #1890ff;
474
+ font-size: 16px;
475
+ font-weight: bold;
476
+ padding: 4px 8px;
477
+ border: 1px solid #1890ff;
478
+ border-radius: 4px;
479
+ line-height: 1.4;
480
+ text-align: center;
481
+ white-space: nowrap;
482
+ overflow: hidden;
483
+ text-overflow: ellipsis;
484
+ }
485
+
486
+ .title-basic {
487
+ display: flex;
488
+ flex-direction: column;
489
+ flex-grow: 1;
490
+
491
+ .subtitle2, .subtitle3 {
492
+ display: inline-block;
493
+ max-width: 50px; /* 固定宽度 */
494
+ white-space: nowrap;
495
+ overflow: hidden;
496
+ text-overflow: ellipsis;
497
+ }
498
+
499
+ .title-main {
500
+ display: flex;
501
+ align-items: center;
502
+ gap: 8px;
503
+ .title-info {
504
+ margin-left: 6px;
505
+ color: #808080;
506
+ }
507
+ .title-title3 {
508
+ color: #808080;
509
+ }
510
+ }
511
+
512
+ .additional-info {
513
+ display: flex;
514
+ gap: 8px;
515
+ font-size: 13px;
516
+ color: #808080;
517
+ .subtitle4 {
518
+ color: rgba(0, 0, 255, 0.8);
519
+ }
520
+ }
521
+ }
522
+ }
523
+
524
+ .ribbon {
525
+ position: absolute;
526
+ top: 16px;
527
+ right: -6px;
528
+ background-color: #ff4d4f;
529
+ color: white;
530
+ padding: 5px 25px;
531
+ font-size: 12px;
532
+ transform: rotate(45deg) translateX(30%);
533
+ transform-origin: top right;
534
+ z-index: 1;
535
+ }
536
+
537
+ .custom-actions {
538
+ .footer-icon {
539
+ margin-right: 5px;
540
+ }
541
+
542
+ .footer-item-split {
543
+ color: rgba(220, 220, 220, 0.59);
544
+ }
545
+
546
+ .footer-item {
547
+ color: rgba(117, 117, 117, 0.8);
548
+ font-size: 1em;
549
+ }
550
+
551
+ .footer-item:hover {
552
+ color: rgb( 24,144,255 );
553
+ cursor: pointer;
554
+ }
555
+ }
556
+ }
557
+
558
+ .ellipsis {
559
+ display: inline-block;
560
+ max-width: 60px;
561
+ white-space: nowrap;
562
+ overflow: hidden;
563
+ text-overflow: ellipsis;
564
+ }
565
+ </style>