Commit cb49f9fcde129514b075df0effafc283d903a89c
1 parent
4390879a
1、动态环图添加提示语
Showing
3 changed files
with
91 additions
and
21 deletions
src/views/bigscreenDesigner/designer/components/LabelTag.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div class="label-tag"> | 2 | + <div class="label-tag" :style="labelTagStyle"> |
| 3 | <template v-if="mergedConfig"> | 3 | <template v-if="mergedConfig"> |
| 4 | - <div class="label-item" v-for="(label, i) in mergedConfig.data" :key="label" :style="mergedConfig.labelStyle"> | ||
| 5 | - <div :style="`background-color: ${mergedConfig.colors[i % mergedConfig.colors.length]};margin-right:5px`" />{{ label }} | ||
| 6 | - </div> | 4 | + <div class="label-item" v-for="(label, i) in mergedConfig.data" :key="label" :style="mergedConfig.labelStyle"> |
| 5 | + <div :style="`background-color: ${mergedConfig.colors[i % mergedConfig.colors.length]};margin-right:5px`" />{{ label }} | ||
| 6 | + </div> | ||
| 7 | </template> | 7 | </template> |
| 8 | </div> | 8 | </div> |
| 9 | </template> | 9 | </template> |
| @@ -37,29 +37,28 @@ export default { | @@ -37,29 +37,28 @@ export default { | ||
| 37 | * @default colors = ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'] | 37 | * @default colors = ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'] |
| 38 | * @example colors = ['#666', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red'] | 38 | * @example colors = ['#666', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red'] |
| 39 | */ | 39 | */ |
| 40 | - colors: ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'] | 40 | + colors: ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'], |
| 41 | }, | 41 | }, |
| 42 | 42 | ||
| 43 | - mergedConfig: null | 43 | + mergedConfig: null, |
| 44 | + labelTagStyle:{} | ||
| 44 | } | 45 | } |
| 45 | }, | 46 | }, |
| 46 | watch: { | 47 | watch: { |
| 47 | config () { | 48 | config () { |
| 48 | const { mergeConfig } = this | 49 | const { mergeConfig } = this |
| 49 | - | ||
| 50 | mergeConfig() | 50 | mergeConfig() |
| 51 | } | 51 | } |
| 52 | }, | 52 | }, |
| 53 | methods: { | 53 | methods: { |
| 54 | mergeConfig () { | 54 | mergeConfig () { |
| 55 | let { config, defaultConfig } = this | 55 | let { config, defaultConfig } = this |
| 56 | - | ||
| 57 | this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {}) | 56 | this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {}) |
| 57 | + this.labelTagStyle = this.mergedConfig.labelTagStyle; | ||
| 58 | } | 58 | } |
| 59 | }, | 59 | }, |
| 60 | mounted () { | 60 | mounted () { |
| 61 | const { mergeConfig } = this | 61 | const { mergeConfig } = this |
| 62 | - | ||
| 63 | mergeConfig() | 62 | mergeConfig() |
| 64 | } | 63 | } |
| 65 | } | 64 | } |
| @@ -68,8 +67,16 @@ export default { | @@ -68,8 +67,16 @@ export default { | ||
| 68 | <style scoped lang="scss"> | 67 | <style scoped lang="scss"> |
| 69 | .label-tag { | 68 | .label-tag { |
| 70 | display: flex; | 69 | display: flex; |
| 70 | + position: absolute; | ||
| 71 | justify-content: center; | 71 | justify-content: center; |
| 72 | align-items: center; | 72 | align-items: center; |
| 73 | + flex-flow: row wrap; | ||
| 74 | + margin: auto; | ||
| 75 | + //top: 0; | ||
| 76 | + //bottom: 0; | ||
| 77 | + //left: 10%; | ||
| 78 | + overflow-y: auto; | ||
| 79 | + padding-right: 5px; | ||
| 73 | 80 | ||
| 74 | .label-item { | 81 | .label-item { |
| 75 | margin: 5px; | 82 | margin: 5px; |
| @@ -77,9 +84,12 @@ export default { | @@ -77,9 +84,12 @@ export default { | ||
| 77 | display: flex; | 84 | display: flex; |
| 78 | align-items: center; | 85 | align-items: center; |
| 79 | div { | 86 | div { |
| 80 | - width: 12px; | ||
| 81 | - height: 12px; | ||
| 82 | margin-left: 5px; | 87 | margin-left: 5px; |
| 88 | + display: inline-block; | ||
| 89 | + width: 30px; | ||
| 90 | + height: 20px; | ||
| 91 | + line-height: 20px; | ||
| 92 | + border-radius: 5px; | ||
| 83 | } | 93 | } |
| 84 | } | 94 | } |
| 85 | } | 95 | } |
src/views/bigscreenDesigner/designer/tools/configure/pieCharts/widget-active-ring-chart.js
| @@ -180,12 +180,20 @@ export const widgetActiveRingChart= { | @@ -180,12 +180,20 @@ export const widgetActiveRingChart= { | ||
| 180 | value: false, | 180 | value: false, |
| 181 | }, | 181 | }, |
| 182 | { | 182 | { |
| 183 | + type: 'el-switch', | ||
| 184 | + label: '数值显示', | ||
| 185 | + name: 'isShowTipVal', | ||
| 186 | + required: false, | ||
| 187 | + placeholder: '', | ||
| 188 | + value: false, | ||
| 189 | + }, | ||
| 190 | + { | ||
| 183 | type: 'el-input-number', | 191 | type: 'el-input-number', |
| 184 | label: '字体字号', | 192 | label: '字体字号', |
| 185 | name: 'tipFontSize', | 193 | name: 'tipFontSize', |
| 186 | required: false, | 194 | required: false, |
| 187 | placeholder: '', | 195 | placeholder: '', |
| 188 | - value: 16 | 196 | + value: 25 |
| 189 | }, | 197 | }, |
| 190 | { | 198 | { |
| 191 | type: 'vue-color', | 199 | type: 'vue-color', |
| @@ -193,7 +201,7 @@ export const widgetActiveRingChart= { | @@ -193,7 +201,7 @@ export const widgetActiveRingChart= { | ||
| 193 | name: 'tipsColor', | 201 | name: 'tipsColor', |
| 194 | required: false, | 202 | required: false, |
| 195 | placeholder: '', | 203 | placeholder: '', |
| 196 | - value: '#00FEFF' | 204 | + value: '#cdddf7' |
| 197 | }, | 205 | }, |
| 198 | { | 206 | { |
| 199 | type: 'el-select', | 207 | type: 'el-select', |
| @@ -202,12 +210,37 @@ export const widgetActiveRingChart= { | @@ -202,12 +210,37 @@ export const widgetActiveRingChart= { | ||
| 202 | required: false, | 210 | required: false, |
| 203 | placeholder: '', | 211 | placeholder: '', |
| 204 | selectOptions: [ | 212 | selectOptions: [ |
| 205 | - { code: 'up', name: '头部' }, | 213 | + { code: 'top', name: '头部' }, |
| 214 | + { code: 'left', name: '左边' }, | ||
| 215 | + { code: 'right', name: '右边' }, | ||
| 206 | { code: 'down', name: '底部' } | 216 | { code: 'down', name: '底部' } |
| 207 | - | ||
| 208 | ], | 217 | ], |
| 209 | value: 'down' | 218 | value: 'down' |
| 210 | - } | 219 | + }, |
| 220 | + { | ||
| 221 | + type: 'el-input-number', | ||
| 222 | + label: '高度', | ||
| 223 | + name: 'tipFontHeight', | ||
| 224 | + required: false, | ||
| 225 | + placeholder: '', | ||
| 226 | + value: 100 | ||
| 227 | + }, | ||
| 228 | + { | ||
| 229 | + type: 'el-input-number', | ||
| 230 | + label: '左右距离', | ||
| 231 | + name: 'tipFontLeft', | ||
| 232 | + required: false, | ||
| 233 | + placeholder: '', | ||
| 234 | + value: 0 | ||
| 235 | + }, | ||
| 236 | + { | ||
| 237 | + type: 'el-input-number', | ||
| 238 | + label: '上下距离', | ||
| 239 | + name: 'tipFontTop', | ||
| 240 | + required: false, | ||
| 241 | + placeholder: '', | ||
| 242 | + value: 0 | ||
| 243 | + }, | ||
| 211 | ], | 244 | ], |
| 212 | }, | 245 | }, |
| 213 | { | 246 | { |
src/views/bigscreenDesigner/designer/widget/pie/widgetActiveRingChart.vue
| @@ -2,12 +2,18 @@ | @@ -2,12 +2,18 @@ | ||
| 2 | 动态环图 | 2 | 动态环图 |
| 3 | --> | 3 | --> |
| 4 | <template> | 4 | <template> |
| 5 | - <div class="bc-chart-item" :style="styleObj" v-if="isRouterAlive" > | 5 | + <div v-if="isRouterAlive"> |
| 6 | <div class="bcci-header" :style="titleConfig.titleStyle" v-if="titleConfig.isNoTitle" >{{titleConfig.titleText}}</div> | 6 | <div class="bcci-header" :style="titleConfig.titleStyle" v-if="titleConfig.isNoTitle" >{{titleConfig.titleText}}</div> |
| 7 | - <Label-Tag :config="labelConfig" v-if="labelConfig.isNoTipTitle && labelConfig.tipsAlign=='up'"/> | ||
| 8 | - <dv-active-ring-chart :config="options" :style="styleRingChart"/> | ||
| 9 | - <Label-Tag :config="labelConfig" v-if="labelConfig.isNoTipTitle && labelConfig.tipsAlign=='down'"/> | 7 | + |
| 8 | + <div class="bc-chart-item" :style="styleObj"> | ||
| 9 | + <Label-Tag :config="labelConfig" v-if="labelConfig.isNoTipTitle && labelConfig.tipsAlign=='top'"/> | ||
| 10 | + <dv-active-ring-chart :config="options" :style="styleRingChart"/> | ||
| 11 | + <Label-Tag :config="labelConfig" v-if="labelConfig.isNoTipTitle | ||
| 12 | + && (labelConfig.tipsAlign=='down' || labelConfig.tipsAlign=='right' || labelConfig.tipsAlign=='left')"/> | ||
| 13 | + </div> | ||
| 14 | + | ||
| 10 | </div> | 15 | </div> |
| 16 | + | ||
| 11 | </template> | 17 | </template> |
| 12 | <script> | 18 | <script> |
| 13 | import Vue from "vue"; | 19 | import Vue from "vue"; |
| @@ -51,6 +57,7 @@ export default { | @@ -51,6 +57,7 @@ export default { | ||
| 51 | labelStyle:{}, | 57 | labelStyle:{}, |
| 52 | isNoTipTitle:false, | 58 | isNoTipTitle:false, |
| 53 | tipsAlign:'down', | 59 | tipsAlign:'down', |
| 60 | + labelTagStyle:{} | ||
| 54 | }, | 61 | }, |
| 55 | titleConfig:{ | 62 | titleConfig:{ |
| 56 | titleStyle:{}, | 63 | titleStyle:{}, |
| @@ -132,11 +139,26 @@ export default { | @@ -132,11 +139,26 @@ export default { | ||
| 132 | setLabelConfig(){ | 139 | setLabelConfig(){ |
| 133 | const optionsSetup = this.optionsSetup; | 140 | const optionsSetup = this.optionsSetup; |
| 134 | let labelStyle = {}; | 141 | let labelStyle = {}; |
| 142 | + let labelTagStyleOne = {}; | ||
| 135 | if(optionsSetup.isNoTipTitle){ | 143 | if(optionsSetup.isNoTipTitle){ |
| 136 | this.labelConfig.isNoTipTitle = optionsSetup.isNoTipTitle; | 144 | this.labelConfig.isNoTipTitle = optionsSetup.isNoTipTitle; |
| 137 | this.labelConfig.tipsAlign = optionsSetup.tipsAlign; | 145 | this.labelConfig.tipsAlign = optionsSetup.tipsAlign; |
| 138 | labelStyle.color = optionsSetup.tipsColor; | 146 | labelStyle.color = optionsSetup.tipsColor; |
| 139 | labelStyle['font-size'] = optionsSetup.tipFontSize+'px'; | 147 | labelStyle['font-size'] = optionsSetup.tipFontSize+'px'; |
| 148 | + if(optionsSetup.tipsAlign=='right' || optionsSetup.tipsAlign=='left'){ | ||
| 149 | + labelTagStyleOne[optionsSetup.tipsAlign]=optionsSetup.tipFontLeft+"%"; | ||
| 150 | + labelTagStyleOne['height']=optionsSetup.tipFontHeight+"%"; | ||
| 151 | + labelTagStyleOne['width']="20%"; | ||
| 152 | + labelTagStyleOne['top']="0"; | ||
| 153 | + labelTagStyleOne['bottom']="0"; | ||
| 154 | + }else if(optionsSetup.tipsAlign=='top'){ | ||
| 155 | + labelTagStyleOne['left']= optionsSetup.tipFontLeft+"%"; | ||
| 156 | + labelTagStyleOne['top']= -optionsSetup.tipFontTop+"%"; | ||
| 157 | + }else{ | ||
| 158 | + labelTagStyleOne['left']= optionsSetup.tipFontLeft+"%"; | ||
| 159 | + labelTagStyleOne['bottom']= optionsSetup.tipFontTop+"%"; | ||
| 160 | + } | ||
| 161 | + this.labelConfig.labelTagStyle = labelTagStyleOne; | ||
| 140 | this.labelConfig.labelStyle = labelStyle; | 162 | this.labelConfig.labelStyle = labelStyle; |
| 141 | }else{ | 163 | }else{ |
| 142 | this.labelConfig.isNoTipTitle = false; | 164 | this.labelConfig.isNoTipTitle = false; |
| @@ -232,11 +254,16 @@ export default { | @@ -232,11 +254,16 @@ export default { | ||
| 232 | this.reload(); | 254 | this.reload(); |
| 233 | }, | 255 | }, |
| 234 | setLabelConfigData(val){ | 256 | setLabelConfigData(val){ |
| 257 | + const optionsSetup = this.optionsSetup; | ||
| 235 | const data = []; | 258 | const data = []; |
| 236 | if(this.isNotBlankArray(val)){ | 259 | if(this.isNotBlankArray(val)){ |
| 237 | for(let i = 0;i<val.length;i++){ | 260 | for(let i = 0;i<val.length;i++){ |
| 238 | const oneVal = val[i]; | 261 | const oneVal = val[i]; |
| 239 | - data.push(oneVal['name']); | 262 | + let showName = oneVal['name']; |
| 263 | + if(optionsSetup.isShowTipVal){ | ||
| 264 | + showName = showName+' '+oneVal['value']; | ||
| 265 | + } | ||
| 266 | + data.push(showName); | ||
| 240 | } | 267 | } |
| 241 | this.labelConfig.data = data; | 268 | this.labelConfig.data = data; |
| 242 | } | 269 | } |