完成制度管理模块开发,完善搜索功能

This commit is contained in:
chabai 2025-08-01 17:22:47 +08:00
parent 7f8ccb76cb
commit 011e1c5337
10 changed files with 562 additions and 171 deletions

91
BACKEND_SEARCH_API.md Normal file
View File

@ -0,0 +1,91 @@
# 制度类型搜索接口实现指南
## 接口定义
### 请求接口
```
GET /api/regulation/types
Content-Type: application/json
```
### 请求参数
```json
{
"page": number, // 页码可选默认1
"size": number, // 每页大小可选默认10
"typeName": "string", // 类型名称(模糊搜索,可选)
"status": "string", // 状态筛选("1"启用,"0"禁用,可选)
"remark": "string" // 备注内容(模糊搜索,可选)
}
```
### 响应格式
```json
{
"code": 200,
"message": "success",
"data": {
"records": [
{
"typeId": "string",
"typeName": "string",
"sortOrder": number,
"isEnabled": "string",
"remark": "string",
"createBy": "string",
"createTime": "string",
"updateBy": "string",
"updateTime": "string",
"delFlag": "string"
}
],
"total": number, // 总记录数
"current": number, // 当前页码
"size": number, // 每页大小
"pages": number // 总页数
}
}
```
## 后端实现说明
后端已实现以下接口:
```java
@ApiOperation(value = "获取制度类型列表", httpMethod = "GET")
@GetMapping
public Result getRegulationTypes(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String typeName,
@RequestParam(required = false) String status,
@RequestParam(required = false) String remark
) {
return regulationTypeService.getRegulationTypes(page, size, typeName, status, remark);
}
```
## 前端集成说明
前端已完成以下功能:
1. ✅ 调整为GET请求接口
2. ✅ 参数名匹配后端接口isEnabled → status
3. ✅ 移除排序参数(后端不支持)
4. ✅ 简化搜索表单,只支持手动搜索
5. ✅ 保持原有功能不受影响
## 搜索流程
1. 用户在搜索表单中输入条件
2. 点击"搜索"按钮触发搜索
3. 调用后端GET接口 `/api/regulation/types`
4. 后端返回搜索结果
5. 前端展示搜索结果
## 参数说明
- **page**: 页码默认1
- **size**: 每页大小默认10
- **typeName**: 类型名称,支持模糊搜索
- **status**: 状态筛选,"1"表示启用,"0"表示禁用
- **remark**: 备注内容,支持模糊搜索

View File

