lw-cdp-ui 1.1.50 → 1.1.52

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.
@@ -30,6 +30,7 @@
30
30
 
31
31
  <!-- 表单内容 -->
32
32
  <el-form-item v-else
33
+ :class="{ 'form-item-name-null': !item?.label }"
33
34
  :prop="getPropName(item)"
34
35
  :rules="rulesHandle(item)">
35
36
  <template #label>
@@ -524,7 +525,13 @@ export default {
524
525
  font-weight: bold;
525
526
  margin-bottom: 10px;
526
527
  margin-top: 10px;
527
- // border-top: 1px solid #efefef;
528
+ border-top: 10px solid #f5f7fa;
528
529
  padding-top: 20px;
529
530
  }
531
+
532
+ :deep(.form-item-name-null) {
533
+ > .el-form-item__label {
534
+ display: none !important;
535
+ }
536
+ }
530
537
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-table :data="tableData"
2
+ <el-table :data="dataList"
3
3
  stripe
4
4
  ref="table"
5
5
  :columns="config.formItems"
@@ -285,6 +285,15 @@
285
285
  </template>
286
286
  </el-table-column>
287
287
  </el-table>
288
+ <div v-if="isPagination && tableData.length > pageSize"
289
+ class="pagination-body">
290
+ <el-pagination size="small"
291
+ background
292
+ :page-size="pageSize"
293
+ v-model:current-page="currentPage"
294
+ layout="prev, pager, next"
295
+ :total="tableData.length" />
296
+ </div>
288
297
  <div v-if="!isView"
289
298
  class="btn-list">
290
299
  <el-button type="primary"
@@ -306,15 +315,17 @@ export default {
306
315
  modelValue: { type: Object, default: () => { } },
307
316
  config: { type: Object, default: () => { } },
308
317
  maxHeight: { type: String, default: 'calc(100vh - 280px)' },
309
- /**
310
- * 是否是查看模式
311
- */
318
+ // 是否是查看模式
312
319
  isView: { type: Boolean, default: false },
320
+ // 是否分页
321
+ isPagination: { type: Boolean, default: false },
313
322
  },
314
323
  data() {
315
324
  return {
316
325
  tableData: [],
317
326
  tagValue: '',
327
+ currentPage: 1,
328
+ pageSize: 8,
318
329
  ids: [],
319
330
  internalUpdate: true,
320
331
  tagVisible: false,
@@ -347,7 +358,20 @@ export default {
347
358
  hasValue() {
348
359
  return Object.keys(this.modelValue).length > 0
349
360
  },
361
+ dataList() {
362
+ if (!this.isPagination) {
363
+ // 如果不需要分页,直接返回所有数据
364
+ return this.tableData;
365
+ }
366
+
367
+ const currentPage = this.currentPage; // 当前页码
350
368
 
369
+ // 计算分页起始位置
370
+ const startIndex = (currentPage - 1) * this.pageSize;
371
+
372
+ // 返回分页后的数据
373
+ return this.tableData.slice(startIndex, startIndex + this.pageSize);
374
+ }
351
375
  },
352
376
  mounted() {
353
377
  this.tableData = this.flattenObject(this.modelValue)
@@ -362,7 +386,7 @@ export default {
362
386
  if (obj.hasOwnProperty(key)) {
363
387
  const newKey = prefix ? `${prefix}.${key}` : key;
364
388
 
365
- if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {
389
+ if ( key != 'errorMsg' && typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {
366
390
  // 递归处理嵌套对象
367
391
  Object.assign(result, getObj(obj[key], newKey));
368
392
  } else {
@@ -449,7 +473,7 @@ export default {
449
473
  }
450
474
  });
451
475
  });
452
-
476
+ console.log(tableData)
453
477
  if (validationMessages.length > 0) {
454
478
  this.$message.warning(`校验失败,存在必填字段为空,请检查`)
455
479
  return true; // 如果有校验失败
@@ -554,27 +578,6 @@ export default {
554
578
  })
555
579
  return obj1;
556
580
  },
557
- //处理动态禁用
558
- hideHandle(item, row) {
559
- if (typeof item.hideHandle === 'string') {
560
- // eslint-disable-next-line no-eval
561
- const exp = eval(item.hideHandle.replace(/\$/g, "row"))
562
- return exp
563
- } else if (typeof item.hideHandle === 'boolean') {
564
- return item.hideHandle
565
- }
566
- return false
567
- },
568
- //处理动态必填
569
- rulesHandle(item) {
570
- if (item.requiredHandle) {
571
- // eslint-disable-next-line no-eval
572
- const exp = eval(item.requiredHandle.replace(/\$/g, "form"))
573
- var requiredRule = item.rules.find(t => 'required' in t)
574
- requiredRule.required = exp
575
- }
576
- return item.rules
577
- },
578
581
  // 删除tag
579
582
  tagClose(tag, item) {
580
583
  item.splice(item.indexOf(tag), 1)
@@ -652,4 +655,9 @@ export default {
652
655
  width: 100%;
653
656
  }
654
657
  }
658
+ .pagination-body {
659
+ padding-top: 10px;
660
+ display: flex;
661
+ justify-content: flex-end;
662
+ }
655
663
  </style>
@@ -71,7 +71,7 @@
71
71
  fit="cover"></el-image>
72
72
  </div>
73
73
 
74
- <div class="el-upload__tip">
74
+ <div v-if="tip" class="el-upload__tip">
75
75
  {{tip}}
76
76
  </div>
77
77
  </div>
@@ -351,6 +351,7 @@ export default {
351
351
 
352
352
  .lw-upload .el-upload--picture-card {
353
353
  border-radius: 0;
354
+ height: 100%;
354
355
  }
355
356
 
356
357
  .lw-upload .uploader,
@@ -452,7 +453,7 @@ export default {
452
453
  align-items: center;
453
454
  flex-wrap: wrap;
454
455
  gap: 10px;
455
- margin-bottom: 10px;
456
+ // margin-bottom: 10px;
456
457
  }
457
458
 
458
459
  .lw-upload .file-empty i {