zpf hace 1 año
padre
commit
5c86545188
Se han modificado 3 ficheros con 126 adiciones y 525 borrados
  1. 6 0
      src/router/index.js
  2. 1 1
      src/views/cockpitNew1/tdsc.vue
  3. 119 524
      src/views/cockpitNew1/tdsy.vue

+ 6 - 0
src/router/index.js

@@ -49,6 +49,12 @@ export const constantRoutes = [{
         hidden: true
     }, {
         path: '/overview',
+        component: () =>
+            import('@/views/viewer.vue'),
+        hidden: true
+    }
+    , {
+        path: '/overview1',
         component: () =>
             import('@/views/viewer1.vue'),
         hidden: true

+ 1 - 1
src/views/cockpitNew1/tdsc.vue

@@ -76,7 +76,7 @@ export default {
           },
         },
         legend: {
-          orient: legendType === 'center' ? 'horizontal' : 'vertical',
+          orient: legendType === 'center' ? '' : 'vertical',
           bottom: "80%",
           right: legendType === 'center' ? 'center' : '2%',
           // data: ['2023/06/08', '2023/10/07','2023/10/11'],

+ 119 - 524
src/views/cockpitNew1/tdsy.vue

@@ -108,7 +108,10 @@
 
 
         <div v-show="!stateOwnedOrcollective">
-            <div id="acrossEchart">
+            <div class="deficiency_echart">
+
+            </div>
+            <div id="across_echart">
 
             </div>
             <!-- <div class="echartInfo">
@@ -129,7 +132,7 @@ export default {
     components: {},
     data() {
         return {
-            stateOwnedOrcollective: true
+            stateOwnedOrcollective: false
         };
     },
     //监听属性 类似于data概念
@@ -142,542 +145,134 @@ export default {
     }, //生命周期 - 创建完成(可以访问当前this实例)
     beforeMount() { }, //生命周期 - 挂载之前
     methods: {
-        getRenKou() {
-            var dom = document.getElementById('tdsyEchart');
+
+        switchStateOwnedButton() {
+            this.stateOwnedOrcollective = !this.stateOwnedOrcollective
+        },
+
+        init_across_echart() {
+
+            var dom = document.getElementById('across_echart');
             var myChart = window.echarts.init(dom);
+            console.log(myChart, "myChart");
 
-            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],
+            //做环形图的本质是 radius: ['内半径', '外半径'] 内半径!=0
+            const backgroundColor = 'rgba(0,0,0,0)';
+            const title = {
+                text: '计划供应面积',
+                subtext: '613103.45\n公倾',
+                backgroundColor: 'rgba(0,0,0,0)',
+                textStyle: {
+                    color: "#fff",
+                    fontFamily: 'Arial',
+                    fontSize: 10,
+                    fontStyle: 'normal',
+                    fontWeight: '400',
                 },
-            }))
-            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',
+                subtextStyle: {
+                    fontSize: 12,
+                    color: "#64daff",
+                    fontWeight: '500',
+
                 },
+                x: 'center',
+                y: '35%',
             }
-            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
+            const legendType = 'center'
+
+
+            const tooltip = {
+                show: false,
+                formatter: '{b}:{d}%',
+            };
+            const color = ['#ca9d51', '#5bbd88', 'rgba(0,0,0,0)'];
             let option = {
-                backgroundColor: 'rgba(1,1,1,0)',
-                title: {
-                    show: true,
-                    // text: sum
-                    text: '收储来源',
-                    // subtext: '收储来源',
-                    x: '49%',
-                    y: '32%',
-                    itemGap: 6,
-                    textStyle: {
-                        color: '#fff',
-                        fontSize: 11,
-                        fontWeight: '400',
-                        lineHeight: 8,
-                    },
-                    subtextStyle: {
-                        color: '#fff',
-                        fontSize: 8,
-                        fontWeight: '400',
-                        lineHeight: 8,
-                    },
-                    textAlign: 'center',
-                },
+                backgroundColor,
+                color,
+                title,
+                tooltip,
 
-                // 图例
-                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;
-                            console.log('dddd', selectedItem)
-                            const p = ((value / sum) * 100).toFixed(2);
-                            const area = `${value}m²`;
-
-                            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'
-                            }
-                        }
-                    }
+                grid: {
+                    // top: '1%',//生成的echarts图片和顶部的距离
+                    bottom: '90px',//echarts图片和底部的距离
+                    // left: '1%',//echarts图片和左边的距离
+                    // right: '2%',//echarts图片和右边的间距,
+                    containLabel: true//当containLabel:为ture时,以上设置生效
                 },
                 series: [
-                    // 中间圆环
                     {
-                        name: '',
+                        name: '网络安全设备',
                         type: 'pie',
-                        roundCap: true,
-                        radius: ['36%', '52%'],
-                        center: ['50%', '35%'],
-                        data: pieData1,
-                        labelLine: {
-                            length: 8,
-                            length2: 16,
-                            lineStyle: {
-                                width: 1,
-                            },
-                        },
+                        center: ['50%', '50%'], //圆心的位置
+                        top: '2%', //单单指的饼图距离上面的距离,top越大饼图越小
+                        left: '0%', //单单指的饼图距离左面的距离,会改变饼图的大小
+                        radius: ['65%', '80%'], //环形图的本质就在这里 [内半径!=0,外半径] 外半径越大,圆越大
+                        avoidLabelOverlap: false, //做同心圆用到
+                        clockwise: true, //顺时针排列
+                        startAngle: 90, //起始角度 影响不大
+                        //roseType:"", // 实心圆 不能出现roseType这个属性
+
                         label: {
-                            show: false,
-                            fontFamily: 'ysbth',
-                            position: 'outside',
-                            padding: [0, -4, 0, -4],
-                            formatter(params) {
-                                if (params.name === '') {
-                                    return ''
-                                }
-                                return `${params.percent.toFixed(0)}% `
+                            show: false, //false不显示饼图上的标签
+                            position: 'center', //inside(在饼图上显示),outside(默认就会出现引导线) center
+                            formatter: '{b}:{c}',
+                            normal: {
+                                position: 'inside', // 在内部显示,outseide 是在外部显示
+                                alignTo: 'labelLine',
+                                textStyle: {
+                                    fontWeight: 200,
+                                    fontSize: 12,   //文字的字体大小
+                                    color: '#fff'
+                                },
+                                formatter: function (params) {
+                                    console.log(params)
+                                    // return '{point|}{white|' + params.name + '}{blue|' + params.percent + '%}\n{yellow|' + params.value + '}';
+                                    return params.value + '%';
+
+                                },
                             },
-                            color: '#fff',
-                            fontSize: '14px',
-                            lineHeight: 10,
                         },
-                        emphasis: {
-                            // 鼠标移入时显示
-                            label: {
-                                show: true,
-                            },
+                        itemStyle: {
+                            //每个扇形的设置
+                            borderColor: 'rgba(0,0,0,0)', //扇形边框颜色
+                            borderWidth: 1, //扇形边框大小 要先给borderColor颜色 设置borderWidth才会有效果
+
                         },
-                    },
-                    // 最里面圆环
-                    {
-                        type: 'pie',
-                        radius: ['28%', '30%'],
-                        center: ['50%', '35%'],
-                        animation: false,
-                        hoverAnimation: false,
                         data: [
-                            {
-                                value: 100,
-                            },
+                            { value: 35, name: 'IDS' },
+                            { value: 25, name: ' WAF' },
+                            { value: 30, name: '' },
                         ],
-                        label: {
-                            show: false,
-                        },
-                        itemStyle: {
-                            color: '#3BC5EF',
-                        },
-                    },
-                    // 最里面圆环内的背景圆
-                    {
-                        name: '',
-                        type: 'pie',
-                        startAngle: 90,
-                        radius: '28%',
-                        animation: false,
-                        hoverAnimation: false,
-                        center: ['50%', '35%'],
-                        itemStyle: {
-                            labelLine: {
-                                show: false,
+                        // .sort((a, b) => b.value - a.value), //数组从大到小排序
+
+                        emphasis: {
+                            scale: true,
+                            scaleSize: 20,
+                            //同心圆单独加上的
+                            label: {
+                                show: true,
+                                fontSize: 24,
+                                fontWeight: 'bold'
                             },
-                            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
+                            //启用鼠标放上去放大效果,这个挺好的
+                            itemStyle: {
+                                shadowBlur: 10,
+                                shadowOffsetX: 0,
+                                shadowColor: 'rgba(0, 0, 0, 0.5)',
                             },
-                            shadowBlur: 60,
                         },
-                        data: [
-                            {
-                                value: 100,
-                            },
-                        ],
-                    },
-                    // 最外面的圆环
-                    {
-                        type: 'pie',
-                        color: ['#1a4a8c', 'rgba(0,0,0,0)', '#1a4a8c', 'rgba(0,0,0,0)'],
-                        radius: ['53%', '54%'],
-                        center: ['50%', '35%'],
-                        label: {
-                            show: false,
-                        },
-                        select: {
-                            display: false,
-                        },
-                        tooltip: {
-                            show: false,
-                        },
-                        data: totalRatio,
                     },
                 ],
-            }
-
-            myChart.setOption(option);
-        },
-        switchStateOwnedButton() {
-            this.stateOwnedOrcollective = !this.stateOwnedOrcollective
-        },
-        buildverticalEchart() {
-            var dom = document.getElementById('verticalEchart');
-            var myChart = window.echarts.init(dom);
-
-
-            let option = {
-                backgroundColor: 'rgba(0,0,0,0)',
-                tooltip: {
-                    trigger: 'axis',
-                },
-                grid: {
-                    left: '5%',
-                    right: '6%',
-                    bottom: '15%',
-                    top: '10%',
-                    containLabel: true
-                },
-                legend: {
-                    icon: 'circle',
-                    right: "center",
-                    top: 230,
-                    itemWidth: 12,
-                    itemHeight: 12,
-                    textStyle: {
-                        color: '#FFF'
-                    },
-                },
-                xAxis: {
-                    show: true,
-                    type: 'category',
-                    data: ['共服务', '公共服务', '公共服务', '公共服务', '公共服务', '公共服务', '公共服务', '公共服务', '公共服务', "公共服务", "公共服务"],
-                    max: 9,
-                    interval: 1,
-
-
-                    axisLabel: {
-                        //坐标轴字体颜色
-                        textStyle: {
-                            color: '#fff'
-                        }
-                    },
-                    axisLine: {
-                        show: false,
-                        lineStyle: {
-                            color: "#e5e5e5"
-                        }
-                    },
-                    axisTick: {       //y轴刻度线
-                        show: false
-                    },
-                    splitLine: {    //网格
-                        show: false,
-
-                    }
-                },
-                yAxis: {
-                    type: 'value',
-                    boundaryGap: ['0%', '20%'],
-
-                    axisLabel: {
-                        show: false, //不显示坐标轴上的文字
-                    },
-                    axisLine: {
-                        show: false,
-                    },
-                    axisTick: {       //y轴刻度线
-                        show: false
-                    },
-                    splitLine: {    //网格
-                        show: false,
-                        lineStyle: {
-                            color: '#dadde4',
-                            type: "dashed"
-                        }
-                    }
-                },
-                series: [{
-                    name: '在线',
-                    type: 'bar',
-                    stack: '策略变更',
-                    barMaxWidth: '20%',  //柱子宽度
-                    itemStyle: {  //柱子颜色
-                        color: 'rgb(18,236,183)',
-                    },
-                    data: [232, 193, 240, 214, 239, 223, 202, 100, 300, 400],
-                    barCategoryGap: '20%',
-                }, {
-                    name: '离线',
-                    type: 'bar',
-                    stack: '策略变更',
-                    barMaxWidth: '30%',  //柱子宽度
-                    itemStyle: {  //柱子颜色
-                        barBorderRadius: [8, 8, 0, 0],
-                        color: 'rgb(252,206,22)',
-                    },
-                    data: [320, 332, 301, 334, 390, 330, 320, 100, 300, 400],
-                    barCategoryGap: '20%',
-
-                }]
-            };
-            myChart.setOption(option);
-
-        },
-
-        buildAcrossEchart() {
-            var dom = document.getElementById('acrossEchart');
-            var myChart = window.echarts.init(dom);
-
-            var spNum = 5, _max = 100;
-            var y_data = ['初设批复', '施工期', '完建期', '已竣工'];
-            var _datamax = [100, 100, 100, 100],
-                _data1 = [
-                    { value: 20, data: 10 },
-                    { value: 10, data: 10 },
-                    { value: 60, data: 10 },
-                    { value: 20, data: 10 }
-                ],
-                _data2 = [
-                    { value: 50, data: 30 },
-                    { value: 30, data: 30 },
-                    { value: 78, data: 30 },
-                    { value: 30, data: 30 }
-                ];
-            var fomatter_fn = function (v) {
-                return v.value + '%'
-            }
-            var _label = {
-                normal: {
-                    show: false,
-                    position: 'inside',
-                    formatter: fomatter_fn,
-                    textStyle: {
-                        color: '#fff',
-                        fontSize: 16
-                    }
-                }
-            };
-            let option = {
-                backgroundColor: "rgba(0,0,0,0)",
-                grid: {
-                    containLabel: true,
-                    top: '16%',
-                    left: 0,
-                    right: 6,
-                    bottom: '10%'
-                },
-                legend: {
-                    data: [
-                        { name: "出让", icon: "circle" },
-                        { name: "划拨", icon: "circle" },
-                    ],
-                    // 大小 和位置 文字样式
-                    itemGap: 12,
-                    top: 200,
-                    right: 40,
-                    textStyle: {
-                        fontSize: 11,
-                        color: "#ffffff",
-                        fontFamily: "SourceHanSansCN-Regular"
-                    }
-                },
-                tooltip: {
-                    show: true,
-                    backgroundColor: '#fff',
-                    borderColor: '#ddd',
-                    borderWidth: 1,
-                    textStyle: {
-                        color: '#3c3c3c',
-                        fontSize: 16
-                    },
-                    formatter: function (p) {
-                        return '名称:' + p.seriesName + '<br>' + '数量:' + p.data.data + '<br>' + '占比:' + p.value + '%';
-                    },
-                    extraCssText: 'box-shadow: 0 0 5px rgba(0, 0, 0, 0.1)'
-                },
-                xAxis: {
-                    splitNumber: '',
-                    interval: 50,
-                    max: 50,
-                    axisLabel: {
-                        rotate: 10,
-                        show: false,
-                        formatter: function (v) {
-                            var _v = Number((v / _max * 100).toFixed(0));
-                            return _v == 0 ? _v : _v + '%';
-                        }
-                    },
-                    axisLine: {
-                        show: false
-                    },
-                    axisTick: {
-                        show: false
-                    },
-                    splitLine: {
-                        show: false
-                    }
-                },
-                yAxis: [{
-                    show: false,
-                    data: y_data,
-                    axisLabel: {
-                        fontSize: 16,
-                        color: '#fff'
-                    },
-                    axisLine: {
-                        show: false
-                    },
-                    axisTick: {
-                        show: false
-                    },
-                    splitLine: {
-                        show: false
-                    }
-                }, {
-                    show: false,
-                    data: y_data,
-                    axisLine: {
-                        show: false
-                    }
-                }],
-                series: [{
-                    type: 'bar',
-                    silent: true,
-                    yAxisIndex: 1,
-                    itemStyle: {
-                        color: 'RGBA(41, 82, 180, 0)',
-                        emphasis: {
-                            color: 'rgba(255,255,255,0)'
-                        }
-                    },
-                    data: _datamax
-                }, {
-                    type: 'bar',
-                    name: '出让',
-                    stack: '2',
-                    label: _label,
-                    legendHoverLink: false,
-                    barWidth: '20%',
-                    itemStyle: {
-                        color: '#01AEFC',
-                        emphasis: {
-                            color: '#00BCD4'
-                        }
-                    },
-                    data: _data1
-                }, {
-                    type: 'bar',
-                    name: '划拨',
-                    stack: '2',
-                    legendHoverLink: false,
-                    label: _label,
-                    itemStyle: {
-                        color: '#FFD200',
-                        emphasis: {
-                            color: '#FF9800'
-                        }
-                    },
-                    data: _data2
-                },
-                ]
             };
             myChart.setOption(option);
 
         }
 
+
     },
     mounted() {
-        this.getRenKou();
-        this.buildverticalEchart();
-        this.buildAcrossEchart();
-
+        this.init_across_echart();
+      
     },
     beforeUpdate() { }, //生命周期 - 更新之前
     updated() { }, //生命周期 - 更新之后
@@ -911,22 +506,22 @@ export default {
     }
 }
 
-#acrossEchart {
-
-    width: 280px;
-    height: 230px;
-    position: relative;
-    left: -2%;
-    top: 2px;
-    display: inline-block
+#across_echart {
+    left: -6rem;
+    top: 2rem;
+    width: 20rem;
+    height: 11rem
 }
 
-#verticalEchart {
-    display: inline-block;
-    width: 280px;
-    height: 260px;
-    position: relative;
-    left: 24%;
-    top: 2px;
+.deficiency_echart {
+    width: 9.5rem;
+    height: 9.5rem;
+    border: 15px solid #104375;
+    position: absolute;
+    top: 3.6rem;
+    left: 1rem;
+
+    border-radius: 80rem;
+
 }
 </style>