chuangte_bike_newxcx/page_shanghu/gongzuotai/shgl.vue
2026-02-12 15:07:28 +08:00

320 lines
6.9 KiB
Vue

<template>
<view class="page">
<u-navbar title="审核管理" :border-bottom="false" :background="bgc" title-color='#000' title-size='36' back-icon-color="#000"
height='44'></u-navbar>
<scroll-view class="list-container" @scrolltolower="handleScrollToLower" scroll-y>
<view class="card" v-for="(item,index) in list " :key="index">
<view class="card-header">
<view class="header-left">
<image src="https://api.ccttiot.com/smartmeter/img/static/uvEJsaNT3zNm414Zqwk3" mode="aspectFit" style="width: 44rpx; height: 44rpx; margin-right: 16rpx;"></image>
<view class="vehicle-info">
<text class="code">编号: {{item.vehicleCode}}</text>
</view>
</view>
<view class="status-tag" :class="{ ignored: item.appealStatus==='0', pending: item.appealStatus==='1', completed: item.appealStatus==='3' }">
{{ getFaultStatusLabel(item.appealStatus) }}
</view>
</view>
<view class="divider"></view>
<view class="card-body">
<view class="info-row">
<text class="label">故障描述</text>
<text class="value">{{item.faultDetail || '无描述'}}</text>
</view>
<view class="info-row">
<text class="label">车牌号</text>
<text class="value">{{item.vehicleNum || '--'}}</text>
</view>
<view class="info-row">
<text class="label">提交时间</text>
<text class="value">{{item.createTime}}</text>
</view>
<view class="pic-list" v-if="item.picture">
<view class="img-wrapper" v-for="(pic, idx) in parsePictures(item.picture)" :key="idx"
@click="preview(pic, item)">
<image :src="pic" mode="aspectFill"></image>
</view>
</view>
</view>
<view class="card-footer" v-if="showAuditBtns(item.appealStatus)">
<view class="divider" style="margin-bottom: 24rpx;"></view>
<view class="action-btns">
<view class="btn secondary" @click="handleAudit(item, false)">忽略</view>
<view class="btn primary" @click="handleAudit(item, true)">已完成</view>
</view>
</view>
</view>
<view class="loading-text">
{{ list.length == 0 ? '暂无审核记录' : (total > list.length ? '加载中...' : '当前没有更多申报审核咯...') }}
</view>
<view style="height: 50rpx;"></view>
</scroll-view>
</view>
</template>
<script>
import { getFaultStatusLabel, canAuditFault } from '@/common/enums/fault.js'
export default {
data() {
return {
bgc: {
backgroundColor: '#F7F7F7'
},
sn: '',
pageNum: 1,
pageSize: 20,
list: [],
total: 0,
areaId: ''
}
},
onLoad(option) {
this.areaId = option.areaId
},
onShow() {
this.pageNum = 1
this.getlist()
},
methods: {
getFaultStatusLabel,
showAuditBtns(appealStatus) {
return canAuditFault(appealStatus)
},
handleScrollToLower() {
if (this.total > this.list.length) {
this.getlist()
}
},
handleAudit(item, pass) {
uni.showLoading({ title: '加载中...' })
this.$u.put('/bst/fault/handle', {
id: item.id,
pass: pass
}).then((res) => {
uni.hideLoading()
if (res.code === 200) {
uni.showToast({ title: '操作成功', icon: 'success', duration: 2000 })
this.pageNum = 1
this.list = []
this.getlist()
} else {
uni.showToast({ title: res.msg || '操作失败', icon: 'none', duration: 2000 })
}
}).catch(() => {
uni.hideLoading()
})
},
parsePictures(pictureString) {
if (pictureString) {
return pictureString.split(',')
}
return [];
},
preview(pic, item) {
uni.previewImage({
current: pic, // 当前显示图片的链接
urls: this.parsePictures(item.picture) // 需要预览的图片链接列表
})
},
getlist() {
let data = {
sn: this.sn,
pageSize: this.pageSize,
pageNum: this.pageNum
};
this.$u.get(`/bst/fault/list?pageNum=${this.pageNum}&pageSize=10&areaId=${this.areaId}`).then((res) => {
if (res.code === 200) {
this.total = res.total
if(this.pageNum == 1){
this.list = res.rows
}else{
this.list = this.list.concat(res.rows)
}
this.pageNum ++
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
}).catch(error => {
console.error("Error fetching area data:", error);
})
}
}
}
</script>
<style lang="scss" scoped>
.page {
min-height: 100vh;
background: #F7F7F7;
}
.list-container {
height: 89vh;
padding: 24rpx;
box-sizing: border-box;
overflow: scroll;
}
.card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20rpx;
.header-left {
display: flex;
align-items: center;
.vehicle-info {
.code {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
}
}
.status-tag {
padding: 6rpx 20rpx;
border-radius: 30rpx;
font-size: 24rpx;
font-weight: 500;
&.pending {
background: #FFF0F0;
color: #FF4D4F;
}
&.ignored,
&.rejected {
background: #F5F5F5;
color: #999;
}
&.repairing {
background: #EBF4FF;
color: #4C97E7;
}
&.completed {
background: #F0F9EB;
color: #67C23A;
}
}
}
.divider {
height: 1rpx;
background: #f5f5f5;
margin-bottom: 24rpx;
}
.card-body {
.info-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 16rpx;
.label {
font-size: 26rpx;
color: #999;
min-width: 140rpx;
}
.value {
font-size: 28rpx;
color: #333;
flex: 1;
text-align: right;
line-height: 1.4;
}
}
.pic-list {
display: flex;
flex-wrap: wrap;
margin-top: 24rpx;
gap: 16rpx;
.img-wrapper {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
}
}
.card-footer {
.action-btns {
display: flex;
justify-content: flex-end;
gap: 20rpx;
.btn {
min-width: 140rpx;
height: 60rpx;
border-radius: 30rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
&.secondary {
border: 1rpx solid #ccc;
color: #666;
background: #fff;
}
&.primary {
background: #4C97E7;
color: #fff;
box-shadow: 0 4rpx 10rpx rgba(76, 151, 231, 0.3);
}
&.success {
background: #67C23A;
color: #fff;
box-shadow: 0 4rpx 10rpx rgba(103, 194, 58, 0.3);
}
&:active {
opacity: 0.9;
}
}
}
}
}
.loading-text {
text-align: center;
color: #999;
font-size: 24rpx;
padding: 30rpx 0;
}
</style>