统计分析新增

This commit is contained in:
yy
2025-05-26 11:28:13 +08:00
parent 6ce4e857ab
commit 7e8d7d3409
9 changed files with 905 additions and 596 deletions

View File

@@ -1,159 +1,159 @@
// https://umijs.org/config/ // https://umijs.org/config/
import { defineConfig } from '@umijs/max'; import { defineConfig } from '@umijs/max';
import { join } from 'path'; import { join } from 'path';
import defaultSettings from './defaultSettings'; import defaultSettings from './defaultSettings';
import proxy from './proxy'; import proxy from './proxy';
import routes from './routes'; import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env; const { REACT_APP_ENV = 'dev' } = process.env;
export default defineConfig({ export default defineConfig({
/** /**
* @name 开启 hash 模式 * @name 开启 hash 模式
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。 * @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
* @doc https://umijs.org/docs/api/config#hash * @doc https://umijs.org/docs/api/config#hash
*/ */
hash: true, hash: true,
/** /**
* @name 兼容性设置 * @name 兼容性设置
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖 * @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
* @doc https://umijs.org/docs/api/config#targets * @doc https://umijs.org/docs/api/config#targets
*/ */
// targets: { // targets: {
// ie: 11, // ie: 11,
// }, // },
/** /**
* @name 路由的配置,不在路由中引入的文件不会编译 * @name 路由的配置,不在路由中引入的文件不会编译
* @description 只支持 pathcomponentroutesredirectwrapperstitle 的配置 * @description 只支持 pathcomponentroutesredirectwrapperstitle 的配置
* @doc https://umijs.org/docs/guides/routes * @doc https://umijs.org/docs/guides/routes
*/ */
// umi routes: https://umijs.org/docs/routing // umi routes: https://umijs.org/docs/routing
routes, routes,
/** /**
* @name 主题的配置 * @name 主题的配置
* @description 虽然叫主题,但是其实只是 less 的变量设置 * @description 虽然叫主题,但是其实只是 less 的变量设置
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn * @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
* @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme * @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme
*/ */
theme: { theme: {
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
// 只有设置为 variable 才能使用 configProvide 动态设置主色调 // 只有设置为 variable 才能使用 configProvide 动态设置主色调
'root-entry-name': 'variable', 'root-entry-name': 'variable',
}, },
/** /**
* @name moment 的国际化配置 * @name moment 的国际化配置
* @description 如果对国际化没有要求打开之后能减少js的包大小 * @description 如果对国际化没有要求打开之后能减少js的包大小
* @doc https://umijs.org/docs/api/config#ignoremomentlocale * @doc https://umijs.org/docs/api/config#ignoremomentlocale
*/ */
ignoreMomentLocale: true, ignoreMomentLocale: true,
/** /**
* @name 代理配置 * @name 代理配置
* @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了 * @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了
* @see 要注意以下 代理只能在本地开发时使用build 之后就无法使用了。 * @see 要注意以下 代理只能在本地开发时使用build 之后就无法使用了。
* @doc 代理介绍 https://umijs.org/docs/guides/proxy * @doc 代理介绍 https://umijs.org/docs/guides/proxy
* @doc 代理配置 https://umijs.org/docs/api/config#proxy * @doc 代理配置 https://umijs.org/docs/api/config#proxy
*/ */
proxy: proxy[REACT_APP_ENV as keyof typeof proxy], proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
/** /**
* @name 快速热更新配置 * @name 快速热更新配置
* @description 一个不错的热更新组件,更新时可以保留 state * @description 一个不错的热更新组件,更新时可以保留 state
*/ */
fastRefresh: true, fastRefresh: true,
//============== 以下都是max的插件配置 =============== //============== 以下都是max的插件配置 ===============
/** /**
* @name 数据流插件 * @name 数据流插件
* @@doc https://umijs.org/docs/max/data-flow * @@doc https://umijs.org/docs/max/data-flow
*/ */
model: {}, model: {},
/** /**
* 一个全局的初始数据流,可以用它在插件之间共享数据 * 一个全局的初始数据流,可以用它在插件之间共享数据
* @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。 * @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。
* @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81 * @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81
*/ */
initialState: {}, initialState: {},
/** /**
* @name layout 插件 * @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu * @doc https://umijs.org/docs/max/layout-menu
*/ */
title: '青岛智慧就业服务系统', title: '青岛智慧就业服务系统',
layout: { layout: {
locale: false, locale: false,
...defaultSettings, ...defaultSettings,
}, },
/** /**
* @name moment2dayjs 插件 * @name moment2dayjs 插件
* @description 将项目中的 moment 替换为 dayjs * @description 将项目中的 moment 替换为 dayjs
* @doc https://umijs.org/docs/max/moment2dayjs * @doc https://umijs.org/docs/max/moment2dayjs
*/ */
moment2dayjs: { moment2dayjs: {
preset: 'antd', preset: 'antd',
plugins: ['duration'], plugins: ['duration'],
}, },
/** /**
* @name 国际化插件 * @name 国际化插件
* @doc https://umijs.org/docs/max/i18n * @doc https://umijs.org/docs/max/i18n
*/ */
locale: { locale: {
// default zh-CN // default zh-CN
default: 'zh-CN', default: 'zh-CN',
antd: false, antd: false,
// default true, when it is true, will use `navigator.language` overwrite default // default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: false, baseNavigator: false,
}, },
/** /**
* @name antd 插件 * @name antd 插件
* @description 内置了 babel import 插件 * @description 内置了 babel import 插件
* @doc https://umijs.org/docs/max/antd#antd * @doc https://umijs.org/docs/max/antd#antd
*/ */
antd: {}, antd: {},
/** /**
* @name 网络请求配置 * @name 网络请求配置
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。 * @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
* @doc https://umijs.org/docs/max/request * @doc https://umijs.org/docs/max/request
*/ */
request: {}, request: {},
/** /**
* @name 权限插件 * @name 权限插件
* @description 基于 initialState 的权限插件,必须先打开 initialState * @description 基于 initialState 的权限插件,必须先打开 initialState
* @doc https://umijs.org/docs/max/access * @doc https://umijs.org/docs/max/access
*/ */
access: {}, access: {},
/** /**
* @name <head> 中额外的 script * @name <head> 中额外的 script
* @description 配置 <head> 中额外的 script * @description 配置 <head> 中额外的 script
*/ */
headScripts: [ headScripts: [
// 解决首次加载时白屏的问题 // 解决首次加载时白屏的问题
{ src: '/qingdao/scripts/loading.js', async: true }, { src: '/qingdao/scripts/loading.js', async: true },
], ],
//================ pro 插件配置 ================= //================ pro 插件配置 =================
presets: ['umi-presets-pro'], presets: ['umi-presets-pro'],
/** /**
* @name openAPI 插件的配置 * @name openAPI 插件的配置
* @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码 * @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码
* @doc https://pro.ant.design/zh-cn/docs/openapi/ * @doc https://pro.ant.design/zh-cn/docs/openapi/
*/ */
openAPI: [ openAPI: [
{ {
requestLibPath: "import { request } from '@umijs/max'", requestLibPath: "import { request } from '@umijs/max'",
// 或者使用在线的版本 // 或者使用在线的版本
// schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json" // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
schemaPath: join(__dirname, 'oneapi.json'), schemaPath: join(__dirname, 'oneapi.json'),
mock: false, mock: false,
}, },
{ {
requestLibPath: "import { request } from '@umijs/max'", requestLibPath: "import { request } from '@umijs/max'",
schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json', schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
projectName: 'swagger', projectName: 'swagger',
}, },
], ],
mfsu: { mfsu: {
strategy: 'normal', strategy: 'normal',
}, },
outputPath: 'qingdao', outputPath: 'qingdao',
base: '/qingdao/', base: '/qingdao/',
publicPath: '/qingdao/', publicPath: '/qingdao/',
esbuildMinifyIIFE: true, esbuildMinifyIIFE: true,
requestRecord: {}, requestRecord: {},
}); });

