|
|
@@ -3,84 +3,267 @@
|
|
|
<div class="facilityUtilizationRate">
|
|
|
<titleComponent :titleData="titleData"></titleComponent>
|
|
|
<div class="eCharts-max-big-top-box">
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-1">
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-2">
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-3">
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-4">
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-5">
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="eCharts-box" id="facilityUtilizationRate-eCharts-6">
|
|
|
-
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="eCharts-max-big-bottom-box" id="facilityUtilizationRate-eCharts-7">
|
|
|
-
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-1"></div>
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-2"></div>
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-3"></div>
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-4"></div>
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-5"></div>
|
|
|
+ <div class="eCharts-box" id="facilityUtilizationRate-eCharts-6"></div>
|
|
|
</div>
|
|
|
+ <div class="eCharts-max-big-bottom-box" id="facilityUtilizationRate-eCharts-7"></div>
|
|
|
+ <div class="position-shade-box"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import { dashboardsFacilitiesUsageStats } from '@/api/yiLi'
|
|
|
import titleComponent from './components/titleComponent.vue'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'facilityUtilizationRate',
|
|
|
components: {
|
|
|
- titleComponent,
|
|
|
+ titleComponent
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- titleData:{
|
|
|
- name:'设施使用率及状态统计',
|
|
|
- text:'Facility utilization rate and status statistics',
|
|
|
+ titleData: {
|
|
|
+ name: '设施使用率及状态统计',
|
|
|
+ text: 'Facility utilization rate and status statistics'
|
|
|
+ },
|
|
|
+ data1: {
|
|
|
+ name: '温室',
|
|
|
+ value: 0,
|
|
|
+ color1: '#FF3131',
|
|
|
+ color2: 'rgba(221, 111, 114, 1)',
|
|
|
+ color3: 'rgba(221, 111, 114, 0.2)'
|
|
|
+ },
|
|
|
+ data2: {
|
|
|
+ name: '温室附属房',
|
|
|
+ value: 0,
|
|
|
+ color1: '#FF8D12',
|
|
|
+ color2: 'rgba(255, 132, 0, 1)',
|
|
|
+ color3: 'rgba(255, 132, 0, 0.2)'
|
|
|
+ },
|
|
|
+ data3: {
|
|
|
+ name: '顶置光型人工气候室',
|
|
|
+ value: 0,
|
|
|
+ color1: '#17C700',
|
|
|
+ color2: 'rgba(104, 231, 88, 1)',
|
|
|
+ color3: 'rgba(104, 231, 88, 0.2)'
|
|
|
+ },
|
|
|
+ data4: {
|
|
|
+ name: '冷库',
|
|
|
+ value: 0,
|
|
|
+ color1: '#0B94F4',
|
|
|
+ color2: 'rgba(65, 177, 255, 1)',
|
|
|
+ color3: 'rgba(65, 177, 255, 0.2)'
|
|
|
+ },
|
|
|
+ data5: {
|
|
|
+ name: '种质资源库',
|
|
|
+ value: 0,
|
|
|
+ color1: '#AE7CF9',
|
|
|
+ color2: 'rgba(180, 130, 255, 1)',
|
|
|
+ color3: 'rgba(180, 130, 255, 0.2)'
|
|
|
+ },
|
|
|
+ data6: {
|
|
|
+ name: '培养架型人工气候室',
|
|
|
+ value: 0,
|
|
|
+ color1: '#00FFFF',
|
|
|
+ color2: 'rgba(68, 255, 255, 1)',
|
|
|
+ color3: 'rgba(68, 255, 255, 0.2)'
|
|
|
},
|
|
|
- //eCharts数据
|
|
|
- eChartsData1:null,
|
|
|
- eChartsData2:null,
|
|
|
- eChartsData3:null,
|
|
|
- eChartsData4:null,
|
|
|
- eChartsData5:null,
|
|
|
- eChartsData6:null,
|
|
|
- eChartsData7:null,
|
|
|
//学院统计数据
|
|
|
- newData:{
|
|
|
- deptName:['学院1','学院2','学院3','学院4','学院5'],
|
|
|
- list1:[1,2,3,4,5],
|
|
|
- list2:[2,3,4,5,6],
|
|
|
- list3:[3,4,5,6,7],
|
|
|
- list4:[4,5,6,7,8],
|
|
|
- list5:[5,6,7,8,9],
|
|
|
- list6:[6,7,8,9,10],
|
|
|
+ newData: {
|
|
|
+ deptName: ['暂无数据'],
|
|
|
+ list1: [0],
|
|
|
+ list2: [0],
|
|
|
+ list3: [0],
|
|
|
+ list4: [0],
|
|
|
+ list5: [0],
|
|
|
+ list6: [0]
|
|
|
},
|
|
|
+ newList:[],
|
|
|
+ //eCharts数据
|
|
|
+ eChartsData1: null,
|
|
|
+ eChartsData2: null,
|
|
|
+ eChartsData3: null,
|
|
|
+ eChartsData4: null,
|
|
|
+ eChartsData5: null,
|
|
|
+ eChartsData6: null,
|
|
|
+ eChartsData7: null,
|
|
|
//图标轮播
|
|
|
- eChartsTimerData:null,
|
|
|
- eChartsCarouselTime:2000,
|
|
|
- eChartsCarouselIndex:0,
|
|
|
+ eChartsTimerData: null,
|
|
|
+ eChartsCarouselTime: 20000,
|
|
|
+ eChartsCarouselIndex: 0,
|
|
|
+ eChartsCarouselMaxIndex:0,
|
|
|
+ //定时拉取数据
|
|
|
+ getDataTimer:null,
|
|
|
+ getDataSwitchTime:360000,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.demo1();
|
|
|
- this.eChartsListMethod();
|
|
|
+ this.getDataTimerFunction();
|
|
|
},
|
|
|
methods: {
|
|
|
- demo1(){
|
|
|
- this.eChartsMethod(this.eChartsData1,{ name:'温室',value:10,color1:'#FF3131',color2:'rgba(221, 111, 114, 1)',color3:'rgba(221, 111, 114, 0.2)' },'facilityUtilizationRate-eCharts-1')
|
|
|
- this.eChartsMethod(this.eChartsData2,{ name:'温室附属房',value:25,color1:'#FF8D12',color2:'rgba(255, 132, 0, 1)',color3:'rgba(255, 132, 0, 0.2)' },'facilityUtilizationRate-eCharts-2')
|
|
|
- this.eChartsMethod(this.eChartsData3,{ name:'顶置光型人工气候室',value:40,color1:'#17C700',color2:'rgba(104, 231, 88, 1)',color3:'rgba(104, 231, 88, 0.2)' },'facilityUtilizationRate-eCharts-3')
|
|
|
- this.eChartsMethod(this.eChartsData4,{ name:'冷库',value:55,color1:'#0B94F4',color2:'rgba(65, 177, 255, 1)',color3:'rgba(65, 177, 255, 0.2)' },'facilityUtilizationRate-eCharts-4')
|
|
|
- this.eChartsMethod(this.eChartsData5,{ name:'种质资源库',value:70,color1:'#AE7CF9',color2:'rgba(180, 130, 255, 1)',color3:'rgba(180, 130, 255, 0.2)' },'facilityUtilizationRate-eCharts-5')
|
|
|
- this.eChartsMethod(this.eChartsData6,{ name:'培养架型人工气候室',value:85,color1:'#00FFFF',color2:'rgba(68, 255, 255, 1)',color3:'rgba(68, 255, 255, 0.2)' },'facilityUtilizationRate-eCharts-6')
|
|
|
+ getDataTimerFunction(){
|
|
|
+ this.dashboardsFacilitiesUsageStats();
|
|
|
+ this.getDataTimer = window.setInterval(() => {
|
|
|
+ this.dashboardsFacilitiesUsageStats();
|
|
|
+ }, this.getDataSwitchTime);
|
|
|
},
|
|
|
- eChartsMethod(eChartsData,item,boxId) {
|
|
|
+ //设施使用率及二级单位统计
|
|
|
+ dashboardsFacilitiesUsageStats() {
|
|
|
+ let self = this
|
|
|
+ clearInterval(this.eChartsTimerData)
|
|
|
+ dashboardsFacilitiesUsageStats().then(res => {
|
|
|
+ this.$set(this,'eChartsCarouselIndex',0);
|
|
|
+ this.$set(this,'eChartsCarouselMaxIndex',0);
|
|
|
+ if(!res.data.monthlyUsage[0]){
|
|
|
+ this.eChartsMethod(this.eChartsData1, this.data1, 'facilityUtilizationRate-eCharts-1')
|
|
|
+ this.eChartsMethod(this.eChartsData2, this.data2, 'facilityUtilizationRate-eCharts-2')
|
|
|
+ this.eChartsMethod(this.eChartsData3, this.data3, 'facilityUtilizationRate-eCharts-3')
|
|
|
+ this.eChartsMethod(this.eChartsData4, this.data4, 'facilityUtilizationRate-eCharts-4')
|
|
|
+ this.eChartsMethod(this.eChartsData5, this.data5, 'facilityUtilizationRate-eCharts-5')
|
|
|
+ this.eChartsMethod(this.eChartsData6, this.data6, 'facilityUtilizationRate-eCharts-6')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let max = 0
|
|
|
+ for (let i = 0; i < res.data.monthlyUsage.length; i++) {
|
|
|
+ max = self.precisionAdd(max,res.data.monthlyUsage[i].equCount)
|
|
|
+ }
|
|
|
+ for (let i = 0; i < res.data.monthlyUsage.length; i++) {
|
|
|
+ if (res.data.monthlyUsage[i].equTypeName == '温室') {
|
|
|
+ self.$set(self.data1, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ } else if (res.data.monthlyUsage[i].equTypeName == '温室附属房') {
|
|
|
+ self.$set(self.data2, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ } else if (res.data.monthlyUsage[i].equTypeName == '顶置光型人工气候室') {
|
|
|
+ self.$set(self.data3, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ } else if (res.data.monthlyUsage[i].equTypeName == '冷库') {
|
|
|
+ self.$set(self.data4, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ } else if (res.data.monthlyUsage[i].equTypeName == '种质资源库') {
|
|
|
+ self.$set(self.data5, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ } else if (res.data.monthlyUsage[i].equTypeName == '培养架型人工气候室') {
|
|
|
+ self.$set(self.data6, 'value', self.calculatePercentage(res.data.monthlyUsage[i].equCount,max,0))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.eChartsMethod(this.eChartsData1, this.data1, 'facilityUtilizationRate-eCharts-1')
|
|
|
+ this.eChartsMethod(this.eChartsData2, this.data2, 'facilityUtilizationRate-eCharts-2')
|
|
|
+ this.eChartsMethod(this.eChartsData3, this.data3, 'facilityUtilizationRate-eCharts-3')
|
|
|
+ this.eChartsMethod(this.eChartsData4, this.data4, 'facilityUtilizationRate-eCharts-4')
|
|
|
+ this.eChartsMethod(this.eChartsData5, this.data5, 'facilityUtilizationRate-eCharts-5')
|
|
|
+ this.eChartsMethod(this.eChartsData6, this.data6, 'facilityUtilizationRate-eCharts-6')
|
|
|
+ if(!res.data.unitStats[0]){
|
|
|
+ this.eChartsListMethod()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let dataList = ['温室','温室附属房','顶置光型人工气候室','冷库','种质资源库','培养架型人工气候室',];
|
|
|
+ let newData = {
|
|
|
+ deptName: [],
|
|
|
+ list1: [],
|
|
|
+ list2: [],
|
|
|
+ list3: [],
|
|
|
+ list4: [],
|
|
|
+ list5: [],
|
|
|
+ list6: [],
|
|
|
+ }
|
|
|
+ let list = [];
|
|
|
+ for(let i=0;i<res.data.unitStats.length;i++){
|
|
|
+ if(newData.deptName[4]){
|
|
|
+ list.push(JSON.parse(JSON.stringify(newData)))
|
|
|
+ newData = JSON.parse(JSON.stringify({deptName: [],list1: [],list2: [],list3: [],list4: [],list5: [],list6: []}))
|
|
|
+ newData.deptName.push(res.data.unitStats[i].unit);
|
|
|
+ for(let o=0;o<dataList.length;o++){
|
|
|
+ let num = 0;
|
|
|
+ for(let x=0;x<res.data.unitStats[i].types.length;x++){
|
|
|
+ if(dataList[o] == res.data.unitStats[i].types[x].type){
|
|
|
+ num++
|
|
|
+ if(o==0){
|
|
|
+ newData.list1.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==1){
|
|
|
+ newData.list2.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==2){
|
|
|
+ newData.list3.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==3){
|
|
|
+ newData.list4.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==4){
|
|
|
+ newData.list5.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==5){
|
|
|
+ newData.list6.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(num == 0){
|
|
|
+ if(o==0){
|
|
|
+ newData.list1.push(0);
|
|
|
+ }else if(o==1){
|
|
|
+ newData.list2.push(0);
|
|
|
+ }else if(o==2){
|
|
|
+ newData.list3.push(0);
|
|
|
+ }else if(o==3){
|
|
|
+ newData.list4.push(0);
|
|
|
+ }else if(o==4){
|
|
|
+ newData.list5.push(0);
|
|
|
+ }else if(o==5){
|
|
|
+ newData.list6.push(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ newData.deptName.push(res.data.unitStats[i].unit);
|
|
|
+ for(let o=0;o<dataList.length;o++){
|
|
|
+ let num = 0;
|
|
|
+ for(let x=0;x<res.data.unitStats[i].types.length;x++){
|
|
|
+ if(dataList[o] == res.data.unitStats[i].types[x].type){
|
|
|
+ num++
|
|
|
+ if(o==0){
|
|
|
+ newData.list1.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==1){
|
|
|
+ newData.list2.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==2){
|
|
|
+ newData.list3.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==3){
|
|
|
+ newData.list4.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==4){
|
|
|
+ newData.list5.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }else if(o==5){
|
|
|
+ newData.list6.push(res.data.unitStats[i].types[x].count);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(num == 0){
|
|
|
+ if(o==0){
|
|
|
+ newData.list1.push(0);
|
|
|
+ }else if(o==1){
|
|
|
+ newData.list2.push(0);
|
|
|
+ }else if(o==2){
|
|
|
+ newData.list3.push(0);
|
|
|
+ }else if(o==3){
|
|
|
+ newData.list4.push(0);
|
|
|
+ }else if(o==4){
|
|
|
+ newData.list5.push(0);
|
|
|
+ }else if(o==5){
|
|
|
+ newData.list6.push(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!list[0]){
|
|
|
+ list.push(JSON.parse(JSON.stringify(newData)))
|
|
|
+ }else{
|
|
|
+ if(list[list.length-1] != newData.deptName[newData.deptName.length-1]){
|
|
|
+ list.push(JSON.parse(JSON.stringify(newData)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(this,'newList',list);
|
|
|
+ this.$set(this,'newData',list[0]);
|
|
|
+ this.eChartsListMethod()
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ eChartsMethod(eChartsData, item, boxId) {
|
|
|
var maxValue = 100
|
|
|
let option = {
|
|
|
title: [{
|
|
|
@@ -99,7 +282,7 @@
|
|
|
textStyle: {
|
|
|
fontSize: '28',
|
|
|
color: item.color1,
|
|
|
- fontWeight: '400',
|
|
|
+ fontWeight: '400'
|
|
|
}
|
|
|
}],
|
|
|
angleAxis: {
|
|
|
@@ -156,107 +339,121 @@
|
|
|
roundCap: true,
|
|
|
z: 1
|
|
|
}]
|
|
|
- };
|
|
|
+ }
|
|
|
eChartsData = this.$echarts.init(document.getElementById(boxId))
|
|
|
eChartsData.clear()
|
|
|
eChartsData.setOption(option)
|
|
|
},
|
|
|
- eChartsListMethod(){
|
|
|
+ eChartsListMethod() {
|
|
|
+ clearInterval(this.eChartsTimerData)
|
|
|
let option = {
|
|
|
legend: {
|
|
|
- show:false,
|
|
|
+ show: false
|
|
|
},
|
|
|
color: [
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(221, 111, 114, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(221, 111, 114, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(221, 111, 114, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(221, 111, 114, 0.2)'
|
|
|
+ }]
|
|
|
+ },
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(255, 132, 0, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(255, 132, 0, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(255, 132, 0, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255, 132, 0, 0.2)'
|
|
|
+ }]
|
|
|
+ },
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(104, 231, 88, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(104, 231, 88, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(104, 231, 88, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(104, 231, 88, 0.2)'
|
|
|
+ }]
|
|
|
+ },
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(65, 177, 255, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(65, 177, 255, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(65, 177, 255, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(65, 177, 255, 0.2)'
|
|
|
+ }]
|
|
|
+ },
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(180, 130, 255, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(180, 130, 255, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(180, 130, 255, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(180, 130, 255, 0.2)'
|
|
|
+ }]
|
|
|
+ },
|
|
|
{
|
|
|
- type: 'linear',
|
|
|
- x: 0,
|
|
|
- y: 0,
|
|
|
- x2: 0,
|
|
|
- y2: 1,
|
|
|
- colorStops: [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(68, 255, 255, 1)'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(68, 255, 255, 0.2)'
|
|
|
- }]
|
|
|
- },
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [{
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(68, 255, 255, 1)'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(68, 255, 255, 0.2)'
|
|
|
+ }]
|
|
|
+ }
|
|
|
],
|
|
|
//浮窗
|
|
|
tooltip: {
|
|
|
- trigger: "axis",
|
|
|
+ trigger: 'axis',
|
|
|
+ position: (data) => {
|
|
|
+ if(this.eChartsCarouselIndex == 0){
|
|
|
+ return [162,50]
|
|
|
+ }else if(this.eChartsCarouselIndex == 1){
|
|
|
+ return [291,50]
|
|
|
+ }else if(this.eChartsCarouselIndex == 2){
|
|
|
+ return [420,50]
|
|
|
+ }else if(this.eChartsCarouselIndex == 3){
|
|
|
+ return [549,50]
|
|
|
+ }else if(this.eChartsCarouselIndex == 4){
|
|
|
+ return [457,50]
|
|
|
+ }
|
|
|
+ },
|
|
|
axisPointer: {
|
|
|
- type: "shadow"
|
|
|
+ type: 'shadow'
|
|
|
},
|
|
|
// 自定义提示框内容
|
|
|
formatter: (data) => {
|
|
|
@@ -271,25 +468,25 @@
|
|
|
return str
|
|
|
},
|
|
|
textStyle: {
|
|
|
- color: "#ffffff",
|
|
|
- fontSize: 16,
|
|
|
+ color: '#ffffff',
|
|
|
+ fontSize: 16
|
|
|
},
|
|
|
- backgroundColor: "rgba(0,0,0,0.7)",
|
|
|
- borderColor: "rgba(0,0,0,0.7)",
|
|
|
+ backgroundColor: 'rgba(0,0,0,0.7)',
|
|
|
+ borderColor: 'rgba(0,0,0,0.7)'
|
|
|
},
|
|
|
grid: {
|
|
|
left: '10%',
|
|
|
right: '10%',
|
|
|
top: '10%',
|
|
|
bottom: '10%',
|
|
|
- containLabel: true,
|
|
|
+ containLabel: true
|
|
|
},
|
|
|
xAxis: {
|
|
|
//学院名称
|
|
|
data: this.newData.deptName,
|
|
|
axisLabel: {
|
|
|
- color: "#fff",
|
|
|
- fontSize: 16,
|
|
|
+ color: '#fff',
|
|
|
+ fontSize: 16
|
|
|
},
|
|
|
axisLine: {
|
|
|
lineStyle: {
|
|
|
@@ -299,19 +496,19 @@
|
|
|
},
|
|
|
axisTick: {
|
|
|
show: false
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
yAxis: {
|
|
|
name: '',
|
|
|
axisLabel: {
|
|
|
- color: "#ffffff",
|
|
|
- fontSize: 14,
|
|
|
+ color: '#ffffff',
|
|
|
+ fontSize: 14
|
|
|
},
|
|
|
axisLine: {
|
|
|
- show:true,
|
|
|
+ show: true,
|
|
|
lineStyle: {
|
|
|
color: '#fff',
|
|
|
- type: 'solid',
|
|
|
+ type: 'solid'
|
|
|
}
|
|
|
},
|
|
|
splitLine: {
|
|
|
@@ -320,165 +517,235 @@
|
|
|
color: ['rgba(65,164,255,0.3)'],
|
|
|
width: 1,
|
|
|
type: 'dashed'
|
|
|
- },
|
|
|
- },
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
series: [
|
|
|
//温室
|
|
|
{
|
|
|
- name: "温室",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '温室',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list1,
|
|
|
+ data: this.newData.list1
|
|
|
},
|
|
|
//温室附属房
|
|
|
{
|
|
|
- name: "温室附属房",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '温室附属房',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list2,
|
|
|
+ data: this.newData.list2
|
|
|
},
|
|
|
//顶置光型人工气候室
|
|
|
{
|
|
|
- name: "顶置光型人工气候室",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '顶置光型人工气候室',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list3,
|
|
|
+ data: this.newData.list3
|
|
|
},
|
|
|
//冷库
|
|
|
{
|
|
|
- name: "冷库",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '冷库',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list4,
|
|
|
+ data: this.newData.list4
|
|
|
},
|
|
|
//种质资源库
|
|
|
{
|
|
|
- name: "种质资源库",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '种质资源库',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list5,
|
|
|
+ data: this.newData.list5
|
|
|
},
|
|
|
//培养架型人工气候室
|
|
|
{
|
|
|
- name: "培养架型人工气候室",
|
|
|
- type: "bar",
|
|
|
- stack: "total",
|
|
|
+ name: '培养架型人工气候室',
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'total',
|
|
|
label: {
|
|
|
show: false,
|
|
|
- color: "#FFFFFF",
|
|
|
- formatter: "{a}",
|
|
|
+ color: '#FFFFFF',
|
|
|
+ formatter: '{a}'
|
|
|
},
|
|
|
emphasis: {
|
|
|
- focus: "series",
|
|
|
+ focus: 'series'
|
|
|
},
|
|
|
barWidth: 16,
|
|
|
- data: this.newData.list6,
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
+ data: this.newData.list6
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
this.eChartsData7 = this.$echarts.init(document.getElementById('facilityUtilizationRate-eCharts-7'))
|
|
|
this.eChartsData7.clear()
|
|
|
this.eChartsData7.setOption(option)
|
|
|
- this.eChartsTimer();
|
|
|
+ this.eChartsTimer()
|
|
|
},
|
|
|
- eChartsTimer(){
|
|
|
- let self = this;
|
|
|
- self.eChartsTimerData = window.setInterval(eChartsCarousel, this.eChartsCarouselTime);
|
|
|
- async function eChartsCarousel() {
|
|
|
- self.eChartsData7.dispatchAction({
|
|
|
- type: 'showTip',
|
|
|
- seriesIndex: 0,
|
|
|
- dataIndex: self.eChartsCarouselIndex
|
|
|
- });
|
|
|
- if(self.eChartsCarouselIndex<self.newData.deptName.length-1){
|
|
|
+ eChartsTimer() {
|
|
|
+ let self = this
|
|
|
+ self.eChartsData7.dispatchAction({
|
|
|
+ type: 'showTip',
|
|
|
+ seriesIndex: 0,
|
|
|
+ dataIndex: self.eChartsCarouselIndex
|
|
|
+ })
|
|
|
+ self.eChartsTimerData = window.setInterval(() => {
|
|
|
+ eChartsCarousel()
|
|
|
+ }, this.eChartsCarouselTime)
|
|
|
+ function eChartsCarousel() {
|
|
|
+ if (self.eChartsCarouselIndex < self.newData.deptName.length-1) {
|
|
|
self.eChartsCarouselIndex++
|
|
|
- }else{
|
|
|
- self.$set(self,'eChartsCarouselIndex',0);
|
|
|
+ self.eChartsData7.dispatchAction({
|
|
|
+ type: 'showTip',
|
|
|
+ seriesIndex: 0,
|
|
|
+ dataIndex: self.eChartsCarouselIndex
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ self.$set(self, 'eChartsCarouselIndex', 0)
|
|
|
+ if(self.newList[self.eChartsCarouselMaxIndex+1]){
|
|
|
+ self.eChartsCarouselMaxIndex++
|
|
|
+ }else{
|
|
|
+ self.$set(self, 'eChartsCarouselMaxIndex', 0)
|
|
|
+ }
|
|
|
+ if(self.newList[0]){
|
|
|
+ self.$set(self,'newData',self.newList[self.eChartsCarouselMaxIndex]);
|
|
|
+ self.eChartsMethod(self.eChartsData1, self.data1, 'facilityUtilizationRate-eCharts-1')
|
|
|
+ self.eChartsMethod(self.eChartsData2, self.data2, 'facilityUtilizationRate-eCharts-2')
|
|
|
+ self.eChartsMethod(self.eChartsData3, self.data3, 'facilityUtilizationRate-eCharts-3')
|
|
|
+ self.eChartsMethod(self.eChartsData4, self.data4, 'facilityUtilizationRate-eCharts-4')
|
|
|
+ self.eChartsMethod(self.eChartsData5, self.data5, 'facilityUtilizationRate-eCharts-5')
|
|
|
+ self.eChartsMethod(self.eChartsData6, self.data6, 'facilityUtilizationRate-eCharts-6')
|
|
|
+ self.eChartsListMethod()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ // 处理浮点数精度的加法
|
|
|
+ precisionAdd(num1, num2) {
|
|
|
+ const multiplier = Math.pow(10, Math.max(this.getDecimalPlaces(num1), this.getDecimalPlaces(num2)));
|
|
|
+ return (Math.round(num1 * multiplier) + Math.round(num2 * multiplier)) / multiplier;
|
|
|
+ },
|
|
|
+ // 高精度百分比计算
|
|
|
+ calculatePercentage(value, total, decimalPlaces) {
|
|
|
+ // 使用高精度计算方法:先乘后除,减少精度损失
|
|
|
+ const percentage = this.precisionMultiply(value / total, 100);
|
|
|
+
|
|
|
+ if (decimalPlaces === 0) {
|
|
|
+ // 保留整数(四舍五入)
|
|
|
+ return Math.round(percentage);
|
|
|
+ } else {
|
|
|
+ // 保留小数
|
|
|
+ // 使用高精度toFixed替代方法
|
|
|
+ const factor = Math.pow(10, decimalPlaces);
|
|
|
+ const rounded = Math.round(percentage * factor) / factor;
|
|
|
+
|
|
|
+ // 确保小数点后位数正确
|
|
|
+ return rounded.toFixed(decimalPlaces);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 处理浮点数精度的乘法
|
|
|
+ precisionMultiply(num1, num2) {
|
|
|
+ const num1DecimalPlaces = this.getDecimalPlaces(num1);
|
|
|
+ const num2DecimalPlaces = this.getDecimalPlaces(num2);
|
|
|
+ const multiplier = Math.pow(10, num1DecimalPlaces + num2DecimalPlaces);
|
|
|
+ return (Math.round(num1 * Math.pow(10, num1DecimalPlaces)) *
|
|
|
+ Math.round(num2 * Math.pow(10, num2DecimalPlaces))) / multiplier;
|
|
|
+ },
|
|
|
+ // 获取数字的小数位数
|
|
|
+ getDecimalPlaces(num) {
|
|
|
+ const str = num.toString();
|
|
|
+ const decimalIndex = str.indexOf('.');
|
|
|
+ return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
|
|
|
+ },
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
//清除定时器
|
|
|
- clearInterval(this.eChartsTimerData);
|
|
|
- },
|
|
|
+ clearInterval(this.getDataTimer);
|
|
|
+ clearInterval(this.eChartsTimerData)
|
|
|
+ }
|
|
|
+ ,
|
|
|
destroyed() {
|
|
|
//清除定时器
|
|
|
- clearInterval(this.eChartsTimerData);
|
|
|
+ clearInterval(this.getDataTimer);
|
|
|
+ clearInterval(this.eChartsTimerData)
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.facilityUtilizationRate {
|
|
|
- width:826px;
|
|
|
- height:937px;
|
|
|
- margin-top:21px;
|
|
|
+ width: 826px;
|
|
|
+ height: 937px;
|
|
|
+ margin-top: 21px;
|
|
|
background-image: url("../../assets/ZDimages/img_sssyljzttj_bg@1x.png");
|
|
|
background-size: 100% 100%;
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
- .eCharts-max-big-top-box{;
|
|
|
- width:801px;
|
|
|
- height:432px;
|
|
|
- margin:42px 12px 0;
|
|
|
+ .eCharts-max-big-top-box {
|
|
|
+ width: 801px;
|
|
|
+ height: 432px;
|
|
|
+ margin: 42px 12px 0;
|
|
|
overflow: hidden;
|
|
|
- .eCharts-box{
|
|
|
+ .eCharts-box {
|
|
|
display: inline-block;
|
|
|
- width:267px;
|
|
|
- height:216px;
|
|
|
+ width: 267px;
|
|
|
+ height: 216px;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
}
|
|
|
- .eCharts-max-big-bottom-box{
|
|
|
- width:826px;
|
|
|
- height:402px;
|
|
|
+ .eCharts-max-big-bottom-box {
|
|
|
+ width: 826px;
|
|
|
+ height: 402px;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+ .position-shade-box{
|
|
|
+ width: 826px;
|
|
|
+ height: 937px;
|
|
|
+ position: absolute;
|
|
|
+ top:0;
|
|
|
+ left:0;
|
|
|
+ z-index:1;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|