|
|
@@ -25,7 +25,7 @@
|
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="auditObject"
|
|
|
+ prop="enterpriseName"
|
|
|
label="发送对象"
|
|
|
width="150"
|
|
|
align="center"
|
|
|
@@ -157,62 +157,33 @@
|
|
|
},
|
|
|
// 获取消息通知列表
|
|
|
async getNoticeList() {
|
|
|
- // 检查是否有子项目
|
|
|
- if (
|
|
|
- !this.selectedProject ||
|
|
|
- !this.selectedProject.children ||
|
|
|
- !Array.isArray(this.selectedProject.children) ||
|
|
|
- this.selectedProject.children.length === 0
|
|
|
- ) {
|
|
|
+ // 检查是否有选中项目
|
|
|
+ if (!this.selectedProject || !this.selectedProject.projectId) {
|
|
|
this.localFormData = []
|
|
|
this.internalPagination.total = 0
|
|
|
return
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- // 获取所有子项目(包含id和auditObject)
|
|
|
- const children = this.selectedProject.children.filter(
|
|
|
- (child) => child.id
|
|
|
- )
|
|
|
-
|
|
|
- // 为每个子项目发送请求,并保存对应的auditObject
|
|
|
- const promises = children.map((child) => {
|
|
|
- const params = {
|
|
|
- taskId: child.id,
|
|
|
- pageNum: this.internalPagination.currentPage,
|
|
|
- pageSize: this.internalPagination.pageSize,
|
|
|
- }
|
|
|
- // 发送请求并返回结果和对应的auditObject
|
|
|
- return sendMessage(params).then((res) => ({
|
|
|
- res,
|
|
|
- auditObject: child.auditObject,
|
|
|
- }))
|
|
|
- })
|
|
|
-
|
|
|
- // 并行处理所有请求
|
|
|
- const results = await Promise.all(promises)
|
|
|
-
|
|
|
- // 合并所有结果,并为每条记录添加auditObject
|
|
|
- let allRecords = []
|
|
|
- let totalCount = 0
|
|
|
+ // 发送单次请求,使用projectId作为查询条件
|
|
|
+ const params = {
|
|
|
+ projectId: this.selectedProject.projectId,
|
|
|
+ pageNum: this.internalPagination.currentPage,
|
|
|
+ pageSize: this.internalPagination.pageSize,
|
|
|
+ }
|
|
|
|
|
|
- results.forEach(({ res, auditObject }) => {
|
|
|
- if (res && res.code === 200 && res.value) {
|
|
|
- // 为每条记录添加auditObject
|
|
|
- const recordsWithAuditObject = (res.value.records || []).map(
|
|
|
- (record) => ({
|
|
|
- ...record,
|
|
|
- auditObject,
|
|
|
- })
|
|
|
- )
|
|
|
- allRecords = allRecords.concat(recordsWithAuditObject)
|
|
|
- totalCount += res.value.total || 0
|
|
|
- }
|
|
|
- })
|
|
|
+ // 发送请求
|
|
|
+ const res = await sendMessage(params)
|
|
|
|
|
|
- // 更新表格数据
|
|
|
- this.localFormData = allRecords
|
|
|
- this.internalPagination.total = totalCount
|
|
|
+ // 处理返回结果
|
|
|
+ if (res && res.code === 200 && res.value) {
|
|
|
+ // 更新表格数据和总数
|
|
|
+ this.localFormData = res.value.records || []
|
|
|
+ this.internalPagination.total = res.value.total || 0
|
|
|
+ } else {
|
|
|
+ this.localFormData = []
|
|
|
+ this.internalPagination.total = 0
|
|
|
+ }
|
|
|
} catch (err) {
|
|
|
console.error('获取消息通知失败', err)
|
|
|
this.localFormData = []
|