123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <!-- 二级学院单位实验室统计 -->
- <template>
- <div class="secondaryCollegeUnitLaboratoryStatistics">
- <div class="secondaryCollegeUnitLaboratoryStatistics-title">
- <p>二级学院单位实验室统计</p>
- </div>
- <div class="secondaryCollegeUnitLaboratoryStatisticsPage" id="secondaryCollegeUnitLaboratoryStatisticsECharts">
- </div>
- </div>
- </template>
- <script>
- import { laboratorySubRelInfoLabStateStatisticsAll } from "@/api/index";
- export default {
- name: 'index',
- data () {
- return {
- //echarts数据
- echartsBox:null,
- // 定时器
- echartsTimer:null,
- minTimer:null,
- //数据
- dataList:[],
- numIndex:0,
- maxNum: 0,
- }
- },
- created () {
- },
- mounted () {
- this.getList();
- this.timeFunction();
- },
- methods: {
- getList(){
- laboratorySubRelInfoLabStateStatisticsAll().then(response => {
- this.$set(this,'numIndex',0);
- this.$set(this,'maxNum',response.data.labLevelVOList.length-1);
- response.data.labLevelVOList.forEach((item)=>{
- item.num = item.levelOneCount + item.levelTwoCount + item.levelThreeCount + item.levelFourCount;
- })
- response.data.labLevelVOList = response.data.labLevelVOList.slice().sort((a, b) => b.num - a.num);
- this.$set(this,'dataList',response.data.labLevelVOList);
- this.minTimeFunction();
- // let obj = {
- // nameList:[],
- // dataListA : [],
- // dataListB : [],
- // dataListC : [],
- // dataListD : [],
- // dataListE : [],
- // };
- // const maxNum = response.data.labLevelVOList[0].levelOneCount + response.data.labLevelVOList[0].levelTwoCount + response.data.labLevelVOList[0].levelThreeCount + response.data.labLevelVOList[0].levelFourCount
- // response.data.labLevelVOList.forEach((item)=>{
- // let num = item.levelOneCount+item.levelTwoCount+item.levelThreeCount+item.levelFourCount
- // obj.nameList.push(item.deptName)
- // obj.dataListA.push(item.levelOneCount)
- // obj.dataListB.push(item.levelTwoCount)
- // obj.dataListC.push(item.levelThreeCount)
- // obj.dataListD.push(item.levelFourCount)
- // obj.dataListE.push({
- // name:num,
- // value:maxNum-num
- // })
- // })
- // this.eChartsMethod(obj);
- })
- },
- minTimeFunction(){
- let self = this;
- showTime();
- if(!this.minTimer){
- this.minTimer = window.setInterval(showTime, 10000);
- }
- function showTime() {
- if(self.dataList[0]){
- let newList = [];
- for(let i=0;i<5;i++){
- if(self.dataList[self.numIndex]){
- newList.push(self.dataList[self.numIndex])
- if(self.numIndex<self.maxNum){
- self.numIndex++;
- }else{
- self.numIndex=0;
- break
- }
- }
- }
- let obj = {
- nameList:[],
- dataListA : [],
- dataListB : [],
- dataListC : [],
- dataListD : [],
- dataListE : [],
- };
- if(newList[0]){
- const maxNum = newList[0].levelOneCount + newList[0].levelTwoCount + newList[0].levelThreeCount + newList[0].levelFourCount
- newList.forEach((item)=>{
- let num = item.levelOneCount+item.levelTwoCount+item.levelThreeCount+item.levelFourCount
- obj.nameList.push(item.deptName)
- obj.dataListA.push(item.levelOneCount)
- obj.dataListB.push(item.levelTwoCount)
- obj.dataListC.push(item.levelThreeCount)
- obj.dataListD.push(item.levelFourCount)
- obj.dataListE.push({
- name:num,
- value:maxNum-num
- })
- })
- self.eChartsMethod(obj);
- }
- }
- }
- },
- eChartsMethod(obj){
- let option = {
- title: {
- show:false,
- },
- tooltip: {
- show:false,
- trigger: "axis",
- axisPointer: {
- type: "shadow",
- textStyle: {
- color: "#fff",
- },
- },
- textStyle: {
- color: "#fff",
- },
- backgroundColor: "background: rgba(255,255,255,0.1);", //设置背景颜色
- borderColor: "rgba(255,255,255,0.1)",
- formatter:function (data) {
- return (data.name )
- },
- },
- legend: {
- icon:'rect',
- left: 'center',
- top:'15',
- itemGap:55,
- itemWidth:30,
- itemHeight:10,
- show: true,
- textStyle:{
- fontSize:34,
- color:'#fff',
- },
- data: [
- { name: 'I 级', itemStyle: { color: '#F38181' } }, // 设置系列1图例的文字颜色为红色
- { name: 'II 级', itemStyle: { color: '#D8A746' } }, // 设置系列1图例的文字颜色为红色
- { name: 'III 级', itemStyle: { color: '#3876E1' } }, // 设置系列1图例的文字颜色为红色
- { name: 'IV 级', itemStyle: { color: '#56A757' } } // 设置系列2图例的文字颜色为绿色
- // 可以继续添加更多系列及其图例颜色配置
- ],
- },
- grid: {
- left: "10%",
- right: "10%",
- bottom: "10%",
- top: "20%",
- },
- xAxis: {
- type: 'category',
- data: obj.nameList,
- axisLabel:{
- color:'#fff',
- fontSize:'30',
- },
- axisLine:{
- show:true,
- lineStyle:{
- color:'#41A4FF',
- }
- },
- splitLine: {
- show: false
- },
- axisTick: {
- show: false
- }
- },
- yAxis: {
- type: 'value',
- axisLabel:{
- color:'#fff',
- fontSize:'30',
- },
- axisLine:{
- show:true,
- lineStyle:{
- color:'#41A4FF',
- }
- },
- splitLine: {
- show: false
- },
- axisTick: {
- show: false
- }
- },
- series: [
- {
- name: 'I 级',
- type: 'bar',
- barWidth: 30,
- stack: '数量',
- data: obj.dataListA,
- itemStyle: {
- normal: {
- color: {//渐变色
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: '#D8D8D8',
- },
- {
- offset: 1,
- color: '#F38181',
- },
- ],
- },
- }
- }
- },
- {
- name: 'II 级',
- type: 'bar',
- barWidth:30,
- stack: '数量',
- data: obj.dataListB,
- itemStyle: {
- normal: {
- color: {//渐变色
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: '#D8D8D8',
- },
- {
- offset: 1,
- color: '#D8A746',
- },
- ],
- },
- }
- }
- },
- {
- name: 'III 级',
- type: 'bar',
- barWidth: 30,
- stack: '数量',
- data: obj.dataListC,
- itemStyle: {
- normal: {
- color: {//渐变色
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: '#D8D8D8',
- },
- {
- offset: 1,
- color: '#3876E1',
- },
- ],
- },
- }
- }
- },
- {
- name: 'IV 级',
- type: 'bar',
- barWidth: 30,
- stack: '数量',
- data: obj.dataListD,
- itemStyle: {
- normal: {
- color: {//渐变色
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: '#D8D8D8',
- },
- {
- offset: 1,
- color: '#56A757',
- },
- ],
- },
- }
- }
- },
- {
- name: '',
- type: 'bar',
- barWidth: 30,
- stack: '数量',
- data: obj.dataListE,
- label: {
- show: true,
- position: 'top',
- textStyle: {
- color: '#fff', //更改坐标轴文字颜色
- fontSize: '34',
- },
- formatter: function (data) {
- return (data.name )
- },
- },
- itemStyle: {
- normal: {
- color: {//渐变色
- x: 0,
- y: 1,
- x2: 0,
- y2: 0,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: 'rgba(216,216,216,0.1)',
- },
- {
- offset: 1,
- color: 'rgba(216,216,216,0.1)',
- },
- ],
- },
- }
- }
- },
- ]
- };
- this.echartsBox = this.$echarts.init(document.getElementById('secondaryCollegeUnitLaboratoryStatisticsECharts'));
- this.echartsBox.clear();
- this.echartsBox.setOption(option);
- },
- //时间定时器
- timeFunction(){
- let self = this;
- this.echartsTimer = window.setInterval(showTime, 180000);
- function showTime() {
- self.getList();
- }
- },
- },
- beforeDestroy() {
- //清除定时器
- window.clearInterval(this.echartsTimer);
- },
- destroyed() {
- //清除定时器
- window.clearInterval(this.echartsTimer);
- }
- }
- </script>
- <style scoped lang="scss">
- .secondaryCollegeUnitLaboratoryStatistics{
- margin: 16px 0 0 88px;
- .secondaryCollegeUnitLaboratoryStatistics-title{
- width:796px;
- height:84px;
- background: url("../../../assets/ZDimages/img_sy_fbt@1x.png");
- background-size: 100%;
- overflow: hidden;
- p{
- font-size:40px;
- line-height:40px;
- margin:18px 0 0 85px;
- font-weight:700;
- background: -webkit-linear-gradient(0deg, #0591F3, #FFFFFF); /* Chrome, Safari */
- background: linear-gradient(0deg, #0591F3, #FFFFFF); /* 标准语法 */
- -webkit-background-clip: text; /* Chrome, Safari */
- background-clip: text;
- -webkit-text-fill-color: transparent; /* Chrome, Safari */
- color: transparent; /* 其他浏览器 */
- }
- }
- .secondaryCollegeUnitLaboratoryStatisticsPage{
- height:665px;
- width:1167px;
- }
- }
- </style>
|