chuangte_bike_newxcx/page_shanghu/gongzuotai/shgl.vue

320 lines
6.9 KiB
Vue
Raw Permalink Normal View History

2025-04-01 21:35:30 +08:00
<template>
<view class="page">
2025-12-20 14:29:10 +08:00
<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>
2025-04-01 21:35:30 +08:00
<view class="card" v-for="(item,index) in list " :key="index">
2025-12-20 14:29:10 +08:00
<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>
2026-02-12 15:07:28 +08:00
<view class="status-tag" :class="{ ignored: item.appealStatus==='0', pending: item.appealStatus==='1', completed: item.appealStatus==='3' }">
{{ getFaultStatusLabel(item.appealStatus) }}
2025-04-01 21:35:30 +08:00
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="divider"></view>
<view class="card-body">
<view class="info-row">
<text class="label">故障描述</text>
<text class="value">{{item.faultDetail || '无描述'}}</text>
2025-04-01 21:35:30 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view class="info-row">
<text class="label">车牌号</text>
<text class="value">{{item.vehicleNum || '--'}}</text>
2025-04-01 21:35:30 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view class="info-row">
<text class="label">提交时间</text>
<text class="value">{{item.createTime}}</text>
2025-04-01 21:35:30 +08:00
</view>
2025-12-20 14:29:10 +08:00
<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>
2025-04-01 21:35:30 +08:00
</view>
2025-12-20 14:29:10 +08:00
</view>
2026-02-12 15:07:28 +08:00
<view class="card-footer" v-if="showAuditBtns(item.appealStatus)">
2025-12-20 14:29:10 +08:00
<view class="divider" style="margin-bottom: 24rpx;"></view>
<view class="action-btns">
2026-02-12 15:07:28 +08:00
<view class="btn secondary" @click="handleAudit(item, false)">忽略</view>
<view class="btn primary" @click="handleAudit(item, true)">已完成</view>
2025-04-01 21:35:30 +08:00
</view>
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="loading-text">
{{ list.length == 0 ? '暂无审核记录' : (total > list.length ? '加载中...' : '当前没有更多申报审核咯...') }}
2025-04-10 08:57:21 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view style="height: 50rpx;"></view>
2025-04-01 21:35:30 +08:00
</scroll-view>
</view>
</template>
<script>
2026-02-12 15:07:28 +08:00
import { getFaultStatusLabel, canAuditFault } from '@/common/enums/fault.js'
2025-04-01 21:35:30 +08:00
export default {
data() {
return {
bgc: {
2025-12-20 14:29:10 +08:00
backgroundColor: '#F7F7F7'
2025-04-01 21:35:30 +08:00
},
sn: '',
2026-02-12 15:07:28 +08:00
pageNum: 1,
pageSize: 20,
list: [],
total: 0,
areaId: ''
}
2025-04-01 21:35:30 +08:00
},
2025-04-28 15:40:26 +08:00
onLoad(option) {
this.areaId = option.areaId
},
2025-04-01 21:35:30 +08:00
onShow() {
2025-04-11 18:23:16 +08:00
this.pageNum = 1
2026-02-12 15:07:28 +08:00
this.getlist()
2025-04-01 21:35:30 +08:00
},
methods: {
2026-02-12 15:07:28 +08:00
getFaultStatusLabel,
showAuditBtns(appealStatus) {
return canAuditFault(appealStatus)
2025-12-20 14:29:10 +08:00
},
2025-04-01 21:35:30 +08:00
handleScrollToLower() {
2026-02-12 15:07:28 +08:00
if (this.total > this.list.length) {
this.getlist()
2025-04-21 18:00:19 +08:00
}
},
2026-02-12 15:07:28 +08:00
handleAudit(item, pass) {
uni.showLoading({ title: '加载中...' })
this.$u.put('/bst/fault/handle', {
id: item.id,
pass: pass
}).then((res) => {
2025-12-20 14:29:10 +08:00
uni.hideLoading()
2025-04-01 21:35:30 +08:00
if (res.code === 200) {
2026-02-12 15:07:28 +08:00
uni.showToast({ title: '操作成功', icon: 'success', duration: 2000 })
this.pageNum = 1
this.list = []
this.getlist()
2025-04-01 21:35:30 +08:00
} else {
2026-02-12 15:07:28 +08:00
uni.showToast({ title: res.msg || '操作失败', icon: 'none', duration: 2000 })
2025-04-01 21:35:30 +08:00
}
2026-02-12 15:07:28 +08:00
}).catch(() => {
uni.hideLoading()
2025-04-01 21:35:30 +08:00
})
},
parsePictures(pictureString) {
if (pictureString) {
2025-04-21 18:00:19 +08:00
return pictureString.split(',')
2025-04-01 21:35:30 +08:00
}
return [];
},
preview(pic, item) {
uni.previewImage({
current: pic, // 当前显示图片的链接
urls: this.parsePictures(item.picture) // 需要预览的图片链接列表
2025-04-21 18:00:19 +08:00
})
2025-04-01 21:35:30 +08:00
},
getlist() {
let data = {
sn: this.sn,
pageSize: this.pageSize,
pageNum: this.pageNum
};
2025-04-28 15:40:26 +08:00
this.$u.get(`/bst/fault/list?pageNum=${this.pageNum}&pageSize=10&areaId=${this.areaId}`).then((res) => {
2025-04-01 21:35:30 +08:00
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
2025-04-21 18:00:19 +08:00
})
2025-04-01 21:35:30 +08:00
}
}).catch(error => {
console.error("Error fetching area data:", error);
2025-04-21 18:00:19 +08:00
})
2025-04-01 21:35:30 +08:00
}
}
2025-04-21 18:00:19 +08:00
}
2025-04-01 21:35:30 +08:00
</script>
<style lang="scss" scoped>
.page {
2025-12-20 14:29:10 +08:00
min-height: 100vh;
background: #F7F7F7;
2025-04-01 21:35:30 +08:00
}
2025-12-20 14:29:10 +08:00
.list-container {
height: 89vh;
padding: 24rpx;
box-sizing: border-box;
overflow: scroll;
2025-04-01 21:35:30 +08:00
}
2025-12-20 14:29:10 +08:00
2025-04-01 21:35:30 +08:00
.card {
background: #FFFFFF;
2025-12-20 14:29:10 +08:00
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
.card-header {
2025-04-01 21:35:30 +08:00
display: flex;
2025-12-20 14:29:10 +08:00
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;
}
}
2025-04-01 21:35:30 +08:00
}
2025-12-20 14:29:10 +08:00
.status-tag {
padding: 6rpx 20rpx;
border-radius: 30rpx;
font-size: 24rpx;
font-weight: 500;
&.pending {
background: #FFF0F0;
color: #FF4D4F;
}
2026-02-12 15:07:28 +08:00
&.ignored,
2025-12-20 14:29:10 +08:00
&.rejected {
background: #F5F5F5;
color: #999;
}
2026-02-12 15:07:28 +08:00
2025-12-20 14:29:10 +08:00
&.repairing {
background: #EBF4FF;
color: #4C97E7;
}
2026-02-12 15:07:28 +08:00
2025-12-20 14:29:10 +08:00
&.completed {
background: #F0F9EB;
color: #67C23A;
}
2025-04-01 21:35:30 +08:00
}
}
2025-12-20 14:29:10 +08:00
.divider {
height: 1rpx;
background: #f5f5f5;
margin-bottom: 24rpx;
2025-04-01 21:35:30 +08:00
}
2025-12-20 14:29:10 +08:00
.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;
}
2025-04-01 21:35:30 +08:00
}
2025-12-20 14:29:10 +08:00
.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%;
}
}
2025-04-01 21:35:30 +08:00
}
}
2025-12-20 14:29:10 +08:00
.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;
}
}
2025-04-01 21:35:30 +08:00
}
}
}
2025-12-20 14:29:10 +08:00
.loading-text {
text-align: center;
color: #999;
font-size: 24rpx;
padding: 30rpx 0;
2025-04-01 21:35:30 +08:00
}
</style>