on-site-robots-screen/src/views/home/components/right-two/index.vue

253 lines
5.8 KiB
Vue

<template>
<!-- 右二 ---- 智能对比 -->
<div class="right-two child-container">
<div class="title-container">
<TitleBackground :title="`智能对比`" />
<div class="more-btn" @click="onHandleMore">更多</div>
</div>
<!-- 内容区域 -->
<div class="content-container">
<div class="content-item" v-for="item in 4" :key="item" :class="`item-${item}`">
<div>
<span style="padding-left: 10px; font-size: 16px"> 巡检次数 </span>
<span style="padding-left: 10px; font-size: 14px"> 总数: </span>
<span> 100 </span>
</div>
<div>
<span style="padding-left: 10px; font-size: 18px; font-weight: bold"> 26 </span>
<span style="font-size: 14px"> 次 </span>
</div>
</div>
</div>
</div>
<!-- 弹框内容 -->
<n-modal v-model:show="morePanelVisible">
<n-card
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
class="more-panel-card"
>
<n-flex justify="space-between">
<n-gradient-text
style="font-size: 20px; font-weight: 600; letter-spacing: 2px"
gradient="linear-gradient(90deg, #CDF7FD 0%, #DAFAFE 20%, #CDF7FD 40%, #DAFAFE 60%, #CDF7FD 80%, #DAFAFE 100%)"
>
人员动态
</n-gradient-text>
<img
class="close-icon"
src="@/assets/home-imgs/close.png"
@click="morePanelVisible = false"
/>
</n-flex>
<div class="tabs-btns">
<div
class="tabs-btn"
:key="item.name"
v-for="(item, index) in tapsBtns"
:class="{ active: activeIndex === index }"
@click="onHandleTabs(item.component, index)"
>
{{ item.name }}
</div>
</div>
<div class="taps-content">
<component :is="componentMap[currentComponent]" />
</div>
</n-card>
</n-modal>
</template>
<script setup>
import { NTag } from 'naive-ui'
import { ref, onMounted, onUpdated, nextTick, h } from 'vue'
import TapsOne from './taps-one.vue'
import TapsTwo from './taps-two.vue'
import TapsThree from './taps-three.vue'
const morePanelVisible = ref(false)
const contentContainer = ref(null)
const shouldScroll = ref(false)
const page = ref(1)
const pageSize = ref(10)
const activeIndex = ref(0)
const currentComponent = ref('comp-a')
const componentMap = {
'comp-a': TapsOne,
'comp-b': TapsTwo,
'comp-c': TapsThree,
}
const tapsBtns = ref([
{
name: '巡检次数',
component: 'comp-a',
},
{
name: '巡检照片',
component: 'comp-b',
},
{
name: '比对结果',
component: 'comp-c',
},
])
const columns = ref([
{
title: '日期时间',
key: 'age',
align: 'center',
},
{
title: '图片',
key: 'tags',
align: 'center',
render(row) {
const tags = row.tags.map((tagKey) => {
return h(
NTag,
{
style: {
marginRight: '6px',
},
type: 'info',
bordered: false,
},
{
default: () => tagKey,
},
)
})
return tags
},
},
{
title: '姓名',
key: 'age',
align: 'center',
},
{
title: '年龄',
key: 'age',
align: 'center',
},
{
title: '工种',
key: 'age',
align: 'center',
},
])
const data = ref([
{
age: '2025-06-01 10:00:00',
tags: ['nice'],
},
])
const onHandleMore = () => {
console.log('更多')
morePanelVisible.value = true
}
const onHandleTabs = (component, index) => {
activeIndex.value = index
currentComponent.value = component
}
</script>
<style lang="scss" scoped>
.right-two {
.title-container {
position: relative;
.more-btn {
position: absolute;
right: 0;
top: 0;
}
}
}
.content-container {
flex: 1;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(4, 1fr);
gap: 10px;
padding: 20px 2px;
.content-item {
display: flex;
flex-direction: column;
justify-content: space-around;
border: 1px solid #00deff;
color: #b9e8fe;
}
.item-1 {
grid-column: 1 / 3;
grid-row: 1 / 3;
}
.item-2 {
grid-column: 3 / 5;
grid-row: 1 / 3;
}
.item-3 {
grid-column: 1 / 3;
grid-row: 3 / 5;
}
.item-4 {
grid-column: 3 / 5;
grid-row: 3 / 5;
}
}
.more-panel-card {
width: 80%;
height: 80vh;
display: flex;
flex-direction: column;
background: url('@/assets/home-imgs/modal-bg.png') no-repeat center center;
background-size: 100% 100%;
}
.close-icon {
width: 20px;
height: 20px;
cursor: pointer;
}
.tabs-btns {
display: flex;
margin: 20px 0;
.tabs-btn {
width: 100px;
height: 42px;
background-color: #1b4589;
color: #fff;
text-align: center;
line-height: 42px;
cursor: pointer;
}
.active {
background-color: #1090f0;
border-radius: 8px;
}
}
.taps-content {
width: 100%;
height: 80%;
}
</style>