fix: 添加交叉评查的案卷类型的查询,动态选择文档类型
This commit is contained in:
@@ -25,6 +25,7 @@ export enum CrossCheckingDocType {
|
|||||||
export interface DocumentType {
|
export interface DocumentType {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
code: string;
|
||||||
evaluation_point_groups_ids?: number[];
|
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[]>> {
|
export async function getCrossCheckingDocumentTypes(jwtToken?: string): Promise<ApiResponse<DocumentType[]>> {
|
||||||
try {
|
try {
|
||||||
console.log('[getCrossCheckingDocumentTypes] 开始获取交叉评查文档类型');
|
// console.log('[getCrossCheckingDocumentTypes] 开始获取交叉评查文档类型');
|
||||||
|
|
||||||
const response = await postgrestGet<DocumentType>('document_types',{
|
const response = await postgrestGet<DocumentType>('document_types',{
|
||||||
select: 'id,name,evaluation_point_groups_ids',
|
select: 'id,name,code,evaluation_point_groups_ids',
|
||||||
filter: {
|
filter: {
|
||||||
evaluation_point_groups_ids: 'not.is.null'
|
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
|
item.evaluation_point_groups_ids.length > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('[getCrossCheckingDocumentTypes] 获取成功,共', filteredData.length, '个文档类型');
|
// console.log('[getCrossCheckingDocumentTypes] 获取成功,共', filteredData.length, '个文档类型');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ export default function Index() {
|
|||||||
aria-label="交叉评查"
|
aria-label="交叉评查"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="/images/icon_assistant.png"
|
src="/images/icon_cross@2x.png"
|
||||||
alt="交叉评查"
|
alt="交叉评查"
|
||||||
className="w-12 h-12 mx-1"
|
className="w-12 h-12 mx-1"
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ import {
|
|||||||
getCrossCheckingStats,
|
getCrossCheckingStats,
|
||||||
deleteCrossCheckingTask,
|
deleteCrossCheckingTask,
|
||||||
getCrossCheckingTaskDetail,
|
getCrossCheckingTaskDetail,
|
||||||
|
getCrossCheckingDocumentTypes,
|
||||||
type CrossCheckingTask,
|
type CrossCheckingTask,
|
||||||
type TaskDocument,
|
type TaskDocument,
|
||||||
type TaskListParams,
|
type TaskListParams,
|
||||||
|
type DocumentType,
|
||||||
CrossCheckingTaskStatus,
|
CrossCheckingTaskStatus,
|
||||||
CrossCheckingTaskType,
|
CrossCheckingTaskType,
|
||||||
CrossCheckingDocType
|
CrossCheckingDocType
|
||||||
@@ -51,6 +53,8 @@ export type LoaderData = {
|
|||||||
};
|
};
|
||||||
initialLoad?: boolean;
|
initialLoad?: boolean;
|
||||||
frontendJWT?: string; // 新增JWT
|
frontendJWT?: string; // 新增JWT
|
||||||
|
documentTypes: DocumentType[]; // 新增:文档类型列表
|
||||||
|
documentTypesError?: string; // 新增:文档类型加载错误
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function loader({ request }: LoaderFunctionArgs) {
|
export async function loader({ request }: LoaderFunctionArgs) {
|
||||||
@@ -75,10 +79,11 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
|
|
||||||
// console.log('frontendJWT', frontendJWT);
|
// console.log('frontendJWT', frontendJWT);
|
||||||
|
|
||||||
// 获取任务列表和统计数据,传递用户信息和JWT
|
// 获取任务列表、统计数据和文档类型,传递用户信息和JWT
|
||||||
const [tasksResponse, statsResponse] = await Promise.all([
|
const [tasksResponse, statsResponse, documentTypesResponse] = await Promise.all([
|
||||||
getCrossCheckingTasks(params, userInfo, frontendJWT),
|
getCrossCheckingTasks(params, userInfo, frontendJWT),
|
||||||
getCrossCheckingStats(userInfo, frontendJWT)
|
getCrossCheckingStats(userInfo, frontendJWT),
|
||||||
|
getCrossCheckingDocumentTypes(frontendJWT)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// console.log('tasksResponse', tasksResponse.data?.tasks);
|
// console.log('tasksResponse', tasksResponse.data?.tasks);
|
||||||
@@ -102,7 +107,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
pageSize: tasksResponse.data?.pageSize || params.pageSize,
|
pageSize: tasksResponse.data?.pageSize || params.pageSize,
|
||||||
totalPages: tasksResponse.data?.totalPages || 0,
|
totalPages: tasksResponse.data?.totalPages || 0,
|
||||||
stats: statsResponse.data || { totalTasks: 0, pendingTasks: 0, inProgressTasks: 0, completedTasks: 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: {
|
headers: {
|
||||||
"Cache-Control": "max-age=60, s-maxage=180"
|
"Cache-Control": "max-age=60, s-maxage=180"
|
||||||
@@ -212,7 +219,7 @@ const docTypeConfig = {
|
|||||||
|
|
||||||
export default function CrossCheckingIndex() {
|
export default function CrossCheckingIndex() {
|
||||||
const loaderData = useLoaderData<typeof loader>();
|
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 [searchParams, setSearchParams] = useSearchParams();
|
||||||
const dateFrom = searchParams.get('dateFrom') || '';
|
const dateFrom = searchParams.get('dateFrom') || '';
|
||||||
const dateTo = searchParams.get('dateTo') || '';
|
const dateTo = searchParams.get('dateTo') || '';
|
||||||
@@ -697,10 +704,16 @@ export default function CrossCheckingIndex() {
|
|||||||
label="案卷类型"
|
label="案卷类型"
|
||||||
name="docType"
|
name="docType"
|
||||||
value={searchParams.get('docType') || ''}
|
value={searchParams.get('docType') || ''}
|
||||||
options={[
|
options={
|
||||||
{ value: CrossCheckingDocType.PENALTY, label: "行政处罚" },
|
documentTypesError
|
||||||
{ value: CrossCheckingDocType.PERMIT, label: "行政许可" }
|
? []
|
||||||
]}
|
: documentTypes && documentTypes.length > 0
|
||||||
|
? documentTypes.map((docType: DocumentType) => ({
|
||||||
|
value: docType.code,
|
||||||
|
label: docType.name
|
||||||
|
}))
|
||||||
|
: []
|
||||||
|
}
|
||||||
onChange={handleFilterChange}
|
onChange={handleFilterChange}
|
||||||
className="mr-4 w-[15%]"
|
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 |
Reference in New Issue
Block a user