Commit cb49f9fcde129514b075df0effafc283d903a89c

Authored by qianbao
1 parent 4390879a

1、动态环图添加提示语

src/views/bigscreenDesigner/designer/components/LabelTag.vue
1 1 <template>
2   - <div class="label-tag">
  2 + <div class="label-tag" :style="labelTagStyle">
3 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 7 </template>
8 8 </div>
9 9 </template>
... ... @@ -37,29 +37,28 @@ export default {
37 37 * @default colors = ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b']
38 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 47 watch: {
47 48 config () {
48 49 const { mergeConfig } = this
49   -
50 50 mergeConfig()
51 51 }
52 52 },
53 53 methods: {
54 54 mergeConfig () {
55 55 let { config, defaultConfig } = this
56   -
57 56 this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
  57 + this.labelTagStyle = this.mergedConfig.labelTagStyle;
58 58 }
59 59 },
60 60 mounted () {
61 61 const { mergeConfig } = this
62   -
63 62 mergeConfig()
64 63 }
65 64 }
... ... @@ -68,8 +67,16 @@ export default {
68 67 <style scoped lang="scss">
69 68 .label-tag {
70 69 display: flex;
  70 + position: absolute;
71 71 justify-content: center;
72 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 81 .label-item {
75 82 margin: 5px;
... ... @@ -77,9 +84,12 @@ export default {
77 84 display: flex;
78 85 align-items: center;
79 86 div {
80   - width: 12px;
81   - height: 12px;
82 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 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 191 type: 'el-input-number',
184 192 label: '字体字号',
185 193 name: 'tipFontSize',
186 194 required: false,
187 195 placeholder: '',
188   - value: 16
  196 + value: 25
189 197 },
190 198 {
191 199 type: 'vue-color',
... ... @@ -193,7 +201,7 @@ export const widgetActiveRingChart= {
193 201 name: 'tipsColor',
194 202 required: false,
195 203 placeholder: '',
196   - value: '#00FEFF'
  204 + value: '#cdddf7'
197 205 },
198 206 {
199 207 type: 'el-select',
... ... @@ -202,12 +210,37 @@ export const widgetActiveRingChart= {
202 210 required: false,
203 211 placeholder: '',
204 212 selectOptions: [
205   - { code: 'up', name: '头部' },
  213 + { code: 'top', name: '头部' },
  214 + { code: 'left', name: '左边' },
  215 + { code: 'right', name: '右边' },
206 216 { code: 'down', name: '底部' }
207   -
208 217 ],
209 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 2 动态环图
3 3 -->
4 4 <template>
5   - <div class="bc-chart-item" :style="styleObj" v-if="isRouterAlive" >
  5 + <div v-if="isRouterAlive">
6 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 15 </div>
  16 +
11 17 </template>
12 18 <script>
13 19 import Vue from "vue";
... ... @@ -51,6 +57,7 @@ export default {
51 57 labelStyle:{},
52 58 isNoTipTitle:false,
53 59 tipsAlign:'down',
  60 + labelTagStyle:{}
54 61 },
55 62 titleConfig:{
56 63 titleStyle:{},
... ... @@ -132,11 +139,26 @@ export default {
132 139 setLabelConfig(){
133 140 const optionsSetup = this.optionsSetup;
134 141 let labelStyle = {};
  142 + let labelTagStyleOne = {};
135 143 if(optionsSetup.isNoTipTitle){
136 144 this.labelConfig.isNoTipTitle = optionsSetup.isNoTipTitle;
137 145 this.labelConfig.tipsAlign = optionsSetup.tipsAlign;
138 146 labelStyle.color = optionsSetup.tipsColor;
139 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 162 this.labelConfig.labelStyle = labelStyle;
141 163 }else{
142 164 this.labelConfig.isNoTipTitle = false;
... ... @@ -232,11 +254,16 @@ export default {
232 254 this.reload();
233 255 },
234 256 setLabelConfigData(val){
  257 + const optionsSetup = this.optionsSetup;
235 258 const data = [];
236 259 if(this.isNotBlankArray(val)){
237 260 for(let i = 0;i<val.length;i++){
238 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 268 this.labelConfig.data = data;
242 269 }
... ...