hi-ucs/front/src/views/capabilityCloud/components/DataResources.vue

292 lines
7.4 KiB
Vue
Raw Normal View History

2022-06-19 10:22:39 +08:00
<!--
* @Author: hisense.liangjunhua
* @Date: 2022-06-19 10:15:33
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-06-19 10:18:16
* @Description: 告诉大家这是什么
-->
<template>
2022-06-19 17:14:38 +08:00
<div class="data-resources">
<div class="resources-top">
<span class="title">数据资源</span>
</div>
<div class="resources-bottom">
<div class="resources-left">
<div v-for="(item, index) in resourcesLeft" :key="index">
<h3>{{ item.name }}</h3>
<h2 class="num">{{ item.num || '0' }}</h2>
</div>
<img :src="leftImg" alt="" />
</div>
<div class="resources-right">
<div class="resources-right-title">
<h3>数据赋能排行</h3>
</div>
<div class="resources-right-table">
<a-table
:data-source="assignRankings"
:columns="columns"
:pagination="false"
bordered="true"
/>
</div>
</div>
</div>
</div>
2022-06-19 10:22:39 +08:00
</template>
2022-06-19 17:14:38 +08:00
<script setup>
import { ref } from 'vue'
import { count, getRecord } from '@/api/file'
// import { abc } from './dataABC.json'
// 左侧数据
const resourcesLeft = ref([
{
name: '总数据数',
num: '',
},
{
name: '总申请次数',
num: '',
},
{
name: '满足率',
num: '',
},
])
// 右侧数据
const assignRankings = ref([
{
index: '1',
2022-06-19 17:56:21 +08:00
name: ' ',
operation: ' ',
2022-06-19 17:14:38 +08:00
},
{
index: '2',
2022-06-19 17:56:21 +08:00
name: ' ',
operation: ' ',
2022-06-19 17:14:38 +08:00
},
{
index: '3',
2022-06-19 17:56:21 +08:00
name: ' ',
operation: ' ',
2022-06-19 17:14:38 +08:00
},
{
index: '4',
2022-06-19 17:56:21 +08:00
name: ' ',
operation: ' ',
2022-06-19 17:14:38 +08:00
},
{
index: '5',
2022-06-19 17:56:21 +08:00
name: ' ',
operation: ' ',
2022-06-19 17:14:38 +08:00
},
])
const columns = ref([
{
title: 'Top',
dataIndex: 'index',
key: 'index',
width: '15%',
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
width: '55%',
ellipsis: true,
},
{
title: '应用数',
dataIndex: 'operation',
key: 'operation',
width: '30%',
},
])
// 左侧图片
const leftImg = require('@/assets/capabilityCloud/resources-left.png')
// 请求左侧数据开始
const obj = {
serviceName: '',
orderField: 'updateTime',
orderType: 'desc',
pageNum: 1,
pageSize: 5,
serviceType: 'data',
}
getRecord(obj).then((res) => {
if (res.data.data) {
// res.data.data.list.forEach((val) => {
// val.name = val.serviceName
// val.createDate = val.updateTime
// val.id = val.serviceId // "requestNum": 0, // "requestQuantity": 0, // "starNum": 4, // "shareStatus": "2"
// })
// resourceList.data = res.data.data.list || []
resourcesLeft.value[0].num = res.data.data.total || '0' // getShoppingCartList(resourceData.value.data.records)
console.log('数据资源~~~~~~~~~~~', resourcesLeft.value[0].num)
}
})
// 请求左侧数据结束
// 请求右侧数据开始
const contentData = ref([])
count().then((res) => {
contentData.value = res.data.data
console.log(contentData.value)
2022-06-19 18:07:27 +08:00
// 总申请次数
2022-06-19 17:14:38 +08:00
resourcesLeft.value[1].num = contentData.value.requestCount || '0'
2022-06-19 18:07:27 +08:00
// 总满足率
2022-06-19 17:14:38 +08:00
resourcesLeft.value[2].num =
contentData.value.satisfactionRate + '%' || '0' + '%'
// 排行
for (let i = 1; i < 6; i++) {
2022-06-19 18:07:27 +08:00
// TOP
2022-06-19 17:14:38 +08:00
assignRankings.value[i - 1].index = i
2022-06-19 18:07:27 +08:00
//
2022-06-19 17:14:38 +08:00
assignRankings.value[i - 1].name =
2022-06-19 18:07:27 +08:00
contentData.value.resourceTop5[i - 1].service_name || 'wowoow'
2022-06-19 17:14:38 +08:00
assignRankings.value[i - 1].opacity =
2022-06-19 18:07:27 +08:00
contentData.value.resourceTop5[i - 1].count || ' '
2022-06-19 17:14:38 +08:00
}
})
// 请求右侧数据结束
</script>
<style lang="less" scoped>
.data-resources {
2022-06-19 17:56:21 +08:00
width: 4.4rem;
height: 4.63rem;
2022-06-19 17:14:38 +08:00
background: rgba(0, 108, 188, 0.1);
2022-06-19 17:56:21 +08:00
border-radius: 0.02rem;
border: 0.01rem solid rgba(0, 108, 188, 0.7);
box-sizing: border-box;
2022-06-19 17:14:38 +08:00
.resources-top {
2022-06-19 17:56:21 +08:00
height: 0.6rem;
2022-06-19 17:14:38 +08:00
background: url('~@/assets/capabilityCloud/resources-title.png') no-repeat;
text-align: center;
2022-06-19 17:56:21 +08:00
font-size: 0.24rem;
2022-06-19 17:14:38 +08:00
}
.resources-bottom {
width: 100%;
display: flex;
.resources-left {
2022-06-19 17:56:21 +08:00
width: 1.56rem;
height: 2.75rem;
2022-06-19 17:14:38 +08:00
background-image: linear-gradient(#214678, transparent);
text-align: center;
2022-06-19 17:56:21 +08:00
margin-left: 0.18rem;
2022-06-19 17:14:38 +08:00
position: relative;
div {
2022-06-19 17:56:21 +08:00
margin: 0 0.1rem;
border-bottom: 0.01rem solid #1f557c;
2022-06-19 17:14:38 +08:00
h3 {
2022-06-19 17:56:21 +08:00
font-size: 0.16rem;
2022-06-19 17:14:38 +08:00
color: #ffffff;
2022-06-19 17:56:21 +08:00
margin-bottom: 0rem;
padding-top: 0.16rem;
2022-06-19 17:14:38 +08:00
}
.num {
2022-06-19 17:56:21 +08:00
font-size: 0.28rem;
2022-06-19 17:14:38 +08:00
color: #1ef6f5;
2022-06-19 17:56:21 +08:00
margin-bottom: 0rem;
2022-06-19 17:14:38 +08:00
}
}
div:last-of-type {
border-bottom: none;
}
img {
width: 90%;
position: absolute;
left: 50%;
2022-06-19 17:56:21 +08:00
bottom: -1.38rem;
2022-06-19 17:14:38 +08:00
margin-left: -45%;
2022-06-19 17:56:21 +08:00
animation: move 5s linear 0s infinite;
@keyframes move {
from {
transform: rotateY(360deg);
}
to {
transform: rotateY(0deg);
}
}
2022-06-19 17:14:38 +08:00
}
}
.resources-right {
2022-06-19 17:56:21 +08:00
margin-left: 0.18rem;
width: 2.35rem;
2022-06-19 17:14:38 +08:00
display: flex;
flex-direction: column;
align-items: center;
.resources-right-title {
2022-06-19 17:56:21 +08:00
width: 2.24rem;
height: 1rem;
2022-06-19 17:14:38 +08:00
text-align: center;
background: url('~@/assets/capabilityCloud/resources-right.png')
no-repeat center;
display: flex;
align-items: center;
h3 {
2022-06-19 17:56:21 +08:00
font-size: 0.18rem;
2022-06-19 17:14:38 +08:00
color: #ffffff;
width: 100%;
2022-06-19 17:56:21 +08:00
height: 0.38rem;
line-height: 0.38rem;
2022-06-19 17:14:38 +08:00
background: linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
#1b76cc 50%,
rgba(0, 0, 0, 0) 100%
);
2022-06-19 17:56:21 +08:00
text-shadow: 0rem 0rem 0.02rem rgba(0, 0, 0, 0.6);
2022-06-19 17:14:38 +08:00
}
}
.resources-right-table {
width: 100%;
:deep(.ant-table-thead > tr > th) {
background-color: #1f557c;
border: none;
color: #1ef6f5;
2022-06-19 17:56:21 +08:00
height: 0.32rem;
2022-06-19 17:14:38 +08:00
padding: 0;
}
:deep(.ant-table-row) {
2022-06-19 17:56:21 +08:00
height: 0.45rem;
2022-06-19 17:14:38 +08:00
}
:deep(.ant-table-cell) {
text-align: center;
2022-06-19 17:56:21 +08:00
transition: all 0s;
background: transparent;
border-bottom: 0.01rem solid #1f557c;
border-right: 0.01rem solid #1f557c;
2022-06-19 17:14:38 +08:00
padding: 0;
}
:deep(.ant-table-cell:nth-child(1)) {
2022-06-19 17:56:21 +08:00
border-left: 0.01rem solid #1f557c;
2022-06-19 17:14:38 +08:00
}
:deep(.ant-table-cell:nth-child(2)) {
text-align: left;
2022-06-19 17:56:21 +08:00
padding-left: 0.1rem;
2022-06-19 17:14:38 +08:00
}
:deep(.ant-table-cell:nth-child(3)) {
color: #1ef6f5;
}
:deep(.ant-table-tbody) {
color: #ffffff;
}
:deep(.ant-table) {
border: none;
background: transparent;
}
:deep(.ant-table-content > table) {
border: none;
}
:deep(.ant-table-container) {
border: none;
}
:deep(.ant-table-cell-row-hover) {
transition: all 0s;
2022-06-19 17:56:21 +08:00
background: transparent;
2022-06-19 17:14:38 +08:00
}
}
}
}
}
</style>