应用资源关联组件

This commit is contained in:
851673013@qq.com 2022-07-06 12:48:00 +08:00
parent d93cfa543c
commit 8a686cfca6
2 changed files with 197 additions and 167 deletions

View File

@ -168,6 +168,7 @@
} }
}) })
} else { } else {
callTheTrendData.value.snum = ['0', '0', '0', '0', '0', '0', '0']
callTheTrend(callTheTrendData.value) callTheTrend(callTheTrendData.value)
} }
} else { } else {
@ -202,6 +203,39 @@
} }
}) })
} else { } else {
callTheTrendData.value.snum = [
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
]
callTheTrend(callTheTrendData.value) callTheTrend(callTheTrendData.value)
} }
} }
@ -253,6 +287,7 @@
], ],
yAxis: [ yAxis: [
{ {
minInterval: 1,
name: '个', name: '个',
type: 'value', type: 'value',
axisTick: { axisTick: {

View File

@ -8,7 +8,12 @@
<template> <template>
<div class="application-navigation" v-if="navList.length > 0"> <div class="application-navigation" v-if="navList.length > 0">
<template v-for="nav in navList" :key="nav.key"> <template v-for="nav in navList" :key="nav.key">
<div class="nav" :class="{ select: nav.key == select }" v-if="nav.show" @click="selectNav(nav.key)"> <div
class="nav"
:class="{ select: nav.key == select }"
v-if="nav.show"
@click="selectNav(nav.key)"
>
{{ nav.name }} {{ nav.name }}
<span class="line"></span> <span class="line"></span>
</div> </div>
@ -16,187 +21,177 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, defineProps, watch } from 'vue' import { ref, defineProps, watch } from 'vue'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
// import { queryPartAppByKeyId } from '@/api/home'
const router = useRouter() //
const keyId = router.currentRoute.value.query.id const router = useRouter()
const navList = ref([ const keyId = router.currentRoute.value.query.id
{ const navList = ref([
name: '应用展示', {
key: 'application-presentation', name: '应用展示',
}, key: 'application-presentation',
{ },
name: '关联组件', {
key: 'application-associated-ability', name: '功能介绍',
}, key: 'function-introduction',
{ },
name: '功能介绍', {
key: 'function-introduction', name: '使用能力',
}, key: 'ability-to-use',
// { },
// name: '', {
// key: 'application-associated-components', name: '部署与安全',
// }, key: 'deployment-and-security',
{ },
name: '使用能力', {
key: 'ability-to-use', name: '归属部门与服务商',
}, key: 'department-and-service-provider',
{ },
name: '部署与安全', {
key: 'deployment-and-security', name: '常见问题',
}, key: 'common-problem',
{ },
name: '归属部门与服务商', ])
key: 'department-and-service-provider', const props = defineProps({
}, selectNow: { type: String, default: '' },
{ dataList: { type: Object, default: null },
name: '常见问题', associatedComponents: { type: Array, default: null },
key: 'common-problem',
},
])
const props = defineProps({
selectNow: { type: String, default: '' },
dataList: { type: Object, default: null },
associatedComponents: { type: Array, default: null },
})
const select = ref('algorithm-display')
const list = ref([])
// id
if (keyId) {
queryPartAppByKeyId2({ keyId: keyId }).then((res) => {
console.log('ressssssss', res)
if (res.data.data.length > 0) {
//
navList.value.unshift({
name: '关联组件',
key: 'layer-service-associated-ability',
show: true,
})
list.value.unshift('关联组件')
}
}) })
} const select = ref('application-associated-ability')
const selectNav = (key) => { const list = ref([])
select.value = key // id
mybus.emit('flyToView', select.value) if (keyId) {
} let params = {
if (props.dataList.infoList) { keyId: keyId,
list.value = [] type: '组件服务',
props.dataList.infoList.map((item) => {
if (
item.attrType === '算法优势' ||
item.attrType === '常见问题' ||
item.attrType === '使用能力' ||
item.attrType === '关联组件'
) {
list.value.push(item.attrType)
} else if (item.attrType === '应用展示视频') {
list.value.push('应用展示')
} }
}) queryPartAppByKeyId(params).then((res) => {
list.value.push('关联组件') console.log('ressssssss', res)
navList.value.forEach((item) => { if (res.data.data.length != 0) {
console.log(item) //
if (list.value.indexOf(item.name) > -1) { navList.value.unshift({
name: '关联组件',
key: 'application-associated-ability',
show: true,
})
list.value.unshift('关联组件')
}
})
}
const selectNav = (key) => {
select.value = key
mybus.emit('flyToView', select.value)
}
if (props.dataList.infoList) {
list.value = []
props.dataList.infoList.map((item) => {
if ( if (
item.name == '关联组件' && item.attrType === '算法优势' ||
props.associatedComponents[0].length != 0 item.attrType === '常见问题' ||
item.attrType === '使用能力' ||
item.attrType === '关联组件'
) { ) {
item.show = true list.value.push(item.attrType)
} else { } else if (item.attrType === '应用展示视频') {
list.value.push('应用展示')
}
})
list.value.unshift('关联组件')
navList.value.forEach((item) => {
console.log(item)
if (list.value.indexOf(item.name) > -1) {
item.show = true item.show = true
} }
} })
}) if (list.value.length > 0) {
select.value = navList.value.filter( if (navList.value.filter((item) => item.name === list.value[0])[0]) {
(item) => item.name === list.value[0]
)[0].key
console.log('11111111111111111111111111', list.value, navList.value)
}
watch(
() => props.selectNow,
(newValue) => {
select.value = newValue
}
)
watch(
() => props.dataList,
(val) => {
if (val) {
list.value = []
val.infoList.map((item) => {
if (
item.attrType === '功能介绍' ||
item.attrType === '常见问题' ||
item.attrType === '使用能力' ||
item.attrType === '关联组件'
) {
list.value.push(item.attrType)
} else if (item.attrType === '应用展示视频') {
list.value.push('应用展示')
}
})
list.value.push('关联组件')
list.value.push('部署与安全')
list.value.push('归属部门与服务商')
navList.value.forEach((item) => {
console.log(item)
if (list.value.indexOf(item.name) > -1) {
if (
item.name == '关联组件' &&
props.associatedComponents[0].length != 0
) {
item.show = true
} else {
item.show = true
}
}
})
if (list.value.length > 0) {
select.value = navList.value.filter( select.value = navList.value.filter(
(item) => item.name === list.value[0] (item) => (item.name === '关联组件') | (item.name === list.value[0])
)[0].key )[0].key
} }
console.log('11111111111111111111111111', list.value, navList.value)
} }
console.log('11111111111111111111111111', list.value, navList.value)
} }
) watch(
() => props.selectNow,
(newValue) => {
select.value = newValue
}
)
watch(
() => props.dataList,
(val) => {
if (val) {
list.value = []
val.infoList.map((item) => {
if (
item.attrType === '功能介绍' ||
item.attrType === '常见问题' ||
item.attrType === '使用能力' ||
item.attrType === '关联组件'
) {
list.value.push(item.attrType)
} else if (item.attrType === '应用展示视频') {
list.value.push('应用展示')
}
})
list.value.unshift('关联组件')
list.value.push('部署与安全')
list.value.push('归属部门与服务商')
navList.value.forEach((item) => {
console.log(item)
if (list.value.indexOf(item.name) > -1) {
item.show = true
}
})
if (list.value.length > 0) {
if (navList.value.filter((item) => item.name === list.value[0])[0]) {
select.value = navList.value.filter(
(item) =>
(item.name === '关联组件') | (item.name === list.value[0])
)[0].key
}
}
console.log('11111111111111111111111111', list.value, navList.value)
}
}
)
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.application-navigation { .application-navigation {
width: 19.12rem; width: 19.12rem;
height: 0.84rem; height: 0.84rem;
line-height: 0.8rem; line-height: 0.8rem;
display: flex;
justify-content: space-around;
font-size: 0.24rem;
color: #666;
background: #fff;
padding: 0 3rem;
box-shadow: 0rem 0.05rem 0.1rem #f2f3fb;
position: relative;
.nav {
cursor: pointer;
display: flex; display: flex;
flex-direction: column; justify-content: space-around;
justify-content: space-between; font-size: 0.24rem;
align-items: center; color: #666;
background: #fff;
padding: 0 3rem;
box-shadow: 0rem 0.05rem 0.1rem #f2f3fb;
position: relative;
.line { .nav {
width: 0.4rem; cursor: pointer;
height: 0.04rem; display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
.line {
width: 0.4rem;
height: 0.04rem;
}
}
.select {
color: #526aff;
.line {
background: #526aff;
}
} }
} }
.select {
color: #526aff;
.line {
background: #526aff;
}
}
}
</style> </style>