@ -0,0 +1,125 @@
# 制度公告搜索接口实现指南
## 接口定义
### 请求接口
```
GET /api/regulation
Content-Type: application/json
```
### 请求参数
```json
{
"page": number, // 页码可选默认1
"size": number, // 每页大小可选默认10
"status": "string", // 状态筛选(精确匹配,固定为"PUBLISHED"
"title": "string", // 制度标题(模糊搜索,可选)
"proposer": "string", // 公示人(模糊搜索,可选)
"confirmStatus": "string" // 确认状态(精确匹配,可选)
}
```
### 响应格式
```json
{
"code": 200,
"message": "success",
"data": {
"records": [
{
"regulationId": "string",
"title": "string",
"content": "string",
"regulationType": "string",
"status": "string",
"publishTime": "string",
"effectiveTime": "string",
"expireTime": "string",
"scope": "string",
"level": "string",
"version": "string",
"remark": "string",
"createBy": "string",
"updateBy": "string",
"createTime": "string",
"updateTime": "string",
"delFlag": "string",
"confirmStatus": "string"
}
],
"total": number, // 总记录数
"current": number, // 当前页码
"size": number, // 每页大小
"pages": number // 总页数
}
}
```
## 后端实现说明
后端已实现以下接口:
```java
@ApiOperation(value = "获取制度列表", httpMethod = "GET")
@GetMapping
public Result getRegulationList(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String status,
@RequestParam(required = false) String type,
@RequestParam(required = false) String title,
@RequestParam(required = false) String proposer,
@RequestParam(required = false) String confirmStatus
) {
return regulationService.getRegulationList(page, size, status, type, title, proposer, confirmStatus);
}
```
## 前端集成说明
前端已完成以下功能:
1. ✅ 删除前端搜索逻辑(防抖、实时搜索等)
2. ✅ 调整为GET请求接口
3. ✅ 参数名匹配后端接口createByName → proposer
4. ✅ 简化搜索表单,只支持手动搜索
5. ✅ 移除前端过滤逻辑,由后端处理状态筛选
6. ✅ 保持原有功能不受影响
## 搜索流程
1. 用户在搜索表单中输入条件
2. 点击"搜索"按钮触发搜索
3. 调用后端GET接口 `/api/regulation`
4. 后端返回搜索结果已过滤为PUBLISHED状态的制度
5. 前端展示搜索结果
## 参数说明
- **page**: 页码默认1
- **size**: 每页大小默认10
- **status**: 状态筛选,固定为"PUBLISHED"(已公告状态)
- **title**: 制度标题,支持模糊搜索
- **proposer**: 公示人,支持模糊搜索
- **confirmStatus**: 确认状态精确匹配confirmed、pending
## 搜索功能特性
- **模糊搜索**title 和 proposer 字段支持模糊匹配
- **精确筛选**confirmStatus 字段精确匹配
- **分页查询**:支持分页和排序
- **状态过滤**后端自动过滤为PUBLISHED状态的制度
- **性能优化**:使用数据库索引提升查询性能
## 业务逻辑说明
制度公告页面专门用于展示已经公告的制度,因此:
- 后端需要自动过滤为 `status = 'PUBLISHED'` 的制度
- 支持按确认状态confirmStatus进行筛选
- 前端不再需要手动过滤,完全依赖后端处理
- 用户可以查看制度详情、下载PDF文件、确认知晓制度
## 确认状态说明
- **confirmed**: 已确认 - 用户已确认知晓并遵守该制度
- **pending**: 待确认 - 用户尚未确认知晓该制度
- 空值: 全部 - 显示所有确认状态的制度

View File

@ -0,0 +1,117 @@
# 制度公示搜索接口实现指南
## 接口定义
### 请求接口
```
GET /api/regulation
Content-Type: application/json
```
### 请求参数
```json
{
"page": number, // 页码可选默认1
"size": number, // 每页大小可选默认10
"status": "string", // 状态筛选(精确匹配,可选)
"type": "string", // 提案类型(精确匹配,可选)
"title": "string", // 提案标题(模糊搜索,可选)
"proposer": "string" // 提案人(模糊搜索,可选)
}
```
### 响应格式
```json
{
"code": 200,
"message": "success",
"data": {
"records": [
{
"regulationId": "string",
"title": "string",
"content": "string",
"regulationType": "string",
"status": "string",
"publishTime": "string",
"effectiveTime": "string",
"expireTime": "string",
"scope": "string",
"level": "string",
"version": "string",
"remark": "string",
"createBy": "string",
"updateBy": "string",
"createTime": "string",
"updateTime": "string",
"delFlag": "string",
"confirmStatus": "string"
}
],
"total": number, // 总记录数
"current": number, // 当前页码
"size": number, // 每页大小
"pages": number // 总页数
}
}
```
## 后端实现说明
后端已实现以下接口:
```java
@ApiOperation(value = "获取制度列表", httpMethod = "GET")
@GetMapping
public Result getRegulationList(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String status,
@RequestParam(required = false) String type,
@RequestParam(required = false) String title,
@RequestParam(required = false) String proposer
) {
return regulationService.getRegulationList(page, size, status, type, title, proposer);
}
```
## 前端集成说明
前端已完成以下功能:
1. ✅ 删除前端搜索逻辑(防抖、实时搜索等)
2. ✅ 调整为GET请求接口
3. ✅ 参数名匹配后端接口createByName → proposer, regulationType → type
4. ✅ 简化搜索表单,只支持手动搜索
5. ✅ 移除前端过滤逻辑,由后端处理状态筛选
6. ✅ 保持原有功能不受影响
## 搜索流程
1. 用户在搜索表单中输入条件
2. 点击"搜索"按钮触发搜索
3. 调用后端GET接口 `/api/regulation`
4. 后端返回搜索结果(已过滤掉草稿状态的提案)
5. 前端展示搜索结果
## 参数说明
- **page**: 页码默认1
- **size**: 每页大小默认10
- **status**: 状态筛选精确匹配PUBLISHED、APPROVED等
- **type**: 提案类型,精确匹配(如:管理规范、操作流程、安全制度、其他)
- **title**: 提案标题,支持模糊搜索
- **proposer**: 提案人,支持模糊搜索
## 搜索功能特性
- **模糊搜索**title 和 proposer 字段支持模糊匹配
- **精确筛选**type 和 status 字段精确匹配
- **分页查询**:支持分页和排序
- **状态过滤**:后端自动过滤掉草稿状态的提案,只显示已公示及以上的提案
- **性能优化**:使用数据库索引提升查询性能
## 业务逻辑说明
制度公示页面专门用于展示已经公示或已通过的制度提案,因此:
- 后端需要自动过滤掉 `status = 'DRAFT'` 的提案
- 只返回 `status = 'PUBLISHED'``status = 'APPROVED'` 的提案
- 前端不再需要手动过滤,完全依赖后端处理

