3328350766
6 天以前 761eb03d6b3bebd0b197179564c84d89d3d12a0d
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<template>
  <div
    :class="`bs-indexCard`"
    style="width: 100%;height: 100%;position: relative;"
  >
    <div
      :style="{
        'background-image': `linear-gradient(${customize.gradientDirection}, ${
          gradientColor0 ? gradientColor0 : gradientColor1
        } , ${gradientColor1 ? gradientColor1 : gradientColor0})`,
        'border-radius':customize.borderRadius + 'px',
        border:`${customize.borderWidth}px solid ${customize.borderColor}`,
      }"
      class="content"
    >
      <div
        class="content-right-first"
        :style="{
          'height': customize.firstSize + 'px',
        }"
      >
        <span
          :style="{
            'font-family': config.customize.fontFamily,
            'font-size': customize.firstSize + 'px',
            color:customize.firstColor,
            'font-weight':customize.firstWeight,
            'margin-bottom':customize.lineDistance +'px'
          }"
        >{{ optionData }}</span>
        <span
          :style="{
            'margin-left':'10px',
            'font-size': customize.unitSize + 'px',
            'line-height':customize.unitSize + 'px',
            color:customize.unitColor,
            'margin-bottom':customize.lineDistance +'px'
          }"
        >
          {{ unit }}
        </span>
      </div>
      <div
        :style="{
          'font-size': customize.secondSize + 'px',
          'height':customize.secondSize + 'px',
          color:customize.secondColor,
          'font-weight':customize.secondWeight,
        }"
        class="content-right-second"
      >
        {{ customize.secondLine }}
      </div>
    </div>
  </div>
</template>
<script>
import commonMixins from 'data-room-ui/js/mixins/commonMixins'
import paramsMixins from 'data-room-ui/js/mixins/paramsMixins'
import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
 
export default {
  name: 'Card',
  components: {},
  mixins: [paramsMixins, commonMixins, linkageMixins],
  props: {
    // 卡片的属性
    config: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
      customClass: {}
    }
  },
  watch: {},
  mounted () {
    // this.chartInit()
  },
  computed: {
    gradientColor0 () {
      return this.config.customize.gradientColor0 || this.config.customize.gradientColor1 || 'transparent'
    },
    gradientColor1 () {
      return this.config.customize.gradientColor1 || this.config.customize.gradientColor0 || 'transparent'
    },
    unit () {
      return this.config?.customize.unit || ''
    },
    option () {
      return this.config?.option
    },
    optionData () {
      return this.option?.data ?? 80
    },
    customize () {
      return this.config?.customize
    }
    // tableData () {
    //   let dataList = ''
    //   if (this.optionData instanceof Array && this.optionData.length > 0) {
    //     dataList = this.option?.yField
    //       ? this.optionData[0][this.option.yField]
    //       : this.optionData[0]?.value
    //   } else {
    //     dataList = this.optionData ? this.optionData[this.option.yField] : ''
    //   }
    //   return dataList
    // }
  },
  methods: {
    dataFormatting (config, data) {
      let dataList = ''
      if (data.success) {
        if (data.data instanceof Array) {
          dataList = config.dataSource.dimensionField
            ? data.data[0][config.dataSource.dimensionField]
            : data.data[0].value
        } else {
          dataList = data.data[config.dataSource.dimensionField]
        }
      } else {
        dataList = 80
      }
      config.option = {
        ...config.option,
        data: dataList
      }
      return config
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import "../../assets/fonts/numberFont/stylesheet.css";
.content{
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  text-align: center;
  justify-content: center;
  .content-right-first{
    display: flex;
    justify-content: center;
    align-items: center;
    // width: 100%;
    // text-align: center;
  }
  .content-right-second{
    width: 100%;
    text-align: center;
  }
}
</style>