ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<script lang="ts" setup>
import { useTable } from '../../Design/hooks/useTable';
import CardHeader from '../CardHeader/index.vue';
 
const props = defineProps(['activeData']);
const { getTableBindValues, list, getColumns, getOption, getItemStyle, getColumnsStyle, tableListRef, tableElRef, getBorder, handleRowClick } = useTable(
  props.activeData,
);
</script>
<template>
  <a-card class="portal-card-box">
    <template #title v-if="activeData.title">
      <CardHeader :title="activeData.title" :card="activeData.card" />
    </template>
    <div class="portal-card-body portal-card-table" ref="tableListRef">
      <a-table :data-source="list" v-bind="getTableBindValues" ref="tableElRef" v-if="getOption.styleType == 1" :class="{ 'custom-table': getBorder }" />
      <template v-else>
        <template v-if="list.length">
          <div class="item" v-for="(item, i) in list" :key="i" :style="getItemStyle(i)" @click="handleRowClick(item)">
            <div class="top-box">
              <span class="name" :style="getColumnsStyle(0)"> {{ item[getColumns[0].fieldName] }}</span>
              <span class="time" :style="getColumnsStyle(2)" v-if="getOption.styleType == 2">{{ item[getColumns[2].fieldName] }}</span>
            </div>
            <div class="pb-[8px]" :style="getColumnsStyle(1)" v-if="getOption.styleType == 2 || getOption.describe">{{ item[getColumns[1].fieldName] }}</div>
            <div class="pb-[8px]" :style="getColumnsStyle(2)" v-if="getOption.styleType == 3">{{ item[getColumns[2].fieldName] }}</div>
          </div>
        </template>
        <div class="portal-common-noData" v-else>
          <jnpf-empty />
        </div>
      </template>
    </div>
  </a-card>
</template>
<style lang="scss" scoped>
.portal-card-table {
  overflow-y: auto !important;
 
  &:hover {
    cursor: pointer;
  }
 
  .item {
    display: flex;
    flex-direction: column;
    margin: 0 24px;
    border-bottom: 1px solid var(--border-color-base1);
 
    .top-box {
      display: flex;
      align-items: center;
      padding: 12px 0 8px;
 
      .name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
        white-space: nowrap;
      }
 
      .time {
        width: 120px;
        text-align: right;
      }
    }
  }
}
</style>