View File

@@ -1,119 +1,120 @@
/** /**
* @name umi 的路由配置 * @name umi 的路由配置
* @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置 * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
* @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。 * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
* @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。 * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
* @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。 * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
* @param redirect 配置路由跳转 * @param redirect 配置路由跳转
* @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验 * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
* @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login则读取 menu.ts 中 menu.login 的取值作为标题 * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login则读取 menu.ts 中 menu.login 的取值作为标题
* @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
* @doc https://umijs.org/docs/guides/routes * @doc https://umijs.org/docs/guides/routes
*/ */
export default [ export default [
{ {
path: '/', path: '/',
redirect: '/account/center', redirect: '/account/center',
}, },
{ {
path: '*', path: '*',
layout: false, layout: false,
component: './404', component: './404',
}, },
{ {
path: '/user', path: '/user',
layout: false, layout: false,
routes: [ routes: [
{ {
name: 'login', name: 'login',
path: '/user/login', path: '/user/login',
component: './User/Login', component: './User/Login',
}, },
], ],
}, },
{ {
path: '/account', path: '/account',
routes: [ routes: [
{ {
name: 'acenter', name: 'acenter',
path: '/account/center', path: '/account/center',
component: './User/Center', component: './User/Center',
}, },
{ {
name: 'asettings', name: 'asettings',
path: '/account/settings', path: '/account/settings',
component: './User/Settings', component: './User/Settings',
}, },
], ],
}, },
{ {
name: 'area', name: 'area',
path: '/area', path: '/area',
routes: [ routes: [
{ {
name: '字典数据', name: '字典数据',
path: '/area/updata-router/index/:id', path: '/area/updata-router/index/:id',
component: './Area/Subway/UpLine', component: './Area/Subway/UpLine',
}, },
], ],
}, },
{ {
name: 'management', name: 'management',
path: '/management', path: '/management',
routes: [ routes: [
{ {
name: '字典数据', name: '字典数据',
path: '/management/see-matching/index/:id', path: '/management/see-matching/index/:id',
component: './Management/List/SeeMatching', component: './Management/List/SeeMatching',
}, },
], ],
}, },
{ {
name: 'system', name: 'system',
path: '/system', path: '/system',
routes: [ routes: [
{ {
name: '字典数据', name: '字典数据',
path: '/system/dict-data/index/:id', path: '/system/dict-data/index/:id',
component: './System/DictData', component: './System/DictData',
}, },
{ {
name: '字典数据', name: '字典数据',
path: '/system/admin-dict-data/index/:id', path: '/system/admin-dict-data/index/:id',
component: './System/AdminDictData', component: './System/AdminDictData',
}, },
{ {
name: '分配用户', name: '分配用户',
path: '/system/role-auth/user/:id', path: '/system/role-auth/user/:id',
component: './System/Role/authUser', component: './System/Role/authUser',
}, },
], ],
}, },
{ {
name: 'monitor', name: 'monitor',
path: '/monitor', path: '/monitor',
routes: [ routes: [
{ {
name: '任务日志', name: '任务日志',
path: '/monitor/job-log/index/:id', path: '/monitor/job-log/index/:id',
component: './Monitor/JobLog', component: './Monitor/JobLog',
}, },
], ],
}, },
{ {
name: 'tool', name: 'tool',
path: '/tool', path: '/tool',
routes: [ routes: [
{ {
name: '导入表', name: '导入表',
path: '/tool/gen/import', path: '/tool/gen/import',
component: './Tool/Gen/import', component: './Tool/Gen/import',
}, },
{ {
name: '编辑表', name: '编辑表',
path: '/tool/gen/edit.tsx', path: '/tool/gen/edit.tsx',
component: './Tool/Gen/edit.tsx', component: './Tool/Gen/edit.tsx',
}, },
], ],
}, },
];
];

