|
@@ -16,6 +16,10 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
|
|
+ import {
|
|
|
|
+ getDeptDropList,
|
|
|
|
+ reportReportBigDataDangerDistribution,
|
|
|
|
+ } from "@/api/index";
|
|
import checkSelectComponents from "@/components/checkSelectComponents.vue";
|
|
import checkSelectComponents from "@/components/checkSelectComponents.vue";
|
|
import titlePageImgComponents from '@/components/titlePageImgComponents.vue'
|
|
import titlePageImgComponents from '@/components/titlePageImgComponents.vue'
|
|
export default {
|
|
export default {
|
|
@@ -28,7 +32,7 @@
|
|
return {
|
|
return {
|
|
propsData:{
|
|
propsData:{
|
|
title:'安全隐患分布',
|
|
title:'安全隐患分布',
|
|
- checkType:'troubleDistributionComponents',
|
|
|
|
|
|
+ // checkType:'troubleDistributionComponents', //后续列表未对接 暂时注销
|
|
},
|
|
},
|
|
//eCharts定时器
|
|
//eCharts定时器
|
|
eChartsTimerLeft:null,
|
|
eChartsTimerLeft:null,
|
|
@@ -45,43 +49,74 @@
|
|
{label:'资源环境',value:'7'},
|
|
{label:'资源环境',value:'7'},
|
|
{label:'国重楼',value:'8'},
|
|
{label:'国重楼',value:'8'},
|
|
],
|
|
],
|
|
|
|
+ deptId:0,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
|
|
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
- this.eChartsMethodLeft();
|
|
|
|
- this.eChartsMethodRight();
|
|
|
|
|
|
+ this.getDeptDropList();
|
|
|
|
+ this.timedRefresh();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ timedRefresh(){
|
|
|
|
+ let self = this;
|
|
|
|
+ self.getData();
|
|
|
|
+ //定时动画
|
|
|
|
+ clearInterval(self.eChartsTimer);
|
|
|
|
+ self.eChartsTimer = setInterval(function(){
|
|
|
|
+ self.getData();
|
|
|
|
+ },1000*30);
|
|
|
|
+ },
|
|
|
|
+ getData(){
|
|
|
|
+ reportReportBigDataDangerDistribution({deptId:this.deptId}).then( response => {
|
|
|
|
+ let leftNameList = [];
|
|
|
|
+ let leftDataList = [];
|
|
|
|
+ let leftTextList = [];
|
|
|
|
+ let rightNameList = [];
|
|
|
|
+ let rightDataList = [];
|
|
|
|
+ let rightTextList = [];
|
|
|
|
+ let leftMax = 0;
|
|
|
|
+ let rightMax = 0;
|
|
|
|
+ for(let i=0;i<response.data.dangerOneList.length;i++){
|
|
|
|
+ if(leftMax < response.data.dangerOneList[i].indicatorCount){
|
|
|
|
+ leftMax = response.data.dangerOneList[i].indicatorCount;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(let i=0;i<response.data.dangerNoRectifyList.length;i++){
|
|
|
|
+ if(rightMax < response.data.dangerNoRectifyList[i].indicatorCount){
|
|
|
|
+ rightMax = response.data.dangerNoRectifyList[i].indicatorCount;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for(let i=0;i<response.data.dangerOneList.length;i++){
|
|
|
|
+ leftNameList.push({
|
|
|
|
+ text:response.data.dangerOneList[i].indicatorName,
|
|
|
|
+ max:leftMax,
|
|
|
|
+ })
|
|
|
|
+ leftDataList.push(response.data.dangerOneList[i].indicatorCount)
|
|
|
|
+ leftTextList.push(response.data.dangerOneList[i].indicatorRate+'%')
|
|
|
|
+ }
|
|
|
|
+ for(let i=0;i<response.data.dangerNoRectifyList.length;i++){
|
|
|
|
+ rightNameList.push({
|
|
|
|
+ text:response.data.dangerNoRectifyList[i].indicatorName,
|
|
|
|
+ max:rightMax,
|
|
|
|
+ })
|
|
|
|
+ rightDataList.push(response.data.dangerNoRectifyList[i].indicatorCount)
|
|
|
|
+ rightTextList.push(response.data.dangerNoRectifyList[i].indicatorRate+'%')
|
|
|
|
+ }
|
|
|
|
+ this.eChartsMethodLeft(leftNameList,leftDataList,leftTextList);
|
|
|
|
+ this.eChartsMethodRight(rightNameList,rightDataList,rightTextList);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//组件方法
|
|
//组件方法
|
|
checkSelectData(value){
|
|
checkSelectData(value){
|
|
|
|
+ this.$set(this,'deptId',value);
|
|
|
|
+ this.getData();
|
|
},
|
|
},
|
|
- eChartsMethodLeft() {
|
|
|
|
- const indicatorList = [
|
|
|
|
- {
|
|
|
|
- text: "化学安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "实验场所",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "安全设施",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "基础安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "生物安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
- let dataValue = [55, 48, 61, 31, 86]
|
|
|
|
|
|
+ eChartsMethodLeft(leftNameList,leftDataList,leftTextList) {
|
|
|
|
+ const indicatorList = leftNameList;
|
|
|
|
+ let dataValue = leftDataList
|
|
let option = {
|
|
let option = {
|
|
color: [
|
|
color: [
|
|
"#FF6A00"
|
|
"#FF6A00"
|
|
@@ -111,7 +146,7 @@
|
|
formatter: function (name, indicator) {
|
|
formatter: function (name, indicator) {
|
|
const text = indicator.text
|
|
const text = indicator.text
|
|
const index = indicatorList.findIndex(item => item.text === text)
|
|
const index = indicatorList.findIndex(item => item.text === text)
|
|
- return `{a| ${name}}\n{b| ${dataValue[index]}}`
|
|
|
|
|
|
+ return `{a| ${name}}\n{b| ${leftTextList[index]}}`
|
|
},
|
|
},
|
|
},
|
|
},
|
|
nameGap: 8,
|
|
nameGap: 8,
|
|
@@ -180,38 +215,12 @@
|
|
};
|
|
};
|
|
|
|
|
|
let echartsBox = this.$echarts.init(document.getElementById('troubleDistributionEChartsLeft'));
|
|
let echartsBox = this.$echarts.init(document.getElementById('troubleDistributionEChartsLeft'));
|
|
|
|
+ echartsBox.clear();
|
|
echartsBox.setOption(option);
|
|
echartsBox.setOption(option);
|
|
- //定时动画
|
|
|
|
- clearInterval(this.eChartsTimerLeft);
|
|
|
|
- this.eChartsTimerLeft = setInterval(function(){
|
|
|
|
- echartsBox.clear();
|
|
|
|
- echartsBox.setOption(option);
|
|
|
|
- },1000*30);
|
|
|
|
},
|
|
},
|
|
- eChartsMethodRight() {
|
|
|
|
- const indicatorList = [
|
|
|
|
- {
|
|
|
|
- text: "化学安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "实验场所",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "安全设施",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "基础安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "生物安全",
|
|
|
|
- max: 100
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
- let dataValue = [32, 67, 23, 54, 14]
|
|
|
|
|
|
+ eChartsMethodRight(rightNameList,rightDataList,rightTextList) {
|
|
|
|
+ const indicatorList = rightNameList;
|
|
|
|
+ let dataValue = rightDataList
|
|
let option = {
|
|
let option = {
|
|
color: [
|
|
color: [
|
|
"#00F6FF"
|
|
"#00F6FF"
|
|
@@ -241,7 +250,7 @@
|
|
formatter: function (name, indicator) {
|
|
formatter: function (name, indicator) {
|
|
const text = indicator.text
|
|
const text = indicator.text
|
|
const index = indicatorList.findIndex(item => item.text === text)
|
|
const index = indicatorList.findIndex(item => item.text === text)
|
|
- return `{a| ${name}}\n{b| ${dataValue[index]}}`
|
|
|
|
|
|
+ return `{a| ${name}}\n{b| ${rightTextList[index]}}`
|
|
},
|
|
},
|
|
},
|
|
},
|
|
nameGap: 8,
|
|
nameGap: 8,
|
|
@@ -309,15 +318,21 @@
|
|
]
|
|
]
|
|
};
|
|
};
|
|
let echartsBox = this.$echarts.init(document.getElementById('troubleDistributionEChartsRight'));
|
|
let echartsBox = this.$echarts.init(document.getElementById('troubleDistributionEChartsRight'));
|
|
|
|
+ echartsBox.clear();
|
|
echartsBox.setOption(option);
|
|
echartsBox.setOption(option);
|
|
- //定时动画
|
|
|
|
- clearInterval(this.eChartsTimerRight);
|
|
|
|
- this.eChartsTimerRight = setInterval(function(){
|
|
|
|
- echartsBox.clear();
|
|
|
|
- echartsBox.setOption(option);
|
|
|
|
- },1000*30);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ getDeptDropList(){
|
|
|
|
+ getDeptDropList({level: 2, deptType: 1 }).then(response => {
|
|
|
|
+ let list = [{label:'全校',value:'0'}];
|
|
|
|
+ for(let i=0;i<response.data.length;i++){
|
|
|
|
+ list.push({
|
|
|
|
+ label:response.data[i].deptShortName,
|
|
|
|
+ value:response.data[i].deptId,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.$set(this,'propsOption',list);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
//清除定时器
|
|
//清除定时器
|