组件服务和基础设施

This commit is contained in:
851673013@qq.com 2022-06-19 18:30:37 +08:00
parent 134d54d5ef
commit e38c8234a4
3 changed files with 133 additions and 32 deletions

View File

@ -49,4 +49,12 @@ export function assemblerBaseStatic() {
method: 'get', method: 'get',
}) })
} }
//-
export function componentServiceRank(params) {
return request({
url: '/census/center/v2/componentServiceRank',
method: 'get',
params
})
}

View File

@ -53,8 +53,18 @@
<div <div
class="component-services-content-right-right-title-top-right" class="component-services-content-right-right-title-top-right"
> >
<div></div> <div
<div></div> @click="timeSwitch('周')"
:class="timeSwitchindex == '周' ? 'timeDown' : ''"
>
</div>
<div
@click="timeSwitch('月')"
:class="timeSwitchindex == '月' ? 'timeDown' : ''"
>
</div>
</div> </div>
</div> </div>
<div class="component-services-content-right-right-title-bottom"> <div class="component-services-content-right-right-title-bottom">
@ -64,8 +74,20 @@
<div class="callTheTrend" id="callTheTrend"></div> <div class="callTheTrend" id="callTheTrend"></div>
<div class="component-services-content-right-right-bottom"> <div class="component-services-content-right-right-bottom">
<div class="component-services-content-right-right-bottom-left"> <div class="component-services-content-right-right-bottom-left">
<div class="components-can-assign">组件赋能排行</div> <div
<div class="components-scores">组件评分排行</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>
<div class="component-services-content-right-right-bottom-right"> <div class="component-services-content-right-right-bottom-right">
<div> <div>
@ -73,10 +95,13 @@
<span>名称</span> <span>名称</span>
<span>应用数</span> <span>应用数</span>
</div> </div>
<div> <div v-for="(item, index) in dataList" :key="index">
<span></span> <span>{{ index + 1 }}</span>
<span></span> <a-tooltip>
<span></span> <template #title>{{ item.name }}</template>
<span>{{ item.name }}</span>
</a-tooltip>
<span>{{ item.count }}</span>
</div> </div>
</div> </div>
</div> </div>
@ -88,25 +113,50 @@
<script setup> <script setup>
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { assemblerBaseStatic } from '@/api/capabilityCloud' import {
// import * as moment from 'moment' assemblerBaseStatic,
componentServiceRank,
} from '@/api/capabilityCloud'
import * as moment from 'moment'
let snum = ref([ let snum = ref([
{ title: '上架总量', num: '0000' }, { title: '上架总量', num: '0000' },
{ title: '总调用次数(API)', num: '0000' }, { title: '总调用次数(API)', num: '0000' },
{ title: '健康度(API)', num: '0000' }, { title: '健康度(API)', num: '0000' },
]) ])
let dataclick = ref('total')
let dataList = ref([])
let timeSwitchindex = ref('周')
let servicesSnum = ref([]) let servicesSnum = ref([])
let callTheTrendData = ref([ let callTheTrendData = ref({ time: [], snum: [] })
{ time: 6.02, value: 10 }, //
{ time: 6.03, value: 12 }, const timeSwitch = (name) => {
{ time: 6.04, value: 0 }, timeSwitchindex.value = name
{ time: 6.05, value: 1 }, callTheTrendData.value.time = []
{ time: 6.06, value: 10 }, callTheTrendData.value.snum = []
{ time: 6.07, value: 20 }, if (name == '周') {
{ time: 6.08, value: 15 }, for (let i = 0; i < 7; i++) {
]) let time = moment()
.subtract('days', 6 - i)
.format('MM-DD')
callTheTrendData.value.time.push(time)
callTheTrendData.value.snum.push('0')
console.log('time', callTheTrendData.value, name)
}
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)
callTheTrendData.value.snum.push('0')
console.log('time', callTheTrendData.value, name)
}
callTheTrend(callTheTrendData.value)
}
}
//echarts //echarts
const callTheTrend = () => { const callTheTrend = (dataFrom) => {
echarts.init(document.getElementById('callTheTrend')).dispose() echarts.init(document.getElementById('callTheTrend')).dispose()
let chartDom = document.getElementById('callTheTrend') let chartDom = document.getElementById('callTheTrend')
let myChart = echarts.init(chartDom) let myChart = echarts.init(chartDom)
@ -134,7 +184,7 @@
size: 18, size: 18,
}, },
}, },
data: ['1-13', '1-14', '1-15', '1-16', '1-17', '1-18', '1-19'], data: dataFrom.time,
}, },
], ],
yAxis: [ yAxis: [
@ -215,17 +265,28 @@
shadowBlur: '3px', shadowBlur: '3px',
}, },
}, },
data: [96.3, 96.4, 97.5, 95.6, 98.1, 94.8, 89.6], data: dataFrom.snum,
}, },
], ],
} }
option && myChart.setOption(option) option && myChart.setOption(option)
} }
//
const ranking = (name) => {
dataclick.value = name
let params = {
type: name,
}
debugger
componentServiceRank(params).then((res) => {
dataList.value = res.data.data
console.log('res', dataList.value)
})
}
// //
const NumberOfComponentServices = () => { const NumberOfComponentServices = () => {
assemblerBaseStatic().then((res) => { assemblerBaseStatic().then((res) => {
snum.value[0].num = res.data.data[0].amount snum.value[0].num = res.data.data[0].amount
console.log('res', res.data)
res.data.data.map((item, index) => { res.data.data.map((item, index) => {
if (index != 0) { if (index != 0) {
servicesSnum.value.push(item) servicesSnum.value.push(item)
@ -234,7 +295,9 @@
}) })
} }
const init = () => { const init = () => {
timeSwitch(timeSwitchindex.value)
NumberOfComponentServices() NumberOfComponentServices()
ranking(dataclick.value)
} }
onMounted(() => { onMounted(() => {
init() init()
@ -243,11 +306,11 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.component-services { .component-services {
height: 4.65rem; height: 4.63rem;
width: 7.84rem; width: 7.84rem;
position: relative; position: relative;
background: rgba(0, 108, 188, 0.1); background: rgba(0, 108, 188, 0.1);
border: 0.02rem rgba(0, 108, 188, 0.7) solid; border: 0.01rem rgba(0, 108, 188, 0.7) solid;
border-radius: 0.03rem; border-radius: 0.03rem;
.component-services-top { .component-services-top {
width: 7.84rem; width: 7.84rem;
@ -393,6 +456,11 @@
margin-right: 0.05rem; margin-right: 0.05rem;
border-radius: 0.12rem; border-radius: 0.12rem;
background: #05315b; background: #05315b;
cursor: pointer;
}
.timeDown {
background: #005ea3;
border: #00ffff 0.01rem solid;
} }
} }
} }
@ -410,7 +478,7 @@
padding-top: 0.13rem; padding-top: 0.13rem;
.component-services-content-right-right-bottom-left { .component-services-content-right-right-bottom-left {
width: 1.28rem; width: 1.28rem;
border-right: 0.02rem rgba(0, 108, 188, 0.7) solid; border-right: 0.01rem rgba(0, 108, 188, 0.7) solid;
margin-right: 0.2rem; margin-right: 0.2rem;
.components-can-assign, .components-can-assign,
.components-scores { .components-scores {
@ -421,12 +489,32 @@
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
line-height: 0.88rem; line-height: 0.88rem;
text-align: center; text-align: center;
cursor: pointer;
background: linear-gradient( background: linear-gradient(
to right, to right,
rgba(0, 117, 203, 0.2), rgba(0, 117, 203, 0.2),
rgba(0, 117, 203, 0) 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 { .components-can-assign {
margin-top: 0; margin-top: 0;
} }
@ -434,15 +522,15 @@
.component-services-content-right-right-bottom-right { .component-services-content-right-right-bottom-right {
width: 2.5rem; width: 2.5rem;
font-size: 0.16rem; font-size: 0.16rem;
border: 0.02rem rgba(0, 108, 188, 0.7) solid; border: 0.01rem rgba(0, 108, 188, 0.7) solid;
color: rgba(255, 255, 255, 0.8); color: rgba(255, 255, 255, 0.8);
& > div { & > div {
& > span { & > span {
display: inline-block; display: inline-block;
height: 0.32rem; height: 0.32rem;
line-height: 0.32rem; line-height: 0.32rem;
border-right: 0.02rem rgba(0, 108, 188, 0.7) solid; border-right: 0.01rem rgba(0, 108, 188, 0.7) solid;
border-bottom: 0.02rem rgba(0, 108, 188, 0.7) solid; border-bottom: 0.01rem rgba(0, 108, 188, 0.7) solid;
} }
& > span:first-child { & > span:first-child {
width: 0.47rem; width: 0.47rem;
@ -450,6 +538,8 @@
} }
& > span:nth-child(2) { & > span:nth-child(2) {
width: 1.47rem; width: 1.47rem;
height: 0.32rem;
padding-left: 0.05rem;
} }
& > span:last-child { & > span:last-child {
width: 0.5rem; width: 0.5rem;

View File

@ -31,7 +31,7 @@
:show-info="false" :show-info="false"
/> />
</div> </div>
<div class="percentage" :class="fontFormat(item.title)"> <div class="percentage" :style="fontFormat(item.title)">
{{ item.percentage }}% {{ item.percentage }}%
</div> </div>
</div> </div>
@ -63,10 +63,13 @@
function fontFormat(name) { function fontFormat(name) {
switch (name) { switch (name) {
case '视频资源数量': case '视频资源数量':
return 'color: #32ff91;'
break break
case '云资源': case '云资源':
return 'color: #f4fd25;'
break break
case '感知资源': case '感知资源':
return 'color: #ff1d18;'
break break
} }
} }
@ -74,10 +77,10 @@
<style lang="less" scoped> <style lang="less" scoped>
.infrastructure { .infrastructure {
width: 4.4rem; width: 4.4rem;
height: 4.65rem; height: 4.63rem;
position: relative; position: relative;
background: rgba(0, 108, 188, 0.1); background: rgba(0, 108, 188, 0.1);
border: 0.02rem rgba(0, 108, 188, 0.7) solid; border: 0.01rem rgba(0, 108, 188, 0.7) solid;
border-radius: 0.03rem; border-radius: 0.03rem;
padding: 0.2rem; padding: 0.2rem;
padding-top: 0; padding-top: 0;