Browse Source

Merge branch 'eta1.4.6'

Karsa 1 năm trước cách đây
mục cha
commit
12875eedb1
2 tập tin đã thay đổi với 128 bổ sung3 xóa
  1. 126 3
      src/views/hzyb/chart/Detail.vue
  2. 2 0
      src/views/hzyb/chart/component/chartBox.vue

+ 126 - 3
src/views/hzyb/chart/Detail.vue

@@ -347,7 +347,7 @@ const getChartInfo=async (type)=>{
         // document.title=res.data.ChartInfo.ChartName
         
         // 设置highchart配置 ChartType: 1曲线图 2季节图:季节图中公历和农历数据结构不同
-        if(![2,7,10].includes(res.data.ChartInfo.ChartType)){
+        if(![2,7,10,11].includes(res.data.ChartInfo.ChartType)){
             if(type=='init'){
                 dateType.value=res.data.ChartInfo.DateType
                 startYear.value=res.data.ChartInfo.StartYear
@@ -384,6 +384,9 @@ const getChartInfo=async (type)=>{
         //截面散点图
         res.data.ChartInfo.ChartType === 10 && initSectionScatterData(res.data);
 
+        //雷达图
+        res.data.ChartInfo.ChartType === 11 && initRadarData(res.data);
+
         
 
         // 向小程序发送分享数据
@@ -1211,6 +1214,115 @@ const setCrossVarietyChart = () => {
 }
 
 
+/* 雷达图 */
+const radarChartRenderData =  ref({})
+const initRadarData = (data) => {
+    const { DataResp,EdbInfoList,ChartInfo } = data;
+    
+    radarChartRenderData.value = {
+        YDataList: DataResp.YDataList,
+        XDataList: EdbInfoList.filter(_ => DataResp.XEdbIdValue.includes(_.EdbInfoId))
+    }
+
+    hasLeftAxis.value=true;
+    axisLimitData.leftMin=Number(ChartInfo.LeftMin)
+    axisLimitData.leftMax=Number(ChartInfo.LeftMax)
+
+    setRadarChart();
+}
+const setRadarChart = () => {
+  const { YDataList,XDataList } = radarChartRenderData.value;
+
+  const { ChartInfo } = resData.value;
+
+    /* 主题样式*/
+    const chartTheme =  ChartInfo.ChartThemeStyle ? JSON.parse(ChartInfo.ChartThemeStyle) : null;
+
+    let categories = XDataList.map(_ => _.EdbAliasName||_.EdbName);
+
+    //x轴
+    let xAxis = {
+      lineWidth: 0,
+      tickLength: 0,
+      tickmarkPlacement: 'on',
+      categories,
+      labels: {
+        allowOverlap: true,
+        autoRotationLimit: 40,
+        style: {
+          ...chartTheme&&chartTheme.xAxisOptions.style
+        }
+      }
+    }
+
+    //y轴
+    const { leftMin,leftMax } = axisLimitData;
+    let yAxis = [{
+      gridLineInterpolation: 'polygon',
+      gridLineWidth: 1,
+      lineWidth: 0,
+      endOnTick: false,
+      startOnTick: false,
+      showLastLabel: true,
+      // tickAmount:4,
+      title: {
+        text:  ChartInfo.Unit ,
+        align: 'high',
+        rotation: 0,
+        y: 5,
+        x:10,
+        textAlign: 'left',
+        reserveSpace: false,
+        style:{
+          ...chartTheme&&chartTheme.yAxisOptions.style
+        },
+      },
+      labels: {
+        allowOverlap: true,
+        style:{
+          ...chartTheme&&chartTheme.yAxisOptions.style
+        }
+      },
+      min: Number(leftMin),
+      max: Number(leftMax),
+    }]
+
+    //系列
+    let series = [];
+    YDataList.forEach(item => {
+      let serie_item = {
+        data: item.Value,
+        pointPlacement: 'on',
+        type: (chartTheme&&chartTheme.lineOptions.lineType) || 'line',
+        dashStyle: (chartTheme&&chartTheme.lineOptions.dashStyle)||'Solid',
+        yAxis: 0,
+        name: item.Name || item.Date,
+        color: item.Color,
+        lineWidth: (chartTheme&&chartTheme.lineOptions.lineWidth) || 1,
+        chartType: 'linear',
+        visible: true
+      };
+      series.push(serie_item)
+    })
+
+    chartData.value = {
+        chart: {
+            ...chartTheme.drawOption,
+            spacing: [2,10,2,10],
+            polar:true,
+        },
+        title: {
+            text:''
+        },
+        pane: {
+            size: '85%'
+        },
+        series,
+        yAxis,
+        xAxis
+    }
+}
+
 
 // 路由改变 解决从搜索页返回数据不刷新问题
 onBeforeRouteUpdate((nval)=>{
@@ -2373,7 +2485,7 @@ const setChartParams = () => {
                 EndDate: endDate.value,
             }
             break;
-        case 7: 
+        case 7:
             params={
                 ChartInfoId: resData.value.ChartInfo.ChartInfoId || 0,
                 ChartEdbInfoList: barEdbData.value.map(_ =>({ EdbInfoId: _.EdbInfoId })),
@@ -2396,6 +2508,17 @@ const setChartParams = () => {
                 })
             } 
             break;
+        
+        case 11: 
+            params={
+                ChartInfoId: resData.value.ChartInfo.ChartInfoId || 0,
+                ChartEdbInfoList: resData.value.EdbInfoList.map(_ =>({ EdbInfoId: _.EdbInfoId })),
+                DateType: 6,
+                LeftMin: String(axisLimitData.leftMin),
+                LeftMax: String(axisLimitData.leftMax),
+            }
+            break;
+
     }
     
     return params
@@ -2549,7 +2672,7 @@ const myChartPageChange=(type)=>{
         </div>
         <div class="top-box" v-if="$route.query.source!=='ybxcx_my_chart'">
             <div class="flex calendar-box" :style="{'color':startDate?'#1F243A':'#999999'}"
-            @click="handleShowDate" v-if="![7,10].includes(resData.ChartInfo.ChartType) &&resData.ChartInfo.Source===1">
+            @click="handleShowDate" v-if="![7,10,11].includes(resData.ChartInfo.ChartType) &&resData.ChartInfo.Source===1">
                 <img src="../../../assets/hzyb/chart/calendar-new-1.png" alt="">
                 <span class="date">{{startDate||'开始日期'}}</span>
                 <span style="margin:0 5px">-</span>

+ 2 - 0
src/views/hzyb/chart/component/chartBox.vue

@@ -109,8 +109,10 @@ const props = defineProps({
 })
 import {ref,onMounted,watch,toRefs } from 'vue'
 import Highcharts from 'highcharts/highstock';
+import HighchartsMore from 'highcharts/highcharts-more';
 import HighchartszhCN  from '../../utils/highcahrts-zh_CN.js'
 HighchartszhCN(Highcharts)
+HighchartsMore(Highcharts);
 let chartIns=ref(null)// 图表实例
 onMounted(() => {
 	let themeOptions = setThemeOptions();