fix
This commit is contained in:
parent
c47c8e48aa
commit
4972dcaf4d
|
@ -22,21 +22,6 @@
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="提案类型">
|
|
||||||
<a-select
|
|
||||||
v-model="searchForm.type"
|
|
||||||
placeholder="请选择类型"
|
|
||||||
allow-clear
|
|
||||||
style="width: 150px"
|
|
||||||
>
|
|
||||||
<a-option value="">全部</a-option>
|
|
||||||
<a-option value="管理规范">管理规范</a-option>
|
|
||||||
<a-option value="操作流程">操作流程</a-option>
|
|
||||||
<a-option value="安全制度">安全制度</a-option>
|
|
||||||
<a-option value="其他">其他</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="状态">
|
<a-form-item label="状态">
|
||||||
<a-select
|
<a-select
|
||||||
v-model="searchForm.status"
|
v-model="searchForm.status"
|
||||||
|
@ -45,8 +30,8 @@
|
||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
>
|
>
|
||||||
<a-option value="">全部</a-option>
|
<a-option value="">全部</a-option>
|
||||||
<a-option value="PUBLISHED">已公示</a-option>
|
<a-option value="PUBLISHED">已公告</a-option>
|
||||||
<a-option value="APPROVED">已通过</a-option>
|
<a-option value="APPROVED">已公示</a-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
@ -183,7 +168,6 @@ const columns = [
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
proposer: '',
|
proposer: '',
|
||||||
type: '',
|
|
||||||
status: ''
|
status: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -213,22 +197,19 @@ const regulationStore = useRegulationStore()
|
||||||
// 获取状态颜色
|
// 获取状态颜色
|
||||||
const getStatusColor = (status: RegulationStatus) => {
|
const getStatusColor = (status: RegulationStatus) => {
|
||||||
const colors = {
|
const colors = {
|
||||||
[RegulationStatus.DRAFT]: 'blue',
|
|
||||||
[RegulationStatus.PUBLISHED]: 'purple',
|
[RegulationStatus.PUBLISHED]: 'purple',
|
||||||
[RegulationStatus.APPROVED]: 'green',
|
[RegulationStatus.APPROVED]: 'green',
|
||||||
}
|
}
|
||||||
return colors[status] || 'blue'
|
return colors[status] || 'purple'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取状态文本
|
// 获取状态文本
|
||||||
const getStatusText = (status: RegulationStatus) => {
|
const getStatusText = (status: RegulationStatus) => {
|
||||||
const texts = {
|
const texts = {
|
||||||
[RegulationStatus.DRAFT]: '草稿',
|
|
||||||
[RegulationStatus.PUBLISHED]: '已公告',
|
[RegulationStatus.PUBLISHED]: '已公告',
|
||||||
[RegulationStatus.APPROVED]: '已公示',
|
[RegulationStatus.APPROVED]: '已公示',
|
||||||
|
|
||||||
}
|
}
|
||||||
return texts[status] || '草稿'
|
return texts[status] || '已公告'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化日期
|
// 格式化日期
|
||||||
|
@ -268,21 +249,56 @@ const getLevelText = (level: RegulationLevel) => {
|
||||||
const getTableData = async () => {
|
const getTableData = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const response = await regulationApi.getRegulationList({
|
// 构建请求参数
|
||||||
|
const requestParams: any = {
|
||||||
page: pagination.current,
|
page: pagination.current,
|
||||||
size: pagination.pageSize,
|
size: pagination.pageSize,
|
||||||
title: searchForm.title || undefined,
|
title: searchForm.title || undefined,
|
||||||
proposer: searchForm.proposer || undefined,
|
proposer: searchForm.proposer || undefined
|
||||||
type: searchForm.type || undefined,
|
}
|
||||||
status: searchForm.status || undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (searchForm.status) {
|
||||||
tableData.value = response.data.records
|
// 用户选择了特定状态
|
||||||
pagination.total = response.data.total
|
requestParams.status = searchForm.status
|
||||||
pagination.current = response.data.current
|
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 {
|
} 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) {
|
} catch (error) {
|
||||||
console.error('搜索制度公示失败:', error)
|
console.error('搜索制度公示失败:', error)
|
||||||
|
@ -303,7 +319,6 @@ const reset = () => {
|
||||||
Object.assign(searchForm, {
|
Object.assign(searchForm, {
|
||||||
title: '',
|
title: '',
|
||||||
proposer: '',
|
proposer: '',
|
||||||
type: '',
|
|
||||||
status: ''
|
status: ''
|
||||||
})
|
})
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
|
|
|
@ -31,21 +31,6 @@
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="提案类型">
|
|
||||||
<a-select
|
|
||||||
v-model="searchForm.type"
|
|
||||||
placeholder="请选择类型"
|
|
||||||
allow-clear
|
|
||||||
style="width: 150px"
|
|
||||||
>
|
|
||||||
<a-option value="">全部</a-option>
|
|
||||||
<a-option value="管理规范">管理规范</a-option>
|
|
||||||
<a-option value="操作流程">操作流程</a-option>
|
|
||||||
<a-option value="安全制度">安全制度</a-option>
|
|
||||||
<a-option value="其他">其他</a-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="状态">
|
<a-form-item label="状态">
|
||||||
<a-select
|
<a-select
|
||||||
v-model="searchForm.status"
|
v-model="searchForm.status"
|
||||||
|
@ -352,7 +337,6 @@ const columns = [
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
proposer: '',
|
proposer: '',
|
||||||
type: '',
|
|
||||||
status: ''
|
status: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -484,7 +468,6 @@ const getTableData = async () => {
|
||||||
size: pagination.pageSize,
|
size: pagination.pageSize,
|
||||||
title: searchForm.title || undefined,
|
title: searchForm.title || undefined,
|
||||||
proposer: searchForm.proposer || undefined,
|
proposer: searchForm.proposer || undefined,
|
||||||
type: searchForm.type || undefined,
|
|
||||||
status: searchForm.status || undefined
|
status: searchForm.status || undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -514,7 +497,6 @@ const reset = () => {
|
||||||
Object.assign(searchForm, {
|
Object.assign(searchForm, {
|
||||||
title: '',
|
title: '',
|
||||||
proposer: '',
|
proposer: '',
|
||||||
type: '',
|
|
||||||
status: ''
|
status: ''
|
||||||
})
|
})
|
||||||
pagination.current = 1
|
pagination.current = 1
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
>
|
>
|
||||||
<a-option value="">全部</a-option>
|
<a-option value="">全部</a-option>
|
||||||
<a-option value="confirmed">已确认</a-option>
|
<a-option value="CONFIRMED">已确认</a-option>
|
||||||
<a-option value="pending">待确认</a-option>
|
<a-option value="PENDING">待确认</a-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #confirmStatus="{ record }">
|
<template #confirmStatus="{ record }">
|
||||||
<a-tag :color="record.confirmStatus === 'confirmed' ? 'green' : 'orange'">
|
<a-tag :color="record.confirmStatus === 'CONFIRMED' ? 'green' : 'orange'">
|
||||||
{{ record.confirmStatus === 'confirmed' ? '已确认' : '待确认' }}
|
{{ record.confirmStatus === 'CONFIRMED' ? '已确认' : '待确认' }}
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -96,6 +96,11 @@
|
||||||
<span>公示人: {{ currentRegulation.createByName }}</span>
|
<span>公示人: {{ currentRegulation.createByName }}</span>
|
||||||
<span>公示时间: {{ currentRegulation.publishTime }}</span>
|
<span>公示时间: {{ currentRegulation.publishTime }}</span>
|
||||||
<span>生效日期: {{ currentRegulation.effectiveTime }}</span>
|
<span>生效日期: {{ currentRegulation.effectiveTime }}</span>
|
||||||
|
<span>确认状态:
|
||||||
|
<a-tag :color="currentRegulation.confirmStatus === 'CONFIRMED' ? 'green' : 'orange'">
|
||||||
|
{{ currentRegulation.confirmStatus === 'CONFIRMED' ? '已确认' : '待确认' }}
|
||||||
|
</a-tag>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -118,9 +123,20 @@
|
||||||
<a-divider />
|
<a-divider />
|
||||||
|
|
||||||
<div class="detail-footer">
|
<div class="detail-footer">
|
||||||
<a-button type="primary" @click="handleConfirm(currentRegulation)">
|
<a-button
|
||||||
确认知晓并遵守
|
v-if="currentRegulation.confirmStatus !== 'CONFIRMED'"
|
||||||
</a-button>
|
type="primary"
|
||||||
|
@click="handleConfirm(currentRegulation)"
|
||||||
|
>
|
||||||
|
确认知晓并遵守
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
v-else
|
||||||
|
type="primary"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
已确认知晓
|
||||||
|
</a-button>
|
||||||
<a-button @click="handleDownload(currentRegulation)">
|
<a-button @click="handleDownload(currentRegulation)">
|
||||||
下载制度文件
|
下载制度文件
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -216,10 +232,20 @@ const getTableData = async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
tableData.value = response.data.records
|
|
||||||
|
|
||||||
|
// 确保每个记录都有 confirmStatus 字段
|
||||||
|
const records = response.data.records.map((record: any) => ({
|
||||||
|
...record,
|
||||||
|
confirmStatus: record.confirmStatus || 'PENDING'
|
||||||
|
}))
|
||||||
|
|
||||||
|
tableData.value = records
|
||||||
pagination.pageSize = response.data.size
|
pagination.pageSize = response.data.size
|
||||||
pagination.current = response.data.current
|
pagination.current = response.data.current
|
||||||
pagination.total = response.data.total
|
pagination.total = response.data.total
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Message.error('搜索失败')
|
Message.error('搜索失败')
|
||||||
}
|
}
|
||||||
|
@ -311,11 +337,16 @@ const submitConfirm = async () => {
|
||||||
Message.success('确认成功,您已承诺遵守该制度')
|
Message.success('确认成功,您已承诺遵守该制度')
|
||||||
confirmModalVisible.value = false
|
confirmModalVisible.value = false
|
||||||
|
|
||||||
// 更新本地数据状态
|
// 立即刷新数据,确保状态同步
|
||||||
const index = tableData.value.findIndex(item => item.regulationId === currentRegulation.value.regulationId)
|
await getTableData()
|
||||||
if (index !== -1) {
|
|
||||||
tableData.value[index].confirmStatus = 'confirmed'
|
// 如果详情弹窗是打开的,也更新详情弹窗中的数据
|
||||||
}
|
if (detailModalVisible.value && currentRegulation.value) {
|
||||||
|
const updatedRecord = tableData.value.find(item => item.regulationId === currentRegulation.value.regulationId)
|
||||||
|
if (updatedRecord) {
|
||||||
|
currentRegulation.value = updatedRecord
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('确认失败:', error)
|
console.error('确认失败:', error)
|
||||||
|
|
Loading…
Reference in New Issue