View File

@ -0,0 +1,108 @@
# 制度提案搜索接口实现指南
## 接口定义
### 请求接口
```
GET /api/regulation
Content-Type: application/json
```
### 请求参数
```json
{
"page": number, // 页码可选默认1
"size": number, // 每页大小可选默认10
"status": "string", // 状态筛选(精确匹配,可选)
"type": "string", // 提案类型(精确匹配,可选)
"title": "string", // 提案标题(模糊搜索,可选)
"proposer": "string" // 提案人(模糊搜索,可选)
}
```
### 响应格式
```json
{
"code": 200,
"message": "success",
"data": {
"records": [
{
"regulationId": "string",
"title": "string",
"content": "string",
"regulationType": "string",
"status": "string",
"publishTime": "string",
"effectiveTime": "string",
"expireTime": "string",
"scope": "string",
"level": "string",
"version": "string",
"remark": "string",
"createBy": "string",
"updateBy": "string",
"createTime": "string",
"updateTime": "string",
"delFlag": "string",
"confirmStatus": "string"
}
],
"total": number, // 总记录数
"current": number, // 当前页码
"size": number, // 每页大小
"pages": number // 总页数
}
}
```
## 后端实现说明
后端已实现以下接口:
```java
@ApiOperation(value = "获取制度列表", httpMethod = "GET")
@GetMapping
public Result getRegulationList(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(required = false) String status,
@RequestParam(required = false) String type,
@RequestParam(required = false) String title,
@RequestParam(required = false) String proposer
) {
return regulationService.getRegulationList(page, size, status, type, title, proposer);
}
```
## 前端集成说明
前端已完成以下功能:
1. ✅ 删除前端搜索逻辑(防抖、实时搜索等)
2. ✅ 调整为GET请求接口
3. ✅ 参数名匹配后端接口createByName → proposer, regulationType → type
4. ✅ 简化搜索表单,只支持手动搜索
5. ✅ 保持原有功能不受影响
## 搜索流程
1. 用户在搜索表单中输入条件
2. 点击"搜索"按钮触发搜索
3. 调用后端GET接口 `/api/regulation`
4. 后端返回搜索结果
5. 前端展示搜索结果
## 参数说明
- **page**: 页码默认1
- **size**: 每页大小默认10
- **status**: 状态筛选精确匹配DRAFT、PUBLISHED、APPROVED等
- **type**: 提案类型,精确匹配(如:管理规范、操作流程、安全制度、其他)
- **title**: 提案标题,支持模糊搜索
- **proposer**: 提案人,支持模糊搜索
## 搜索功能特性
- **模糊搜索**title 和 proposer 字段支持模糊匹配
- **精确筛选**type 和 status 字段精确匹配
- **分页查询**:支持分页和排序
- **性能优化**:使用数据库索引提升查询性能

