|
@@ -1,5 +1,9 @@
|
|
|
|
|
|
import MiniMap from '../../../../MapView/miniMap/index';
|
|
|
+import { GeoJSON } from "ol/format";
|
|
|
+import Feature from 'ol/Feature';
|
|
|
+import elementResizeDetectorMaker from "element-resize-detector"
|
|
|
+
|
|
|
import echarts from 'echarts'
|
|
|
export default {
|
|
|
components: {
|
|
@@ -17,7 +21,7 @@ export default {
|
|
|
{ value: "5", label: '通信管线' },
|
|
|
{ value: "6", label: '综合管线' }],
|
|
|
pipeLineType: "请选择",
|
|
|
- selectType: '2',
|
|
|
+ selectType: '1',
|
|
|
staCondition: [],
|
|
|
optionFields:[{value: 'buildingNo',label: '楼盘编号'},
|
|
|
{value: 'buildingNum',label: '幢号'},
|
|
@@ -36,7 +40,8 @@ export default {
|
|
|
optionConnect: [{ value: 'and', label: '并且' },
|
|
|
{ value: 'or', label: '或者'}
|
|
|
],
|
|
|
- statisticData:[]
|
|
|
+ statisticData: [],
|
|
|
+ activeName:'line'
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -55,26 +60,48 @@ export default {
|
|
|
staCondition(newValue, oldValue) {
|
|
|
console.log("改变", newValue, oldValue);
|
|
|
this.statisticCondition = newValue;
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.loadEchart();
|
|
|
- this.classifyStatistic();
|
|
|
this.statisticMode = '';
|
|
|
this.staCondition.push({ id: 0, fieldName: '', symbol: '', value: '', connect: '' });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+
|
|
|
+ this.classifyStatistic();
|
|
|
+ this.pointClassifyStatistic();
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
methods: {
|
|
|
+
|
|
|
+
|
|
|
+ * 新增条件
|
|
|
+ */
|
|
|
addCondition(id) {
|
|
|
this.staCondition.push({ id: id+1, fieldName: '', symbol: '', value: '', connect: '' });
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+ * 删除条件
|
|
|
+ */
|
|
|
delCondition(id) {
|
|
|
this.staCondition.splice(id, 1);
|
|
|
if (this.staCondition.length < 1) {
|
|
|
this.staCondition.push({ id: 0, fieldName: '', symbol: '', value: '', connect: '' });
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
|
|
|
+
|
|
|
+ * 鼠标切换tab事件
|
|
|
+ */
|
|
|
+ handleClick(tab, event) {
|
|
|
+ console.log('1111111111', tab, tab.name, event, this.$refs.pointDiamStatistic.style.width);
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
* 根据地图配置获取统计类型
|
|
|
* @data 数组
|
|
@@ -104,18 +131,119 @@ export default {
|
|
|
this.statisticData = [];
|
|
|
}
|
|
|
if (data.type == 'add') {
|
|
|
- this.statisticData.push({name:data.name,result:data.result});
|
|
|
+ this.statisticData.push(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.statisticCount <= data.times) {
|
|
|
+ console.log('返回数据', this.statisticData);
|
|
|
+ this.getOverviewData(this.statisticData);
|
|
|
}
|
|
|
- console.log('返回数据', this.statisticData);
|
|
|
-
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+ * 获取总览统计数据
|
|
|
+ */
|
|
|
+ getOverviewData(statisticData) {
|
|
|
+ let data = { };
|
|
|
+ if (statisticData && statisticData.length > 0) {
|
|
|
+ statisticData.forEach(item => {
|
|
|
+
|
|
|
+ if (data.hasOwnProperty(item.dataSetInfo.type)) {
|
|
|
+ if (item.dataSetInfo.type == 'point') {
|
|
|
+ data[item.dataSetInfo.type].dataName.push(item.dataSetInfo.label);
|
|
|
+ data[item.dataSetInfo.type].dataValue.push(item.result.featureCount);
|
|
|
+ }
|
|
|
+ if (item.dataSetInfo.type == 'line') {
|
|
|
+ let dataValue = 0;
|
|
|
+ if (item.result.featureCount > 0) {
|
|
|
+ item.result.features.features.forEach(feature => {
|
|
|
+ let fea = new Feature({
|
|
|
+ geometry: new GeoJSON().readGeometry(feature.geometry)
|
|
|
+ });
|
|
|
+ let length = fea.getGeometry().getLength();
|
|
|
+
|
|
|
+ dataValue = dataValue + length;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ dataValue = 0
|
|
|
+ }
|
|
|
+ data[item.dataSetInfo.type].dataName.push(item.dataSetInfo.label);
|
|
|
+ data[item.dataSetInfo.type].dataValue.push(parseFloat(dataValue));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (item.dataSetInfo.type == 'point') {
|
|
|
+ data[item.dataSetInfo.type] = {
|
|
|
+ name: '管点',
|
|
|
+ dataName: [item.dataSetInfo.label],
|
|
|
+ dataValue: [item.result.featureCount]
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- loadEchart() {
|
|
|
- let option = {
|
|
|
+ if (item.dataSetInfo.type == 'line') {
|
|
|
+ let dataValue = 0;
|
|
|
+ if (item.result.featureCount > 0) {
|
|
|
+ item.result.features.features.forEach(feature => {
|
|
|
+ dataValue = dataValue + feature.properties.SMLENGTH;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ dataValue = 0
|
|
|
+ }
|
|
|
+ data[item.dataSetInfo.type] = {
|
|
|
+ name: '管线',
|
|
|
+ dataName: [item.dataSetInfo.label],
|
|
|
+ dataValue: [parseFloat(dataValue)]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.loadOverviewEchart(data);
|
|
|
+ },
|
|
|
+
|
|
|
+ loadOverviewEchart(data) {
|
|
|
+ console.log('-----------',data);
|
|
|
+ let option = null;
|
|
|
+ let dataName = [];
|
|
|
+ let dataValue = [];
|
|
|
+ let text = '';
|
|
|
+ if (data.hasOwnProperty('point')) {
|
|
|
+ dataName = data.point.dataName;
|
|
|
+ dataValue = data.point.dataValue;
|
|
|
+ text = '管点总个数:' + eval(dataValue.join("+")) + '个';
|
|
|
+ option = this.echartOption(text,dataName, dataValue);
|
|
|
+ echarts.init(this.$refs.pipePointOverview).setOption(option);
|
|
|
+ }
|
|
|
+ if(data.hasOwnProperty('line')) {
|
|
|
+ dataName = data.line.dataName;
|
|
|
+ dataValue = data.line.dataValue;
|
|
|
+ let sum = 0;
|
|
|
+ dataValue.forEach(item => {
|
|
|
+ sum = sum + parseFloat(item);
|
|
|
+ });
|
|
|
+ text = '管线长度:'+ sum.toFixed(4) + '千米';
|
|
|
+ option = this.echartOption(text,dataName,dataValue)
|
|
|
+ echarts.init(this.$refs.pipeLineOverview).setOption(option);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 总览显示-管点统计
|
|
|
+ * @dataName 数组,统计类型名称
|
|
|
+ * @dataValue 数组,统计数据
|
|
|
+ * 注意:1、dataName和dataValue数组长度必须保存一致
|
|
|
+ * 2、dataValue数字类型数组
|
|
|
+ */
|
|
|
+ echartOption(text,dataName, dataValue) {
|
|
|
+ return {
|
|
|
+ title: {
|
|
|
+ text: text,
|
|
|
+ },
|
|
|
xAxis: {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- data: ['排水管线', '供水管线', '燃气管线', '电力管线', '通信管线', '综合管线']
|
|
|
+ type: 'category',
|
|
|
+ data: dataName
|
|
|
},
|
|
|
|
|
|
toolbox: {
|
|
@@ -124,9 +252,9 @@ export default {
|
|
|
dataZoom: {
|
|
|
yAxisIndex: 'none'
|
|
|
},
|
|
|
- dataView: {readOnly: false},
|
|
|
- magicType: {type: ['line', 'bar','pie']},
|
|
|
- restore: {},
|
|
|
+
|
|
|
+ magicType: {type: ['line', 'bar']},
|
|
|
+
|
|
|
saveAsImage: {}
|
|
|
}
|
|
|
},
|
|
@@ -135,7 +263,7 @@ export default {
|
|
|
},
|
|
|
series: [{
|
|
|
showBackground: true,
|
|
|
- itemStyle: {
|
|
|
+ itemStyle: {
|
|
|
color: new echarts.graphic.LinearGradient(
|
|
|
0, 0, 0, 1,
|
|
|
[
|
|
@@ -144,21 +272,45 @@ export default {
|
|
|
{offset: 1, color: '#188df0'}
|
|
|
]
|
|
|
)
|
|
|
- },
|
|
|
- data: [820, 932, 901, 934, 1290, 1330],
|
|
|
- type: 'line',
|
|
|
- areaStyle: {}
|
|
|
+ },
|
|
|
+ data: dataValue,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth:'30',
|
|
|
+ areaStyle: {}
|
|
|
}]
|
|
|
};
|
|
|
- echarts.init(this.$refs.pipeLineOverview).setOption(option);
|
|
|
- echarts.init(this.$refs.pipePointOverview).setOption(option);
|
|
|
},
|
|
|
+
|
|
|
|
|
|
|
|
|
classifyStatistic() {
|
|
|
- let option = {
|
|
|
+ let dataName = []
|
|
|
+ let dataValue = [];
|
|
|
+ let text = '';
|
|
|
+ let option = null;
|
|
|
+ setTimeout(() => {
|
|
|
+ dataName = ['200-400', '400-600', '600-800','800-100']
|
|
|
+ dataValue = [820, 932, 901,1200];
|
|
|
+ text = '按管径统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ echarts.init(this.$refs.lineTypeStatistic).setOption(option);
|
|
|
+ dataName = ['筋混凝土管', '石棉水泥管', '玻璃钢管', '塑料管', '水球墨铸铁管', '钢管']
|
|
|
+ dataValue = [1234, 932, 456, 671, 234, 981];
|
|
|
+ text = '按材料统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ echarts.init(this.$refs.lineMaterialStatistic).setOption(option);
|
|
|
+ dataName = ['白色硅胶管', '灰色软管', '黑色塑料管', '灰色塑料管']
|
|
|
+ dataValue = [890, 932, 1231, 2341];
|
|
|
+ text = '按特征统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ echarts.init(this.$refs.lineDiamStatistic).setOption(option);
|
|
|
+ }, 200);
|
|
|
+ },
|
|
|
+
|
|
|
+ getClassifyoption(text,dataName,dataValue) {
|
|
|
+ return {
|
|
|
title: {
|
|
|
- text: '按管径统计',
|
|
|
+ text: text,
|
|
|
subtext: '',
|
|
|
left: 'left',
|
|
|
textStyle: {
|
|
@@ -174,7 +326,7 @@ export default {
|
|
|
interval:0,
|
|
|
rotate:40
|
|
|
} ,
|
|
|
- data: ['排水管线', '供水管线', '燃气管线', '电力管线', '通信管线', '综合管线']
|
|
|
+ data: dataName
|
|
|
},
|
|
|
|
|
|
toolbox: {
|
|
@@ -183,9 +335,9 @@ export default {
|
|
|
dataZoom: {
|
|
|
yAxisIndex: 'none'
|
|
|
},
|
|
|
- dataView: {readOnly: false},
|
|
|
+
|
|
|
magicType: {type: ['line', 'bar','pie']},
|
|
|
- restore: {},
|
|
|
+
|
|
|
saveAsImage: {}
|
|
|
}
|
|
|
},
|
|
@@ -194,7 +346,7 @@ export default {
|
|
|
},
|
|
|
series: [{
|
|
|
showBackground: true,
|
|
|
- itemStyle: {
|
|
|
+ itemStyle: {
|
|
|
color: new echarts.graphic.LinearGradient(
|
|
|
0, 0, 0, 1,
|
|
|
[
|
|
@@ -203,20 +355,52 @@ export default {
|
|
|
{offset: 1, color: '#188df0'}
|
|
|
]
|
|
|
)
|
|
|
- },
|
|
|
- data: [820, 932, 901, 934, 1290, 1330],
|
|
|
- type: 'line',
|
|
|
- areaStyle: {}
|
|
|
+ },
|
|
|
+ data: dataValue,
|
|
|
+ type: 'line',
|
|
|
+ barWidth:'30',
|
|
|
+ areaStyle: {}
|
|
|
}]
|
|
|
};
|
|
|
-
|
|
|
- echarts.init(this.$refs.lineTypeStatistic).setOption(option);
|
|
|
- echarts.init(this.$refs.lineMaterialStatistic).setOption(option);
|
|
|
- echarts.init(this.$refs.lineDiamStatistic).setOption(option);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ pointClassifyStatistic() {
|
|
|
+ let dataName = []
|
|
|
+ let dataValue = [];
|
|
|
+ let text = '';
|
|
|
+ let option = null;
|
|
|
+ dataName = ['弯管', '直管', '三通管']
|
|
|
+ dataValue = [820, 932, 901];
|
|
|
+ text = '按特征统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ let pointDiam = echarts.init(this.$refs.pointDiamStatistic);
|
|
|
+ pointDiam.setOption(option);
|
|
|
+ dataName = ['筋混凝土管', '石棉水泥管', '玻璃钢管', '塑料管', '水球墨铸铁管', '钢管']
|
|
|
+ dataValue = [1234, 932, 456, 671, 234, 981];
|
|
|
+ text = '按附属物统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ let pointMaterial = echarts.init(this.$refs.pointMaterialStatistic);
|
|
|
+ pointMaterial.setOption(option);
|
|
|
+ dataName = ['白色硅胶管', '灰色软管', '黑色塑料管', '灰色塑料管']
|
|
|
+ dataValue = [890, 932, 1231, 2341];
|
|
|
+ text = '按类型统计';
|
|
|
+ option = this.getClassifyoption(text,dataName,dataValue);
|
|
|
+ let pointType = echarts.init(this.$refs.pointTypeStatistic);
|
|
|
+ pointType.setOption(option)
|
|
|
+
|
|
|
+ elementResizeDetectorMaker().listenTo(this.$refs.pointDiamStatistic, () => {
|
|
|
+ this.$nextTick(pointDiam.resize)
|
|
|
+ });
|
|
|
+
|
|
|
+ elementResizeDetectorMaker().listenTo(this.$refs.pointMaterialStatistic, () => {
|
|
|
+ this.$nextTick(pointMaterial.resize)
|
|
|
+ });
|
|
|
+
|
|
|
+ elementResizeDetectorMaker().listenTo(this.$refs.pointTypeStatistic, () => {
|
|
|
+ this.$nextTick(pointType.resize)
|
|
|
+ });
|
|
|
|
|
|
- echarts.init(this.$refs.pointDiamStatistic).setOption(option);
|
|
|
- echarts.init(this.$refs.pointMaterialStatistic).setOption(option);
|
|
|
- echarts.init(this.$refs.pointTypeStatistic).setOption(option);
|
|
|
}
|
|
|
}
|
|
|
}
|