Browse Source

Merge branch 'master' of https://git.caner.top/Caner/busRoute

bls-dan 2 years ago
parent
commit
6ca2fc092d
1 changed files with 145 additions and 179 deletions
  1. 145 179
      src/pages/views/home/components/HomePage.vue

+ 145 - 179
src/pages/views/home/components/HomePage.vue

@@ -47,8 +47,8 @@
                 <div
                 <div
                   v-for="(itm, index) in item.btns"
                   v-for="(itm, index) in item.btns"
                   :key="index"
                   :key="index"
-                  :class="{active:index === item.checkId}"
-                  @click="changeFn(index,item)"
+                  :class="{ active: index === item.checkId }"
+                  @click="changeFn(index, item)"
                 >
                 >
                   {{ itm }}
                   {{ itm }}
                 </div>
                 </div>
@@ -336,7 +336,6 @@ const datas = [
     name: '系列a'
     name: '系列a'
   }
   }
 ]
 ]
-const colorList = [ 'rgba(211, 68, 53, 1)', 'rgba(228, 133, 48, 1)', 'rgba(231, 185, 44, 1)', 'rgba(23, 165, 213, 1)' ]
 
 
 const leftContent = ref({
 const leftContent = ref({
   topCount: [
   topCount: [
@@ -368,7 +367,9 @@ const leftContent = ref({
       name: '客运量',
       name: '客运量',
       option: {
       option: {
         grid: {
         grid: {
-          containLabel: true
+          containLabel: true,
+          top: 100,
+          bottom: 100
         },
         },
         tooltip: {
         tooltip: {
           trigger: 'axis',
           trigger: 'axis',
@@ -377,10 +378,8 @@ const leftContent = ref({
           }
           }
         },
         },
         legend: {
         legend: {
-          top: 10,
-          right: 10,
-          itemWidth: 18,
-          itemHeight: 18,
+          top: 45,
+          lett: 'center',
           itemGap: 30,
           itemGap: 30,
           textStyle: {
           textStyle: {
             fontSize: 18,
             fontSize: 18,
@@ -388,49 +387,28 @@ const leftContent = ref({
           }
           }
         },
         },
         xAxis: {
         xAxis: {
-          // name: "班级",
           triggerEvent: true,
           triggerEvent: true,
           data: [
           data: [
-            '一部一车间',
-            '一部二车间',
-            '二部一车间',
-            '二部三车间',
-            '新能源',
-            '四部一车间'
+            '1月',
+            '2月',
+            '3月',
+            '4月',
+            '5月',
+            '6月'
           ],
           ],
           axisLabel: {
           axisLabel: {
             interval: 0,
             interval: 0,
-            show: true,
             fontSize: 18,
             fontSize: 18,
             color: '#C9D2FA'
             color: '#C9D2FA'
-          },
-          axisLine: {
-            show: false,
-            lineStyle: {
-              show: false,
-              color: '#F3F3F3',
-              width: 2
-            }
-          },
-
-          axisTick: {
-            show: false
           }
           }
         },
         },
         yAxis: [
         yAxis: [
           {
           {
             splitNumber: 2,
             splitNumber: 2,
             axisLabel: {
             axisLabel: {
-              show: true,
               fontSize: 18,
               fontSize: 18,
               color: '#C9D2FA'
               color: '#C9D2FA'
             },
             },
-            axisLine: {
-              show: false
-            },
-            axisTick: {
-              show: false
-            },
             splitLine: {
             splitLine: {
               lineStyle: {
               lineStyle: {
                 type: 'dashed',
                 type: 'dashed',
@@ -442,7 +420,6 @@ const leftContent = ref({
             splitNumber: 2,
             splitNumber: 2,
             position: 'right', // 放在右边
             position: 'right', // 放在右边
             axisLabel: {
             axisLabel: {
-              show: true,
               fontSize: 18,
               fontSize: 18,
               color: '#C9D2FA',
               color: '#C9D2FA',
               formatter(value: number) {
               formatter(value: number) {
@@ -450,12 +427,6 @@ const leftContent = ref({
                 return `${value}%`
                 return `${value}%`
               }
               }
             },
             },
-            axisLine: {
-              show: false
-            },
-            axisTick: {
-              show: false
-            },
             splitLine: {
             splitLine: {
               lineStyle: {
               lineStyle: {
                 type: 'dashed',
                 type: 'dashed',
@@ -466,7 +437,7 @@ const leftContent = ref({
         ],
         ],
         series: [
         series: [
           {
           {
-            name: 'test1',
+            name: '客运量',
             type: 'bar',
             type: 'bar',
             silent: true,
             silent: true,
             itemStyle: {
             itemStyle: {
@@ -474,19 +445,9 @@ const leftContent = ref({
             },
             },
             barWidth: 30,
             barWidth: 30,
             data: [ 200, 108, 200, 40, 210, 100 ]
             data: [ 200, 108, 200, 40, 210, 100 ]
-            // label: {
-            //   show: true, // 显示标签
-            //   position: 'top', // 标签显示在柱状图的上方
-            //   fontSize: 14,
-            //   color: '#fff',
-            //   formatter: function (params) {
-            //     // 在标签文本后添加百分号
-            //     return params.value + '%';
-            //   },
-            // },
           },
           },
           {
           {
-            name: 'test2',
+            name: '同比增长率',
             type: 'line',
             type: 'line',
             yAxisIndex: 1, // 与第二个 y 轴关联
             yAxisIndex: 1, // 与第二个 y 轴关联
             itemStyle: {
             itemStyle: {
@@ -518,7 +479,6 @@ const leftContent = ref({
         },
         },
         // 图表图例
         // 图表图例
         legend: {
         legend: {
-          show: true,
           type: 'scroll',
           type: 'scroll',
           orient: 'horizontal', // 图例排列方向
           orient: 'horizontal', // 图例排列方向
           icon: 'circle', // 图例样式为圆形
           icon: 'circle', // 图例样式为圆形
@@ -532,8 +492,6 @@ const leftContent = ref({
             fontSize: 20
             fontSize: 20
           }
           }
         },
         },
-
-        // color: [ '#6386e0', '#fb9a55', '#6bd98d', '#8dfd15', '#6bd98d', '#fff' ],
         series: [
         series: [
           {
           {
             type: 'pie', // 图表类型为饼图
             type: 'pie', // 图表类型为饼图
@@ -541,7 +499,6 @@ const leftContent = ref({
             avoidLabelOverlap: true, // 是否启用防止标签重叠策略
             avoidLabelOverlap: true, // 是否启用防止标签重叠策略
             showEmptyCircle: true, // 是否在无数据的时候显示一个占位圆
             showEmptyCircle: true, // 是否在无数据的时候显示一个占位圆
             label: {
             label: {
-              show: true,
               formatter: '{b}\n{d}%',
               formatter: '{b}\n{d}%',
               color: 'white'
               color: 'white'
             },
             },
@@ -566,101 +523,105 @@ const leftContent = ref({
       name: '客流排名',
       name: '客流排名',
       option: {
       option: {
         tooltip: {
         tooltip: {
-          show: false,
           trigger: 'axis',
           trigger: 'axis',
           axisPointer: {
           axisPointer: {
             type: 'shadow'
             type: 'shadow'
           }
           }
         },
         },
-        legend: {
-          show: false
-        },
         grid: {
         grid: {
-          left: 0,
-          right: 30,
+          top: 20,
+          left: 20,
+          bottom: 20,
+          right: 20,
           containLabel: true
           containLabel: true
         },
         },
         xAxis: {
         xAxis: {
-          show: true,
           type: 'value',
           type: 'value',
-          axisLine: {
-            show: false,
-            lineStyle: {
-              color: [ 'rgba(62, 113, 157, 0.5)' ]
-            }
-          },
           splitLine: {
           splitLine: {
             lineStyle: {
             lineStyle: {
-              color: 'rgba(62, 113, 157, 0.5)'
+              color: '#fff'
             }
             }
           },
           },
           axisLabel: {
           axisLabel: {
-            color: 'rgba(62, 113, 157, 1)'
+            color: '#fff',
+            fontSize: 18
           }
           }
         },
         },
         yAxis: {
         yAxis: {
           type: 'category',
           type: 'category',
           inverse: true,
           inverse: true,
-          axisLine: {
-            show: false
-          },
           axisTick: {
           axisTick: {
-            show: true,
-            alignWithLabel: true
+            alignWithLabel: true,
+            lineStyle: {
+              color: '#fff'
+            }
           },
           },
-          axisPointer: {
-            label: {
-              show: true,
-              margin: 30
+          axisLine: {
+            lineStyle: {
+              color: '#fff'
             }
             }
           },
           },
-          data: datas.map((item) => item.name),
+          data: [ '雨城区', '雨城区', '雨城区', '雨城区', '雨城区', '雨城区', '雨城区', '雨城区' ],
           axisLabel: {
           axisLabel: {
-            margin: 100,
-            fontSize: 14,
-            align: 'left',
+            fontSize: 18,
             color: '#fff',
             color: '#fff',
+            margin: 10,
             rich: {
             rich: {
               a1: {
               a1: {
-                color: '#fff',
-                backgroundColor: colorList[0],
-                width: 20,
-                height: 20,
+                backgroundColor: '#FFFF0050',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#FFFF00',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               a2: {
               a2: {
-                color: '#fff',
-                backgroundColor: colorList[1],
-                width: 20,
-                height: 20,
+                backgroundColor: '#F2F2F250',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#F2F2F2',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               a3: {
               a3: {
-                color: '#fff',
-                backgroundColor: colorList[2],
-                width: 20,
-                height: 20,
+                backgroundColor: '#FAAD0E50',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#FAAD0E',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               b: {
               b: {
-                color: '#fff',
-                backgroundColor: colorList[3],
-                width: 20,
-                height: 20,
+                backgroundColor: '#00FFFF50',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#00FFFF',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               }
               }
             },
             },
-            formatter: (params: string) => {
-              let index = datas.map((item) => item.name).indexOf(params) as number
-              index += 1
-              if (index - 1 < 3) {
-                return `{a${index}|${index}} ${params}`
+            formatter: (params: string, _id: number) => {
+              const id = _id + 1
+              if (_id < 3) {
+                return `{a${id}|${id}}  ${params}`
               }
               }
-              return `{b|${index}} ${params}`
+              return `{b|${id}}  ${params}`
             }
             }
           }
           }
         },
         },
@@ -669,7 +630,7 @@ const leftContent = ref({
             z: 2,
             z: 2,
             name: 'value',
             name: 'value',
             type: 'bar',
             type: 'bar',
-            barWidth: 8,
+            barWidth: 25,
             zlevel: 1,
             zlevel: 1,
             data: datas.map((item, i) => ({
             data: datas.map((item, i) => ({
               value: item.value,
               value: item.value,
@@ -681,16 +642,15 @@ const leftContent = ref({
                   },
                   },
                   {
                   {
                     offset: 1,
                     offset: 1,
-                    color: colorList[3]
+                    color: 'rgba(231, 185, 44, 1)'
                   }
                   }
                 ])
                 ])
               }
               }
             })),
             })),
             label: {
             label: {
-              show: true,
               position: 'inside',
               position: 'inside',
               color: '#fff',
               color: '#fff',
-              fontSize: 14
+              fontSize: 16
             },
             },
             itemStyle: {
             itemStyle: {
               borderRadius: [ 0, 15, 15, 0 ]
               borderRadius: [ 0, 15, 15, 0 ]
@@ -703,101 +663,105 @@ const leftContent = ref({
       name: '线路客流排名',
       name: '线路客流排名',
       option: {
       option: {
         tooltip: {
         tooltip: {
-          show: false,
           trigger: 'axis',
           trigger: 'axis',
           axisPointer: {
           axisPointer: {
             type: 'shadow'
             type: 'shadow'
           }
           }
         },
         },
-        legend: {
-          show: false
-        },
         grid: {
         grid: {
-          left: 0,
-          right: 30,
+          top: 20,
+          left: 20,
+          bottom: 20,
+          right: 20,
           containLabel: true
           containLabel: true
         },
         },
         xAxis: {
         xAxis: {
-          show: true,
           type: 'value',
           type: 'value',
-          axisLine: {
-            show: false,
-            lineStyle: {
-              color: [ 'rgba(62, 113, 157, 0.5)' ]
-            }
-          },
           splitLine: {
           splitLine: {
             lineStyle: {
             lineStyle: {
-              color: 'rgba(62, 113, 157, 0.5)'
+              color: '#fff'
             }
             }
           },
           },
           axisLabel: {
           axisLabel: {
-            color: 'rgba(62, 113, 157, 1)'
+            color: '#fff',
+            fontSize: 18
           }
           }
         },
         },
         yAxis: {
         yAxis: {
           type: 'category',
           type: 'category',
           inverse: true,
           inverse: true,
-          axisLine: {
-            show: false
-          },
           axisTick: {
           axisTick: {
-            show: true,
-            alignWithLabel: true
+            alignWithLabel: true,
+            lineStyle: {
+              color: '#fff'
+            }
           },
           },
-          axisPointer: {
-            label: {
-              show: true,
-              margin: 30
+          axisLine: {
+            lineStyle: {
+              color: '#fff'
             }
             }
           },
           },
-          data: datas.map((item) => item.name),
+          data: [ '1路(45689)', '2路(45689)', '3路(45689)', '4路(45689)', '5路(45689)', '6路(45689)', '7路(45689)', '8路(45689)' ],
           axisLabel: {
           axisLabel: {
-            margin: 100,
-            fontSize: 14,
-            align: 'left',
+            fontSize: 18,
             color: '#fff',
             color: '#fff',
+            margin: 20,
             rich: {
             rich: {
               a1: {
               a1: {
-                color: '#fff',
-                backgroundColor: colorList[0],
-                width: 20,
-                height: 20,
+                backgroundColor: '#FFFF0050',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#FFFF00',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               a2: {
               a2: {
-                color: '#fff',
-                backgroundColor: colorList[1],
-                width: 20,
-                height: 20,
+                backgroundColor: '#F2F2F250',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#F2F2F2',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               a3: {
               a3: {
-                color: '#fff',
-                backgroundColor: colorList[2],
-                width: 20,
-                height: 20,
+                backgroundColor: '#FAAD0E50',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#FAAD0E',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               },
               },
               b: {
               b: {
-                color: '#fff',
-                backgroundColor: colorList[3],
-                width: 20,
-                height: 20,
+                backgroundColor: '#00FFFF50',
+                width: 30,
+                height: 28,
                 align: 'center',
                 align: 'center',
-                borderRadius: 10
+                borderRadius: 15,
+                fontSize: 18,
+                borderColor: '#00FFFF',
+                borderType: 'solid',
+                borderWidth: 1,
+                padding: [ 2, 0, 0, 0 ]
               }
               }
             },
             },
-            formatter: (params: string) => {
-              let index = datas.map((item) => item.name).indexOf(params) as number
-              index += 1
-              if (index - 1 < 3) {
-                return `{a${index}|${index}} ${params}`
+            formatter: (params: string, _id: number) => {
+              const id = _id + 1
+              if (_id < 3) {
+                return `{a${id}|${id}}  ${params}`
               }
               }
-              return `{b|${index}} ${params}`
+              return `{b|${id}}  ${params}`
             }
             }
           }
           }
         },
         },
@@ -806,7 +770,7 @@ const leftContent = ref({
             z: 2,
             z: 2,
             name: 'value',
             name: 'value',
             type: 'bar',
             type: 'bar',
-            barWidth: 8,
+            barWidth: 25,
             zlevel: 1,
             zlevel: 1,
             data: datas.map((item, i) => ({
             data: datas.map((item, i) => ({
               value: item.value,
               value: item.value,
@@ -818,16 +782,15 @@ const leftContent = ref({
                   },
                   },
                   {
                   {
                     offset: 1,
                     offset: 1,
-                    color: colorList[3]
+                    color: 'rgba(231, 185, 44, 1)'
                   }
                   }
                 ])
                 ])
               }
               }
             })),
             })),
             label: {
             label: {
-              show: true,
               position: 'inside',
               position: 'inside',
               color: '#fff',
               color: '#fff',
-              fontSize: 14
+              fontSize: 16
             },
             },
             itemStyle: {
             itemStyle: {
               borderRadius: [ 0, 15, 15, 0 ]
               borderRadius: [ 0, 15, 15, 0 ]
@@ -955,7 +918,7 @@ const rightContent = ref([
   }
   }
 ] as any)
 ] as any)
 
 
-function changeFn(id:number, item:any) {
+function changeFn(id: number, item: any) {
   item.checkId = id
   item.checkId = id
 }
 }
 </script>
 </script>
@@ -1015,22 +978,25 @@ function changeFn(id:number, item:any) {
         border-radius: 30px;
         border-radius: 30px;
         border: solid 1px #2185E8;
         border: solid 1px #2185E8;
         left: 50%;
         left: 50%;
-        transform: translate(-50%,0);
+        transform: translate(-50%, 0);
         top: 10px;
         top: 10px;
         z-index: 2;
         z-index: 2;
         display: flex;
         display: flex;
-        &>div{
+
+        &>div {
           width: 90px;
           width: 90px;
           color: white;
           color: white;
           font-size: 16px;
           font-size: 16px;
           text-align: center;
           text-align: center;
           cursor: pointer;
           cursor: pointer;
           line-height: 30px;
           line-height: 30px;
-          &:not(:first-child){
+
+          &:not(:first-child) {
             border-left: solid 1px #2185E8;
             border-left: solid 1px #2185E8;
           }
           }
         }
         }
-        .active{
+
+        .active {
           background: #2185e860;
           background: #2185e860;
         }
         }
       }
       }