|
@@ -1,9 +1,12 @@
|
|
<template>
|
|
<template>
|
|
<div class="cradDataControllerShow" :style="getCardStyle()">
|
|
<div class="cradDataControllerShow" :style="getCardStyle()">
|
|
<template v-for="(item,index) in list" >
|
|
<template v-for="(item,index) in list" >
|
|
- <div :key="index" v-if="index < (config.showRow * config.showColumn)" :style="getStyle(item)">
|
|
|
|
- <div >
|
|
|
|
- {{item.title}} : {{item.execValue}}
|
|
|
|
|
|
+ <div :key="index" v-if="index < (config.showRow * config.showColumn)" :style="config.showMode === 1 ? getStyle(item) : getTextStyle(item)">
|
|
|
|
+ <div :style="titleStyle(item)">
|
|
|
|
+ {{item.title}} :
|
|
|
|
+ </div>
|
|
|
|
+ <div :style="dataStyle(item)">
|
|
|
|
+ {{item.execValue}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -24,10 +27,31 @@ export default {
|
|
'flex-wrap':this.config.showRow == 1 ? 'nowrap' : 'wrap'
|
|
'flex-wrap':this.config.showRow == 1 ? 'nowrap' : 'wrap'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ titleStyle(item){
|
|
|
|
+ let styleJson = JSON.parse(this.config.styleJson);
|
|
|
|
+ let itemStyleJson = item.style ? JSON.parse(item.style) : null
|
|
|
|
+ return {
|
|
|
|
+ 'color':itemStyleJson && itemStyleJson.titleFontColor,
|
|
|
|
+ 'font-size': `${Number(itemStyleJson.titleFontSize)}px`,
|
|
|
|
+ display:styleJson && styleJson.titleDataStyle === '1' ? 'inline' : 'block'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ dataStyle(item){
|
|
|
|
+ let styleJson = JSON.parse(this.config.styleJson);
|
|
|
|
+ let itemStyleJson = item.style ? JSON.parse(item.style) : null
|
|
|
|
+ return {
|
|
|
|
+ 'color':itemStyleJson && itemStyleJson.fontColor,
|
|
|
|
+ 'font-size': `${Number(itemStyleJson.fontSize)}px`,
|
|
|
|
+ display:styleJson && styleJson.titleDataStyle === '1' ? 'inline' : 'block'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
getStyle(item) {
|
|
getStyle(item) {
|
|
let styleJson = JSON.parse(this.config.styleJson);
|
|
let styleJson = JSON.parse(this.config.styleJson);
|
|
const flexBasis = `calc(${100 / this.config.showColumn}% - 10px)`;
|
|
const flexBasis = `calc(${100 / this.config.showColumn}% - 10px)`;
|
|
let itemStyleJson = item.style ? JSON.parse(item.style) : null
|
|
let itemStyleJson = item.style ? JSON.parse(item.style) : null
|
|
|
|
+ // 添加默认值以防止 undefined
|
|
|
|
+ const boxHeight = Number(styleJson.boxHeight || 0);
|
|
|
|
+ const dbBoxHeight = boxHeight / 2
|
|
return {
|
|
return {
|
|
borderWidth: itemStyleJson && itemStyleJson.shadowFlag ? itemStyleJson.borderWeight + 'px' : 'none',
|
|
borderWidth: itemStyleJson && itemStyleJson.shadowFlag ? itemStyleJson.borderWeight + 'px' : 'none',
|
|
borderStyle: itemStyleJson && itemStyleJson.shadowFlag ? itemStyleJson.borderStyle : 'none',
|
|
borderStyle: itemStyleJson && itemStyleJson.shadowFlag ? itemStyleJson.borderStyle : 'none',
|
|
@@ -37,20 +61,27 @@ export default {
|
|
backgroundImage:itemStyleJson && itemStyleJson.backgroundType === 3 ? `url(${JSON.stringify(itemStyleJson.blockImg)})` : 'transparent',
|
|
backgroundImage:itemStyleJson && itemStyleJson.backgroundType === 3 ? `url(${JSON.stringify(itemStyleJson.blockImg)})` : 'transparent',
|
|
'background-size': itemStyleJson && itemStyleJson.backgroundType === 3 ? 'cover' : 'cover',
|
|
'background-size': itemStyleJson && itemStyleJson.backgroundType === 3 ? 'cover' : 'cover',
|
|
'background-position': itemStyleJson && itemStyleJson.backgroundType === 3 ? 'center' : 'center',
|
|
'background-position': itemStyleJson && itemStyleJson.backgroundType === 3 ? 'center' : 'center',
|
|
- 'color':itemStyleJson && itemStyleJson.fontColor,
|
|
|
|
- 'font-size': `${Number(styleJson.fontSize)}px`,
|
|
|
|
'text-decoration': styleJson.textDecoration == 1 ? 'none' : 'underline',
|
|
'text-decoration': styleJson.textDecoration == 1 ? 'none' : 'underline',
|
|
fontStyle: styleJson.fontStyle == 1 ? 'normal' : 'italic',
|
|
fontStyle: styleJson.fontStyle == 1 ? 'normal' : 'italic',
|
|
fontWeight: styleJson.fontWeight == 1 ? '500' : '600',
|
|
fontWeight: styleJson.fontWeight == 1 ? '500' : '600',
|
|
borderRadius: `${Number(styleJson.borderRadio)}px`,
|
|
borderRadius: `${Number(styleJson.borderRadio)}px`,
|
|
width: `${Number(styleJson.boxWidth)}px`,
|
|
width: `${Number(styleJson.boxWidth)}px`,
|
|
- height: this.config.showMode == 1 ? `${Number(styleJson.boxHeight)}px` : '',
|
|
|
|
- 'line-height': this.config.showMode == 1 && styleJson.linHeight == 2 ? `${Number(styleJson.boxHeight)}px` : '',
|
|
|
|
- 'text-align': styleJson.linHeight == 2 ? 'center' : '',
|
|
|
|
|
|
+ height: `${Number(styleJson.boxHeight)}px`,
|
|
|
|
+ 'line-height': styleJson.linHeight == 2 ? styleJson.titleDataStyle === '1' ? `${boxHeight}px` : `${ dbBoxHeight }px` : '',
|
|
|
|
+ 'text-align': 'center',
|
|
'flex': `1 1 ${flexBasis}`,
|
|
'flex': `1 1 ${flexBasis}`,
|
|
'margin':'0 5px',
|
|
'margin':'0 5px',
|
|
- 'padding':this.config.showMode == 2 ? '10px' : ''
|
|
|
|
|
|
+ 'padding': ''
|
|
};
|
|
};
|
|
|
|
+ },
|
|
|
|
+ getTextStyle(){
|
|
|
|
+ let styleJson = JSON.parse(this.config.styleJson);
|
|
|
|
+ return {
|
|
|
|
+ width: `${Number(styleJson.boxWidth)}px`,
|
|
|
|
+ height:'',
|
|
|
|
+ 'text-align': 'center',
|
|
|
|
+ 'padding': '10px',
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|