diff --git a/BACKEND_SEARCH_API.md b/BACKEND_SEARCH_API.md new file mode 100644 index 0000000..6f72e1b --- /dev/null +++ b/BACKEND_SEARCH_API.md @@ -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**: 备注内容,支持模糊搜索 + diff --git a/REGULATION_ANNOUNCEMENT_SEARCH_API.md b/REGULATION_ANNOUNCEMENT_SEARCH_API.md new file mode 100644 index 0000000..600d403 --- /dev/null +++ b/REGULATION_ANNOUNCEMENT_SEARCH_API.md @@ -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**: 待确认 - 用户尚未确认知晓该制度 +- 空值: 全部 - 显示所有确认状态的制度 \ No newline at end of file diff --git a/REGULATION_DISPLAY_SEARCH_API.md b/REGULATION_DISPLAY_SEARCH_API.md new file mode 100644 index 0000000..a2d600f --- /dev/null +++ b/REGULATION_DISPLAY_SEARCH_API.md @@ -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'` 的提案 +- 前端不再需要手动过滤,完全依赖后端处理 \ No newline at end of file diff --git a/REGULATION_PROPOSAL_SEARCH_API.md b/REGULATION_PROPOSAL_SEARCH_API.md new file mode 100644 index 0000000..add5ee1 --- /dev/null +++ b/REGULATION_PROPOSAL_SEARCH_API.md @@ -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 字段精确匹配 +- **分页查询**:支持分页和排序 +- **性能优化**:使用数据库索引提升查询性能 \ No newline at end of file diff --git a/src/apis/regulation/index.ts b/src/apis/regulation/index.ts index 4ec6810..8a3bacb 100644 --- a/src/apis/regulation/index.ts +++ b/src/apis/regulation/index.ts @@ -1,12 +1,22 @@ import http from '@/utils/http' +import { + type RegulationTypeSearchRequest, + type RegulationTypeSearchResponse, + type RegulationProposalSearchRequest, + type RegulationProposalSearchResponse +} from './type' // 制度管理API接口 export const regulationApi = { // 获取制度列表 getRegulationList: (params: { - page: number - size: number - }) => { + page?: number + size?: number + status?: string + type?: string + title?: string + proposer?: string + }): Promise => { return http.get('/regulation', params) }, @@ -62,12 +72,12 @@ export const regulationApi = { return http.post(`/regulation/${regulationId}/confirm`) }, - // 获取制度类型列表 - getRegulationTypes: (params?: { + // 搜索制度类型(后端搜索接口) + searchRegulationTypes: (params: { page?: number size?: number typeName?: string - isEnabled?: string + status?: string remark?: string }) => { return http.get('/regulation/types', params) diff --git a/src/apis/regulation/type.ts b/src/apis/regulation/type.ts index 9e1f7a7..1444879 100644 --- a/src/apis/regulation/type.ts +++ b/src/apis/regulation/type.ts @@ -81,4 +81,41 @@ export interface UpdateRegulationTypeRequest { sortOrder?: number isEnabled?: 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 } \ No newline at end of file diff --git a/src/views/regulation/confirm.vue b/src/views/regulation/confirm.vue index fac5923..3fedb0e 100644 --- a/src/views/regulation/confirm.vue +++ b/src/views/regulation/confirm.vue @@ -10,27 +10,24 @@ placeholder="请输入提案标题" allow-clear style="width: 200px" - @input="debouncedSearch" /> 全部 管理规范 @@ -46,7 +43,6 @@ placeholder="请选择状态" allow-clear style="width: 150px" - @change="debouncedSearch" > 全部 已公示 @@ -112,12 +108,6 @@ - - - - - - { - let timeoutId: NodeJS.Timeout - return (...args: any[]) => { - clearTimeout(timeoutId) - timeoutId = setTimeout(() => func.apply(null, args), delay) - } -} - defineOptions({ name: 'ProcessManagement' }) // 表格列定义 @@ -201,8 +182,8 @@ const columns = [ // 搜索表单 const searchForm = reactive({ title: '', - createByName: '', - regulationType: '', + proposer: '', + type: '', status: '' }) @@ -283,7 +264,7 @@ const getLevelText = (level: RegulationLevel) => { return texts[level] || '中' } -// 获取表格数据 - 只获取已公示及以上的提案 +// 获取表格数据 - 使用后端搜索接口 const getTableData = async () => { loading.value = true try { @@ -291,34 +272,26 @@ const getTableData = async () => { page: pagination.current, size: pagination.pageSize, title: searchForm.title || undefined, - createByName: searchForm.createByName || undefined, - regulationType: searchForm.regulationType || undefined, + proposer: searchForm.proposer || undefined, + type: searchForm.type || undefined, status: searchForm.status || undefined }) if (response.status === 200) { - // 过滤掉草稿状态的提案,只显示已公示及以上的 - const allRecords = response.data.records || [] - tableData.value = allRecords.filter(item => item.status !== RegulationStatus.DRAFT) - pagination.total = tableData.value.length + tableData.value = response.data.records + pagination.total = response.data.total pagination.current = response.data.current } else { - Message.error('获取数据失败') + Message.error('搜索失败') } } catch (error) { - console.error('获取制度列表失败:', error) - Message.error('获取数据失败') + console.error('搜索制度公示失败:', error) + Message.error('搜索失败') } finally { loading.value = false } } -// 防抖搜索函数 -const debouncedSearch = debounce(() => { - pagination.current = 1 - getTableData() -}, 300) - // 搜索 const search = () => { pagination.current = 1 @@ -329,8 +302,8 @@ const search = () => { const reset = () => { Object.assign(searchForm, { title: '', - createByName: '', - regulationType: '', + proposer: '', + type: '', status: '' }) pagination.current = 1 @@ -406,8 +379,6 @@ onMounted(() => { } } - - .proposal-detail { .detail-header { margin-bottom: 16px; @@ -443,8 +414,6 @@ onMounted(() => { } } - - .detail-footer { display: flex; gap: 12px; diff --git a/src/views/regulation/proposal/index.vue b/src/views/regulation/proposal/index.vue index 5dff23c..6b16543 100644 --- a/src/views/regulation/proposal/index.vue +++ b/src/views/regulation/proposal/index.vue @@ -19,27 +19,24 @@ placeholder="请输入提案标题" allow-clear style="width: 200px" - @input="debouncedSearch" /> 全部 管理规范 @@ -55,7 +52,6 @@ placeholder="请选择状态" allow-clear style="width: 150px" - @change="debouncedSearch" > 全部 草稿 @@ -335,18 +331,10 @@ import { RegulationStatus, RegulationLevel, type Regulation, - type RegulationType + type RegulationType, + type RegulationProposalSearchRequest } 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' }) // 表格列定义 @@ -363,8 +351,8 @@ const columns = [ // 搜索表单 const searchForm = reactive({ title: '', - createByName: '', - regulationType: '', + proposer: '', + type: '', status: '' }) @@ -487,17 +475,16 @@ const getRegulationTypes = async () => { } } -// 获取表格数据 - 只获取草稿状态的提案 +// 获取表格数据 - 使用后端搜索接口 const getTableData = async () => { loading.value = true try { const response = await regulationApi.getRegulationList({ page: pagination.current, size: pagination.pageSize, - status: RegulationStatus.DRAFT, // 只获取草稿状态的提案 title: searchForm.title || undefined, - createByName: searchForm.createByName || undefined, - regulationType: searchForm.regulationType || undefined, + proposer: searchForm.proposer || undefined, + type: searchForm.type || undefined, status: searchForm.status || undefined }) @@ -505,34 +492,17 @@ const getTableData = async () => { tableData.value = response.data.records pagination.total = response.data.total 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 { - Message.error('获取数据失败') + Message.error('搜索失败') } } catch (error) { - console.error('获取制度列表失败:', error) - Message.error('获取数据失败') + console.error('搜索制度提案失败:', error) + Message.error('搜索失败') } finally { loading.value = false } } -// 防抖搜索函数 -const debouncedSearch = debounce(() => { - pagination.current = 1 - getTableData() -}, 300) - // 搜索 const search = () => { pagination.current = 1 @@ -543,8 +513,8 @@ const search = () => { const reset = () => { Object.assign(searchForm, { title: '', - createByName: '', - regulationType: '', + proposer: '', + type: '', status: '' }) pagination.current = 1 diff --git a/src/views/regulation/repository.vue b/src/views/regulation/repository.vue index 2f7b1ee..e503b6f 100644 --- a/src/views/regulation/repository.vue +++ b/src/views/regulation/repository.vue @@ -10,17 +10,15 @@ placeholder="请输入制度标题" allow-clear style="width: 200px" - @input="debouncedSearch" /> @@ -30,7 +28,6 @@ placeholder="请选择状态" allow-clear style="width: 150px" - @change="debouncedSearch" > 全部 已确认 @@ -164,23 +161,14 @@ import { useRegulationStore } from '@/stores/modules/regulation' import { regulationApi } from '@/apis/regulation' 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' }) // 表格列定义 const columns = [ { title: '制度名称', dataIndex: 'title', key: 'title' }, { title: '制度类型', dataIndex: 'regulationType', key: 'regulationType' }, - { title: '公示人', dataIndex: 'createByName', key: 'createByName' }, - { title: '公示时间', dataIndex: 'publishTime', key: 'publishTime' }, + { title: '公示人', dataIndex: 'createByName', key: 'createByName' }, + { title: '公示时间', dataIndex: 'publishTime', key: 'publishTime' }, { title: '生效日期', dataIndex: 'effectiveTime', key: 'effectiveTime' }, { title: '确认状态', dataIndex: 'confirmStatus', key: 'confirmStatus', slotName: 'confirmStatus' }, { title: '操作', key: 'operations', slotName: 'operations', width: 250 } @@ -201,7 +189,7 @@ const pagination = reactive({ // 搜索表单 const searchForm = reactive({ title: '', - createByName: '', + proposer: '', confirmStatus: '' }) @@ -214,16 +202,16 @@ const agreeTerms = ref(false) // 制度管理store const regulationStore = useRegulationStore() -// 获取表格数据 +// 获取表格数据 - 使用后端搜索接口 const getTableData = async () => { loading.value = true try { - const response = await regulationApi.getPublishedRegulationList({ + const response = await regulationApi.getRegulationList({ page: pagination.current, size: pagination.pageSize, status: "PUBLISHED", title: searchForm.title || undefined, - createByName: searchForm.createByName || undefined, + proposer: searchForm.proposer || undefined, confirmStatus: searchForm.confirmStatus || undefined }) @@ -233,22 +221,16 @@ const getTableData = async () => { pagination.current = response.data.current pagination.total = response.data.total } else { - Message.error('获取数据失败') + Message.error('搜索失败') } } catch (error) { - console.error('获取已公示制度列表失败:', error) - Message.error('获取数据失败') + console.error('搜索已公告制度失败:', error) + Message.error('搜索失败') } finally { loading.value = false } } -// 防抖搜索函数 -const debouncedSearch = debounce(() => { - pagination.current = 1 - getTableData() -}, 300) - // 搜索 const search = () => { pagination.current = 1 @@ -259,7 +241,7 @@ const search = () => { const reset = () => { Object.assign(searchForm, { title: '', - createByName: '', + proposer: '', confirmStatus: '' }) pagination.current = 1 @@ -315,8 +297,6 @@ const handleDownload = async (record: any) => { } } - - // 提交确认 const submitConfirm = async () => { if (!agreeTerms.value) { diff --git a/src/views/regulation/type/index.vue b/src/views/regulation/type/index.vue index 537dc37..4c3b2c0 100644 --- a/src/views/regulation/type/index.vue +++ b/src/views/regulation/type/index.vue @@ -16,23 +16,21 @@
- + - + 全部 启用 禁用 @@ -40,13 +38,12 @@ - + @@ -153,18 +150,10 @@ import { regulationApi } from '@/apis/regulation' import { type RegulationType, type CreateRegulationTypeRequest, - type UpdateRegulationTypeRequest + type UpdateRegulationTypeRequest, + type RegulationTypeSearchRequest } 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' }) // 表格列定义 @@ -195,7 +184,7 @@ const pagination = reactive({ // 查询表单 const searchForm = reactive({ typeName: '', - isEnabled: '', + status: '', remark: '' }) @@ -222,12 +211,13 @@ const rules = { const getTableData = async () => { loading.value = true try { - const response = await regulationApi.getRegulationTypes({ + // 使用后端搜索接口 + const response = await regulationApi.searchRegulationTypes({ page: pagination.current, size: pagination.pageSize, typeName: searchForm.typeName || undefined, - isEnabled: searchForm.isEnabled || undefined, - remark: searchForm.remark || undefined + status: searchForm.status || undefined, + remark: searchForm.remark || undefined, }) if (response.status === 200) { @@ -235,22 +225,16 @@ const getTableData = async () => { pagination.total = response.data.total || response.data.length pagination.current = response.data.current || 1 } else { - Message.error('获取数据失败') + Message.error('搜索失败') } } catch (error) { - console.error('获取制度类型列表失败:', error) - Message.error('获取数据失败') + console.error('搜索制度类型失败:', error) + Message.error('搜索失败') } finally { loading.value = false } } -// 防抖搜索函数 -const debouncedSearch = debounce(() => { - pagination.current = 1 - getTableData() -}, 300) - // 搜索 const search = () => { pagination.current = 1 @@ -263,7 +247,7 @@ const search = () => { const reset = () => { Object.assign(searchForm, { typeName: '', - isEnabled: '', + status: '', remark: '' }) pagination.current = 1