89 lines
2.1 KiB
TypeScript
89 lines
2.1 KiB
TypeScript
|
import http from '@/utils/http'
|
||
|
|
||
|
// 制度管理API接口
|
||
|
export const regulationApi = {
|
||
|
// 获取制度列表
|
||
|
getRegulationList: (params: {
|
||
|
page: number
|
||
|
size: number
|
||
|
}) => {
|
||
|
return http.get('/regulation', params)
|
||
|
},
|
||
|
|
||
|
// 获取制度详情
|
||
|
getRegulationDetail: (regulationId: string) => {
|
||
|
return http.get(`/regulation/${regulationId}`)
|
||
|
},
|
||
|
|
||
|
// 创建制度提案
|
||
|
createProposal: (data: {
|
||
|
title: string
|
||
|
content: string
|
||
|
regulationType: string
|
||
|
scope: string
|
||
|
level: string
|
||
|
remark?: string
|
||
|
}) => {
|
||
|
return http.post('/regulation/proposal', data)
|
||
|
},
|
||
|
|
||
|
// 更新制度提案
|
||
|
updateProposal: (regulationId: string, data: any) => {
|
||
|
return http.put(`/regulation/proposal/${regulationId}`, data)
|
||
|
},
|
||
|
|
||
|
// 删除制度提案
|
||
|
deleteProposal: (regulationId: string) => {
|
||
|
return http.del(`/regulation/proposal/${regulationId}`)
|
||
|
},
|
||
|
|
||
|
// 提交投票
|
||
|
submitVote: (regulationId: string, data: {
|
||
|
voteType: 'FOR' | 'AGAINST' | 'ABSTAIN'
|
||
|
reason?: string
|
||
|
}) => {
|
||
|
return http.post(`/regulation/${regulationId}/vote`, data)
|
||
|
},
|
||
|
|
||
|
// 获取投票结果
|
||
|
getVoteResult: (regulationId: string) => {
|
||
|
return http.get(`/regulation/${regulationId}/vote-result`)
|
||
|
},
|
||
|
|
||
|
// 发布制度
|
||
|
publishRegulation: (regulationId: string) => {
|
||
|
return http.post(`/regulation/${regulationId}/publish`)
|
||
|
},
|
||
|
|
||
|
// 获取讨论列表
|
||
|
getDiscussionList: (regulationId: string) => {
|
||
|
return http.get(`/regulation/${regulationId}/discussions`)
|
||
|
},
|
||
|
|
||
|
// 发表评论
|
||
|
addComment: (regulationId: string, data: {
|
||
|
content: string
|
||
|
}) => {
|
||
|
return http.post(`/regulation/${regulationId}/discussions`, data)
|
||
|
},
|
||
|
|
||
|
// 获取已发布制度列表
|
||
|
getPublishedRegulationList: (params: {
|
||
|
page: number
|
||
|
size: number
|
||
|
}) => {
|
||
|
return http.get('/regulation/published', params)
|
||
|
},
|
||
|
|
||
|
// 确认制度知晓
|
||
|
confirmRegulation: (regulationId: string, data: {
|
||
|
agreeTerms: boolean
|
||
|
}) => {
|
||
|
return http.post(`/regulation/${regulationId}/confirm`, data)
|
||
|
},
|
||
|
|
||
|
// 批量确认制度
|
||
|
confirmAllRegulations: () => {
|
||
|
return http.post('/regulation/confirm-all')
|
||
|
}
|
||
|
}
|