277 lines
6.5 KiB
Vue
277 lines
6.5 KiB
Vue
<template>
|
|
<view class="container">
|
|
<!-- 操作说明 -->
|
|
<view class="operation-tip">
|
|
<u-icon name="info-circle" color="#007bff" size="16"></u-icon>
|
|
<text class="tip-text">点击对应的行可以查看详情</text>
|
|
</view>
|
|
|
|
<!-- 数据列表 -->
|
|
<view class="table-wrapper">
|
|
<scroll-view scroll-x class="table-scroll">
|
|
<view class="table-container">
|
|
<view class="table-header">
|
|
<view class="header-cell">汇报标题</view>
|
|
<view class="header-cell">最近汇报时间</view>
|
|
<view class="header-cell">汇报日期</view>
|
|
<view class="header-cell">汇报人</view>
|
|
<view class="header-cell">涉及项目</view>
|
|
<view class="header-cell">备注</view>
|
|
</view>
|
|
<view class="table-body">
|
|
<view
|
|
v-for="(item, index) in reportSummaryList"
|
|
:key="item.summaryId"
|
|
class="table-row"
|
|
@click="handleRowClick(item)"
|
|
>
|
|
<view class="table-cell">{{ item.reportTitle || '-' }}</view>
|
|
<view class="table-cell">{{ formatDate(item.lastUpdateTime) }}</view>
|
|
<view class="table-cell">{{ formatDate(item.reportDate) }}</view>
|
|
<view class="table-cell">{{ item.reporter || '-' }}</view>
|
|
<view class="table-cell">{{ item.projectName || '-' }}</view>
|
|
<view class="table-cell">{{ item.remark || '-' }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
|
|
<!-- 分页 -->
|
|
<u-loadmore
|
|
v-if="total > 0"
|
|
:status="loadMoreStatus"
|
|
@loadmore="loadMore"
|
|
></u-loadmore>
|
|
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { listProject } from '@/api/oa/project'
|
|
import { listReportSummary } from '@/api/oa/reportSummary'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
projectList: [],
|
|
loading: true,
|
|
total: 0,
|
|
reportSummaryList: [],
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
reportTitle: undefined,
|
|
reportDate: undefined,
|
|
reporter: undefined,
|
|
projectId: undefined,
|
|
type: 1
|
|
},
|
|
loadMoreStatus: 'loadmore'
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getList();
|
|
this.getProjectList();
|
|
},
|
|
methods: {
|
|
getList() {
|
|
this.loading = true;
|
|
listReportSummary(this.queryParams).then(response => {
|
|
this.reportSummaryList = response.rows || [];
|
|
this.total = response.total || 0;
|
|
this.loading = false;
|
|
this.selectedIds = [];
|
|
this.selectAll = false;
|
|
}).catch(() => {
|
|
this.loading = false;
|
|
});
|
|
},
|
|
getProjectList() {
|
|
listProject({ pageNum: 1, pageSize: 9999 }).then(res => {
|
|
const rawData = res.rows || [];
|
|
// 按照 uni-data-select 的标准格式处理数据
|
|
this.projectList = rawData.map(item => ({
|
|
value: item.projectId,
|
|
text: item.projectName,
|
|
// 保留原始数据用于提交
|
|
projectId: item.projectId,
|
|
projectName: item.projectName,
|
|
projectNum: item.projectNum,
|
|
projectCode: item.projectCode
|
|
}));
|
|
}).catch(err => {
|
|
console.error('获取项目列表失败:', err);
|
|
uni.showToast({
|
|
title: '获取项目列表失败',
|
|
icon: 'none'
|
|
});
|
|
});
|
|
},
|
|
|
|
formatDate(date) {
|
|
if (!date) return '-';
|
|
const d = new Date(date);
|
|
return `${d.getFullYear()}-${(d.getMonth()+1).toString().padStart(2,'0')}-${d.getDate().toString().padStart(2,'0')}`;
|
|
},
|
|
loadMore() {
|
|
if (this.loadMoreStatus === 'nomore') return;
|
|
this.loadMoreStatus = 'loading';
|
|
this.queryParams.pageNum += 1;
|
|
listReportSummary(this.queryParams).then(response => {
|
|
const newData = response.rows || [];
|
|
this.reportSummaryList = [...this.reportSummaryList, ...newData];
|
|
this.total = response.total || 0;
|
|
if (newData.length < this.queryParams.pageSize) {
|
|
this.loadMoreStatus = 'nomore';
|
|
} else {
|
|
this.loadMoreStatus = 'loadmore';
|
|
}
|
|
}).catch(() => {
|
|
this.loadMoreStatus = 'loadmore';
|
|
this.queryParams.pageNum -= 1;
|
|
});
|
|
},
|
|
|
|
// 点击行跳转到详情页
|
|
handleRowClick(item) {
|
|
uni.navigateTo({
|
|
url: `/pages/workbench/construction/detail?summaryId=${item.summaryId}&reportTitle=${encodeURIComponent(item.reportTitle || '')}&reporter=${encodeURIComponent(item.reporter || '')}&projectName=${encodeURIComponent(item.projectName || '')}`
|
|
});
|
|
},
|
|
|
|
// 项目选择变化处理
|
|
handleProjectChange(value) {
|
|
this.form.projectId = value;
|
|
// 根据选择的项目ID获取项目名称
|
|
const selectedProject = this.projectList.find(item => item.projectId === value);
|
|
if (selectedProject) {
|
|
this.selectedProjectName = selectedProject.projectName;
|
|
}
|
|
},
|
|
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.container {
|
|
padding: 20rpx;
|
|
background-color: #f5f5f5;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.operation-tip {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10rpx;
|
|
padding: 20rpx;
|
|
background-color: #e3f2fd;
|
|
border-radius: 8rpx;
|
|
margin-bottom: 20rpx;
|
|
border-left: 4rpx solid #007bff;
|
|
|
|
.tip-text {
|
|
font-size: 28rpx;
|
|
color: #007bff;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
|
|
.table-wrapper {
|
|
background-color: #fff;
|
|
border-radius: 10rpx;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.table-scroll {
|
|
width: 100%;
|
|
}
|
|
|
|
.table-container {
|
|
min-width: 1200rpx; // 设置最小宽度,确保表格内容不会被压缩
|
|
.table-header {
|
|
display: flex;
|
|
background-color: #f8f9fa;
|
|
border-bottom: 1rpx solid #e9ecef;
|
|
.header-cell {
|
|
width: 200rpx; // 固定列宽
|
|
padding: 20rpx 10rpx;
|
|
text-align: center;
|
|
font-weight: bold;
|
|
font-size: 28rpx;
|
|
flex-shrink: 0; // 防止列被压缩
|
|
&.checkbox {
|
|
width: 100rpx; // 复选框列宽度
|
|
}
|
|
}
|
|
}
|
|
.table-body {
|
|
.table-row {
|
|
display: flex;
|
|
border-bottom: 1rpx solid #e9ecef;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
|
|
&:hover {
|
|
background-color: #f8f9fa;
|
|
}
|
|
|
|
&:active {
|
|
background-color: #e9ecef;
|
|
}
|
|
.table-cell {
|
|
width: 200rpx; // 固定列宽
|
|
padding: 20rpx 10rpx;
|
|
text-align: center;
|
|
font-size: 26rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0; // 防止列被压缩
|
|
word-break: break-all; // 长文本换行
|
|
&.checkbox {
|
|
width: 100rpx; // 复选框列宽度
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.form-popup-content {
|
|
background-color: #fff;
|
|
border-radius: 20rpx 20rpx 0 0;
|
|
overflow: hidden;
|
|
width: 100%;
|
|
max-height: 80vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.popup-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 30rpx;
|
|
border-bottom: 1rpx solid #e9ecef;
|
|
.popup-title {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
.form-content {
|
|
padding: 30rpx;
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
.popup-footer {
|
|
display: flex;
|
|
gap: 20rpx;
|
|
padding: 30rpx;
|
|
border-top: 1rpx solid #e9ecef;
|
|
}
|
|
}
|
|
</style>
|