Commit de24b39b15d0438c3945574add04d284e2701cfb

Authored by fengwotao
1 parent 7435d812

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

... ... @@ -254,13 +254,11 @@
254 254 >
255 255 <a-row type="flex" justify="space-between" align="middle">
256 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 262 </a-col>
265 263 <a-col :span="12">
266 264 <a-row type="flex" justify="space-between" align="middle" style="row-gap: 30px">
... ...
... ... @@ -6,10 +6,10 @@
6 6 :key="index"
7 7 :span="8"
8 8 >
9   - <div
  9 + <a-col
10 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 13 </a-col>
14 14 </a-row>
15 15 </template>
... ... @@ -76,7 +76,7 @@
76 76 style: {
77 77 fill: '#1a1a1a',
78 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 104 }
105 105 });
106 106
107   - const resize = () => {
  107 + const resize = (flag) => {
108 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 114 onMounted(() => {
114   - window.addEventListener('resize', resize);
  115 + window.addEventListener('resize', () => resize('r'));
115 116 });
116 117
117 118 onUnmounted(() => {
118   - window.removeEventListener('resize', resize);
  119 + window.removeEventListener('resize', () => resize('d'));
119 120 });
120 121 },
121 122 });
... ...