View File

@@ -1,145 +1,146 @@
{ {
"name": "ant-design-pro", "name": "ant-design-pro",
"version": "6.0.0", "version": "6.0.0",
"private": true, "private": true,
"description": "An out-of-box UI solution for enterprise applications", "description": "An out-of-box UI solution for enterprise applications",
"scripts": { "scripts": {
"dev": "npm run start:dev", "dev": "npm run start:dev",
"build": "max build", "build": "max build",
"deploy": "npm run build && npm run gh-pages", "deploy": "npm run build && npm run gh-pages",
"preview": "npm run build && max preview --port 8000", "preview": "npm run build && max preview --port 8000",
"serve": "umi-serve", "serve": "umi-serve",
"start": "cross-env UMI_ENV=dev max dev", "start": "cross-env UMI_ENV=dev max dev",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev",
"start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev", "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
"start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
"start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev", "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev",
"test": "jest", "test": "jest",
"test:coverage": "npm run jest -- --coverage", "test:coverage": "npm run jest -- --coverage",
"test:update": "npm run jest -- -u", "test:update": "npm run jest -- -u",
"docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./", "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
"docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build", "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up", "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro", "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
"docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro", "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
"analyze": "cross-env ANALYZE=1 max build", "analyze": "cross-env ANALYZE=1 max build",
"gh-pages": "gh-pages -d dist", "gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write", "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "max setup", "postinstall": "max setup",
"jest": "jest", "jest": "jest",
"lint": "npm run lint:js && npm run lint:prettier && npm run tsc", "lint": "npm run lint:js && npm run lint:prettier && npm run tsc",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"openapi": "max openapi", "openapi": "max openapi",
"prepare": "cd .. && husky install", "prepare": "cd .. && husky install",
"prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"tsc": "tsc --noEmit", "tsc": "tsc --noEmit",
"record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login" "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login"
}, },
"lint-staged": { "lint-staged": {
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
"**/*.{js,jsx,tsx,ts,less,md,json}": [ "**/*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write" "prettier --write"
] ]
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"not ie <= 10" "not ie <= 10"
], ],
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/icons": "^5.5.0", "@ant-design/charts": "^2.3.0",
"@ant-design/plots": "^2.3.2", "@ant-design/icons": "^5.5.0",
"@ant-design/pro-components": "^2.7.19", "@ant-design/plots": "^2.3.2",
"@ant-design/use-emotion-css": "1.0.4", "@ant-design/pro-components": "^2.8.7",
"@testing-library/dom": "^10.4.0", "@ant-design/use-emotion-css": "1.0.4",
"@umijs/route-utils": "^4.0.1", "@testing-library/dom": "^10.4.0",
"ant-design-pro": "file:", "@umijs/route-utils": "^4.0.1",
"antd": "^5.21.1", "ant-design-pro": "file:",
"antd-style": "^3.6.2", "antd": "^5.21.1",
"classnames": "^2.5.1", "antd-style": "^3.6.2",
"dayjs": "^1.11.13", "classnames": "^2.5.1",
"echarts": "^5.6.0", "dayjs": "^1.11.13",
"fabric": "^6.4.0", "echarts": "^5.6.0",
"highlight.js": "^11.10.0", "fabric": "^6.4.0",
"lodash": "^4.17.21", "highlight.js": "^11.10.0",
"moment": "^2.30.1", "lodash": "^4.17.21",
"omit.js": "^2.0.2", "moment": "^2.30.1",
"query-string": "^9.1.0", "omit.js": "^2.0.2",
"rc-menu": "^9.15.0", "query-string": "^9.1.0",
"rc-util": "^5.43.0", "rc-menu": "^9.15.0",
"react": "^18.3.0", "rc-util": "^5.43.0",
"react-cropper": "^2.3.3", "react": "^18.3.0",
"react-dev-inspector": "^2.0.1", "react-cropper": "^2.3.3",
"react-dom": "^18.3.0", "react-dev-inspector": "^2.0.1",
"react-helmet-async": "^2.0.0", "react-dom": "^18.3.0",
"react-highlight": "^0.15.0" "react-helmet-async": "^2.0.0",
}, "react-highlight": "^0.15.0"
"devDependencies": { },
"@ant-design/pro-cli": "^3.3.0", "devDependencies": {
"@testing-library/react": "^16.0.1", "@ant-design/pro-cli": "^3.3.0",
"@types/classnames": "^2.3.1", "@testing-library/react": "^16.0.1",
"@types/express": "^4.17.21", "@types/classnames": "^2.3.1",
"@types/history": "^4.7.11", "@types/express": "^4.17.21",
"@types/jest": "^29.5.12", "@types/history": "^4.7.11",
"@types/lodash": "^4.17.4", "@types/jest": "^29.5.12",
"@types/react": "^18.3.0", "@types/lodash": "^4.17.4",
"@types/react-dom": "^18.3.0", "@types/react": "^18.3.0",
"@types/react-helmet": "^6.1.11", "@types/react-dom": "^18.3.0",
"@umijs/fabric": "^2.14.1", "@types/react-helmet": "^6.1.11",
"@umijs/lint": "^4.2.9", "@umijs/fabric": "^2.14.1",
"@umijs/max": "^4.2.9", "@umijs/lint": "^4.2.9",
"cross-env": "^7.0.3", "@umijs/max": "^4.2.9",
"eslint": "^9.11.0", "cross-env": "^7.0.3",
"express": "^4.21.0", "eslint": "^9.11.0",
"gh-pages": "^6.1.0", "express": "^4.21.0",
"husky": "^9.1.3", "gh-pages": "^6.1.0",
"jest": "^29.7.0", "husky": "^9.1.3",
"jest-environment-jsdom": "^29.7.0", "jest": "^29.7.0",
"lint-staged": "^15.2.0", "jest-environment-jsdom": "^29.7.0",
"mockjs": "^1.1.0", "lint-staged": "^15.2.0",
"prettier": "^3.3.0", "mockjs": "^1.1.0",
"swagger-ui-dist": "^5.17.14", "prettier": "^3.3.0",
"ts-node": "^10.9.1", "swagger-ui-dist": "^5.17.14",
"typescript": "^5.6.2", "ts-node": "^10.9.1",
"umi-presets-pro": "^2.0.0" "typescript": "^5.6.2",
}, "umi-presets-pro": "^2.0.0"
"engines": { },
"node": ">=12.0.0" "engines": {
}, "node": ">=12.0.0"
"create-umi": { },
"ignoreScript": [ "create-umi": {
"docker*", "ignoreScript": [
"functions*", "docker*",
"site", "functions*",
"generateMock" "site",
], "generateMock"
"ignoreDependencies": [ ],
"netlify*", "ignoreDependencies": [
"serverless" "netlify*",
], "serverless"
"ignore": [ ],
".dockerignore", "ignore": [
".git", ".dockerignore",
".github", ".git",
".gitpod.yml", ".github",
"CODE_OF_CONDUCT.md", ".gitpod.yml",
"Dockerfile", "CODE_OF_CONDUCT.md",
"Dockerfile.*", "Dockerfile",
"lambda", "Dockerfile.*",
"LICENSE", "lambda",
"netlify.toml", "LICENSE",
"README.*.md", "netlify.toml",
"azure-pipelines.yml", "README.*.md",
"docker", "azure-pipelines.yml",
"CNAME", "docker",
"create-umi" "CNAME",
] "create-umi"
} ]
} }
}

