|
@@ -2,7 +2,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="usageRateComponent">
|
|
<div class="usageRateComponent">
|
|
|
<p class="title-p">设施使用率排行</p>
|
|
<p class="title-p">设施使用率排行</p>
|
|
|
- <dv-scroll-board :config="config" style="width:470px;height:435px" />
|
|
|
|
|
|
|
+ <dv-scroll-board :config="config" style="width:470px;height:435px" v-if="config.data[0]"/>
|
|
|
|
|
+ <p class="position-null-p" v-if="!config.data[0]">暂无数据</p>
|
|
|
<img class="position-left-top" src="@/assets/ZDimages/img_min_icon.png">
|
|
<img class="position-left-top" src="@/assets/ZDimages/img_min_icon.png">
|
|
|
<img class="position-right-top" src="@/assets/ZDimages/img_min_icon.png">
|
|
<img class="position-right-top" src="@/assets/ZDimages/img_min_icon.png">
|
|
|
<img class="position-left-bottom" src="@/assets/ZDimages/img_min_icon.png">
|
|
<img class="position-left-bottom" src="@/assets/ZDimages/img_min_icon.png">
|
|
@@ -10,165 +11,223 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ import { dashboardsFacilitiesUsageStats } from '@/api/yiLi'
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
name: 'usageRateComponent',
|
|
name: 'usageRateComponent',
|
|
|
- data () {
|
|
|
|
|
|
|
+ data() {
|
|
|
return {
|
|
return {
|
|
|
- wendu_zc : require('@/assets/ZDimages/img_cgq_zc@1x.png'),
|
|
|
|
|
- config:{
|
|
|
|
|
- rowNum:7,
|
|
|
|
|
- headerBGC:'rgba(0,66,138,0.5)',
|
|
|
|
|
- oddRowBGC:'rgba(0,66,138,0.0)',
|
|
|
|
|
- evenRowBGC:'rgba(0,66,138,0.0)',
|
|
|
|
|
|
|
+ wendu_zc: require('@/assets/ZDimages/img_cgq_zc@1x.png'),
|
|
|
|
|
+ config: {
|
|
|
|
|
+ rowNum: 7,
|
|
|
|
|
+ headerBGC: 'rgba(0,66,138,0.5)',
|
|
|
|
|
+ oddRowBGC: 'rgba(0,66,138,0.0)',
|
|
|
|
|
+ evenRowBGC: 'rgba(0,66,138,0.0)',
|
|
|
header: ['', '设施房间', '使用人次', '使用率'],
|
|
header: ['', '设施房间', '使用人次', '使用率'],
|
|
|
- data:[
|
|
|
|
|
- ['<span class="span_1"><span></span></span>','行1列1', '行1列2', '行1列3'],
|
|
|
|
|
- ['<span class="span_2"><span></span></span>','行2列1', '行2列2', '行2列3'],
|
|
|
|
|
- ['<span class="span_3"><span></span></span>','行3列1', '行3列2', '行3列3'],
|
|
|
|
|
- ['<span class="span_num"><span>4</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
- ['<span class="span_num"><span>5</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
- ['<span class="span_num"><span>6</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
- ['<span class="span_num"><span>7</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
- ['<span class="span_num"><span>8</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
- ['<span class="span_num"><span>9</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
|
|
+ data: [
|
|
|
|
|
+ // ['<span class="span_1"><span></span></span>','行1列1', '行1列2', '行1列3'],
|
|
|
|
|
+ // ['<span class="span_2"><span></span></span>','行2列1', '行2列2', '行2列3'],
|
|
|
|
|
+ // ['<span class="span_3"><span></span></span>','行3列1', '行3列2', '行3列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>4</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>5</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>6</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>7</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>8</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
|
|
+ // ['<span class="span_num"><span>9</span></span>','行4列1', '行4列2', '行4列3'],
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- created(){
|
|
|
|
|
|
|
+ created() {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
- mounted(){
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- methods:{
|
|
|
|
|
-
|
|
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.dashboardsFacilitiesUsageStats()
|
|
|
},
|
|
},
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ dashboardsFacilitiesUsageStats() {
|
|
|
|
|
+ let self = this
|
|
|
|
|
+ dashboardsFacilitiesUsageStats().then(res => {
|
|
|
|
|
+ let list = []
|
|
|
|
|
+ for (let i = 0; i < res.data.monthlyUsage.length; i++) {
|
|
|
|
|
+ let obj = {
|
|
|
|
|
+ name: res.data.monthlyUsage[i].equTypeName,
|
|
|
|
|
+ num: res.data.monthlyUsage[i].equRentingCount,
|
|
|
|
|
+ value: res.data.monthlyUsage[i].equRentingCount == 0 ? res.data.monthlyUsage[i].equRentingCount + '%' : self.calculatePercentage(res.data.monthlyUsage[i].equRentingCount, res.data.monthlyUsage[i].equCount, { decimal: 0 })
|
|
|
|
|
+ }
|
|
|
|
|
+ list.push(obj)
|
|
|
|
|
+ }
|
|
|
|
|
+ list = this.sortByPercentageDesc(list)
|
|
|
|
|
+ let newList = [];
|
|
|
|
|
+ for(let i=0;i<list.length;i++){
|
|
|
|
|
+ if(i==0){
|
|
|
|
|
+ newList.push(['<span class="span_1"><span></span></span>',list[i].name, list[i].num+'', list[i].value])
|
|
|
|
|
+ }else if(i==1){
|
|
|
|
|
+ newList.push(['<span class="span_2"><span></span></span>',list[i].name, list[i].num+'', list[i].value])
|
|
|
|
|
+ }else if(i==1){
|
|
|
|
|
+ newList.push(['<span class="span_3"><span></span></span>',list[i].name, list[i].num+'', list[i].value])
|
|
|
|
|
+ }else{
|
|
|
|
|
+ newList.push(['<span class="span_num"><span>'+(i+1)+'</span></span>',list[i].name, list[i].num+'', list[i].value])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$set(this.config,'data',newList)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ calculatePercentage(numerator, denominator, options = {}) {
|
|
|
|
|
+ if (typeof numerator !== 'number' || typeof denominator !== 'number') {
|
|
|
|
|
+ throw new TypeError('分子和分母必须是数字')
|
|
|
|
|
+ }
|
|
|
|
|
+ if (denominator === 0) {
|
|
|
|
|
+ throw new Error('分母不能为零')
|
|
|
|
|
+ }
|
|
|
|
|
+ const { decimal = 2, returnString = true } = options
|
|
|
|
|
+ const percentage = (numerator / denominator) * 100
|
|
|
|
|
+ const rounded = Math.round(percentage * Math.pow(10, decimal)) / Math.pow(10, decimal)
|
|
|
|
|
+ return returnString ? `${rounded}%` : rounded
|
|
|
|
|
+ },
|
|
|
|
|
+ parsePercentage(percentStr) {
|
|
|
|
|
+ return parseFloat(percentStr.replace('%', ''))
|
|
|
|
|
+ },
|
|
|
|
|
+ sortByPercentageDesc(arr, prop = 'value') {
|
|
|
|
|
+ return [...arr].sort((a, b) => {
|
|
|
|
|
+ const valA = this.parsePercentage(a[prop])
|
|
|
|
|
+ const valB = this.parsePercentage(b[prop])
|
|
|
|
|
+ return valB - valA // 降序排序
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
- .usageRateComponent{
|
|
|
|
|
- width:530px;
|
|
|
|
|
- height:512px;
|
|
|
|
|
- margin:20px 0 0 20px;
|
|
|
|
|
|
|
+ .usageRateComponent {
|
|
|
|
|
+ width: 530px;
|
|
|
|
|
+ height: 512px;
|
|
|
|
|
+ margin: 20px 0 0 20px;
|
|
|
background-image: url("../../assets/ZDimages/img_sssylph@1x.png");
|
|
background-image: url("../../assets/ZDimages/img_sssylph@1x.png");
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
position: relative;
|
|
position: relative;
|
|
|
- .title-p{
|
|
|
|
|
|
|
+ .title-p {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- width:282px;
|
|
|
|
|
- height:36px;
|
|
|
|
|
|
|
+ width: 282px;
|
|
|
|
|
+ height: 36px;
|
|
|
line-height: 36px;
|
|
line-height: 36px;
|
|
|
- color:#fff;
|
|
|
|
|
- font-size:18px;
|
|
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ font-size: 18px;
|
|
|
font-weight: 700;
|
|
font-weight: 700;
|
|
|
font-family: Source Han Sans, Source Han Sans;
|
|
font-family: Source Han Sans, Source Han Sans;
|
|
|
- padding-left:24px;
|
|
|
|
|
|
|
+ padding-left: 24px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .position-null-p {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 230px;
|
|
|
|
|
+ top: 240px;
|
|
|
|
|
+ color: #dedede;
|
|
|
|
|
+ font-size: 16px;
|
|
|
}
|
|
}
|
|
|
- .position-left-top{
|
|
|
|
|
|
|
+ .position-left-top {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- left:-15px;
|
|
|
|
|
- top:28px;
|
|
|
|
|
- width:42px;
|
|
|
|
|
- height:42px;
|
|
|
|
|
- z-index:1;
|
|
|
|
|
|
|
+ left: -15px;
|
|
|
|
|
+ top: 28px;
|
|
|
|
|
+ width: 42px;
|
|
|
|
|
+ height: 42px;
|
|
|
|
|
+ z-index: 1;
|
|
|
}
|
|
}
|
|
|
- .position-right-top{
|
|
|
|
|
|
|
+ .position-right-top {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- right:-15px;
|
|
|
|
|
- top:-15px;
|
|
|
|
|
- width:42px;
|
|
|
|
|
- height:42px;
|
|
|
|
|
- z-index:1;
|
|
|
|
|
|
|
+ right: -15px;
|
|
|
|
|
+ top: -15px;
|
|
|
|
|
+ width: 42px;
|
|
|
|
|
+ height: 42px;
|
|
|
|
|
+ z-index: 1;
|
|
|
transform: rotate(90deg);
|
|
transform: rotate(90deg);
|
|
|
}
|
|
}
|
|
|
- .position-left-bottom{
|
|
|
|
|
|
|
+ .position-left-bottom {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- left:-15px;
|
|
|
|
|
- bottom:-15px;
|
|
|
|
|
- width:42px;
|
|
|
|
|
- height:42px;
|
|
|
|
|
- z-index:1;
|
|
|
|
|
|
|
+ left: -15px;
|
|
|
|
|
+ bottom: -15px;
|
|
|
|
|
+ width: 42px;
|
|
|
|
|
+ height: 42px;
|
|
|
|
|
+ z-index: 1;
|
|
|
transform: rotate(270deg);
|
|
transform: rotate(270deg);
|
|
|
}
|
|
}
|
|
|
- .position-right-bottom{
|
|
|
|
|
|
|
+ .position-right-bottom {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
- right:-14px;
|
|
|
|
|
- bottom:-15px;
|
|
|
|
|
- width:42px;
|
|
|
|
|
- height:42px;
|
|
|
|
|
- z-index:1;
|
|
|
|
|
|
|
+ right: -14px;
|
|
|
|
|
+ bottom: -15px;
|
|
|
|
|
+ width: 42px;
|
|
|
|
|
+ height: 42px;
|
|
|
|
|
+ z-index: 1;
|
|
|
transform: rotate(180deg);
|
|
transform: rotate(180deg);
|
|
|
}
|
|
}
|
|
|
- ::v-deep .dv-scroll-board{
|
|
|
|
|
- margin:54px 0 0 30px;
|
|
|
|
|
- .header{
|
|
|
|
|
- .header-item{
|
|
|
|
|
- width:137px!important;
|
|
|
|
|
|
|
+ ::v-deep .dv-scroll-board {
|
|
|
|
|
+ margin: 54px 0 0 30px;
|
|
|
|
|
+ .header {
|
|
|
|
|
+ .header-item {
|
|
|
|
|
+ width: 137px !important;
|
|
|
}
|
|
}
|
|
|
- .header-item:nth-child(1){
|
|
|
|
|
- width:50px!important;
|
|
|
|
|
|
|
+ .header-item:nth-child(1) {
|
|
|
|
|
+ width: 50px !important;
|
|
|
}
|
|
}
|
|
|
- .header-item:nth-child(3){
|
|
|
|
|
|
|
+ .header-item:nth-child(3) {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
}
|
|
}
|
|
|
- .header-item:nth-child(4){
|
|
|
|
|
|
|
+ .header-item:nth-child(4) {
|
|
|
text-align: right;
|
|
text-align: right;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .row-item{
|
|
|
|
|
- height:50px!important;
|
|
|
|
|
- line-height:50px!important;
|
|
|
|
|
- border-bottom:1px dashed rgba(216,216,216,0.1);
|
|
|
|
|
- .ceil{
|
|
|
|
|
- width:137px!important;
|
|
|
|
|
|
|
+ .row-item {
|
|
|
|
|
+ height: 50px !important;
|
|
|
|
|
+ line-height: 50px !important;
|
|
|
|
|
+ border-bottom: 1px dashed rgba(216, 216, 216, 0.1);
|
|
|
|
|
+ .ceil {
|
|
|
|
|
+ width: 137px !important;
|
|
|
}
|
|
}
|
|
|
- .ceil:nth-child(1){
|
|
|
|
|
- width:50px!important;
|
|
|
|
|
|
|
+ .ceil:nth-child(1) {
|
|
|
|
|
+ width: 50px !important;
|
|
|
}
|
|
}
|
|
|
- .ceil:nth-child(3){
|
|
|
|
|
|
|
+ .ceil:nth-child(3) {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
}
|
|
}
|
|
|
- .ceil:nth-child(4){
|
|
|
|
|
|
|
+ .ceil:nth-child(4) {
|
|
|
text-align: right;
|
|
text-align: right;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .span_1{
|
|
|
|
|
- display:inline-block;
|
|
|
|
|
- width:24px;
|
|
|
|
|
- height:30px;
|
|
|
|
|
- margin:10px 0 0 0;
|
|
|
|
|
|
|
+ .span_1 {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ width: 24px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ margin: 10px 0 0 0;
|
|
|
background-image: url("../../assets/ZDimages/img_pm_a@1x.png");
|
|
background-image: url("../../assets/ZDimages/img_pm_a@1x.png");
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
}
|
|
}
|
|
|
- .span_2{
|
|
|
|
|
- display:inline-block;
|
|
|
|
|
- width:24px;
|
|
|
|
|
- height:30px;
|
|
|
|
|
- margin:10px 0 0 0;
|
|
|
|
|
|
|
+ .span_2 {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ width: 24px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ margin: 10px 0 0 0;
|
|
|
background-image: url("../../assets/ZDimages/img_pm_b.png");
|
|
background-image: url("../../assets/ZDimages/img_pm_b.png");
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
}
|
|
}
|
|
|
- .span_3{
|
|
|
|
|
- display:inline-block;
|
|
|
|
|
- width:24px;
|
|
|
|
|
- height:30px;
|
|
|
|
|
- margin:10px 0 0 0;
|
|
|
|
|
|
|
+ .span_3 {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ width: 24px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ margin: 10px 0 0 0;
|
|
|
background-image: url("../../assets/ZDimages/img_pm_c@1x.png");
|
|
background-image: url("../../assets/ZDimages/img_pm_c@1x.png");
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
}
|
|
}
|
|
|
- .span_num{
|
|
|
|
|
- display:inline-block;
|
|
|
|
|
- width:24px;
|
|
|
|
|
- height:30px;
|
|
|
|
|
- span{
|
|
|
|
|
- display:inline-block;
|
|
|
|
|
- width:20px;
|
|
|
|
|
- height:20px;
|
|
|
|
|
- line-height:20px;
|
|
|
|
|
|
|
+ .span_num {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ width: 24px;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ span {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ width: 20px;
|
|
|
|
|
+ height: 20px;
|
|
|
|
|
+ line-height: 20px;
|
|
|
background-color: #0E52C3;
|
|
background-color: #0E52C3;
|
|
|
- border:1px solid #0576FF;
|
|
|
|
|
- border-radius:50%;
|
|
|
|
|
|
|
+ border: 1px solid #0576FF;
|
|
|
|
|
+ border-radius: 50%;
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|