Commit de24b39b15d0438c3945574add04d284e2701cfb

Authored by fengwotao
1 parent 7435d812

pref:优化首页右边设备状态统计圆环图渲染方式

@@ -254,13 +254,11 @@ @@ -254,13 +254,11 @@
254 > 254 >
255 <a-row type="flex" justify="space-between" align="middle"> 255 <a-row type="flex" justify="space-between" align="middle">
256 <a-col :span="12"> 256 <a-col :span="12">
257 - <div>  
258 - <PieChartDeviceStatus  
259 - v-if="seriesStatusData.length > 0"  
260 - :seriesStatusData="seriesStatusData"  
261 - />  
262 - <div class="empty-box" v-else><Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" /></div>  
263 - </div> 257 + <PieChartDeviceStatus
  258 + v-if="seriesStatusData.length > 0"
  259 + :seriesStatusData="seriesStatusData"
  260 + />
  261 + <div class="empty-box" v-else><Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" /></div>
264 </a-col> 262 </a-col>
265 <a-col :span="12"> 263 <a-col :span="12">
266 <a-row type="flex" justify="space-between" align="middle" style="row-gap: 30px"> 264 <a-row type="flex" justify="space-between" align="middle" style="row-gap: 30px">
@@ -6,10 +6,10 @@ @@ -6,10 +6,10 @@
6 :key="index" 6 :key="index"
7 :span="8" 7 :span="8"
8 > 8 >
9 - <div 9 + <a-col
10 :id="`chartPie${item.key}`" 10 :id="`chartPie${item.key}`"
11 - style="width: 150px; height: 200px; position: relative; top: -0.7rem"  
12 - ></div> 11 + style="width: 10rem; height: 12rem; position: relative; top: -0.7rem"
  12 + />
13 </a-col> 13 </a-col>
14 </a-row> 14 </a-row>
15 </template> 15 </template>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 style: { 76 style: {
77 fill: '#1a1a1a', 77 fill: '#1a1a1a',
78 text: value + '个', 78 text: value + '个',
79 - font: '14px Microsoft YaHei', 79 + font: '1.25vh Microsoft YaHei',
80 }, 80 },
81 }, 81 },
82 ], 82 ],
@@ -104,18 +104,19 @@ @@ -104,18 +104,19 @@
104 } 104 }
105 }); 105 });
106 106
107 - const resize = () => { 107 + const resize = (flag) => {
108 Object.keys(chartsInstance).forEach((key) => { 108 Object.keys(chartsInstance).forEach((key) => {
109 - chartsInstance[key].resize(); 109 + const doFuncKey = chartsInstance[key];
  110 + flag === 'r' ? doFuncKey.resize() : doFuncKey.dispose();
110 }); 111 });
111 }; 112 };
112 113
113 onMounted(() => { 114 onMounted(() => {
114 - window.addEventListener('resize', resize); 115 + window.addEventListener('resize', () => resize('r'));
115 }); 116 });
116 117
117 onUnmounted(() => { 118 onUnmounted(() => {
118 - window.removeEventListener('resize', resize); 119 + window.removeEventListener('resize', () => resize('d'));
119 }); 120 });
120 }, 121 },
121 }); 122 });