You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
3.3 KiB
Vue
146 lines
3.3 KiB
Vue
2 years ago
|
<template>
|
||
|
<div
|
||
2 years ago
|
:class="`bs-indexCard`"
|
||
2 years ago
|
style="width: 100%;height: 100%;position: relative;"
|
||
|
>
|
||
|
<div
|
||
|
:style="{
|
||
|
'background-color':customize.bgColor,
|
||
|
'border-radius':customize.borderRadius + 'px',
|
||
|
border:`${customize.borderWidth}px solid ${customize.borderColor}`,
|
||
|
}"
|
||
|
class="content"
|
||
|
>
|
||
|
<div
|
||
|
:style="{
|
||
|
'margin-right':customize.distance + 'px'
|
||
|
}"
|
||
|
class="content-left"
|
||
|
>
|
||
|
<el-image
|
||
|
:style="{
|
||
|
width: customize.imgSize + 'px',
|
||
|
height: customize.imgSize + 'px',
|
||
|
}"
|
||
|
:src="customize.src"
|
||
|
fit="contain"
|
||
|
/>
|
||
|
</div>
|
||
|
<div class="content-right">
|
||
|
<span
|
||
|
class="content-right-first"
|
||
|
:style="{
|
||
|
'font-size': customize.firstSize + 'px',
|
||
|
'height':customize.firstSize + 'px',
|
||
|
color:customize.firstColor,
|
||
|
'font-weight':customize.firstWeight,
|
||
|
'margin-bottom':customize.lineDistance +'px'
|
||
|
}"
|
||
1 year ago
|
>{{ optionData}}</span>
|
||
2 years ago
|
<span
|
||
|
:style="{
|
||
|
'font-size': customize.secondSize + 'px',
|
||
|
'height':customize.secondSize + 'px',
|
||
|
color:customize.secondColor,
|
||
|
'font-weight':customize.secondWeight,
|
||
|
}"
|
||
2 years ago
|
class="content-right-second"
|
||
|
>
|
||
2 years ago
|
{{ customize.secondLine }}
|
||
|
</span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
1 year ago
|
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'
|
||
2 years ago
|
export default {
|
||
|
name: 'Card',
|
||
|
components: {},
|
||
1 year ago
|
mixins: [paramsMixins, commonMixins, linkageMixins],
|
||
2 years ago
|
props: {
|
||
|
// 卡片的属性
|
||
|
config: {
|
||
|
type: Object,
|
||
|
default: () => ({})
|
||
|
}
|
||
|
},
|
||
2 years ago
|
data () {
|
||
2 years ago
|
return {
|
||
|
customClass: {}
|
||
|
}
|
||
|
},
|
||
|
watch: {},
|
||
|
mounted () {
|
||
|
},
|
||
|
computed: {
|
||
|
option () {
|
||
|
return this.config?.option
|
||
|
},
|
||
|
optionData () {
|
||
1 year ago
|
return this.option?.data || 0
|
||
2 years ago
|
},
|
||
|
customize () {
|
||
1 year ago
|
return this.config?.customize
|
||
2 years ago
|
},
|
||
1 year ago
|
},
|
||
|
methods: {
|
||
|
dataFormatting (config, data) {
|
||
2 years ago
|
let dataList = ''
|
||
1 year ago
|
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=0
|
||
2 years ago
|
}
|
||
1 year ago
|
config.option = {
|
||
|
...config.option,
|
||
|
data: dataList
|
||
|
}
|
||
|
return config
|
||
2 years ago
|
}
|
||
1 year ago
|
}
|
||
2 years ago
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.content{
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
height: 100%;
|
||
|
width: 100%;
|
||
|
// background-color: aliceblue;
|
||
|
justify-content: center;
|
||
|
.content-left{
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
height: 100%;
|
||
|
align-items: center;
|
||
|
}
|
||
|
.content-right{
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
height: 100%;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
.content-right-first{
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
align-items: center;
|
||
|
padding-bottom: 5px;
|
||
|
}
|
||
|
.content-right-second{
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
align-items: center;
|
||
|
}
|
||
|
}
|
||
|
</style>
|