数据库: - 新增 odf_checkin/odf_cables/odf_cable_faults/odf_cable_fault_images/odf_user_modules 5张表 - 新增菜单权限和角色分配 SQL 脚本 后台 API (.NET/SqlSugar): - 新增实体模型、DTO、Service、Controller (签到/光缆/故障/图片/用户模块) 前端 APP (UniApp): - 新增 portal/checkin/trunk/cable/fault-list/fault-detail/fault-add/trunk-search/route-plan 9个页面 - 新增 permission/checkin/trunk 服务层 - 新增 navigation/watermark 工具函数 后台管理前端 (ZR.Vue): - 新增光缆管理/干线故障管理/签到记录管理/用户模块权限 4个管理页面 - 新增对应 API 模块和表单组件
246 lines
5.0 KiB
Vue
246 lines
5.0 KiB
Vue
<template>
|
|
<view class="fault-list-page">
|
|
<image class="bg-image" src="/static/images/home_bg.png" mode="aspectFill" />
|
|
|
|
<view class="content">
|
|
<!-- 顶部导航栏 -->
|
|
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
|
<view class="nav-bar-inner">
|
|
<image
|
|
class="nav-icon"
|
|
src="/static/images/ic_back.png"
|
|
mode="aspectFit"
|
|
@click="goBack"
|
|
/>
|
|
<text class="nav-title">干线</text>
|
|
<view class="nav-icon-placeholder" />
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 小标题 -->
|
|
<text class="section-title">故障列表</text>
|
|
|
|
<!-- 故障列表 -->
|
|
<view class="fault-list">
|
|
<view
|
|
class="fault-card"
|
|
v-for="item in faultList"
|
|
:key="item.id"
|
|
@click="goFaultDetail(item)"
|
|
>
|
|
<view class="fault-row">
|
|
<text class="fault-label">故障时间:</text>
|
|
<text class="fault-value">{{ item.faultTime }}</text>
|
|
</view>
|
|
<view class="fault-row">
|
|
<text class="fault-label">故障原因:</text>
|
|
<text class="fault-value">{{ item.faultReason }}</text>
|
|
</view>
|
|
<view class="fault-row">
|
|
<text class="fault-label">表显故障里程:</text>
|
|
<text class="fault-value">{{ item.mileage }}</text>
|
|
</view>
|
|
<view class="fault-row last-row">
|
|
<text class="fault-label">所属光缆:</text>
|
|
<text class="fault-value">{{ item.cableName }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 底部固定按钮 -->
|
|
<view class="bottom-bar">
|
|
<view class="add-fault-btn" @click="goFaultAdd">
|
|
<text class="add-fault-btn-text">新增故障</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue'
|
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
|
|
import { getFaultList } from '@/services/trunk'
|
|
|
|
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0
|
|
const faultList = ref([])
|
|
const cableId = ref('')
|
|
const cableName = ref('')
|
|
const pageNum = ref(1)
|
|
const pageSize = ref(20)
|
|
const totalPage = ref(1)
|
|
const loading = ref(false)
|
|
|
|
async function loadFaultList(isLoadMore = false) {
|
|
if (loading.value) return
|
|
loading.value = true
|
|
|
|
try {
|
|
const res = await getFaultList(cableId.value, pageNum.value, pageSize.value)
|
|
if (res.code === 200) {
|
|
const data = res.data || {}
|
|
const list = data.result || []
|
|
if (isLoadMore) {
|
|
faultList.value = [...faultList.value, ...list]
|
|
} else {
|
|
faultList.value = list
|
|
}
|
|
totalPage.value = data.totalPage || 1
|
|
}
|
|
} catch (err) {
|
|
uni.showToast({ title: '加载失败', icon: 'none' })
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
function goBack() {
|
|
uni.navigateBack()
|
|
}
|
|
|
|
function goFaultDetail(item) {
|
|
uni.navigateTo({ url: '/pages/fault-detail/index?faultId=' + item.id })
|
|
}
|
|
|
|
function goFaultAdd() {
|
|
uni.navigateTo({
|
|
url: '/pages/fault-add/index?cableId=' + cableId.value + '&cableName=' + encodeURIComponent(cableName.value)
|
|
})
|
|
}
|
|
|
|
onLoad((options) => {
|
|
if (options.cableId) {
|
|
cableId.value = options.cableId
|
|
}
|
|
if (options.cableName) {
|
|
cableName.value = decodeURIComponent(options.cableName)
|
|
}
|
|
loadFaultList()
|
|
})
|
|
|
|
onReachBottom(() => {
|
|
if (pageNum.value < totalPage.value) {
|
|
pageNum.value++
|
|
loadFaultList(true)
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.fault-list-page {
|
|
position: relative;
|
|
min-height: 100vh;
|
|
background-color: #F5F5F5;
|
|
padding-bottom: 120rpx;
|
|
}
|
|
|
|
.bg-image {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 500rpx;
|
|
z-index: 0;
|
|
}
|
|
|
|
.content {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.nav-bar {
|
|
width: 100%;
|
|
}
|
|
|
|
.nav-bar-inner {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 88rpx;
|
|
padding: 0 24rpx;
|
|
}
|
|
|
|
.nav-icon {
|
|
width: 44rpx;
|
|
height: 44rpx;
|
|
}
|
|
|
|
.nav-icon-placeholder {
|
|
width: 44rpx;
|
|
height: 44rpx;
|
|
}
|
|
|
|
.nav-title {
|
|
font-size: 34rpx;
|
|
font-weight: 600;
|
|
color: #fff;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 30rpx;
|
|
font-weight: 600;
|
|
color: #333;
|
|
padding: 16rpx 24rpx 8rpx;
|
|
display: block;
|
|
}
|
|
|
|
.fault-list {
|
|
padding: 0 0 24rpx;
|
|
}
|
|
|
|
.fault-card {
|
|
background-color: #fff;
|
|
border-radius: 12rpx;
|
|
border: 1rpx solid #E8E8E8;
|
|
padding: 24rpx;
|
|
margin: 0 24rpx 20rpx;
|
|
}
|
|
|
|
.fault-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
margin-bottom: 12rpx;
|
|
}
|
|
|
|
.fault-row.last-row {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.fault-label {
|
|
font-size: 26rpx;
|
|
color: #999;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.fault-value {
|
|
font-size: 26rpx;
|
|
color: #333;
|
|
flex: 1;
|
|
}
|
|
|
|
.bottom-bar {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
padding: 24rpx;
|
|
background: #fff;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.add-fault-btn {
|
|
width: 100%;
|
|
height: 88rpx;
|
|
background: #1A73EC;
|
|
border-radius: 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.add-fault-btn-text {
|
|
color: #fff;
|
|
font-size: 32rpx;
|
|
}
|
|
</style>
|