更新工作汇报相关代码

This commit is contained in:
许允枞 2025-02-12 15:13:23 +08:00
parent 82e007cf91
commit 765682f288
2 changed files with 204 additions and 28 deletions

View File

@ -1,7 +1,6 @@
<template>
<view class="container">
<!-- 顶部导航栏 -->
<view class="top-heder">
<view class="t-left" @click="getback()">
<uni-icons type="left" size="18"></uni-icons>
@ -9,17 +8,21 @@
<view class="t-title">
<text>汇报列表</text>
</view>
<view class="t-you"></view>
<view class="t-you" @click="showFilterPopup">
<text>筛选</text>
</view>
</view>
<!-- 搜索栏 -->
<view class="searchContent">
<view class="t-input">
<uni-icons type="search" color="#BCBCBC" size="22"></uni-icons>
<input type="text" v-model="queryParams.topicOrUserName" placeholder="请输入设备名称.....">
<input type="text" v-model="queryParams.topicOrUserName" placeholder="请输入汇报主题或汇报人">
</view>
<view class="sou" @click="getReportList()">搜索</view>
<view class="sou" @click="search()">搜索</view>
</view>
<!-- 汇报列表 -->
<view class="report-list">
<view class="report-item" v-for="(item, index) in reportList" :key="index" @click="goToEditWriteReport(item.id)">
@ -34,6 +37,51 @@
</view>
</view>
<!-- 筛选弹窗 -->
<u-popup :show="showPopup" @close="closeFilterPopup" mode="right" closeable="true">
<view class="filter-popup">
<view class="popup-header">
<text>时间筛选</text>
</view>
<view class="time-picker">
<view class="picker-item" @click="showStarTime = true">
<text class="label">开始时间</text>
<text :class="['time-text', !queryParams.reportTime[0] && 'placeholder']">
{{ reportTimeStr[0] || '选择时间' }}
</text>
<uni-icons type="calendar" size="16" color="#666"></uni-icons>
</view>
<view class="picker-item" @click="showEndTime = true">
<text class="label">结束时间</text>
<text :class="['time-text', !queryParams.reportTime[1] && 'placeholder']">
{{ reportTimeStr[1] || '选择时间' }}
</text>
<uni-icons type="calendar" size="16" color="#666"></uni-icons>
</view>
</view>
<view class="popup-footer">
<u-button type="primary" @click="applyFilter">应用筛选</u-button>
<u-button type="default" @click="clearTime">清除时间</u-button>
</view>
</view>
</u-popup>
<u-datetime-picker
:show="showStarTime"
v-model="queryParams.reportTime[0]"
mode="date"
@cancel="showStarTime = false"
@confirm="selectStartTime"
></u-datetime-picker>
<u-datetime-picker
:show="showEndTime"
v-model="queryParams.reportTime[1]"
mode="date"
@cancel="showEndTime = false"
@confirm="selectEndTime"
></u-datetime-picker>
<!-- 底部按钮 -->
<view class="bottom-btn">
<u-button type="primary" shape="circle" class="report-btn" @click="goToWriteReport">填写汇报</u-button>
@ -50,6 +98,7 @@ export default {
data() {
return {
reportList: [],
showPopup: false, //
//
queryParams: {
pageNo: 1,
@ -59,10 +108,14 @@ export default {
createTime: [],
userName: null,
servicePackageId: "jiance",
topicOrUserName:''
dictType: 'ins_high_rise',
topicOrUserName: '',
},
showStarTime: false,
showEndTime: false,
baseImageUrl: config.baseImageUrl,
totalPages:0,
totalPages: 0,
reportTimeStr: [],
};
},
onLoad() {
@ -73,18 +126,57 @@ export default {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
});
} else {
this.queryParams.pageNo++
this.getReportList()
this.queryParams.pageNo++;
this.getReportList();
}
},
methods: {
//
showFilterPopup() {
this.showPopup = true;
},
//
closeFilterPopup() {
this.showPopup = false;
},
//
applyFilter() {
if (!this.queryParams.reportTime[0] || !this.queryParams.reportTime[1]) {
uni.showToast({
title: '请选择时间',
icon: 'none'
});
return;
}
if (this.queryParams.reportTime[0] > this.queryParams.reportTime[1]) {
uni.showToast({
title: '开始时间不能大于结束时间',
icon: 'none'
});
return;
}
this.closeFilterPopup();
this.search();
},
//
clearTime() {
this.showPopup = false;
this.queryParams.reportTime = ['', ''];
this.reportTimeStr = [];
this.search();
},
formatDateTimeToMinute,
formatDate,
//
search() {
this.reportList = [];
this.queryParams.pageNo = 1;
this.getReportList();
},
//
getReportList() {
//
request({
url: "/work/report/page",
method: "GET",
@ -92,27 +184,39 @@ export default {
}).then((res) => {
if (this.queryParams.pageNo != 1) {
this.reportList = this.reportList.concat(res.data.records);
}else {
} else {
this.reportList = res.data.records;
}
console.log(this.reportList)
let total = res.total
let total = res.total;
this.totalPages = Math.ceil(total / this.queryParams.pageSize);
});
},
//
getback() {
uni.navigateBack({
delta: 1, //
});
uni.navigateBack({delta: 1});
},
//
goToWriteReport() {
uni.navigateTo({
url: "/pages/manage/workReport/workReportAdd?type=add",
});
uni.navigateTo({url: "/pages/manage/workReport/workReportAdd?type=add"});
},
//
goToEditWriteReport(id) {
uni.navigateTo({
url: "/pages/manage/workReport/workReportAdd?type=edit&id=" + id,
uni.navigateTo({url: "/pages/manage/workReport/workReportAdd?type=edit&id=" + id});
},
selectStartTime() {
//
this.$nextTick(() => {
this.queryParams.reportTime[0] = formatDate(this.queryParams.reportTime[0]);
this.reportTimeStr[0] = this.queryParams.reportTime[0]
this.showStarTime = false;
});
},
selectEndTime() {
this.$nextTick(() => {
this.queryParams.reportTime[1] = formatDate(this.queryParams.reportTime[1]);
this.reportTimeStr[1] = this.queryParams.reportTime[1]
this.showEndTime = false;
});
},
},
@ -126,6 +230,25 @@ export default {
padding-bottom: 120rpx;
}
/* 筛选弹窗样式 */
.filter-popup {
padding: 20rpx;
}
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #eee;
}
.popup-footer {
display: flex;
justify-content: space-between;
margin-top: 20rpx;
}
/* 列表样式 */
.report-list {
padding: 20rpx;
@ -146,8 +269,7 @@ export default {
.avatar {
width: 90rpx;
height: 90rpx;
//border-radius: 50%; margin-right: 20rpx;
border: 2rpx solid #ddd;
//border-radius: 50%; margin-right: 20rpx; border: 2rpx solid #ddd;
}
/* 内容区 */
@ -253,5 +375,61 @@ export default {
.searchContent {
display: flex;
justify-content: center;
margin-top: 20rpx;
}
.time-picker {
display: flex;
flex-direction: column; /* 添加:使子元素垂直排列 */
align-items: center;
padding: 20rpx;
background: #fff;
margin: 20rpx 0;
}
.picker-item {
flex: 1;
display: block; /* 修改:改为块级元素 */
padding: 20rpx;
background: #f8f8f8;
border-radius: 12rpx;
margin: 10rpx 0; /* 添加:增加上下间距 */
}
.split-line {
padding: 0 10rpx;
color: #999;
}
.label {
font-size: 26rpx;
color: #666;
margin-right: 15rpx;
}
.time-text {
flex: 1;
font-size: 28rpx;
color: #333;
}
.placeholder {
color: #999;
}
uni-icons {
margin-left: 10rpx;
}
/* 添加清除按钮样式 */
.clear-btn {
color: #007AFF;
font-size: 26rpx;
margin-left: 20rpx;
padding: 10rpx 20rpx;
border: 1rpx solid #007AFF;
border-radius: 8rpx;
}
</style>

View File

@ -77,7 +77,7 @@ export default {
report: {
reportTopic: '',
reportContent: '',
reportTime: undefined,
reportTime: new Date(),
reportTos: [],
servicePackageId: "jiance",
},
@ -95,9 +95,7 @@ export default {
async onLoad(data) {
await this.getReportTo(); // getReportTo
this.type = data.type
if (data.type === 'add') {
this.report.reportTime = new Date().getTime();
} else if (data.type === 'edit') {
if (data.type === 'edit') {
this.title = "编辑汇报"
await this.getWorkReport(data.id)
}