660 lines
20 KiB
Vue
660 lines
20 KiB
Vue
<!--
|
|
* @Author: hisense.liangjunhua
|
|
* @Date: 2022-06-19 10:15:33
|
|
* @LastEditors: hisense.wuhongjian
|
|
* @LastEditTime: 2022-06-19 18:19:58
|
|
* @Description: 能力云图-组件服务
|
|
-->
|
|
<template>
|
|
<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
|
|
@click="timeSwitch('周')"
|
|
:class="timeSwitchindex == '周' ? 'timeDown' : ''"
|
|
>
|
|
周
|
|
</div>
|
|
<div
|
|
@click="timeSwitch('月')"
|
|
:class="timeSwitchindex == '月' ? 'timeDown' : ''"
|
|
>
|
|
月
|
|
</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"
|
|
@click="ranking('total')"
|
|
:class="dataclick == 'total' ? 'down' : ''"
|
|
>
|
|
组件赋能排行
|
|
</div>
|
|
<div
|
|
class="components-scores"
|
|
@click="ranking('score')"
|
|
:class="dataclick == 'score' ? 'down' : ''"
|
|
>
|
|
组件评分排行
|
|
</div>
|
|
</div>
|
|
<div class="component-services-content-right-right-bottom-right">
|
|
<div>
|
|
<span>TOP</span>
|
|
<span>名称</span>
|
|
<span v-if="dataclick != 'score'">应用数</span>
|
|
<span v-else>分数</span>
|
|
</div>
|
|
<div v-for="(item, index) in dataList" :key="index">
|
|
<span>{{ index + 1 }}</span>
|
|
<a-tooltip>
|
|
<template #title>{{ item.name }}</template>
|
|
<span>{{ item.name }}</span>
|
|
</a-tooltip>
|
|
<span>{{ item.count || 0 }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue'
|
|
import * as echarts from 'echarts'
|
|
import {
|
|
assemblerBaseStatic,
|
|
componentServiceRank,
|
|
callTheTrendPort,
|
|
totalCallsSnum,
|
|
} from '@/api/capabilityCloud'
|
|
import * as moment from 'moment'
|
|
let snum = ref([
|
|
{ title: '上架总量', num: '0000' },
|
|
{ title: '总调用次数(API)', num: '0' },
|
|
{ title: '健康度(API)', num: '100%' },
|
|
])
|
|
let dataclick = ref('total')
|
|
let dataList = ref([])
|
|
let timeSwitchindex = ref('周')
|
|
let servicesSnum = ref([
|
|
{ amount: '', type: '智能算法' },
|
|
{ amount: '', type: '图层服务' },
|
|
{ amount: '', type: '开发组件' },
|
|
{ amount: '', type: '业务组件' },
|
|
])
|
|
let callTheTrendData = ref({ time: [], snum: [] })
|
|
//年月切换
|
|
const timeSwitch = (name) => {
|
|
timeSwitchindex.value = name
|
|
callTheTrendData.value.time = []
|
|
callTheTrendData.value.snum = []
|
|
if (name == '周') {
|
|
for (let i = 0; i < 7; i++) {
|
|
let time = moment()
|
|
.subtract('days', 6 - i)
|
|
.format('MM-DD')
|
|
callTheTrendData.value.time.push(time)
|
|
console.log('time', callTheTrendData.value, name)
|
|
}
|
|
const start = parseInt(
|
|
(Date.parse(new Date()) - 168 * 60 * 60 * 1000) / 1000
|
|
)
|
|
const end = Date.parse(new Date()) / 1000
|
|
callTheTrendPort(start, end, 86400).then((res) => {
|
|
if (res.data.data.result) {
|
|
res.data.data.result[0].values.splice(0, 1)
|
|
res.data.data.result[0].values.map((item) => {
|
|
callTheTrendData.value.snum.push(parseInt(item[1]))
|
|
})
|
|
callTheTrend(callTheTrendData.value)
|
|
} else {
|
|
callTheTrendData.value.snum = ['0', '0', '0', '0', '0', '0', '0']
|
|
callTheTrend(callTheTrendData.value)
|
|
}
|
|
})
|
|
} else {
|
|
for (let i = 0; i < 31; i++) {
|
|
let time = moment()
|
|
.subtract('days', 30 - i)
|
|
.format('MM-DD')
|
|
callTheTrendData.value.time.push(time)
|
|
console.log('time', callTheTrendData.value, name)
|
|
}
|
|
const start = parseInt(
|
|
(Date.parse(new Date()) - 720 * 60 * 60 * 1000) / 1000
|
|
)
|
|
const end = Date.parse(new Date()) / 1000
|
|
callTheTrendPort(start, end, 86400).then((res) => {
|
|
if (res.data.data.result) {
|
|
// res.data.data.result.splice(0, 1)
|
|
callTheTrendData.value.snum = []
|
|
res.data.data.result[0].values.map((item) => {
|
|
callTheTrendData.value.snum.push(
|
|
moment(item[0] * 1000).format('MM-DD')
|
|
)
|
|
callTheTrendData.value.snum.push(parseInt(item[1]))
|
|
})
|
|
callTheTrend(callTheTrendData.value)
|
|
} else {
|
|
for (let i = 0; i < 30; i++) {
|
|
callTheTrendData.value.snum.push('0')
|
|
}
|
|
callTheTrend(callTheTrendData.value)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
//调用趋势echarts图
|
|
const callTheTrend = (dataFrom) => {
|
|
echarts.init(document.getElementById('callTheTrend')).dispose()
|
|
let chartDom = document.getElementById('callTheTrend')
|
|
let myChart = echarts.init(chartDom)
|
|
let option
|
|
option = {
|
|
tooltip: {
|
|
backgroundColor: 'rgba(17,61,116,0.8)',
|
|
borderWidth: 0,
|
|
trigger: 'axis',
|
|
formatter: function (val) {
|
|
console.log(val)
|
|
let res = `<div style="background:rgba(17,61,116,0.8);border:1px soild rgba(28,119,205,0.8);color:#fff;padding:0">
|
|
<span>日期 : ${val[0].name}</span>
|
|
<div style="margin-left: 18px">调用次数 : ${val[0].value}</div>
|
|
</div>`
|
|
return res
|
|
},
|
|
},
|
|
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: dataFrom.time,
|
|
},
|
|
],
|
|
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: dataFrom.snum,
|
|
},
|
|
],
|
|
}
|
|
option && myChart.setOption(option)
|
|
}
|
|
//组件复制排名接口
|
|
const ranking = (name) => {
|
|
dataclick.value = name
|
|
let params = {
|
|
type: name,
|
|
}
|
|
componentServiceRank(params).then((res) => {
|
|
dataList.value = res.data.data
|
|
console.log('res', dataList.value)
|
|
})
|
|
}
|
|
//组件服务数量接口
|
|
const NumberOfComponentServices = () => {
|
|
assemblerBaseStatic().then((res) => {
|
|
snum.value[0].num = res.data.data[0].amount
|
|
res.data.data.map((item, index) => {
|
|
if (index != 0) {
|
|
servicesSnum.value.map((servicesSnumitem, servicesSnumindex) => {
|
|
if (servicesSnumitem.type == item.type) {
|
|
servicesSnum.value[servicesSnumindex].amount = item.amount
|
|
}
|
|
})
|
|
}
|
|
})
|
|
})
|
|
}
|
|
//总调用次数接口
|
|
const TotalCallsAPI = () => {
|
|
const end = Date.parse(new Date()) / 1000
|
|
totalCallsSnum(end).then((res) => {
|
|
snum.value[1].num = res.data.data.result[0].value[1]
|
|
})
|
|
}
|
|
const init = () => {
|
|
timeSwitch(timeSwitchindex.value)
|
|
NumberOfComponentServices()
|
|
ranking(dataclick.value)
|
|
TotalCallsAPI()
|
|
}
|
|
onMounted(() => {
|
|
init()
|
|
callTheTrend(callTheTrendData.value)
|
|
})
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.component-services {
|
|
height: 4.63rem;
|
|
width: 7.84rem;
|
|
position: relative;
|
|
background: rgba(0, 108, 188, 0.1);
|
|
border: 0.01rem rgba(0, 108, 188, 0.7) solid;
|
|
border-radius: 0.03rem;
|
|
text-decoration: none;
|
|
outline: none;
|
|
-webkit-transition: all 100ms ease-out;
|
|
-moz-transition: all 100ms ease-out;
|
|
transition: all 100ms ease-out;
|
|
.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;
|
|
cursor: pointer;
|
|
}
|
|
.timeDown {
|
|
background: #005ea3;
|
|
border: #00ffff 0.01rem solid;
|
|
}
|
|
}
|
|
}
|
|
.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.01rem 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;
|
|
cursor: pointer;
|
|
background: linear-gradient(
|
|
to right,
|
|
rgba(0, 117, 203, 0.2),
|
|
rgba(0, 117, 203, 0)
|
|
);
|
|
}
|
|
.components-can-assign:hover,
|
|
.components-scores:hover {
|
|
border-left: 0.02rem solid #00ffff;
|
|
background: linear-gradient(
|
|
to right,
|
|
rgba(0, 117, 203, 1),
|
|
rgba(0, 117, 203, 0)
|
|
);
|
|
color: #ffffff;
|
|
}
|
|
.down {
|
|
border-left: 0.02rem solid #00ffff;
|
|
background: linear-gradient(
|
|
to right,
|
|
rgba(0, 117, 203, 1),
|
|
rgba(0, 117, 203, 0)
|
|
);
|
|
color: #ffffff;
|
|
}
|
|
.components-can-assign {
|
|
margin-top: 0;
|
|
}
|
|
}
|
|
.component-services-content-right-right-bottom-right {
|
|
width: 2.5rem;
|
|
font-size: 0.16rem;
|
|
border: 0.01rem rgba(0, 108, 188, 0.7) solid;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
& > div {
|
|
height: 0.32rem;
|
|
& > span {
|
|
display: inline-block;
|
|
height: 0.32rem;
|
|
line-height: 0.32rem;
|
|
border-right: 0.01rem rgba(0, 108, 188, 0.7) solid;
|
|
border-bottom: 0.01rem rgba(0, 108, 188, 0.7) solid;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
-webkit-line-clamp: 1;
|
|
-webkit-box-orient: vertical;
|
|
word-break: break-all;
|
|
}
|
|
& > span:first-child {
|
|
width: 0.47rem;
|
|
text-align: center;
|
|
}
|
|
& > span:nth-child(2) {
|
|
width: 1.47rem;
|
|
padding-left: 0.05rem;
|
|
}
|
|
& > span:last-child {
|
|
width: 0.5rem;
|
|
color: #1ffefd;
|
|
text-align: center;
|
|
border-right: 0;
|
|
}
|
|
}
|
|
& > div:first-child {
|
|
color: #1ffefd;
|
|
background: #27528c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.component-services:hover {
|
|
border: 2px solid;
|
|
animation: turn 5s linear infinite;
|
|
}
|
|
@keyframes turn {
|
|
0% {
|
|
border-image: linear-gradient(to right, #003194, #00ffea) 1;
|
|
}
|
|
25% {
|
|
border-image: linear-gradient(to bottom, #003194, #00ffea) 1;
|
|
}
|
|
50% {
|
|
border-image: linear-gradient(to left, #003194, #00ffea) 1;
|
|
}
|
|
75% {
|
|
border-image: linear-gradient(to top, #003194, #00ffea) 1;
|
|
}
|
|
100% {
|
|
border-image: linear-gradient(to right, #003194, #00ffea) 1;
|
|
}
|
|
}
|
|
</style>
|