fix: 添加交叉评查的案卷类型的查询,动态选择文档类型

This commit is contained in:
2025-12-01 12:36:38 +08:00
parent af258fe669
commit c43485ec27
5 changed files with 30 additions and 16 deletions
+4 -3
View File
@@ -25,6 +25,7 @@ export enum CrossCheckingDocType {
export interface DocumentType {
id: number;
name: string;
code: string;
evaluation_point_groups_ids?: number[];
}
@@ -521,10 +522,10 @@ export async function updateDocumentAuditStatus(id: string, auditStatus: number,
*/
export async function getCrossCheckingDocumentTypes(jwtToken?: string): Promise<ApiResponse<DocumentType[]>> {
try {
console.log('[getCrossCheckingDocumentTypes] 开始获取交叉评查文档类型');
// console.log('[getCrossCheckingDocumentTypes] 开始获取交叉评查文档类型');
const response = await postgrestGet<DocumentType>('document_types',{
select: 'id,name,evaluation_point_groups_ids',
select: 'id,name,code,evaluation_point_groups_ids',
filter: {
evaluation_point_groups_ids: 'not.is.null'
},
@@ -547,7 +548,7 @@ export async function getCrossCheckingDocumentTypes(jwtToken?: string): Promise<
item.evaluation_point_groups_ids.length > 0
);
console.log('[getCrossCheckingDocumentTypes] 获取成功,共', filteredData.length, '个文档类型');
// console.log('[getCrossCheckingDocumentTypes] 获取成功,共', filteredData.length, '个文档类型');
return {
success: true,
+1 -1
View File
@@ -392,7 +392,7 @@ export default function Index() {
aria-label="交叉评查"
>
<img
src="/images/icon_assistant.png"
src="/images/icon_cross@2x.png"
alt="交叉评查"
className="w-12 h-12 mx-1"
onError={(e) => {
+25 -12
View File
@@ -11,14 +11,16 @@ import { Table } from '~/components/ui/Table';
import { FilterPanel, FilterSelect, SearchFilter, DateRangeFilter } from '~/components/ui/FilterPanel';
import { Pagination } from '~/components/ui/Pagination';
import { toastService } from '~/components/ui/Toast';
import {
getCrossCheckingTasks,
import {
getCrossCheckingTasks,
getCrossCheckingStats,
deleteCrossCheckingTask,
getCrossCheckingTaskDetail,
getCrossCheckingDocumentTypes,
type CrossCheckingTask,
type TaskDocument,
type TaskListParams,
type DocumentType,
CrossCheckingTaskStatus,
CrossCheckingTaskType,
CrossCheckingDocType
@@ -51,6 +53,8 @@ export type LoaderData = {
};
initialLoad?: boolean;
frontendJWT?: string; // 新增JWT
documentTypes: DocumentType[]; // 新增:文档类型列表
documentTypesError?: string; // 新增:文档类型加载错误
};
export async function loader({ request }: LoaderFunctionArgs) {
@@ -74,11 +78,12 @@ export async function loader({ request }: LoaderFunctionArgs) {
const { userInfo, frontendJWT } = await getUserSession(request);
// console.log('frontendJWT', frontendJWT);
// 获取任务列表统计数据,传递用户信息和JWT
const [tasksResponse, statsResponse] = await Promise.all([
// 获取任务列表统计数据和文档类型,传递用户信息和JWT
const [tasksResponse, statsResponse, documentTypesResponse] = await Promise.all([
getCrossCheckingTasks(params, userInfo, frontendJWT),
getCrossCheckingStats(userInfo, frontendJWT)
getCrossCheckingStats(userInfo, frontendJWT),
getCrossCheckingDocumentTypes(frontendJWT)
]);
// console.log('tasksResponse', tasksResponse.data?.tasks);
@@ -102,7 +107,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
pageSize: tasksResponse.data?.pageSize || params.pageSize,
totalPages: tasksResponse.data?.totalPages || 0,
stats: statsResponse.data || { totalTasks: 0, pendingTasks: 0, inProgressTasks: 0, completedTasks: 0 },
frontendJWT // 新增:返回JWT给客户端
frontendJWT, // 新增:返回JWT给客户端
documentTypes: documentTypesResponse.success ? documentTypesResponse.data || [] : [], // 新增:返回文档类型列表
documentTypesError: documentTypesResponse.error // 新增:返回文档类型加载错误
}, {
headers: {
"Cache-Control": "max-age=60, s-maxage=180"
@@ -212,7 +219,7 @@ const docTypeConfig = {
export default function CrossCheckingIndex() {
const loaderData = useLoaderData<typeof loader>();
const { tasks, totalCount, currentPage, pageSize, stats, frontendJWT } = loaderData;
const { tasks, totalCount, currentPage, pageSize, stats, frontendJWT, documentTypes, documentTypesError } = loaderData;
const [searchParams, setSearchParams] = useSearchParams();
const dateFrom = searchParams.get('dateFrom') || '';
const dateTo = searchParams.get('dateTo') || '';
@@ -697,10 +704,16 @@ export default function CrossCheckingIndex() {
label="案卷类型"
name="docType"
value={searchParams.get('docType') || ''}
options={[
{ value: CrossCheckingDocType.PENALTY, label: "行政处罚" },
{ value: CrossCheckingDocType.PERMIT, label: "行政许可" }
]}
options={
documentTypesError
? []
: documentTypes && documentTypes.length > 0
? documentTypes.map((docType: DocumentType) => ({
value: docType.code,
label: docType.name
}))
: []
}
onChange={handleFilterChange}
className="mr-4 w-[15%]"
/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB