From 9ae49516b4b039e537a1d26b1cd52d22435ee285 Mon Sep 17 00:00:00 2001 From: yangxiao <3261756395@qq.com> Date: Sun, 28 Dec 2025 19:58:28 +0800 Subject: [PATCH] =?UTF-8?q?flat:=20=E6=8F=90=E4=BA=A4=E7=9F=B3=E6=B2=B3?= =?UTF-8?q?=E5=AD=90=E6=A1=88=E4=BB=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseManagement/index.tsx | 177 ++++++++++ src/services/session.ts | 330 +++++++++--------- .../CaseManagement.d.ts | 49 +++ 3 files changed, 392 insertions(+), 164 deletions(-) create mode 100644 src/pages/CaseManagementAndTracking/CaseManagement/index.tsx create mode 100644 src/types/CaseManagementAndTracking/CaseManagement.d.ts diff --git a/src/pages/CaseManagementAndTracking/CaseManagement/index.tsx b/src/pages/CaseManagementAndTracking/CaseManagement/index.tsx new file mode 100644 index 0000000..34f647a --- /dev/null +++ b/src/pages/CaseManagementAndTracking/CaseManagement/index.tsx @@ -0,0 +1,177 @@ +import React, { Fragment, useRef, useState } from 'react'; +import { Button, FormInstance, message } from 'antd'; +import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; + +export default function CaseManagement() { + const actionRef = useRef(); + const formTableRef = useRef() + + const columns: ProColumns[] = [ + { + title: '序号', + dataIndex: 'storageDate', + valueType: 'text', + render: (_, record, index) => index + 1, + align: 'center', + hideInSearch: true, + }, + { + title: '投诉编号', + dataIndex: 'detectionId', + valueType: 'text', + align: 'center', + }, + { + title: '行业类别', + dataIndex: 'industry', + valueType: 'text', + align: 'center', + }, + { + title: '用工所在地', + dataIndex: 'address', + valueType: 'text', + align: 'center', + hideInSearch: true, + }, + { + title: '投诉单位', + dataIndex: 'unit', + valueType: 'text', + align: 'center', + }, + { + title: '投诉人', + dataIndex: 'websiteName', + valueType: 'text', + align: 'center', + }, + { + title: '投诉人手机号', + dataIndex: 'number', + valueType: 'text', + align: 'center', + }, + { + title: '欠薪人数', + dataIndex: 'wage', + valueType: 'text', + align: 'center', + hideInSearch: true, + }, + { + title: '欠薪金额(万元)', + dataIndex: 'amount', + valueType: 'text', + align: 'center', + hideInSearch: true, + }, + { + title: '欠薪日期', + dataIndex: 'storageDate', + valueType: 'text', + align: 'center', + hideInSearch: true, + }, + { + title: '欠薪区域', + dataIndex: 'wageArrearsArea', + valueType: 'text', + align: 'center', + hideInSearch: true, + ellipsis: true, + }, + { + title: '案件状态', + dataIndex: 'failedReason', + valueType: 'text', + align: 'center', + hideInSearch: true, + }, + { + title: '操作状态', + dataIndex: 'failedReason', + valueType: 'text', + hideInSearch: true, + align: 'center', + }, + // { + // title: '操作', + // hideInSearch: true, + // align: 'center', + // dataIndex: 'detectionId', + // width: 120, + // // render: (detectionId, record) => ( + // //
+ // // + // //
+ // // ), + // }, +]; + + return ( +
+
+ + actionRef={actionRef} + formRef={formTableRef} + rowKey="detectionId" + key="storageDetectionIndex" + columns={columns} + search={{ labelWidth: 'auto' }} + request={async (params) => { + // 模拟 API 响应 + return { + data: [ + { + detectionId: '230', + storageDate: '2023-01-01', + storageDetail: '存储详情1', + failedReason: '正在处理', + industry: '销售', + address: '石河子', + unit: '石河子市水利局‌', + websiteName: '测试1', + number: '1234567890', + wage: '2', + amount: '1111', + wageArrearsArea: '石河子市', + + // ... 其他字段 + }, + { + detectionId: '231', + storageDate: '2023-01-01', + storageDetail: '存储详情1', + failedReason: '正在处理', + industry: '销售', + address: '石河子', + unit: '石河子市水利局‌', + websiteName: '测试1', + number: '1234567890', + wage: '2', + amount: '1111', + wageArrearsArea: '石河子市', + + // ... 其他字段 + }, + ], + total: 2, + success: true, + }; + }} + /> +
+
+ ); +} diff --git a/src/services/session.ts b/src/services/session.ts index f3a947c..b36b4ba 100644 --- a/src/services/session.ts +++ b/src/services/session.ts @@ -1,164 +1,166 @@ -import { createIcon } from '@/utils/IconUtil'; -import { MenuDataItem } from '@ant-design/pro-components'; -import { request } from '@umijs/max'; -import React, { lazy } from 'react'; - - -let remoteMenu: any = null; - -export function getRemoteMenu() { - return remoteMenu; -} - -export function setRemoteMenu(data: any) { - remoteMenu = data; -} - - -function patchRouteItems(route: any, menu: any, parentPath: string) { - for (const menuItem of menu) { - if (menuItem.component === 'Layout' || menuItem.component === 'ParentView') { - if (menuItem.routes) { - let hasItem = false; - let newItem = null; - for (const routeChild of route.routes) { - if (routeChild.path === menuItem.path) { - hasItem = true; - newItem = routeChild; - } - } - if (!hasItem) { - newItem = { - path: menuItem.path, - routes: [], - children: [] - } - route.routes.push(newItem) - } - patchRouteItems(newItem, menuItem.routes, parentPath + menuItem.path + '/'); - } - } else { - const names: string[] = menuItem.component.split('/'); - let path = ''; - names.forEach(name => { - if (path.length > 0) { - path += '/'; - } - if (name !== 'index') { - path += name.at(0)?.toUpperCase() + name.substr(1); - } else { - path += name; - } - }) - if (!path.endsWith('.tsx')) { - path += '.tsx' - } - if (route.routes === undefined) { - route.routes = []; - } - if (route.children === undefined) { - route.children = []; - } - const newRoute = { - element: React.createElement(lazy(() => import('@/pages/' + path))), - path: parentPath + menuItem.path, - } - route.children.push(newRoute); - route.routes.push(newRoute); - } - } -} - -export function patchRouteWithRemoteMenus(routes: any) { - if (remoteMenu === null) { return; } - let proLayout = null; - for (const routeItem of routes) { - if (routeItem.id === 'ant-design-pro-layout') { - proLayout = routeItem; - break; - } - } - patchRouteItems(proLayout, remoteMenu, ''); -} - -/** 获取当前的用户 GET /api/getUserInfo */ -export async function getUserInfo(options?: Record) { - return request('/api/getInfo', { - method: 'GET', - ...(options || {}), - }); -} - -// 刷新方法 -export async function refreshToken() { - return request('/api/auth/refresh', { - method: 'post' - }) -} - -export async function getRouters(): Promise { - return request('/api/getRouters'); -} - -export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { - // childrens = childrens.filter((item) => item.meta !== undefined); - return childrens.map((item: API.RoutersMenuItem) => { - if (!item.meta && item.children?.length) { - item = item.children[0] - } - return { - path: item.path, - icon: item.meta && createIcon(item.meta.icon), - name: item.meta && item.meta.title, - routes: item.children ? convertCompatRouters(item.children) : undefined, - hideChildrenInMenu: item.hidden, - hideInMenu: item.hidden, - component: item.component, - authority: item.perms, - }; - }); -} - -export async function getRoutersInfo(): Promise { - return getRouters().then((res) => { - if (res.code === 200) { - console.log(res.data) - console.log(convertCompatRouters(res.data)) - return convertCompatRouters(res.data); - } else { - return []; - } - }); -} - -export function getMatchMenuItem( - path: string, - menuData: MenuDataItem[] | undefined, -): MenuDataItem[] { - if (!menuData) return []; - let items: MenuDataItem[] = []; - menuData.forEach((item) => { - if (item.path) { - if (item.path === path) { - items.push(item); - return; - } - if (path.length >= item.path?.length) { - const exp = `${item.path}/*`; - if (path.match(exp)) { - if (item.routes) { - const subpath = path.substr(item.path.length + 1); - const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes); - items = items.concat(subItem); - } else { - const paths = path.split('/'); - if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') { - items.push(item); - } - } - } - } - } - }); - return items; -} +import { createIcon } from '@/utils/IconUtil'; +import { MenuDataItem } from '@ant-design/pro-components'; +import { request } from '@umijs/max'; +import React, { lazy } from 'react'; + + +let remoteMenu: any = null; + +export function getRemoteMenu() { + return remoteMenu; +} + +export function setRemoteMenu(data: any) { + remoteMenu = data; +} + + +function patchRouteItems(route: any, menu: any, parentPath: string) { + for (const menuItem of menu) { + console.log(menuItem, 'menuItem') + if (menuItem.component === 'Layout' || menuItem.component === 'ParentView') { + if (menuItem.routes) { + let hasItem = false; + let newItem = null; + for (const routeChild of route.routes) { + if (routeChild.path === menuItem.path) { + hasItem = true; + newItem = routeChild; + } + } + if (!hasItem) { + newItem = { + path: menuItem.path, + routes: [], + children: [] + } + route.routes.push(newItem) + } + patchRouteItems(newItem, menuItem.routes, parentPath + menuItem.path + '/'); + } + } else { + const names: string[] = menuItem.component && menuItem.component.split('/'); + console.log(names, 'names') + let path = ''; + names && names.forEach(name => { + if (path.length > 0) { + path += '/'; + } + if (name !== 'index') { + path += name.at(0)?.toUpperCase() + name.substr(1); + } else { + path += name; + } + }) + if (!path.endsWith('.tsx')) { + path += '.tsx' + } + if (route.routes === undefined) { + route.routes = []; + } + if (route.children === undefined) { + route.children = []; + } + const newRoute = { + element: React.createElement(lazy(() => import('@/pages/' + path))), + path: parentPath + menuItem.path, + } + route.children.push(newRoute); + route.routes.push(newRoute); + } + } +} + +export function patchRouteWithRemoteMenus(routes: any) { + if (remoteMenu === null) { return; } + let proLayout = null; + for (const routeItem of routes) { + if (routeItem.id === 'ant-design-pro-layout') { + proLayout = routeItem; + break; + } + } + patchRouteItems(proLayout, remoteMenu, ''); +} + +/** 获取当前的用户 GET /api/getUserInfo */ +export async function getUserInfo(options?: Record) { + return request('/api/getInfo', { + method: 'GET', + ...(options || {}), + }); +} + +// 刷新方法 +export async function refreshToken() { + return request('/api/auth/refresh', { + method: 'post' + }) +} + +export async function getRouters(): Promise { + return request('/api/getRouters'); +} + +export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { + // childrens = childrens.filter((item) => item.meta !== undefined); + return childrens.map((item: API.RoutersMenuItem) => { + if (!item.meta && item.children?.length) { + item = item.children[0] + } + return { + path: item.path, + icon: item.meta && createIcon(item.meta.icon), + name: item.meta && item.meta.title, + routes: item.children ? convertCompatRouters(item.children) : undefined, + hideChildrenInMenu: item.hidden, + hideInMenu: item.hidden, + component: item.component, + authority: item.perms, + }; + }); +} + +export async function getRoutersInfo(): Promise { + return getRouters().then((res) => { + if (res.code === 200) { + console.log(res.data) + console.log(convertCompatRouters(res.data)) + return convertCompatRouters(res.data); + } else { + return []; + } + }); +} + +export function getMatchMenuItem( + path: string, + menuData: MenuDataItem[] | undefined, +): MenuDataItem[] { + if (!menuData) return []; + let items: MenuDataItem[] = []; + menuData.forEach((item) => { + if (item.path) { + if (item.path === path) { + items.push(item); + return; + } + if (path.length >= item.path?.length) { + const exp = `${item.path}/*`; + if (path.match(exp)) { + if (item.routes) { + const subpath = path.substr(item.path.length + 1); + const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes); + items = items.concat(subItem); + } else { + const paths = path.split('/'); + if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') { + items.push(item); + } + } + } + } + } + }); + return items; +} diff --git a/src/types/CaseManagementAndTracking/CaseManagement.d.ts b/src/types/CaseManagementAndTracking/CaseManagement.d.ts new file mode 100644 index 0000000..12c5264 --- /dev/null +++ b/src/types/CaseManagementAndTracking/CaseManagement.d.ts @@ -0,0 +1,49 @@ +declare namespace API.StorageDetection { + export interface StorageDetailItem { + detailId?: string; + websiteId?: string; + websiteName?: string; + successNumber?: string; + failedNumber?: string; + storageDetail?: string; + storageTime?: string; + } + + export interface StorageItem { + detectionId?: string; + storageDate?: string; + storageNumber?: string; + storageResult?: string; + storageDetail?: string; + websiteId?: string; + websiteName?: string; + details?: StorageDetailItem[]; + } + + export interface AddParams { + storageDate?: string; + storageNumber?: string; + storageResult?: string; + storageDetail?: string; + websiteName?: string; + } + + export interface ListParams { + storageDate?: string; + pageSize?: number; + current?: number; + } + + export interface StorageIdResult { + code: number; + msg: string; + data: StorageItem; + } + + export interface StoragePageResult { + code: number; + msg: string; + total: number; + rows: Array; + } +} \ No newline at end of file