更新工作汇报相关代码
This commit is contained in:
parent
82e007cf91
commit
765682f288
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 顶部导航栏 -->
|
<!-- 顶部导航栏 -->
|
||||||
|
|
||||||
<view class="top-heder">
|
<view class="top-heder">
|
||||||
<view class="t-left" @click="getback()">
|
<view class="t-left" @click="getback()">
|
||||||
<uni-icons type="left" size="18"></uni-icons>
|
<uni-icons type="left" size="18"></uni-icons>
|
||||||
@ -9,17 +8,21 @@
|
|||||||
<view class="t-title">
|
<view class="t-title">
|
||||||
<text>汇报列表</text>
|
<text>汇报列表</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="t-you"></view>
|
<view class="t-you" @click="showFilterPopup">
|
||||||
|
<text>筛选</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 搜索栏 -->
|
||||||
<view class="searchContent">
|
<view class="searchContent">
|
||||||
<view class="t-input">
|
<view class="t-input">
|
||||||
<uni-icons type="search" color="#BCBCBC" size="22"></uni-icons>
|
<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>
|
||||||
<view class="sou" @click="getReportList()">搜索</view>
|
<view class="sou" @click="search()">搜索</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 汇报列表 -->
|
<!-- 汇报列表 -->
|
||||||
<view class="report-list">
|
<view class="report-list">
|
||||||
<view class="report-item" v-for="(item, index) in reportList" :key="index" @click="goToEditWriteReport(item.id)">
|
<view class="report-item" v-for="(item, index) in reportList" :key="index" @click="goToEditWriteReport(item.id)">
|
||||||
@ -34,6 +37,51 @@
|
|||||||
</view>
|
</view>
|
||||||
</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">
|
<view class="bottom-btn">
|
||||||
<u-button type="primary" shape="circle" class="report-btn" @click="goToWriteReport">填写汇报</u-button>
|
<u-button type="primary" shape="circle" class="report-btn" @click="goToWriteReport">填写汇报</u-button>
|
||||||
@ -50,6 +98,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reportList: [],
|
reportList: [],
|
||||||
|
showPopup: false, // 控制筛选弹窗显示
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@ -59,10 +108,14 @@ export default {
|
|||||||
createTime: [],
|
createTime: [],
|
||||||
userName: null,
|
userName: null,
|
||||||
servicePackageId: "jiance",
|
servicePackageId: "jiance",
|
||||||
topicOrUserName:''
|
dictType: 'ins_high_rise',
|
||||||
|
topicOrUserName: '',
|
||||||
},
|
},
|
||||||
|
showStarTime: false,
|
||||||
|
showEndTime: false,
|
||||||
baseImageUrl: config.baseImageUrl,
|
baseImageUrl: config.baseImageUrl,
|
||||||
totalPages:0,
|
totalPages: 0,
|
||||||
|
reportTimeStr: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@ -73,18 +126,57 @@ export default {
|
|||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '没有下一页数据',
|
title: '没有下一页数据',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.queryParams.pageNo++
|
this.queryParams.pageNo++;
|
||||||
this.getReportList()
|
this.getReportList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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,
|
formatDateTimeToMinute,
|
||||||
formatDate,
|
formatDate,
|
||||||
|
// 搜索
|
||||||
|
search() {
|
||||||
|
this.reportList = [];
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getReportList();
|
||||||
|
},
|
||||||
|
// 获取汇报列表
|
||||||
getReportList() {
|
getReportList() {
|
||||||
// 获取汇报列表
|
|
||||||
request({
|
request({
|
||||||
url: "/work/report/page",
|
url: "/work/report/page",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@ -92,27 +184,39 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (this.queryParams.pageNo != 1) {
|
if (this.queryParams.pageNo != 1) {
|
||||||
this.reportList = this.reportList.concat(res.data.records);
|
this.reportList = this.reportList.concat(res.data.records);
|
||||||
}else {
|
} else {
|
||||||
this.reportList = res.data.records;
|
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);
|
this.totalPages = Math.ceil(total / this.queryParams.pageSize);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 返回上一页
|
||||||
getback() {
|
getback() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({delta: 1});
|
||||||
delta: 1, // 返回上一页
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
// 跳转到填写汇报页面
|
||||||
goToWriteReport() {
|
goToWriteReport() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({url: "/pages/manage/workReport/workReportAdd?type=add"});
|
||||||
url: "/pages/manage/workReport/workReportAdd?type=add",
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
// 跳转到编辑汇报页面
|
||||||
goToEditWriteReport(id) {
|
goToEditWriteReport(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({url: "/pages/manage/workReport/workReportAdd?type=edit&id=" + id});
|
||||||
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;
|
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 {
|
.report-list {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
@ -146,8 +269,7 @@ export default {
|
|||||||
.avatar {
|
.avatar {
|
||||||
width: 90rpx;
|
width: 90rpx;
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
//border-radius: 50%; margin-right: 20rpx;
|
//border-radius: 50%; margin-right: 20rpx; border: 2rpx solid #ddd;
|
||||||
border: 2rpx solid #ddd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容区 */
|
/* 内容区 */
|
||||||
@ -253,5 +375,61 @@ export default {
|
|||||||
.searchContent {
|
.searchContent {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
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>
|
</style>
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
|||||||
report: {
|
report: {
|
||||||
reportTopic: '',
|
reportTopic: '',
|
||||||
reportContent: '',
|
reportContent: '',
|
||||||
reportTime: undefined,
|
reportTime: new Date(),
|
||||||
reportTos: [],
|
reportTos: [],
|
||||||
servicePackageId: "jiance",
|
servicePackageId: "jiance",
|
||||||
},
|
},
|
||||||
@ -95,9 +95,7 @@ export default {
|
|||||||
async onLoad(data) {
|
async onLoad(data) {
|
||||||
await this.getReportTo(); // 等待 getReportTo 执行完成
|
await this.getReportTo(); // 等待 getReportTo 执行完成
|
||||||
this.type = data.type
|
this.type = data.type
|
||||||
if (data.type === 'add') {
|
if (data.type === 'edit') {
|
||||||
this.report.reportTime = new Date().getTime();
|
|
||||||
} else if (data.type === 'edit') {
|
|
||||||
this.title = "编辑汇报"
|
this.title = "编辑汇报"
|
||||||
await this.getWorkReport(data.id)
|
await this.getWorkReport(data.id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user