ソースを参照

[Mod 0000] 首页根据接口更新重新对接并完善详细信息

houzekong 1 週間 前
コミット
c2e8b6e782

+ 16 - 6
src/components/Configurable/detail/CustomChart.vue

@@ -416,7 +416,7 @@
     }
     if (type === 'pie_drag') {
       return {
-        legend: baseSeries.map((e) => {
+        legend: baseSeries.map(() => {
           return {
             orient: 'vertical',
             right: '20%',
@@ -431,9 +431,16 @@
               fontFamily: 'DDIN',
               fontWeight: '700',
             },
-            data: e.data.map((e) => {
-              return `${e[0]}: ${e[1]}`;
-            }),
+            tooltip: {
+              show: true,
+              formatter({ name }) {
+                return name;
+              },
+            },
+            formatter(name) {
+              const [str] = name.split(':');
+              return str;
+            },
           };
         }),
         graphic: {
@@ -468,9 +475,12 @@
             itemStyle: {
               opacity: 0.7,
             },
+            tooltip: {
+              show: false,
+            },
             // padAngle: 5,
             data: serie.data.map((e) => ({
-              name: `${e[0]}: ${e[1]}`,
+              name: e[0],
               value: e[1],
             })),
           });
@@ -491,7 +501,7 @@
             },
             // padAngle: 6,
             data: serie.data.map((e) => ({
-              name: `${e[0]}: ${e[1]}`,
+              name: e[0],
               value: e[1],
             })),
           });

+ 1 - 1
src/views/dashboard/SealedGoaf/configurable.data.sealedGoaf.ts

@@ -160,7 +160,7 @@ export const testConfigSealedGoaf: Config[] = [
           legend: { show: false, formatter: '{b}:{c}\n{d}%' },
           xAxis: [{ show: false }],
           yAxis: [{ show: false, name: '风量', position: 'left' }],
-          series: [{ readFrom: 'coalSeamFireData', xprop: 'coalSeamLevel', yprop: 'num', label: '' }],
+          series: [{ readFrom: 'coalSeamFireData', xprop: 'coalSeamLevel', yprop: 'num', label: '${coalSeamFireData.desc}' }],
         },
       ],
       gallery: [],

+ 31 - 1
src/views/dashboard/SealedGoaf/index.vue

@@ -139,8 +139,38 @@
         accessDetails,
         totalNum: { yjTotal, zxTotal, lxTotal, wjTotal },
       };
+
+      // const coalSeamFireChartData = ['Ⅰ类容易自燃', 'Ⅱ类自燃', 'Ⅲ类不易自燃'].reduce(
+      //   (val: any, key) => {
+      //     const arr = coalSeamFireData[key];
+      //     val.coalSeamLevel.push(key);
+      //     val.num.push(arr.length);
+      //     val.desc.push(arr.map((e) => `${e.mineName}-${e.coalSeamName}`).join('、'));
+      //     // return { coalSeamLevel: key, num: arr?.length, desc:  };
+      //     return val;
+      //   },
+      //   { coalSeamLevel: [], num: [], desc: [] }
+      // );
+
+      const coalSeamFireChartData = ['Ⅰ类容易自燃', 'Ⅱ类自燃', 'Ⅲ类不易自燃'].map((key) => {
+        const arr = coalSeamFireData[key];
+        const obj = { name1: key, name2: arr.map((e) => `${e.mineName}-${e.coalSeamName}`).join('<br>') };
+        return {
+          coalSeamLevel: `${obj.name1}:<br>${obj.name2}`,
+          num: arr?.length,
+        };
+      });
+      console.log('debug coal', coalSeamFireChartData);
+
       // 3. 把接口数据赋值给响应式变量(备用)
-      mineData.value = { coalSeamFireData, productionStatusData, overLimitData, goafAlarmData, totalNum, goafAccessCount };
+      mineData.value = {
+        coalSeamFireData: coalSeamFireChartData as any,
+        productionStatusData,
+        overLimitData,
+        goafAlarmData,
+        totalNum,
+        goafAccessCount,
+      };
       // 5. 更新页面数据
       updateData(mineData.value);
     } catch (error) {