chuangte_bike_newxcx/page_shanghu/gongzuotai/diaodulist.vue

362 lines
8.2 KiB
Vue
Raw Normal View History

2025-11-08 09:37:13 +08:00
<template>
<view class="page">
2025-12-20 14:29:10 +08:00
<u-navbar :title="tit" :border-bottom="false" :background="bgc" back-icon-color="#000" title-color='#000'
title-size='36' height='44'></u-navbar>
<!-- 顶部固定筛选区域 -->
<view class="fixed-header">
<view class="search-box">
<view class="date-picker-group">
<view class="date-btn" @click="btnonetime">
<text>{{startDate}}</text>
<u-icon name="calendar" color="#999" size="28" style="margin-left: 10rpx;"></u-icon>
2025-11-08 09:37:13 +08:00
</view>
2025-12-20 14:29:10 +08:00
<text class="separator"></text>
<view class="date-btn" @click="btnonetimes">
<text>{{endDate}}</text>
<u-icon name="calendar" color="#999" size="28" style="margin-left: 10rpx;"></u-icon>
2025-11-08 09:37:13 +08:00
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="search-icon-btn" @click="getlist">
<u-icon name="search" color="#fff" size="36"></u-icon>
2025-11-08 09:37:13 +08:00
</view>
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="list-container">
<!-- 占位元素把内容顶下来 -->
<!-- <view style="height: 140rpx;"></view> -->
<scroll-view class="list_box" @scrolltolower="handqixing" scroll-y refresher-enabled @refresherrefresh="onRefresh" :refresher-triggered="isRefreshing">
<view class="card" v-for="(item,index) in dhlist" :key="index">
<view class="card-header">
<view class="header-left">
<u-icon name="clock" color="#999" size="28" style="margin-right: 10rpx;"></u-icon>
<text class="time">{{item.startTime}}</text>
2025-11-08 09:37:13 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view class="status-tag" :class="item.status == 2 ? 'success' : 'processing'">
{{item.status == 1 ? '调度中' : '已完成'}}
2025-11-08 09:37:13 +08:00
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="divider"></view>
<view class="info-grid">
<view class="grid-item">
<text class="label">车牌号</text>
<text class="value highlight">{{item.deviceVehicleNum}}</text>
2025-11-08 09:37:13 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view class="grid-item">
<text class="label">是否有效</text>
<text class="value" :class="item.isValid ? 'valid' : 'invalid'">
{{item.isValid ? '有效' : '无效'}}
</text>
2025-11-08 09:37:13 +08:00
</view>
</view>
</view>
2025-12-20 14:29:10 +08:00
<view class="loading-text">
{{ dhlist.length == 0 ? '暂无调度记录' : (total > dhlist.length ? '加载中...' : '当前没有更多调度记录咯...') }}
2025-11-08 09:37:13 +08:00
</view>
2025-12-20 14:29:10 +08:00
<view style="height: 50rpx;"></view>
2025-11-08 09:37:13 +08:00
</scroll-view>
2025-12-20 14:29:10 +08:00
</view>
2025-11-08 09:37:13 +08:00
<u-picker mode="time" v-model="show" :params="params" @confirm="confirmone"></u-picker>
<u-picker mode="time" v-model="shows" :params="paramss" @confirm="confirmones"></u-picker>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
areaId: '',
startDate: '', // 初始开始日期
endDate: '' ,// 初始结束日期
dhlist:[],
userId:'',
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
show: false,
paramss: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
shows: false,
tit:'',
pageNum:1,
total:0,
isRefreshing:false,
}
},
onLoad(option) {
2025-12-20 14:29:10 +08:00
this.tit = option.tit || '调度列表'
2025-11-08 09:37:13 +08:00
this.startDate = this.getCurrentDate().formatted
this.endDate = this.getCurrentDate().formatted
this.areaId = option.areaId
this.userId = option.userId
this.getlist()
},
methods: {
// 上拉加载更多
handqixing() {
if(this.dhlist.length < this.total){
2025-12-20 14:29:10 +08:00
this.pageNum++
2025-11-08 09:37:13 +08:00
this.getlist()
}
console.log(11)
},
// 下拉刷新列表
onRefresh() {
this.isRefreshing = true
this.pageNum = 1
this.getlist()
setTimeout(() => {
this.isRefreshing = false
}, 1000)
},
btnonetime(){
this.show = true
},
confirmone(e){
console.log(e);
this.startDate = e.year + '-' + e.month + '-' + e.day
},
btnonetimes(){
this.shows = true
},
confirmones(e){
console.log(e);
this.endDate = e.year + '-' + e.month + '-' + e.day
},
// 请求调度记录
getlist(){
this.$u.get(`/bst/dispatchLog/list?areaId=${this.areaId}&endDateRange=${this.startDate + ',' + this.endDate}&userId=${this.userId}&pageNum=${this.pageNum}&pageSize=20`).then(res =>{
if(res.code == 200){
this.total = res.total
if(this.pageNum == 1){
this.dhlist = res.rows
}else{
this.dhlist = this.dhlist.concat(res.rows)
}
}
})
},
// 点击跳转到调度列表
btnitem(){
2025-12-20 14:29:10 +08:00
// uni.navigateTo({
// url:'/page_shanghu/gongzuotai/diaodulist'
// })
2025-11-08 09:37:13 +08:00
},
getCurrentDate() {
const date = new Date(); // 获取当前时间对象
// 获取年份4位数字
const year = date.getFullYear();
// 获取月份(注意:月份从 0 开始,需 +1 转换为实际月份)
const month = date.getMonth() + 1;
// 获取日期(当月的第几天)
const day = date.getDate();
// 格式化:补零(可选,例如将 3 月转为 "03"
const formattedMonth = month.toString().padStart(2, '0');
const formattedDay = day.toString().padStart(2, '0');
// 组合结果
const currentDate = {
year, // 年2025
month, // 月11未补零
day, // 日6未补零
formatted: `${year}-${formattedMonth}-${formattedDay}` // 格式化字符串2025-11-06
};
console.log('当天年月日:', currentDate);
return currentDate;
}
}
}
</script>
<style lang="scss">
page {
2025-12-20 14:29:10 +08:00
background: #F7F7F7;
}
.page {
min-height: 100vh;
2025-11-08 09:37:13 +08:00
}
2025-12-20 14:29:10 +08:00
.fixed-header {
// position: fixed;
// top: 0;
// margin-top: calc(44px + var(--status-bar-height));
// left: 0;
width: 100%;
z-index: 10;
background-color: #fff;
box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
}
.search-box {
padding: 20rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.date-picker-group {
flex: 1;
2025-11-08 09:37:13 +08:00
display: flex;
2025-12-20 14:29:10 +08:00
align-items: center;
2025-11-08 09:37:13 +08:00
justify-content: space-between;
2025-12-20 14:29:10 +08:00
background: #F5F7FA;
padding: 10rpx;
border-radius: 40rpx;
margin-right: 20rpx;
.date-btn {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
height: 60rpx;
font-size: 26rpx;
color: #333;
background: #fff;
border-radius: 30rpx;
margin: 0 10rpx;
box-shadow: 0 2rpx 4rpx rgba(0,0,0,0.03);
}
.separator {
color: #999;
font-size: 24rpx;
padding: 0 6rpx;
2025-11-08 09:37:13 +08:00
}
}
2025-12-20 14:29:10 +08:00
.search-icon-btn {
width: 80rpx;
height: 80rpx;
background: #4C97E7;
border-radius: 50%;
2025-11-08 09:37:13 +08:00
display: flex;
2025-12-20 14:29:10 +08:00
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 10rpx rgba(76, 151, 231, 0.3);
&:active {
opacity: 0.9;
2025-11-08 09:37:13 +08:00
}
}
}
2025-12-20 14:29:10 +08:00
.list-container {
padding: 0 24rpx;
2025-11-08 09:37:13 +08:00
box-sizing: border-box;
2025-12-20 14:29:10 +08:00
padding-top: 24rpx;
height: 81vh;
2025-11-08 09:37:13 +08:00
}
2025-12-20 14:29:10 +08:00
.list_box {
height: 100%;
2025-11-08 09:37:13 +08:00
}
2025-12-20 14:29:10 +08:00
.card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
.card-header {
2025-11-08 09:37:13 +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;
font-size: 28rpx;
color: #666;
2025-11-08 09:37:13 +08:00
}
2025-12-20 14:29:10 +08:00
.status-tag {
padding: 4rpx 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.processing {
background: #EBF4FF;
color: #4C97E7;
}
&.success {
background: #F0F9EB;
color: #67C23A;
}
}
}
.divider {
height: 1rpx;
background: #f5f5f5;
margin-bottom: 24rpx;
}
.info-grid {
display: flex;
justify-content: space-between;
.grid-item {
display: flex;
flex-direction: column;
.label {
font-size: 24rpx;
color: #999;
margin-bottom: 8rpx;
}
.value {
font-size: 30rpx;
color: #333;
font-weight: 500;
&.highlight {
font-weight: 600;
}
&.valid {
color: #67C23A;
}
&.invalid {
color: #FF4D4F;
}
}
&:last-child {
align-items: flex-end;
}
}
}
2025-11-08 09:37:13 +08:00
}
2025-12-20 14:29:10 +08:00
.loading-text {
text-align: center;
2025-11-08 09:37:13 +08:00
color: #999;
2025-12-20 14:29:10 +08:00
font-size: 24rpx;
padding: 30rpx 0;
2025-11-08 09:37:13 +08:00
}
</style>