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

472 lines
14 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:17:22
2022-06-19 17:12:30 +08:00
* @Description: 能力云图-组件服务
2022-06-19 10:22:39 +08:00
-->
<template>
2022-06-19 17:12:30 +08:00
<div class="component-services">
<div class="component-services-top">
<span class="title">组件服务</span>
</div>
<div class="component-services-content">
<!-- 上架总量 -->
<div class="component-services-content-left">
<div class="component-services-content-left-top">组件</div>
<div class="component-services-content-left-bottom">
<div
class="component-services-content-left-bottom-son"
v-for="(item, index) in snum"
:key="index"
>
<P>{{ item.title }}</P>
<p class="num">{{ item.num }}</p>
</div>
</div>
</div>
<!-- 组件数量和调用趋势 -->
<div class="component-services-content-right">
<div class="component-services-content-right-left">
<div class="component-services-content-right-left-title">
组件数量
</div>
<div class="component-services-content-right-left-content">
<div
v-for="(item, index) in servicesSnum"
:key="index"
class="component-services-content-right-left-content-son"
>
<p>{{ item.type }}</p>
<p class="num">{{ item.amount }}</p>
</div>
</div>
</div>
<div class="component-services-content-right-right">
<div class="component-services-content-right-right-title">
<div class="component-services-content-right-right-title-top">
<div
class="component-services-content-right-right-title-top-left"
>
调用趋势
</div>
<div
class="component-services-content-right-right-title-top-right"
>
<div></div>
<div></div>
</div>
</div>
<div class="component-services-content-right-right-title-bottom">
</div>
</div>
<div class="callTheTrend" id="callTheTrend"></div>
<div class="component-services-content-right-right-bottom">
<div class="component-services-content-right-right-bottom-left">
<div class="components-can-assign">组件赋能排行</div>
<div class="components-scores">组件评分排行</div>
</div>
<div class="component-services-content-right-right-bottom-right">
<div>
<span>TOP</span>
<span>名称</span>
<span>应用数</span>
</div>
<div>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
2022-06-19 10:22:39 +08:00
</template>
2022-06-19 17:12:30 +08:00
<script setup>
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
import { assemblerBaseStatic } from '@/api/capabilityCloud'
// import * as moment from 'moment'
let snum = ref([
{ title: '上架总量', num: '0000' },
{ title: '总调用次数(API)', num: '0000' },
{ title: '健康度(API)', num: '0000' },
])
let servicesSnum = ref([])
let callTheTrendData = ref([
{ time: 6.02, value: 10 },
{ time: 6.03, value: 12 },
{ time: 6.04, value: 0 },
{ time: 6.05, value: 1 },
{ time: 6.06, value: 10 },
{ time: 6.07, value: 20 },
{ time: 6.08, value: 15 },
])
//调用趋势echarts图
const callTheTrend = () => {
echarts.init(document.getElementById('callTheTrend')).dispose()
let chartDom = document.getElementById('callTheTrend')
let myChart = echarts.init(chartDom)
let option
option = {
grid: {
top: '10%',
left: '0%',
right: '5%',
bottom: '0%',
containLabel: true,
},
xAxis: [
{
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: 'rgba(28,119,205,0.8)',
},
},
axisLabel: {
textStyle: {
color: 'rgba(255,255,255,0.5)',
size: 18,
},
},
data: ['1-13', '1-14', '1-15', '1-16', '1-17', '1-18', '1-19'],
},
],
yAxis: [
{
name: '个',
type: 'value',
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: '#57617B',
},
},
axisLabel: {
textStyle: {
color: 'rgba(255,255,255,0.5)',
size: 18,
},
},
splitLine: {
show: false,
},
},
],
series: [
{
type: 'line',
smooth: true,
lineStyle: {
normal: {
width: 3,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: 'rgba(244,124,37, 1)',
},
{
offset: 0.8,
color: 'rgba(244,124,37, 0)',
},
],
false
),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10,
},
},
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: '#ffe22e',
},
{
offset: 0.8,
color: '#f47c25',
},
],
false
),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: '3px',
},
},
data: [96.3, 96.4, 97.5, 95.6, 98.1, 94.8, 89.6],
},
],
}
option && myChart.setOption(option)
}
//组件服务数量接口
const NumberOfComponentServices = () => {
assemblerBaseStatic().then((res) => {
snum.value[0].num = res.data.data[0].amount
console.log('res', res.data)
res.data.data.map((item, index) => {
if (index != 0) {
servicesSnum.value.push(item)
}
})
})
}
const init = () => {
NumberOfComponentServices()
}
onMounted(() => {
init()
callTheTrend(callTheTrendData.value)
})
</script>
<style lang="less" scoped>
.component-services {
height: 4.65rem;
width: 7.84rem;
position: relative;
background: rgba(0, 108, 188, 0.1);
border: 0.02rem rgba(0, 108, 188, 0.7) solid;
border-radius: 0.03rem;
.component-services-top {
width: 7.84rem;
height: 0.44rem;
position: absolute;
top: 0;
background: url('~@/assets/capabilityCloud/Component_services_bg.png')
no-repeat;
background-size: cover;
background-position: center;
line-height: 0.44rem;
text-align: center;
.title {
font-size: 0.24rem;
}
}
.component-services-content {
padding: 0.28rem 0 0.28rem 0.28rem;
width: 7.84rem;
height: 4.65rem;
display: flex;
.component-services-content-left {
margin-right: 0.18rem;
.component-services-content-left-top {
width: 1.16rem;
height: 1.04rem;
margin-left: 0.15rem;
line-height: 1.04rem;
text-align: center;
color: rgba(255, 255, 255, 0.9);
font-size: 0.2rem;
background: url('~@/assets/capabilityCloud/Component_services_title.png')
no-repeat;
background-size: cover;
background-position: center;
}
.component-services-content-left-bottom {
width: 1.48rem;
margin-top: -0.15rem;
padding-top: 0.52rem;
background: url('~@/assets/capabilityCloud/Component_services_content_bg.png')
no-repeat;
background-size: cover;
background-position: center;
.component-services-content-left-bottom-son {
text-align: center;
margin-bottom: 0.56rem;
& > p:first-child {
color: #ffffff;
font-size: 0.16rem;
line-height: 0.16rem;
margin-bottom: 0.12rem;
margin-top: ;
}
& > p:last-child {
color: #1ef6f5;
font-size: 0.28rem;
line-height: 0.28rem;
}
}
.component-services-content-left-bottom-son:last-child {
margin-bottom: 0rem;
}
}
}
.component-services-content-right {
width: (100% - 1.66rem);
margin-top: 0.35rem;
display: flex;
.component-services-content-right-left {
width: 1.6rem;
height: 3.72rem;
background: -webkit-linear-gradient(#214677, transparent);
margin-right: 0.13rem;
.component-services-content-right-left-title {
font-size: 0.2rem;
color: #ffffff;
padding: 0.14rem 0 0.1rem 0;
border-bottom: #00ffff 0.01rem solid;
text-align: center;
margin: 0 0.13rem;
}
.component-services-content-right-left-content {
padding-top: 0.14rem;
.component-services-content-right-left-content-son {
background: url('~@/assets/capabilityCloud/Component_services_snum.png')
no-repeat;
background-size: 1.1rem 0.59rem;
background-position: center;
text-align: center;
& > p:first-child {
color: #ffffff;
font-size: 0.16rem;
line-height: 0.16rem;
margin-bottom: 0.12rem;
}
& > p:last-child {
color: #1ef6f5;
font-size: 0.28rem;
line-height: 0.28rem;
padding-bottom: 0.24rem;
margin: 0;
}
}
.component-services-content-right-left-content-son :first-child {
& > p:last-child {
color: #1ef6f5;
font-size: 0.28rem;
line-height: 0.28rem;
padding-bottom: 0.38rem;
}
}
}
}
.component-services-content-right-right {
width: 3.96rem;
.component-services-content-right-right-title {
.component-services-content-right-right-title-top {
display: flex;
align-items: center;
.component-services-content-right-right-title-top-left {
font-size: 0.18rem;
height: 0.2rem;
line-height: 0.18rem;
color: #ffffff;
background: url('~@/assets/capabilityCloud/Component_services_title_bg.png')
no-repeat;
background-size: 0.7rem 0.08rem;
background-position: bottom;
}
.component-services-content-right-right-title-top-right {
margin-left: 0.15rem;
display: flex;
color: #ffffff;
font-size: 0.14rem;
& > div {
font-size: 0.14rem;
height: 0.26rem;
width: 0.4rem;
border: 0.01rem solid #61d2d2;
text-align: center;
line-height: 0.24rem;
margin-right: 0.05rem;
border-radius: 0.12rem;
background: #05315b;
}
}
}
.component-services-content-right-right-title-bottom {
color: rgba(255, 255, 255, 0.5);
line-height: 0.14rem;
}
}
.callTheTrend {
height: 1.32rem;
width: 100%;
}
.component-services-content-right-right-bottom {
display: flex;
padding-top: 0.13rem;
.component-services-content-right-right-bottom-left {
width: 1.28rem;
border-right: 0.02rem rgba(0, 108, 188, 0.7) solid;
margin-right: 0.2rem;
.components-can-assign,
.components-scores {
margin-top: 0.13rem;
height: 0.88rem;
width: 1.25rem;
font-size: 0.16rem;
color: rgba(255, 255, 255, 0.6);
line-height: 0.88rem;
text-align: center;
background: linear-gradient(
to right,
rgba(0, 117, 203, 0.2),
rgba(0, 117, 203, 0)
);
}
.components-can-assign {
margin-top: 0;
}
}
.component-services-content-right-right-bottom-right {
width: 2.5rem;
font-size: 0.16rem;
border: 0.02rem rgba(0, 108, 188, 0.7) solid;
color: rgba(255, 255, 255, 0.8);
& > div {
& > span {
display: inline-block;
height: 0.32rem;
line-height: 0.32rem;
border-right: 0.02rem rgba(0, 108, 188, 0.7) solid;
border-bottom: 0.02rem rgba(0, 108, 188, 0.7) solid;
}
& > span:first-child {
width: 0.47rem;
text-align: center;
}
& > span:nth-child(2) {
width: 1.47rem;
}
& > span:last-child {
width: 0.5rem;
color: #1ffefd;
text-align: center;
border-right: 0;
}
}
& > div:first-child {
color: #1ffefd;
background: #27528c;
}
}
}
}
}
}
}
</style>