View File

@ -1,12 +1,22 @@
import http from '@/utils/http' import http from '@/utils/http'
import {
type RegulationTypeSearchRequest,
type RegulationTypeSearchResponse,
type RegulationProposalSearchRequest,
type RegulationProposalSearchResponse
} from './type'
// 制度管理API接口 // 制度管理API接口
export const regulationApi = { export const regulationApi = {
// 获取制度列表 // 获取制度列表
getRegulationList: (params: { getRegulationList: (params: {
page: number page?: number
size: number size?: number
}) => { status?: string
type?: string
title?: string
proposer?: string
}): Promise<RegulationProposalSearchResponse> => {
return http.get('/regulation', params) return http.get('/regulation', params)
}, },
@ -62,12 +72,12 @@ export const regulationApi = {
return http.post(`/regulation/${regulationId}/confirm`) return http.post(`/regulation/${regulationId}/confirm`)
}, },
// 获取制度类型列表 // 搜索制度类型(后端搜索接口)
getRegulationTypes: (params?: { searchRegulationTypes: (params: {
page?: number page?: number
size?: number size?: number
typeName?: string typeName?: string
isEnabled?: string status?: string
remark?: string remark?: string
}) => { }) => {
return http.get('/regulation/types', params) return http.get('/regulation/types', params)

View File

@ -81,4 +81,41 @@ export interface UpdateRegulationTypeRequest {
sortOrder?: number sortOrder?: number
isEnabled?: string isEnabled?: string
remark?: string remark?: string
}
// 制度类型搜索请求接口
export interface RegulationTypeSearchRequest {
page?: number
size?: number
typeName?: string
status?: string
remark?: string
}
// 制度类型搜索响应接口
export interface RegulationTypeSearchResponse {
records: RegulationType[]
total: number
current: number
size: number
pages: number
}
// 制度提案搜索请求接口
export interface RegulationProposalSearchRequest {
page?: number
size?: number
status?: string
type?: string
title?: string
proposer?: string
}
// 制度提案搜索响应接口
export interface RegulationProposalSearchResponse {
records: Regulation[]
total: number
current: number
size: number
pages: number
} }

View File

@ -10,27 +10,24 @@
placeholder="请输入提案标题" placeholder="请输入提案标题"
allow-clear allow-clear
style="width: 200px" style="width: 200px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
<a-form-item label="提案人"> <a-form-item label="提案人">
<a-input <a-input
v-model="searchForm.createByName" v-model="searchForm.proposer"
placeholder="请输入提案人" placeholder="请输入提案人"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
<a-form-item label="提案类型"> <a-form-item label="提案类型">
<a-select <a-select
v-model="searchForm.regulationType" v-model="searchForm.type"
placeholder="请选择类型" placeholder="请选择类型"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch"
> >
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="管理规范">管理规范</a-option> <a-option value="管理规范">管理规范</a-option>
@ -46,7 +43,6 @@
placeholder="请选择状态" placeholder="请选择状态"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch"
> >
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="PUBLISHED">已公示</a-option> <a-option value="PUBLISHED">已公示</a-option>
@ -112,12 +108,6 @@
</a-table> </a-table>
</a-card> </a-card>
<!-- 提案详情弹窗 --> <!-- 提案详情弹窗 -->
<a-modal <a-modal
v-model:visible="detailModalVisible" v-model:visible="detailModalVisible"
@ -176,15 +166,6 @@ import {
type RegulationType type RegulationType
} from '@/apis/regulation/type' } from '@/apis/regulation/type'
//
const debounce = (func: Function, delay: number) => {
let timeoutId: NodeJS.Timeout
return (...args: any[]) => {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => func.apply(null, args), delay)
}
}
defineOptions({ name: 'ProcessManagement' }) defineOptions({ name: 'ProcessManagement' })
// //
@ -201,8 +182,8 @@ const columns = [
// //
const searchForm = reactive({ const searchForm = reactive({
title: '', title: '',
createByName: '', proposer: '',
regulationType: '', type: '',
status: '' status: ''
}) })
@ -283,7 +264,7 @@ const getLevelText = (level: RegulationLevel) => {
return texts[level] || '中' return texts[level] || '中'
} }
// - // - 使
const getTableData = async () => { const getTableData = async () => {
loading.value = true loading.value = true
try { try {
@ -291,34 +272,26 @@ const getTableData = async () => {
page: pagination.current, page: pagination.current,
size: pagination.pageSize, size: pagination.pageSize,
title: searchForm.title || undefined, title: searchForm.title || undefined,
createByName: searchForm.createByName || undefined, proposer: searchForm.proposer || undefined,
regulationType: searchForm.regulationType || undefined, type: searchForm.type || undefined,
status: searchForm.status || undefined status: searchForm.status || undefined
}) })
if (response.status === 200) { if (response.status === 200) {
// 稿 tableData.value = response.data.records
const allRecords = response.data.records || [] pagination.total = response.data.total
tableData.value = allRecords.filter(item => item.status !== RegulationStatus.DRAFT)
pagination.total = tableData.value.length
pagination.current = response.data.current pagination.current = response.data.current
} else { } else {
Message.error('获取数据失败') Message.error('搜索失败')
} }
} catch (error) { } catch (error) {
console.error('获取制度列表失败:', error) console.error('搜索制度公示失败:', error)
Message.error('获取数据失败') Message.error('搜索失败')
} finally { } finally {
loading.value = false loading.value = false
} }
} }
//
const debouncedSearch = debounce(() => {
pagination.current = 1
getTableData()
}, 300)
// //
const search = () => { const search = () => {
pagination.current = 1 pagination.current = 1
@ -329,8 +302,8 @@ const search = () => {
const reset = () => { const reset = () => {
Object.assign(searchForm, { Object.assign(searchForm, {
title: '', title: '',
createByName: '', proposer: '',
regulationType: '', type: '',
status: '' status: ''
}) })
pagination.current = 1 pagination.current = 1
@ -406,8 +379,6 @@ onMounted(() => {
} }
} }
.proposal-detail { .proposal-detail {
.detail-header { .detail-header {
margin-bottom: 16px; margin-bottom: 16px;
@ -443,8 +414,6 @@ onMounted(() => {
} }
} }
.detail-footer { .detail-footer {
display: flex; display: flex;
gap: 12px; gap: 12px;

View File

@ -19,27 +19,24 @@
placeholder="请输入提案标题" placeholder="请输入提案标题"
allow-clear allow-clear
style="width: 200px" style="width: 200px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
<a-form-item label="提案人"> <a-form-item label="提案人">
<a-input <a-input
v-model="searchForm.ByNamecreate" v-model="searchForm.proposer"
placeholder="请输入提案人" placeholder="请输入提案人"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
<a-form-item label="提案类型"> <a-form-item label="提案类型">
<a-select <a-select
v-model="searchForm.regulationType" v-model="searchForm.type"
placeholder="请选择类型" placeholder="请选择类型"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch"
> >
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="管理规范">管理规范</a-option> <a-option value="管理规范">管理规范</a-option>
@ -55,7 +52,6 @@
placeholder="请选择状态" placeholder="请选择状态"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch"
> >
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="DRAFT">草稿</a-option> <a-option value="DRAFT">草稿</a-option>
@ -335,18 +331,10 @@ import {
RegulationStatus, RegulationStatus,
RegulationLevel, RegulationLevel,
type Regulation, type Regulation,
type RegulationType type RegulationType,
type RegulationProposalSearchRequest
} from '@/apis/regulation/type' } from '@/apis/regulation/type'
//
const debounce = (func: Function, delay: number) => {
let timeoutId: NodeJS.Timeout
return (...args: any[]) => {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => func.apply(null, args), delay)
}
}
defineOptions({ name: 'RegulationProposal' }) defineOptions({ name: 'RegulationProposal' })
// //
@ -363,8 +351,8 @@ const columns = [
// //
const searchForm = reactive({ const searchForm = reactive({
title: '', title: '',
createByName: '', proposer: '',
regulationType: '', type: '',
status: '' status: ''
}) })
@ -487,17 +475,16 @@ const getRegulationTypes = async () => {
} }
} }
// - 稿 // - 使
const getTableData = async () => { const getTableData = async () => {
loading.value = true loading.value = true
try { try {
const response = await regulationApi.getRegulationList({ const response = await regulationApi.getRegulationList({
page: pagination.current, page: pagination.current,
size: pagination.pageSize, size: pagination.pageSize,
status: RegulationStatus.DRAFT, // 稿
title: searchForm.title || undefined, title: searchForm.title || undefined,
createByName: searchForm.createByName || undefined, proposer: searchForm.proposer || undefined,
regulationType: searchForm.regulationType || undefined, type: searchForm.type || undefined,
status: searchForm.status || undefined status: searchForm.status || undefined
}) })
@ -505,34 +492,17 @@ const getTableData = async () => {
tableData.value = response.data.records tableData.value = response.data.records
pagination.total = response.data.total pagination.total = response.data.total
pagination.current = response.data.current pagination.current = response.data.current
//
console.log('当前用户:', currentUser.value)
tableData.value.forEach((item, index) => {
console.log(`提案 ${index + 1}:`, {
title: item.title,
createByName: item.createByName,
status: item.status,
canEdit: item.status === RegulationStatus.DRAFT && item.createByName === currentUser.value
})
})
} else { } else {
Message.error('获取数据失败') Message.error('搜索失败')
} }
} catch (error) { } catch (error) {
console.error('获取制度列表失败:', error) console.error('搜索制度提案失败:', error)
Message.error('获取数据失败') Message.error('搜索失败')
} finally { } finally {
loading.value = false loading.value = false
} }
} }
//
const debouncedSearch = debounce(() => {
pagination.current = 1
getTableData()
}, 300)
// //
const search = () => { const search = () => {
pagination.current = 1 pagination.current = 1
@ -543,8 +513,8 @@ const search = () => {
const reset = () => { const reset = () => {
Object.assign(searchForm, { Object.assign(searchForm, {
title: '', title: '',
createByName: '', proposer: '',
regulationType: '', type: '',
status: '' status: ''
}) })
pagination.current = 1 pagination.current = 1

View File

@ -10,17 +10,15 @@
placeholder="请输入制度标题" placeholder="请输入制度标题"
allow-clear allow-clear
style="width: 200px" style="width: 200px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
<a-form-item label="公示人"> <a-form-item label="公示人">
<a-input <a-input
v-model="searchForm.createByName" v-model="searchForm.proposer"
placeholder="请输入公示人" placeholder="请输入公示人"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@input="debouncedSearch"
/> />
</a-form-item> </a-form-item>
@ -30,7 +28,6 @@
placeholder="请选择状态" placeholder="请选择状态"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch"
> >
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="confirmed">已确认</a-option> <a-option value="confirmed">已确认</a-option>
@ -164,23 +161,14 @@ import { useRegulationStore } from '@/stores/modules/regulation'
import { regulationApi } from '@/apis/regulation' import { regulationApi } from '@/apis/regulation'
import { PDFGenerator } from '@/utils/pdfGenerator' import { PDFGenerator } from '@/utils/pdfGenerator'
//
const debounce = (func: Function, delay: number) => {
let timeoutId: NodeJS.Timeout
return (...args: any[]) => {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => func.apply(null, args), delay)
}
}
defineOptions({ name: 'SystemRegulation' }) defineOptions({ name: 'SystemRegulation' })
// //
const columns = [ const columns = [
{ title: '制度名称', dataIndex: 'title', key: 'title' }, { title: '制度名称', dataIndex: 'title', key: 'title' },
{ title: '制度类型', dataIndex: 'regulationType', key: 'regulationType' }, { title: '制度类型', dataIndex: 'regulationType', key: 'regulationType' },
{ title: '公示人', dataIndex: 'createByName', key: 'createByName' }, { title: '公示人', dataIndex: 'createByName', key: 'createByName' },
{ title: '公示时间', dataIndex: 'publishTime', key: 'publishTime' }, { title: '公示时间', dataIndex: 'publishTime', key: 'publishTime' },
{ title: '生效日期', dataIndex: 'effectiveTime', key: 'effectiveTime' }, { title: '生效日期', dataIndex: 'effectiveTime', key: 'effectiveTime' },
{ title: '确认状态', dataIndex: 'confirmStatus', key: 'confirmStatus', slotName: 'confirmStatus' }, { title: '确认状态', dataIndex: 'confirmStatus', key: 'confirmStatus', slotName: 'confirmStatus' },
{ title: '操作', key: 'operations', slotName: 'operations', width: 250 } { title: '操作', key: 'operations', slotName: 'operations', width: 250 }
@ -201,7 +189,7 @@ const pagination = reactive({
// //
const searchForm = reactive({ const searchForm = reactive({
title: '', title: '',
createByName: '', proposer: '',
confirmStatus: '' confirmStatus: ''
}) })
@ -214,16 +202,16 @@ const agreeTerms = ref(false)
// store // store
const regulationStore = useRegulationStore() const regulationStore = useRegulationStore()
// // - 使
const getTableData = async () => { const getTableData = async () => {
loading.value = true loading.value = true
try { try {
const response = await regulationApi.getPublishedRegulationList({ const response = await regulationApi.getRegulationList({
page: pagination.current, page: pagination.current,
size: pagination.pageSize, size: pagination.pageSize,
status: "PUBLISHED", status: "PUBLISHED",
title: searchForm.title || undefined, title: searchForm.title || undefined,
createByName: searchForm.createByName || undefined, proposer: searchForm.proposer || undefined,
confirmStatus: searchForm.confirmStatus || undefined confirmStatus: searchForm.confirmStatus || undefined
}) })
@ -233,22 +221,16 @@ const getTableData = async () => {
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('搜索失败')
} }
} catch (error) { } catch (error) {
console.error('获取已公示制度列表失败:', error) console.error('搜索已公告制度失败:', error)
Message.error('获取数据失败') Message.error('搜索失败')
} finally { } finally {
loading.value = false loading.value = false
} }
} }
//
const debouncedSearch = debounce(() => {
pagination.current = 1
getTableData()
}, 300)
// //
const search = () => { const search = () => {
pagination.current = 1 pagination.current = 1
@ -259,7 +241,7 @@ const search = () => {
const reset = () => { const reset = () => {
Object.assign(searchForm, { Object.assign(searchForm, {
title: '', title: '',
createByName: '', proposer: '',
confirmStatus: '' confirmStatus: ''
}) })
pagination.current = 1 pagination.current = 1
@ -315,8 +297,6 @@ const handleDownload = async (record: any) => {
} }
} }
// //
const submitConfirm = async () => { const submitConfirm = async () => {
if (!agreeTerms.value) { if (!agreeTerms.value) {

View File

@ -16,23 +16,21 @@
<div class="search-container"> <div class="search-container">
<a-form layout="inline" :model="searchForm" class="search-form"> <a-form layout="inline" :model="searchForm" class="search-form">
<a-form-item label="类型名称"> <a-form-item label="类型名称">
<a-input <a-input
v-model="searchForm.typeName" v-model="searchForm.typeName"
placeholder="请输入类型名称" placeholder="请输入类型名称"
allow-clear allow-clear
style="width: 200px" style="width: 200px"
@input="debouncedSearch" />
/>
</a-form-item> </a-form-item>
<a-form-item label="状态"> <a-form-item label="状态">
<a-select <a-select
v-model="searchForm.isEnabled" v-model="searchForm.status"
placeholder="请选择状态" placeholder="请选择状态"
allow-clear allow-clear
style="width: 150px" style="width: 150px"
@change="debouncedSearch" >
>
<a-option value="">全部</a-option> <a-option value="">全部</a-option>
<a-option value="1">启用</a-option> <a-option value="1">启用</a-option>
<a-option value="0">禁用</a-option> <a-option value="0">禁用</a-option>
@ -40,13 +38,12 @@
</a-form-item> </a-form-item>
<a-form-item label="备注"> <a-form-item label="备注">
<a-input <a-input
v-model="searchForm.remark" v-model="searchForm.remark"
placeholder="请输入备注内容" placeholder="请输入备注内容"
allow-clear allow-clear
style="width: 200px" style="width: 200px"
@input="debouncedSearch" />
/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
@ -153,18 +150,10 @@ import { regulationApi } from '@/apis/regulation'
import { import {
type RegulationType, type RegulationType,
type CreateRegulationTypeRequest, type CreateRegulationTypeRequest,
type UpdateRegulationTypeRequest type UpdateRegulationTypeRequest,
type RegulationTypeSearchRequest
} from '@/apis/regulation/type' } from '@/apis/regulation/type'
//
const debounce = (func: Function, delay: number) => {
let timeoutId: NodeJS.Timeout
return (...args: any[]) => {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => func.apply(null, args), delay)
}
}
defineOptions({ name: 'RegulationType' }) defineOptions({ name: 'RegulationType' })
// //
@ -195,7 +184,7 @@ const pagination = reactive({
// //
const searchForm = reactive({ const searchForm = reactive({
typeName: '', typeName: '',
isEnabled: '', status: '',
remark: '' remark: ''
}) })
@ -222,12 +211,13 @@ const rules = {
const getTableData = async () => { const getTableData = async () => {
loading.value = true loading.value = true
try { try {
const response = await regulationApi.getRegulationTypes({ // 使
const response = await regulationApi.searchRegulationTypes({
page: pagination.current, page: pagination.current,
size: pagination.pageSize, size: pagination.pageSize,
typeName: searchForm.typeName || undefined, typeName: searchForm.typeName || undefined,
isEnabled: searchForm.isEnabled || undefined, status: searchForm.status || undefined,
remark: searchForm.remark || undefined remark: searchForm.remark || undefined,
}) })
if (response.status === 200) { if (response.status === 200) {
@ -235,22 +225,16 @@ const getTableData = async () => {
pagination.total = response.data.total || response.data.length pagination.total = response.data.total || response.data.length
pagination.current = response.data.current || 1 pagination.current = response.data.current || 1
} else { } else {
Message.error('获取数据失败') Message.error('搜索失败')
} }
} catch (error) { } catch (error) {
console.error('获取制度类型列表失败:', error) console.error('搜索制度类型失败:', error)
Message.error('获取数据失败') Message.error('搜索失败')
} finally { } finally {
loading.value = false loading.value = false
} }
} }
//
const debouncedSearch = debounce(() => {
pagination.current = 1
getTableData()
}, 300)
// //
const search = () => { const search = () => {
pagination.current = 1 pagination.current = 1
@ -263,7 +247,7 @@ const search = () => {
const reset = () => { const reset = () => {
Object.assign(searchForm, { Object.assign(searchForm, {
typeName: '', typeName: '',
isEnabled: '', status: '',
remark: '' remark: ''
}) })
pagination.current = 1 pagination.current = 1