2025-05-19 11:59:51 +08:00
<!--
* @ Author : XHC
* @ Date : 2025 - 05 - 19 11 : 07 : 37
* @ LastEditors : XHC
2025-05-26 17:16:40 +08:00
* @ LastEditTime : 2025 - 05 - 26 16 : 31 : 15
2025-05-22 09:59:54 +08:00
* @ Description : 首页
2025-05-19 11:59:51 +08:00
-- >
< template >
2025-05-22 09:59:54 +08:00
< view class = "index" >
< view class = "header" >
< image src = "/static/image/index/logo.png" mode = "scaleToFill" / >
< view class = "title" >
< view > 多技术集约多部门协同综合巡检 < / view >
< view > < text > ◎ 集中管控 < / text > < text > ◎ 部门协同 < / text > < text > ◎ 提升效能 < / text > < / view >
< / view >
< / view >
< view class = "nav-content" >
< scroll-view
scroll - x = "true"
class = "content-scroll"
: show - scrollbar = "false"
enable - flex
>
< view
v - for = "(item, index) in departments"
: key = "index"
: class = "navCurIndex == index ? 'active' : ''"
2025-05-26 17:16:40 +08:00
class = "control-item"
2025-05-22 09:59:54 +08:00
@ click = "changeTitle(index)"
>
{ { item . name } }
< / view >
< / scroll-view >
< view v-if = "navCurIndex == 0" >
< uni-card :is-shadow = "false" class = "patrol-card" >
< view class = "time" > 巡检时间 : < text > { { patrolData . time } } < / text > < / view >
< view class = "card-info" >
< view class = "card-box" >
< view class = "total line" > < text > 线路总数 < / text > < text > { { patrolData . linesTotal } } < / text > < / view >
< view class = "lines" v-for ="(item, index) in patrolData.lines" :key ="index" > < text class = "title" > { { item . title } } < / text > < text class = "num" > { { item . total } } < / text > < / view >
< / view >
< view class = "card-box" >
< view class = "total point" > < text > 点位总数 < / text > < text > { { patrolData . pointTotal } } < / text > < / view >
< view class = "completion-rate" >
< Dashboard :data = "70.8" > < / Dashboard >
< / view >
< div class = "points-box" >
< view class = "points" v-for ="(item, index) in patrolData.points" :key ="index" > < text class = "title" > { { item . title } } < / text > < text class = "num" > { { item . total } } < / text > < / view >
< / div >
< / view >
< / view >
< view class = "inlet-box" >
2025-05-23 16:31:00 +08:00
< view class = "history" @click ="goToHistory" >
2025-05-22 09:59:54 +08:00
< view class = "title" >
< view > 历史巡检 < / view >
< view class = "english" > HISTORICAL INSPECTION < / view >
< / view >
< view class = "go" > GO < / view >
< / view >
< view class = "report" >
< view class = "title" >
< view > 巡检报告 < / view >
< view class = "english" > INSPECTION REPORT < / view >
< / view >
< view class = "go" > GO < / view >
< / view >
< / view >
< / uni-card >
< view class = "category-box" >
< view
v - for = "(item, index) in category"
: key = "index"
: class = "categoryCurIndex == index ? 'active' : ''"
class = "category-item grey"
@ click = "changeCategory(index)"
>
{ { item . name } }
< / view >
< / view >
2025-05-26 15:54:22 +08:00
< view class = "category-content" >
< view v-if = "categoryCurIndex == 0" >
< uni-card class = "list-card" v-for = "(item, index) in listData" :key="index" @click="goToStartInspection(item)" >
< view class = "head" >
< text class = "title" > { { item . title } } < / text >
< uni-tag :inverted = "true" :text = "item.state" : type = "item.state == '未巡检' ? 'error' : item.state == '巡检中' ? 'warning' : 'success'" / >
< / view >
< view class = "num grey" > 线路编号 : { { item . num } } < / view >
< view class = "info-box grey" >
< view class = "info" > < uni-icons fontFamily = "iconfont" color = "#808185" > { { '' } } < / uni-icons > { { item . info } } < / view >
< text class = "info" > 任务 { { item . task } } < / text >
< / view >
< / uni-card >
< / view >
< view v-if = "categoryCurIndex == 1" > < / view >
< view v-if = "categoryCurIndex == 2" > < / view >
< view v-if = "categoryCurIndex == 3" > < / view >
2025-05-22 09:59:54 +08:00
< / view >
< / view >
< view v-if = "navCurIndex == 1" > 发电分部 < / view >
< view v-if = "navCurIndex == 2" > 自动分部 < / view >
< view v-if = "navCurIndex == 3" > 保护分部 < / view >
< / view >
< / view >
2025-05-19 11:59:51 +08:00
< / template >
< script setup >
2025-05-23 14:57:57 +08:00
import { reactive , ref } from "vue" ;
2025-05-22 09:59:54 +08:00
import { onReachBottom } from "@dcloudio/uni-app" ;
import Dashboard from "@/components/echarts/dashboard.vue" ;
// 导航栏
let navCurIndex = ref ( 0 )
const departments = reactive ( [
{ id : 1 , name : "运行部" } ,
{ id : 2 , name : "发电分部" } ,
{ id : 3 , name : "自动分部" } ,
{ id : 4 , name : "保护分部" } ,
{ id : 5 , name : "测试分部" } ,
] ) ;
const patrolData = reactive ( {
time : '2025 2-15 12:00:00' ,
linesTotal : 14 ,
lines : [
{ title : '已巡路线' , total : 11 } ,
{ title : '未巡路线' , total : 3 } ,
{ title : '异常问题' , total : 3 } ,
] ,
pointTotal : 397 ,
points : [
{ title : '已巡点位' , total : 285 } ,
{ title : '未巡点位' , total : 112 } ,
] ,
completionRate : 71.8
} )
// 巡检类别
let categoryCurIndex = ref ( 0 )
const category = reactive ( [
{ id : 1 , name : "全部" } ,
{ id : 2 , name : "未巡检" } ,
{ id : 3 , name : "巡检中" } ,
{ id : 4 , name : "已巡检" } ,
] )
// 列表数据
let listData = reactive ( [
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '已巡检' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '已巡检' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '未巡检' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '未巡检' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '左岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
] )
onReachBottom ( ( ) => {
loadMore ( )
} )
const loadMore = async ( ) => {
let data = [
{ title : '右岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '右岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
{ title : '右岸白班机组' , state : '巡检中' , num : 'BHT-YX-XJ-L1.2' , info : '白班每班一次,由当班值执行' , task : '5/32' } ,
]
listData = [ ... listData , ... data ]
}
// 切换导航
const changeTitle = ( index ) => {
navCurIndex . value = index
} ;
const changeCategory = ( index ) => {
categoryCurIndex . value = index
2025-05-23 16:31:00 +08:00
}
2025-05-22 09:59:54 +08:00
2025-05-23 16:31:00 +08:00
// 历史巡检跳转
const goToHistory = ( ) => {
uni . navigateTo ( {
url : '/pages/history/history'
} ) ;
2025-05-22 09:59:54 +08:00
}
2025-05-26 15:54:22 +08:00
// 列表跳转
const goToStartInspection = ( item ) => {
console . log ( item ) ;
uni . navigateTo ( {
url : ` /pages/startInspection/startInspection?data= ${ JSON . stringify ( item ) } `
} ) ;
}
2025-05-19 11:59:51 +08:00
< / script >
2025-05-22 09:59:54 +08:00
< style lang = "scss" scoped >
. index {
padding - top : 100 rpx ;
. header {
display : flex ;
align - items : center ;
image {
width : 200 rpx ;
height : 200 rpx ;
}
. title {
color : # fff ;
view : nth - child ( 1 ) {
font - weight : 700 ;
font - size : 36 rpx ;
background - image : linear - gradient ( to bottom , # fff , # ffffffef , # ffffff00 ) ; /* 渐变方向和颜色 */
- webkit - background - clip : text ;
color : transparent ; /* 文字颜色设置为透明,使背景色显示 */
}
view : nth - child ( 2 ) {
display : flex ;
justify - content : space - between ;
margin : 15 rpx 60 rpx 0 0 ;
font - size : 24 rpx ;
border - bottom : 2 rpx solid # fff ;
}
}
}
. nav - content {
box - sizing : border - box ;
. content - scroll {
height : 100 rpx ;
line - height : 100 rpx ;
white - space : nowrap ;
2025-05-26 17:16:40 +08:00
. control - item {
2025-05-22 09:59:54 +08:00
height : 35 rpx ;
line - height : 35 rpx ;
display : inline - block ;
padding : 0 20 rpx ;
2025-05-26 17:16:40 +08:00
margin - left : 30 rpx ;
2025-05-22 09:59:54 +08:00
position : relative ;
& . active {
2025-05-26 17:16:40 +08:00
padding : 15 rpx 20 rpx ! important ;
2025-05-22 09:59:54 +08:00
}
}
}
}
. patrol - card {
border - radius : 10 rpx ;
padding : 5 rpx 10 rpx ;
. time {
color : # 808185 ;
}
. card - info {
display : flex ;
justify - content : space - between ;
. card - box {
width : 42 % ;
background : # EDF3FD ;
border - radius : 10 rpx ;
padding : 20 rpx ;
. total {
display : grid ;
grid - template - columns : 180 rpx 50 rpx ;
padding - left : 20 rpx ;
margin - bottom : 20 rpx ;
font - weight : 600 ;
border - left : 6 rpx solid ;
height : 30 rpx ;
line - height : 30 rpx ;
}
. lines {
display : grid ;
grid - template - columns : 205 rpx 50 rpx ;
align - items : center ;
margin - top : 20 rpx ;
. title {
padding : 10 rpx 24 rpx ;
border - radius : 10 rpx ;
background : linear - gradient ( to right , # c7dcfbb5 , # e7f1fd28 ) ;
}
& : nth - child ( 3 ) {
color : # E99A71 ;
}
& : nth - child ( 4 ) {
color : # DE503B ;
}
}
. line {
border - color : # 5291 FF ;
}
. point {
border - color : # 4 AC1B3 ;
}
. title {
color : # 7 E848D ;
}
. num {
font - weight : 600 ;
}
. points - box {
display : flex ;
justify - content : space - between ;
. points {
display : flex ;
flex - direction : column - reverse ;
align - items : center ;
. num {
font - size : 27 rpx ;
}
& : nth - last - child ( 1 ) {
color : # E99A71 ;
}
}
}
}
}
. inlet - box {
display : flex ;
justify - content : space - between ;
margin : 20 rpx - 40 rpx - 20 rpx - 40 rpx ;
color : # fff ;
i { font - size : 40 rpx ; }
. history {
background : url ( '@/static/image/index/history.png' ) no - repeat ;
}
. report {
background : url ( '@/static/image/index/report.png' ) ;
}
. history , . report {
width : 50 % ;
display : grid ;
grid - template - columns : 90 % 50 rpx ;
align - items : center ;
justify - items : center ;
background - size : 100 % 100 % ;
. title {
font - size : 27 rpx ;
font - weight : bold ;
2025-05-22 15:05:43 +08:00
margin : 20 rpx 0 0 60 rpx ;
2025-05-22 09:59:54 +08:00
. english {
font - size : 14 rpx ;
color : # B6DED2 ;
}
}
. go {
font - size : 11 rpx ;
font - weight : bold ;
2025-05-22 15:05:43 +08:00
margin : - 30 rpx 0 0 - 100 rpx ;
2025-05-22 09:59:54 +08:00
border - radius : 15 rpx ;
background : # ffffff6f ;
width : 40 rpx ;
height : 20 rpx ;
line - height : 20 rpx ;
text - align : center ;
}
}
}
}
. category - box {
display : flex ;
justify - content : space - around ;
font - weight : bold ;
font - size : 31 rpx ;
. active {
position : relative ;
color : # 146 FF3 ;
& : : before {
content : '' ;
position : absolute ;
left : 50 % ;
bottom : - 10 rpx ;
transform : translateX ( - 50 % ) ;
width : 30 rpx ;
height : 6 rpx ;
background : # 146 FF3 ;
}
}
}
}
< / style >