View File

@@ -20,24 +20,14 @@ body,
.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed { .ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed {
left: unset; left: unset;
} }
.ant-table-cell .ant-table-row-expand-icon {
vertical-align: middle;
margin-right: 8px;
}
.ant-table-row { .ant-table-row {
&-level-0 .ant-table-cell:first-child {
padding-left: 16px !important;
}
&-level-1 .ant-table-cell:first-child { &-level-1 .ant-table-cell:first-child {
padding-left: 40px !important; padding-left: 24px !important;
} }
&-level-2 .ant-table-cell:first-child { &-level-2 .ant-table-cell:first-child {
padding-left: 64px !important; padding-left: 48px !important;
} }
} // 可根据需要添加更多层级
.ant-table-row .ant-table-cell:first-child {
display: flex;
align-items: center;
} }
.ant-table-row-level-2 .ant-table-row-expand-icon { .ant-table-row-level-2 .ant-table-row-expand-icon {
display: none; display: none;
@@ -74,4 +64,4 @@ ol {
} }
} }
} }
} }

View File

@@ -0,0 +1,289 @@
import React, { useEffect, useState, useMemo } from 'react';
import { Card, Select, Button, Space, Spin, Empty, Row, Col, message } from 'antd';
import { Line } from '@ant-design/charts';
import { getIndustryTrend } from '@/services/analysis/industry';
import dayjs from 'dayjs';
import { useRequest } from '@umijs/max';
const { Option } = Select;
type IndustryDataItem = {
date: string;
category: string;
value: number;
};
const IndustryTrendPage: React.FC = () => {
const [params, setParams] = useState({
timeDimension: '月' as '月' | '季度' | '年',
type: '岗位发布数量' as '岗位发布数量' | '招聘增长率',
startTime: dayjs().subtract(6, 'month').format('YYYY-MM'),
endTime: dayjs().format('YYYY-MM'),
selectedIndustry: ''
});
const [allData, setAllData] = useState<IndustryDataItem[]>([]);
const [prevSelectedIndustry, setPrevSelectedIndustry] = useState('');
const { loading, run } = useRequest(
() => getIndustryTrend({
...params,
startTime: formatTimeParam(params.startTime, params.timeDimension),
endTime: formatTimeParam(params.endTime, params.timeDimension)
}),
{
manual: true,
onError: (error) => message.error('数据加载失败: ' + error.message),
onSuccess: (responseData) => {
const formattedData = convertApiData(responseData);
setAllData(formattedData);
const industryToSelect = prevSelectedIndustry ||
(formattedData.length > 0 ? formattedData[0].category : '');
setParams(prev => ({ ...prev, selectedIndustry: industryToSelect }));
}
}
);
const convertApiData = (apiData: any): IndustryDataItem[] => {
if (!apiData) return [];
try {
const result: IndustryDataItem[] = [];
if (typeof apiData === 'object' && !Array.isArray(apiData)) {
Object.entries(apiData).forEach(([month, monthData]) => {
if (Array.isArray(monthData)) {
(monthData as any[]).forEach(item => {
const convertedItem = {
date: month,
category: item.name || item.category,
value: Number(item.data || item.value) || 0
};
console.log('转换后的数据项:', convertedItem);
result.push(convertedItem);
});
}
});
return result;
}
if (Array.isArray(apiData)) {
return apiData.map(item => {
const convertedItem = {
date: item.time || item.date,
category: item.name || item.category,
value: Number(item.data || item.value) || 0
};
console.log('转换后的数据项:', convertedItem);
return convertedItem;
});
}
return [];
} catch (error) {
console.error('数据转换错误:', error);
return [];
}
};
const industries = useMemo(() => {
if (allData.length === 0) return [];
const categories = new Set<string>();
allData.forEach(item => categories.add(item.category));
return Array.from(categories).sort();
}, [allData]);
const formatTimeParam = (dateStr: string, dimension: string) => {
const date = dayjs(dateStr);
switch (dimension) {
case '季度': return `${date.year()}-Q${Math.ceil((date.month() + 1) / 3)}`;
case '年': return `${date.year()}`;
default: return date.format('YYYY-MM');
}
};
const handleIndustryChange = (value: string) => {
setPrevSelectedIndustry(value);
setParams(p => ({ ...p, selectedIndustry: value }));
};
const currentIndustryData = useMemo(() => {
if (!params.selectedIndustry) return [];
const filteredData = allData
.filter(item => item.category === params.selectedIndustry)
.map(item => ({
date: item.date,
category: item.category,
value: item.value ?? 0,
}))
.sort((a, b) => dayjs(a.date).valueOf() - dayjs(b.date).valueOf());
console.log("当前行业数据 (过滤后):", filteredData);
return filteredData;
}, [allData, params.selectedIndustry]);
console.log("最终图表数据:", currentIndustryData);
const chartConfig = {
data: currentIndustryData,
height: 180,
xField: 'date',
yField: 'value',
seriesField: 'category',
xAxis: {
type: 'cat',
tickCount: 5,
label: {
formatter: (text: string) => {
if (params.timeDimension === '年') return text.split('-')[0];
if (params.timeDimension === '季度') return text.split('-')[1];
return text.split('-')[1];
},
},
},
yAxis: {
label: {
formatter: (val: string) => `${val}${params.type === '招聘增长率' ? '%' : '个'}`,
},
},
tooltip: false,
point: {
size: 4,
shape: 'circle',
},
animation: {
appear: {
animation: 'path-in',
duration: 1000,
},
},
};
useEffect(() => {
run();
}, [params.timeDimension, params.startTime, params.endTime]);
return (
<div style={{ padding: 16 }}>
<Card
title="行业趋势分析"
style={{ marginBottom: 24 }}
>
<div style={{ marginBottom: 16 }}>
<Space size="middle" wrap>
<Select
value={params.selectedIndustry}
onChange={handleIndustryChange}
style={{ width: 180 }}
loading={loading}
placeholder="选择行业"
>
{industries.map(industry => (
<Option key={industry} value={industry}>{industry}</Option>
))}
</Select>
<Select
value={params.timeDimension}
onChange={value => setParams(p => ({ ...p, timeDimension: value }))}
style={{ width: 100 }}
>
<Option value="月"></Option>
<Option value="季度"></Option>
<Option value="年"></Option>
</Select>
<Select
value={params.type}
onChange={value => setParams(p => ({ ...p, type: value }))}
style={{ width: 120 }}
>
<Option value="岗位发布数量"></Option>
<Option value="招聘增长率"></Option>
</Select>
<Button
type="primary"
onClick={() => run()}
loading={loading}
size="middle"
>
</Button>
</Space>
</div>
<Card
title={`${params.selectedIndustry || '行业'}趋势`}
style={{ marginBottom: 24 }}
bodyStyle={{
padding: 12,
height: 180,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Spin spinning={loading}>
{currentIndustryData.length > 0 ? (
<Line {...chartConfig} />
) : (
<Empty description={loading ? '数据加载中...' : '请选择行业'} />
)}
</Spin>
</Card>
<Row gutter={[16, 16]}>
<Col xs={24} sm={12} md={8} lg={8} xl={6}>
<Card
title="区域分析"
bodyStyle={{
padding: 12,
height: 300,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Empty description="热力地图预留位置" />
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={8} xl={6}>
<Card
title="薪资趋势"
bodyStyle={{
padding: 12,
height: 300,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Empty description="薪资分析预留位置" />
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={8} xl={6}>
<Card
title="经验要求"
bodyStyle={{
padding: 12,
height: 300,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Empty description="经验分析预留位置" />
</Card>
</Col>
<Col xs={24} sm={12} md={8} lg={8} xl={6}>
<Card
title="技能需求"
bodyStyle={{
padding: 12,
height: 300,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Empty description="技能分析预留位置" />
</Card>
</Col>
</Row>
</Card>
</div>
);
};
export default IndustryTrendPage;

View File

View File

@@ -0,0 +1,8 @@
import { request } from '@umijs/max';
export async function getIndustryTrend(params?: API.Analysis.IndustryParams) {
return request<API.Analysis.IndustryResult>('/api/cms/statics/industry', {
method: 'GET',
params
});
}

View File

@@ -1,159 +1,159 @@
import { createIcon } from '@/utils/IconUtil'; import { createIcon } from '@/utils/IconUtil';
import { MenuDataItem } from '@ant-design/pro-components'; import { MenuDataItem } from '@ant-design/pro-components';
import { request } from '@umijs/max'; import { request } from '@umijs/max';
import React, { lazy } from 'react'; import React, { lazy } from 'react';
let remoteMenu: any = null; let remoteMenu: any = null;
export function getRemoteMenu() { export function getRemoteMenu() {
return remoteMenu; return remoteMenu;
} }
export function setRemoteMenu(data: any) { export function setRemoteMenu(data: any) {
remoteMenu = data; remoteMenu = data;
} }
function patchRouteItems(route: any, menu: any, parentPath: string) { function patchRouteItems(route: any, menu: any, parentPath: string) {
for (const menuItem of menu) { for (const menuItem of menu) {
if (menuItem.component === 'Layout' || menuItem.component === 'ParentView') { if (menuItem.component === 'Layout' || menuItem.component === 'ParentView') {
if (menuItem.routes) { if (menuItem.routes) {
let hasItem = false; let hasItem = false;
let newItem = null; let newItem = null;
for (const routeChild of route.routes) { for (const routeChild of route.routes) {
if (routeChild.path === menuItem.path) { if (routeChild.path === menuItem.path) {
hasItem = true; hasItem = true;
newItem = routeChild; newItem = routeChild;
} }
} }
if (!hasItem) { if (!hasItem) {
newItem = { newItem = {
path: menuItem.path, path: menuItem.path,
routes: [], routes: [],
children: [] children: []
} }
route.routes.push(newItem) route.routes.push(newItem)
} }
patchRouteItems(newItem, menuItem.routes, parentPath + menuItem.path + '/'); patchRouteItems(newItem, menuItem.routes, parentPath + menuItem.path + '/');
} }
} else { } else {
const names: string[] = menuItem.component.split('/'); const names: string[] = menuItem.component.split('/');
let path = ''; let path = '';
names.forEach(name => { names.forEach(name => {
if (path.length > 0) { if (path.length > 0) {
path += '/'; path += '/';
} }
if (name !== 'index') { if (name !== 'index') {
path += name.at(0)?.toUpperCase() + name.substr(1); path += name.at(0)?.toUpperCase() + name.substr(1);
} else { } else {
path += name; path += name;
} }
}) })
if (!path.endsWith('.tsx')) { if (!path.endsWith('.tsx')) {
path += '.tsx' path += '.tsx'
} }
if (route.routes === undefined) { if (route.routes === undefined) {
route.routes = []; route.routes = [];
} }
if (route.children === undefined) { if (route.children === undefined) {
route.children = []; route.children = [];
} }
const newRoute = { const newRoute = {
element: React.createElement(lazy(() => import('@/pages/' + path))), element: React.createElement(lazy(() => import('@/pages/' + path))),
path: parentPath + menuItem.path, path: parentPath + menuItem.path,
} }
route.children.push(newRoute); route.children.push(newRoute);
route.routes.push(newRoute); route.routes.push(newRoute);
} }
} }
} }
export function patchRouteWithRemoteMenus(routes: any) { export function patchRouteWithRemoteMenus(routes: any) {
if (remoteMenu === null) { return; } if (remoteMenu === null) { return; }
let proLayout = null; let proLayout = null;
for (const routeItem of routes) { for (const routeItem of routes) {
if (routeItem.id === 'ant-design-pro-layout') { if (routeItem.id === 'ant-design-pro-layout') {
proLayout = routeItem; proLayout = routeItem;
break; break;
} }
} }
patchRouteItems(proLayout, remoteMenu, ''); patchRouteItems(proLayout, remoteMenu, '');
} }
/** 获取当前的用户 GET /api/getUserInfo */ /** 获取当前的用户 GET /api/getUserInfo */
export async function getUserInfo(options?: Record<string, any>) { export async function getUserInfo(options?: Record<string, any>) {
return request<API.UserInfoResult>('/api/getInfo', { return request<API.UserInfoResult>('/api/getInfo', {
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}); });
} }
// 刷新方法 // 刷新方法
export async function refreshToken() { export async function refreshToken() {
return request('/api/auth/refresh', { return request('/api/auth/refresh', {
method: 'post' method: 'post'
}) })
} }
export async function getRouters(): Promise<any> { export async function getRouters(): Promise<any> {
return request('/api/getRouters'); return request('/api/getRouters');
} }
export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] {
return childrens.map((item: API.RoutersMenuItem) => { return childrens.map((item: API.RoutersMenuItem) => {
return { return {
path: item.path, path: item.path,
icon: createIcon(item.meta.icon), icon: createIcon(item.meta.icon),
// icon: item.meta.icon, // icon: item.meta.icon,
name: item.meta.title, name: item.meta.title,
routes: item.children ? convertCompatRouters(item.children) : undefined, routes: item.children ? convertCompatRouters(item.children) : undefined,
hideChildrenInMenu: item.hidden, hideChildrenInMenu: item.hidden,
hideInMenu: item.hidden, hideInMenu: item.hidden,
component: item.component, component: item.component,
authority: item.perms, authority: item.perms,
}; };
}); });
} }
export async function getRoutersInfo(): Promise<MenuDataItem[]> { export async function getRoutersInfo(): Promise<MenuDataItem[]> {
return getRouters().then((res) => { return getRouters().then((res) => {
if (res.code === 200) { if (res.code === 200) {
return convertCompatRouters(res.data); return convertCompatRouters(res.data);
} else { } else {
return []; return [];
} }
}); });
} }
export function getMatchMenuItem( export function getMatchMenuItem(
path: string, path: string,
menuData: MenuDataItem[] | undefined, menuData: MenuDataItem[] | undefined,
): MenuDataItem[] { ): MenuDataItem[] {
if (!menuData) return []; if (!menuData) return [];
let items: MenuDataItem[] = []; let items: MenuDataItem[] = [];
menuData.forEach((item) => { menuData.forEach((item) => {
if (item.path) { if (item.path) {
if (item.path === path) { if (item.path === path) {
items.push(item); items.push(item);
return; return;
} }
if (path.length >= item.path?.length) { if (path.length >= item.path?.length) {
const exp = `${item.path}/*`; const exp = `${item.path}/*`;
if (path.match(exp)) { if (path.match(exp)) {
if (item.routes) { if (item.routes) {
const subpath = path.substr(item.path.length + 1); const subpath = path.substr(item.path.length + 1);
const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes); const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes);
items = items.concat(subItem); items = items.concat(subItem);
} else { } else {
const paths = path.split('/'); const paths = path.split('/');
if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') { if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') {
items.push(item); items.push(item);
} }
} }
} }
} }
} }
}); });
return items; return items;
} }

20
src/types/analysis/industry.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
declare namespace API.Analysis {
export interface IndustryResult {
data: TrendItem[];
code: number;
msg: string;
}
export interface TrendItem {
date: string;
category: string;
value: number;
}
export interface IndustryParams {
timeDimension: '月' | '季度' | '年';
type: '岗位发布数量' | '招聘增长率';
startTime: string;
endTime: string;
}
}