Explorar o código

海域使用权

zpf hai 11 meses
pai
achega
dffba43059
Modificáronse 1 ficheiros con 155 adicións e 338 borrados
  1. 155 338
      src/views/cockpitNew1/hysy.vue

+ 155 - 338
src/views/cockpitNew1/hysy.vue

@@ -2,39 +2,11 @@
     <div class="hysy">
         <div class="box">
             <div class="title"> 海域使用权出让</div>
-            <div class="content">
-                <div class="item">
-                    <div class="icon">
-                        <div class="icon2">
 
-                        </div>
-                    </div>
-                    <div class="text">
-                        <p>在变控规</p>
-                        <span>66</span>个
-
-                    </div>
-                </div>
-                <div class="item">
-                    <div class="icon">
-                        <div class="icon2">
-
-                        </div>
-                    </div>
-                    <div class="text">
-                        <p>已入库控规 </p>
-                        <span>66</span>个
-
-                    </div>
-                </div>
-
-            </div>
             <div id="hysyEchart">
 
             </div>
-            <div class="legend">
 
-            </div>
         </div>
     </div>
 </template>
@@ -62,263 +34,184 @@ export default {
 
             var myChart = window.echarts.init(dom);
 
-            let data = [
-                { name: '商业', value: 30 },
-                { name: '租赁', value: 40 },
-                { name: '自用', value: 50 },
-                { name: '住宿', value: 24 },
-            ]
-            for (var i = 0; i < data.length; i++) {
-                for (var j = i + 1; j < data.length; j++) {
-                    //如果第一个比第二个大,就交换他们两个位置
-                    if (data[i].value < data[j].value) {
-                        var temp = data[i];
-                        data[i] = data[j];
-                        data[j] = temp;
-                    }
-                }
-            }
-            let pm = []
-            for (var i = 0; i < data.length; i++) {
-                let k = i + 1
-                pm.push('NO.' + k)
-            }
-            data.forEach(function (value, index, obj) {
-                value.pm = pm[index]
-            })
-            const colors = ['rgb(96,149,239)', 'rgb(239,157,147)', 'rgb(232,191,72)', 'rgb(189,147,227)']
-            const chartData = data.map((item, index) => ({
-                value: item.value,
-                name: item.name,
-                pm: item.pm,
-                itemStyle: {
-                    shadowBlur: 20,
-                    shadowColor: `#${(((index + 1) % 7) + 10) * 100 + 99}`,
-                    shadowOffsetx: 25,
-                    shadowOffsety: 20,
-                    color: colors[index % colors.length],
+            let option = {
+                grid: {
+                    top: "65px",
+                    bottom: "50px",
+                    left: "45px",
+                    right: "20px",
                 },
-            }))
-            const sum = chartData.reduce((per, cur) => per + cur.value, 0)
-            const gap = (1 * sum) / 100
-            const pieData1 = []
-            const gapData = {
-                name: '',
-                value: gap,
-                itemStyle: {
-                    color: 'transparent',
+                title: {  //配置标题组件
+                    text: "",  //设置主标题
+                    textStyle: {  //设置主标题文字样式
+                        color: 'green',
+                    },
+                    left: 20,  //设置适当调整工具框的left位置
+                    top: 3  //设置适当调整工具框的top位置
                 },
-            }
-            let totalRatio = []
-            // let totalPercent = 0
-            for (let i = 0; i < chartData.length; i++) {
-                // 计算占比
-                // let ratio = (chartData[i].value / sum).toFixed(2) * 100;
-                // 累加占比到总占比中
-                // totalRatio.push(ratio*100)
-                let ratio = (chartData[i].value / sum) * 100
-                let percent = Math.round(ratio)
-                totalRatio.push(percent)
-                // totalPercent += percent
-                // 第一圈数据
-                pieData1.push({
-                    ...chartData[i],
-                })
-                pieData1.push(gapData)
-            }
-            // 补充最后一项占比百分比保证之和为100%
-            // totalRatio[0].value += 100 - totalPercent
-            let option = {
-                backgroundColor: 'rgba(1,1,1,0)',
-                title: {
-                    show: true,
-                    // text: sum
-                    text: '用海类型',
-                    // subtext: '收储来源',
-                    x: '49%',
-                    y: '32%',
-                    itemGap: 6,
+                tooltip: {  //配置提示框组件
+                    trigger: 'axis',     //当鼠标滑过轴线时触发显示于详情
+                    axisPointer: {
+                        type: 'cross',//line(直线) || shadow(阴影) || cross(十字准星) || none
+                        label: {
+                            show: true // 鼠标移入X轴文字效果 true || false
+                        }
+                    }
+                },
+                legend: {  //配置图例组件
+                    data: ['渔业用海', '工业用海', '造地工程', '旅游娱乐', '交通运输'],
+                    left: 100,  //设置适当调整工具框的left位置
+                    bottom: "200px",  //设置适当调整工具框的top位置
                     textStyle: {
+                        fontSize: 12,
                         color: '#fff',
-                        fontSize: 11,
-                        fontWeight: '400',
-                        lineHeight: 8,
-                    },
-                    subtextStyle: {
-                        color: '#fff',
-                        fontSize: 8,
-                        fontWeight: '400',
-                        lineHeight: 8,
+                        padding: [5, 0, 0, 2],
+                        rich: {
+                            a: {
+                                verticalAlign: 'middle',
+                            },
+                        },
                     },
-                    textAlign: 'center',
-                },
-
-                // 图例
-                legend: {
-                    show: false,
-                    orient: 'horizontal',
                     icon: 'rect',
-                    textStyle: {
-                        color: '#f2f2f2',
-                        fontSize: '12px',
-                    },
-                    top: '10%',
-                    left: '80%',
-                    itemGap: 14,
                     itemHeight: 14,
                     itemWidth: 14,
-                    data: chartData,
-                    formatter: function (name) {
-                        const selectedItem = chartData.find((item) => `${item.name}`.includes(`${name}`));
-                        if (selectedItem) {
-                            const { value } = selectedItem;
-                            const { pm } = selectedItem;
-                            const p = ((value / sum) * 100).toFixed(2);
-                            const area = `${value}m²`;
-                            // console.log(`{icon|${pm}} {name|${name}}  {percent|${p}%} {area|${area}} `);
-
-                            return `{icon|${pm}} {name|${name}}  {percent|${p}%} {area|${area}} `;
-                        } else {
-
-                            return name;
-                        }
-                    },
-                    textStyle: {
-                        rich: {
-                            icon: {
-                                color: colors
-                            },
-                            name: {
-                                color: '#f2f2f2'
-                            },
-                            percent: {
-                                color: '#f2f2f2'
-                            },
-                            area: {
-                                color: '#f2f2f2'
-                            }
-                        }
-                    }
                 },
-                series: [
-                    // 中间圆环
+                xAxis: [  //配置X轴坐标系
                     {
-                        name: '',
-                        type: 'pie',
-                        roundCap: true,
-                        radius: ['36%', '52%'],
-                        center: ['50%', '35%'],
-                        data: pieData1,
-                        labelLine: {
-                            length: 8,
-                            length2: 16,
-                            lineStyle: {
-                                width: 1,
-                            },
+                        //type: 'category',
+                        boundaryGap: false,
+                        data: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
+                        axisLabel: {
+                            color: "#fff",
+                            fontSize: 12
                         },
-                        label: {
-                            show: false,
-                            fontFamily: 'ysbth',
-                            position: 'outside',
-                            padding: [0, -4, 0, -4],
-                            formatter(params) {
-                                if (params.name === '') {
-                                    return ''
-                                }
-                                return `${params.percent.toFixed(0)}% `
-                            },
-                            color: '#fff',
-                            fontSize: '14px',
-                            lineHeight: 10,
+                    }
+                ],
+                yAxis: [  //配置Y轴坐标系
+                    {
+                        name: "面积/公顷",
+                        nameTextStyle: {
+                            color: "#fff",
+                            fontSize: 12,
+                            padding: [0, 0, 4, 0], //name文字位置 对应 上右下左
                         },
-                        emphasis: {
-                            // 鼠标移入时显示
-                            label: {
-                                show: true,
-                            },
+                        axisLabel: {
+                            color: "#fff",
+                            fontSize: 12
                         },
-                    },
-                    // 最里面圆环
+                        type: "value",
+                    }
+                ],
+                series: [  //配置数据系列。注意:将所有areaStyle去掉,则变成堆积折线图
                     {
-                        type: 'pie',
-                        radius: ['28%', '30%'],
-                        center: ['50%', '35%'],
-                        animation: false,
-                        hoverAnimation: false,
-                        data: [
-                            {
-                                value: 100,
-                            },
-                        ],
-                        label: {
-                            show: false,
+                        name: '渔业用海',
+                        type: 'line',   //设置指定显示为折线
+                        stack: '总量',  //smooth:true,
+                        color: 'rgb(0,0,0)',
+                        symbol: "none",
+                        lineStyle: {
+                            normal: {
+                                color: "rgba(65, 139, 212, 1)" // 线条颜色
+                            }
                         },
                         itemStyle: {
-                            color: '#3BC5EF',
+                            normal: {
+                                areaStyle: {
+                                    //type: 'default',
+                                    color: 'rgba(65, 139, 212, 1)'
+                                }
+                            }
                         },
+                        data: [434, 345, 456, 222, 333, 444, 432]
                     },
-                    // 最里面圆环内的背景圆
                     {
-                        name: '',
-                        type: 'pie',
-                        startAngle: 90,
-                        radius: '28%',
-                        animation: false,
-                        hoverAnimation: false,
-                        center: ['50%', '35%'],
+                        name: '工业用海',
+                        type: 'line',   //设置指定显示为折线
+                        stack: '总量',  //设置堆积
+                        color: 'blue',
+                        symbol: "none",
+                        lineStyle: {
+                            normal: {
+                                color: "rgba(255, 176, 57, 1)" // 线条颜色
+                            }
+                        },
                         itemStyle: {
-                            labelLine: {
-                                show: false,
-                            },
-                            color: {
-                                type: 'radial',
-                                x: 0.5,
-                                y: 0.5,
-                                r: 1,
-                                colorStops: [
-                                    {
-                                        offset: 1,
-                                        color: 'rgba(50,171,241, 0)',
-                                    },
-                                    {
-                                        offset: 0.5,
-                                        color: 'rgba(50,171,241, .4)',
-                                    },
-                                    {
-                                        offset: 0,
-                                        color: 'rgba(55,70,130, 0)',
-                                    },
-                                ],
-                                global: false, // 缺省为 false
-                            },
-                            shadowBlur: 60,
+                            normal: {
+                                areaStyle: {
+                                    //type: 'default',
+                                    color: 'rgba(255, 176, 57, 1)'
+                                }
+                            }
                         },
-                        data: [
-                            {
-                                value: 100,
-                            },
-                        ],
+                        data: [420, 282, 391, 344, 390, 530, 410]
                     },
-                    // 最外面的圆环
                     {
-                        type: 'pie',
-                        color: ['#1a4a8c', 'rgba(0,0,0,0)', '#1a4a8c', 'rgba(0,0,0,0)'],
-                        radius: ['53%', '54%'],
-                        center: ['50%', '35%'],
-                        label: {
-                            show: false,
+                        name: '造地工程',
+                        type: 'line',   //设置指定显示为折线
+                        stack: '总量',  //设置堆积
+                        color: 'red',
+                        symbol: "none",
+                        lineStyle: {
+                            normal: {
+                                color: "rgba(92, 185, 129, 1)" // 线条颜色
+                            }
                         },
-                        select: {
-                            display: false,
+                        itemStyle: {
+                            normal: {
+                                areaStyle: {
+                                    //type: 'default',
+                                    color: 'rgba(92, 185, 129, 1)'
+                                }
+                            }
                         },
-                        tooltip: {
-                            show: false,
+                        data: [350, 332, 331, 334, 390, 320, 340]
+                    },
+                    {
+                        name: '旅游娱乐',
+                        type: 'line',   //设置指定显示为折线
+                        stack: '总量',  //设置堆积
+                        color: 'green',
+
+                        symbol: "none",
+                        lineStyle: {
+                            normal: {
+                                color: "rgba(255, 98, 96, 1)" // 线条颜色
+                            }
+                        },
+                        itemStyle: {
+                            normal: {
+                                areaStyle: {
+                                    //type: 'default',
+                                    color: 'rgba(255, 98, 96, 1)'
+                                }
+                            }
                         },
-                        data: totalRatio,
+                        data: [420, 222, 333, 442, 230, 430, 430]
                     },
-                ],
-            }
-
+                    {
+                        name: '交通运输',
+                        type: 'line',   //设置指定显示为折线
+                        stack: '总量',  //设置堆积
+                        color: '#FA8072',
+
+                        symbol: "none",
+                        lineStyle: {
+                            normal: {
+                                color: "rgba(137, 81, 157, 1))" // 线条颜色
+                            }
+                        },
+                        itemStyle: {//设置item的样式
+                            normal: {//常规状态
+                                areaStyle: {    //区域样式,仅在折线图中有效
+                                    //type: 'default',
+                                    color: 'rgba(137, 81, 157, 1)'
+                                }
+                            }
+                        },
+                        data: [330, 442, 432, 555, 456, 666, 877, 634, 534, 55, 111]
+                    }
+                ]
+            };
             myChart.setOption(option);
         },
     },
@@ -375,89 +268,13 @@ export default {
     padding: 2%;
 }
 
-.content {
-    // border: #00FFFF 1px solid;
-    position: absolute;
-    left: 5%;
-    width: 400px;
-    height: 190px;
-    top: 18%;
-}
-
-.item {
-    width: 45%;
-    height: 30%;
-    display: inline-block;
-    // border: #00FFFF 1px solid;
 
-}
-
-.icon {
-    width: 50px;
-    padding: 1.5%;
-    border-radius: 8px;
-    background-color: rgba(104, 244, 251, 0.215686);
-    display: inline-block;
-    height: 50px
-}
-
-.icon2 {
-    background: no-repeat 50%;
-    background-image: url("/static/images/cockpitNew/u296.svg");
-    /* border: #00FFFF 1px solid; */
-    width: 45px;
-    height: 45px;
-    display: inline-block;
-
-}
 
-.text {
-    display: inline-block;
-    // border: #00FFFF 1px solid;
-    width: 100px;
-
-    p {
-        font-kerning: normal;
-        font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
-        font-weight: 700;
-        font-style: normal;
-        font-size: 14px;
-        color: #FFFFFF;
-    }
-
-    span {
-        font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
-        font-weight: 700;
-        font-style: normal;
-        color: #68F4FB;
-    }
-}
 
 #hysyEchart {
-    width: 280px;
-    height: 230px;
-    width: 280px;
-    height: 230px;
-    position: relative;
-    left: -35px;
-    top: 59px;
-}
-
-.legend {
-
-
-
-
-    background: no-repeat -10% 69%;
-    background-size: 65%;
-    // background-image: url(/static/images/cockpitNew/legend.png);
-    background-image: url("/static/images/cockpitNew/legend.png");
-
-    position: absolute;
-    top: 46%;
-    left: 31%;
-    width: 520px;
-    height: 132px;
-
+    left: 1rem;
+    top: 1rem;
+    width: 32rem;
+    height: 14rem;
 }
 </style>