迁移oa部分页面:施工进度和每日报工

This commit is contained in:
砂糖
2025-07-05 18:37:20 +08:00
parent 3b556ce46a
commit 043c95667b
59 changed files with 10247 additions and 518 deletions

View File

@@ -1,9 +1,9 @@
<template>
<view class="container">
<!-- 操作按钮 -->
<view class="action-buttons">
<u-button type="primary" @click="handleAdd" size="medium">新增</u-button>
<u-button type="error" @click="handleDelete" size="medium" :disabled="!selectedIds.length">删除</u-button>
<!-- 操作说明 -->
<view class="operation-tip">
<u-icon name="info-circle" color="#007bff" size="16"></u-icon>
<text class="tip-text">点击对应的行可以查看详情</text>
</view>
<!-- 数据列表 -->
@@ -11,9 +11,6 @@
<scroll-view scroll-x class="table-scroll">
<view class="table-container">
<view class="table-header">
<view class="header-cell checkbox">
<u-checkbox v-model="selectAll" @change="handleSelectAll"></u-checkbox>
</view>
<view class="header-cell">汇报标题</view>
<view class="header-cell">最近汇报时间</view>
<view class="header-cell">汇报日期</view>
@@ -21,29 +18,21 @@
<view class="header-cell">涉及项目</view>
<view class="header-cell">备注</view>
</view>
<u-checkbox-group v-model="selectedIds" @change="handleSelectionChange">
<view class="table-body">
<view
v-for="(item, index) in reportSummaryList"
:key="item.summaryId"
class="table-row"
@click="handleRowClick(item)"
>
<view class="table-cell checkbox" @click.stop>
<u-checkbox
:name="item.summaryId"
:value="item.summaryId"
></u-checkbox>
</view>
<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 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>
</u-checkbox-group>
</view>
</view>
</scroll-view>
</view>
@@ -55,68 +44,21 @@
@loadmore="loadMore"
></u-loadmore>
<!-- 新增弹窗 -->
<u-popup v-model="showForm" mode="center" width="600rpx" height="700rpx">
<view class="form-popup">
<view class="popup-header">
<text class="popup-title">{{ title }}</text>
<u-icon name="close" @click="cancel" size="40"></u-icon>
</view>
<scroll-view scroll-y class="form-content">
<u-form :model="form" ref="form" label-width="160rpx">
<u-form-item label="汇报标题" prop="reportTitle">
<u-input v-model="form.reportTitle" placeholder="请输入汇报标题"></u-input>
</u-form-item>
<u-form-item label="汇报日期" prop="reportDate">
<u-datetime-picker
v-model="form.reportDate"
type="datetime"
placeholder="请选择汇报日期"
></u-datetime-picker>
</u-form-item>
<u-form-item label="汇报人" prop="reporter">
<u-input v-model="form.reporter" placeholder="请输入汇报人"></u-input>
</u-form-item>
<u-form-item label="涉及项目" prop="projectId">
<u-select
v-model="form.projectId"
:list="projectList"
label-name="projectName"
value-name="projectId"
placeholder="请选择涉及项目"
></u-select>
</u-form-item>
<u-form-item label="备注" prop="remark">
<u-input v-model="form.remark" type="textarea" placeholder="请输入内容"></u-input>
</u-form-item>
</u-form>
</scroll-view>
<view class="popup-footer">
<u-button type="primary" @click="submitForm" :loading="buttonLoading">确定</u-button>
<u-button @click="cancel">取消</u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { listProject } from '@/api/oa/project'
import { addReportSummary, delReportSummary, listReportSummary } from '@/api/oa/reportSummary'
import { listReportSummary } from '@/api/oa/reportSummary'
export default {
data() {
return {
projectList: [],
buttonLoading: false,
loading: true,
selectedIds: [],
selectAll: false,
showSearch: false,
total: 0,
reportSummaryList: [],
title: '',
showForm: false,
queryParams: {
pageNum: 1,
pageSize: 10,
@@ -126,22 +68,7 @@ export default {
projectId: undefined,
type: 1
},
form: {},
loadMoreStatus: 'loadmore',
rules: {
reportTitle: [
{ required: true, message: '汇报标题不能为空', trigger: 'blur' }
],
reportDate: [
{ required: true, message: '汇报日期不能为空', trigger: 'blur' }
],
reporter: [
{ required: true, message: '汇报人不能为空', trigger: 'blur' }
],
projectId: [
{ required: true, message: '涉及项目不能为空', trigger: 'blur' }
],
}
loadMoreStatus: 'loadmore'
}
},
onLoad() {
@@ -162,121 +89,27 @@ export default {
});
},
getProjectList() {
listProject({ pageSize: 999 }).then(({ rows }) => {
this.projectList = rows || [];
});
},
toggleSearch() {
this.showSearch = !this.showSearch;
},
handleSelectAll(value) {
if (value) {
// 全选
this.selectedIds = this.reportSummaryList.map(item => item.summaryId);
} else {
// 取消全选
this.selectedIds = [];
}
},
handleSelectionChange(value) {
// value 是选中的 ID 数组
this.selectedIds = value;
// 检查是否全选
this.selectAll = this.reportSummaryList.length > 0 &&
this.selectedIds.length === this.reportSummaryList.length;
},
cancel() {
this.showForm = false;
this.reset();
},
reset() {
this.form = {
reportTitle: undefined,
reportDate: undefined,
reporter: undefined,
projectId: undefined,
remark: undefined,
type: 1
};
this.$refs.form && this.$refs.form.resetFields();
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
reportTitle: undefined,
reportDate: undefined,
reporter: undefined,
projectId: undefined,
type: 1
};
this.handleQuery();
},
handleAdd() {
this.reset();
this.showForm = true;
this.title = '添加汇报概述';
},
submitForm() {
this.$refs.form.validate(valid => {
if (valid) {
this.buttonLoading = true;
addReportSummary(this.form).then(response => {
uni.showToast({
title: '新增成功',
icon: 'success'
});
this.showForm = false;
this.getList();
}).catch(() => {
uni.showToast({
title: '新增失败',
icon: 'error'
});
}).finally(() => {
this.buttonLoading = false;
});
}
});
},
handleDelete(row) {
const ids = row ? row.summaryId : this.selectedIds;
if (!ids || (Array.isArray(ids) && ids.length === 0)) {
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: '请选择要删除的数据',
title: '获取项目列表失败',
icon: 'none'
});
return;
}
uni.showModal({
title: '确认删除',
content: '是否确认删除选中的数据?',
success: (res) => {
if (res.confirm) {
this.loading = true;
const deleteIds = Array.isArray(ids) ? ids.join(',') : ids;
delReportSummary(deleteIds).then(() => {
this.loading = false;
this.getList();
uni.showToast({
title: '删除成功',
icon: 'success'
});
}).catch(() => {
this.loading = false;
uni.showToast({
title: '删除失败',
icon: 'error'
});
});
}
}
});
},
formatDate(date) {
if (!date) return '-';
const d = new Date(date);
@@ -306,23 +139,48 @@ export default {
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" scoped>
<style lang="scss">
.container {
padding: 20rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.action-buttons {
.operation-tip {
display: flex;
gap: 20rpx;
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;
@@ -382,10 +240,16 @@ export default {
}
}
}
.form-popup {
.form-popup-content {
background-color: #fff;
border-radius: 20rpx;
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;
@@ -399,7 +263,8 @@ export default {
}
.form-content {
padding: 30rpx;
max-height: 500rpx;
flex: 1;
overflow-y: auto;
}
.popup-footer {
display: flex;