diff --git a/src/views/regulation/confirm.vue b/src/views/regulation/confirm.vue index 3fedb0e..d9e1a6a 100644 --- a/src/views/regulation/confirm.vue +++ b/src/views/regulation/confirm.vue @@ -22,21 +22,6 @@ /> - - - 全部 - 管理规范 - 操作流程 - 安全制度 - 其他 - - - 全部 - 已公示 - 已通过 + 已公告 + 已公示 @@ -183,7 +168,6 @@ const columns = [ const searchForm = reactive({ title: '', proposer: '', - type: '', status: '' }) @@ -213,22 +197,19 @@ const regulationStore = useRegulationStore() // 获取状态颜色 const getStatusColor = (status: RegulationStatus) => { const colors = { - [RegulationStatus.DRAFT]: 'blue', [RegulationStatus.PUBLISHED]: 'purple', [RegulationStatus.APPROVED]: 'green', } - return colors[status] || 'blue' + return colors[status] || 'purple' } // 获取状态文本 const getStatusText = (status: RegulationStatus) => { const texts = { - [RegulationStatus.DRAFT]: '草稿', [RegulationStatus.PUBLISHED]: '已公告', [RegulationStatus.APPROVED]: '已公示', - } - return texts[status] || '草稿' + return texts[status] || '已公告' } // 格式化日期 @@ -268,21 +249,56 @@ const getLevelText = (level: RegulationLevel) => { const getTableData = async () => { loading.value = true try { - const response = await regulationApi.getRegulationList({ + // 构建请求参数 + const requestParams: any = { page: pagination.current, size: pagination.pageSize, title: searchForm.title || undefined, - proposer: searchForm.proposer || undefined, - type: searchForm.type || undefined, - status: searchForm.status || undefined - }) + proposer: searchForm.proposer || undefined + } - if (response.status === 200) { - tableData.value = response.data.records - pagination.total = response.data.total - pagination.current = response.data.current + if (searchForm.status) { + // 用户选择了特定状态 + requestParams.status = searchForm.status + const response = await regulationApi.getRegulationList(requestParams) + + if (response.status === 200) { + tableData.value = response.data.records + pagination.total = response.data.total + pagination.current = response.data.current + } else { + Message.error('搜索失败') + } } else { - Message.error('搜索失败') + // 用户没有选择状态,默认显示已公示和已公告的提案 + // 分别查询已公告和已公示的提案 + const [publishedResponse, approvedResponse] = await Promise.all([ + regulationApi.getRegulationList({ + ...requestParams, + status: RegulationStatus.PUBLISHED + }), + regulationApi.getRegulationList({ + ...requestParams, + status: RegulationStatus.APPROVED + }) + ]) + + if (publishedResponse.status === 200 && approvedResponse.status === 200) { + // 合并两个结果 + const allRecords = [ + ...publishedResponse.data.records, + ...approvedResponse.data.records + ] + + // 按创建时间排序 + allRecords.sort((a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime()) + + tableData.value = allRecords + pagination.total = allRecords.length + pagination.current = 1 + } else { + Message.error('搜索失败') + } } } catch (error) { console.error('搜索制度公示失败:', error) @@ -303,7 +319,6 @@ const reset = () => { Object.assign(searchForm, { title: '', proposer: '', - type: '', status: '' }) pagination.current = 1 diff --git a/src/views/regulation/proposal/index.vue b/src/views/regulation/proposal/index.vue index b4170d8..c0124b6 100644 --- a/src/views/regulation/proposal/index.vue +++ b/src/views/regulation/proposal/index.vue @@ -31,21 +31,6 @@ /> - - - 全部 - 管理规范 - 操作流程 - 安全制度 - 其他 - - - { size: pagination.pageSize, title: searchForm.title || undefined, proposer: searchForm.proposer || undefined, - type: searchForm.type || undefined, status: searchForm.status || undefined }) @@ -514,7 +497,6 @@ const reset = () => { Object.assign(searchForm, { title: '', proposer: '', - type: '', status: '' }) pagination.current = 1 diff --git a/src/views/regulation/repository.vue b/src/views/regulation/repository.vue index e503b6f..b3ad144 100644 --- a/src/views/regulation/repository.vue +++ b/src/views/regulation/repository.vue @@ -30,8 +30,8 @@ style="width: 150px" > 全部 - 已确认 - 待确认 + 已确认 + 待确认 @@ -64,8 +64,8 @@ @@ -96,6 +96,11 @@ 公示人: {{ currentRegulation.createByName }} 公示时间: {{ currentRegulation.publishTime }} 生效日期: {{ currentRegulation.effectiveTime }} + 确认状态: + + {{ currentRegulation.confirmStatus === 'CONFIRMED' ? '已确认' : '待确认' }} + + @@ -118,9 +123,20 @@