321 lines
7.2 KiB
Vue
321 lines
7.2 KiB
Vue
<template>
|
||
<view class="page">
|
||
<u-navbar title="调度记录" :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>
|
||
</view>
|
||
<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>
|
||
</view>
|
||
</view>
|
||
<view class="search-icon-btn" @click="getlist">
|
||
<u-icon name="search" color="#fff" size="36"></u-icon>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="list-container">
|
||
<!-- 占位元素,把内容顶下来 -->
|
||
<!-- <view style="height: 140rpx;"></view> -->
|
||
|
||
<view class="card" v-for="(item,index) in dhlist" :key="index" @click="btnitem(item)">
|
||
<view class="card-content">
|
||
<view class="user-row">
|
||
<view class="user-info">
|
||
<text class="name">{{item.userName || '未命名'}}</text>
|
||
<text class="phone">{{item.userPhone || '--'}}</text>
|
||
</view>
|
||
<u-icon name="arrow-right" color="#ccc" size="28"></u-icon>
|
||
</view>
|
||
|
||
<view class="divider-line"></view>
|
||
|
||
<view class="data-grid">
|
||
<view class="data-item">
|
||
<text class="label">有效次数</text>
|
||
<text class="value success">{{item.validCount || 0}}</text>
|
||
</view>
|
||
<view class="v-line"></view>
|
||
<view class="data-item">
|
||
<text class="label">无效次数</text>
|
||
<text class="value error">{{item.invalidCount || 0}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="loading-text">
|
||
{{ dhlist.length == 0 ? '暂无调度记录' : '当前没有更多调度记录咯...' }}
|
||
</view>
|
||
</view>
|
||
|
||
<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
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
this.startDate = this.getCurrentDate().formatted
|
||
this.endDate = this.getCurrentDate().formatted
|
||
this.areaId = option.areaId
|
||
this.getlist()
|
||
},
|
||
methods: {
|
||
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(`/dashboard/dispatchLog/userFinishRank?areaId=${this.areaId}&endDateRange=${this.startDate + ',' + this.endDate}`).then(res =>{
|
||
if(res.code == 200){
|
||
this.dhlist = res.data
|
||
}
|
||
})
|
||
},
|
||
// 点击跳转到调度列表
|
||
btnitem(item){
|
||
uni.navigateTo({
|
||
url:'/page_shanghu/gongzuotai/diaodulist?tit=' + item.userName + '&userId=' + item.userId + '&areaId=' + this.areaId
|
||
})
|
||
},
|
||
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 {
|
||
background: #F7F7F7;
|
||
}
|
||
|
||
.page {
|
||
min-height: 100vh;
|
||
}
|
||
|
||
.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;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
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;
|
||
}
|
||
}
|
||
|
||
.search-icon-btn {
|
||
width: 80rpx;
|
||
height: 80rpx;
|
||
background: #4C97E7;
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 4rpx 10rpx rgba(76, 151, 231, 0.3);
|
||
|
||
&:active {
|
||
opacity: 0.9;
|
||
}
|
||
}
|
||
}
|
||
|
||
.list-container {
|
||
padding: 0 24rpx;
|
||
box-sizing: border-box;
|
||
padding-top: 24rpx;
|
||
height: 81vh;
|
||
overflow: scroll;
|
||
}
|
||
|
||
.card {
|
||
background: #FFFFFF;
|
||
border-radius: 20rpx;
|
||
padding: 30rpx;
|
||
margin-bottom: 24rpx;
|
||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
|
||
|
||
.user-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 24rpx;
|
||
|
||
.user-info {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.name {
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
color: #333;
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.phone {
|
||
font-size: 26rpx;
|
||
color: #999;
|
||
}
|
||
}
|
||
}
|
||
|
||
.divider-line {
|
||
height: 1rpx;
|
||
background: #F0F0F0;
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.data-grid {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.v-line {
|
||
width: 1rpx;
|
||
height: 40rpx;
|
||
background: #E0E0E0;
|
||
margin: 0 30rpx;
|
||
}
|
||
|
||
.data-item {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
|
||
.label {
|
||
font-size: 24rpx;
|
||
color: #999;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.value {
|
||
font-size: 36rpx;
|
||
font-weight: bold;
|
||
|
||
&.success {
|
||
color: #4C97E7;
|
||
}
|
||
|
||
&.error {
|
||
color: #FF4D4F;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.loading-text {
|
||
text-align: center;
|
||
color: #999;
|
||
font-size: 24rpx;
|
||
padding: 30rpx 0;
|
||
}
|
||
</style> |