From de7cf142484a5fe591fa1576069e002418bf8cbc Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Wed, 29 Oct 2025 17:34:55 +0800 Subject: [PATCH] =?UTF-8?q?flat:=E5=95=86=E5=9C=88=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E5=87=BA=E6=96=87=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.ts | 244 +++++++------- src/pages/Area/Business/UpLine/edit.tsx | 172 ++++++++++ src/pages/Area/Business/UpLine/index.tsx | 178 ++++++++++ src/pages/Area/Business/detail.tsx | 0 src/pages/Area/Business/edit.tsx | 131 +------- src/pages/Area/Business/index.tsx | 156 ++++----- src/pages/Jobfair/List/index.tsx | 87 +++-- src/pages/Logs/Mobilelog/index.tsx | 408 ++++++++++++----------- src/pages/User/Login/index.tsx | 14 +- src/services/Management/list.ts | 7 +- src/services/area/business.ts | 49 ++- src/services/classify/industry.ts | 3 +- src/services/classify/jobs.ts | 6 +- src/services/company/list.ts | 7 +- src/services/jobfair/list.ts | 7 +- src/services/system/admindicdata.ts | 12 +- src/services/system/dictdata.ts | 3 +- src/types/area/business.d.ts | 70 ++-- src/utils/tools.ts | 17 + 19 files changed, 943 insertions(+), 628 deletions(-) create mode 100644 src/pages/Area/Business/UpLine/edit.tsx create mode 100644 src/pages/Area/Business/UpLine/index.tsx delete mode 100644 src/pages/Area/Business/detail.tsx diff --git a/config/routes.ts b/config/routes.ts index 70645ef..47f3fc5 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -1,120 +1,124 @@ -/** - * @name umi 的路由配置 - * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置 - * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。 - * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。 - * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。 - * @param redirect 配置路由跳转 - * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验 - * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题 - * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 则取值应为 user 或者 User - * @doc https://umijs.org/docs/guides/routes - */ -export default [ - { - path: '/', - redirect: '/account/center', - }, - { - path: '*', - layout: false, - component: './404', - }, - { - path: '/user', - layout: false, - routes: [ - { - name: 'login', - path: '/user/login', - component: './User/Login', - }, - ], - }, - { - path: '/account', - routes: [ - { - name: 'acenter', - path: '/account/center', - component: './User/Center', - }, - { - name: 'asettings', - path: '/account/settings', - component: './User/Settings', - }, - ], - }, - { - name: 'area', - path: '/area', - routes: [ - { - name: '字典数据', - path: '/area/updata-router/index/:id', - component: './Area/Subway/UpLine', - }, - ], - }, - { - name: 'management', - path: '/management', - routes: [ - { - name: '字典数据', - path: '/management/see-matching/index/:id', - component: './Management/List/SeeMatching', - }, - ], - }, - { - name: 'system', - path: '/system', - routes: [ - { - name: '字典数据', - path: '/system/dict-data/index/:id', - component: './System/DictData', - }, - { - name: '字典数据', - path: '/system/admin-dict-data/index/:id', - component: './System/AdminDictData', - }, - { - name: '分配用户', - path: '/system/role-auth/user/:id', - component: './System/Role/authUser', - }, - ], - }, - { - name: 'monitor', - path: '/monitor', - routes: [ - { - name: '任务日志', - path: '/monitor/job-log/index/:id', - component: './Monitor/JobLog', - }, - ], - }, - { - name: 'tool', - path: '/tool', - routes: [ - { - name: '导入表', - path: '/tool/gen/import', - component: './Tool/Gen/import', - }, - { - name: '编辑表', - path: '/tool/gen/edit.tsx', - component: './Tool/Gen/edit.tsx', - }, - ], - }, - -]; +/** + * @name umi 的路由配置 + * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置 + * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。 + * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。 + * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。 + * @param redirect 配置路由跳转 + * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验 + * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题 + * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 则取值应为 user 或者 User + * @doc https://umijs.org/docs/guides/routes + */ +export default [ + { + path: '/', + redirect: '/account/center', + }, + { + path: '*', + layout: false, + component: './404', + }, + { + path: '/user', + layout: false, + routes: [ + { + name: 'login', + path: '/user/login', + component: './User/Login', + }, + ], + }, + { + path: '/account', + routes: [ + { + name: 'acenter', + path: '/account/center', + component: './User/Center', + }, + { + name: 'asettings', + path: '/account/settings', + component: './User/Settings', + }, + ], + }, + { + name: 'area', + path: '/area', + routes: [ + { + name: '字典数据', + path: '/area/updata-router/index/:id', + component: './Area/Subway/UpLine', + }, + { + name: '字典数据', + path: '/area/updata-router/business/:id', + component: './Area/Business/UpLine', + }, + ], + }, + { + name: 'management', + path: '/management', + routes: [ + { + name: '字典数据', + path: '/management/see-matching/index/:id', + component: './Management/List/SeeMatching', + }, + ], + }, + { + name: 'system', + path: '/system', + routes: [ + { + name: '字典数据', + path: '/system/dict-data/index/:id', + component: './System/DictData', + }, + { + name: '字典数据', + path: '/system/admin-dict-data/index/:id', + component: './System/AdminDictData', + }, + { + name: '分配用户', + path: '/system/role-auth/user/:id', + component: './System/Role/authUser', + }, + ], + }, + { + name: 'monitor', + path: '/monitor', + routes: [ + { + name: '任务日志', + path: '/monitor/job-log/index/:id', + component: './Monitor/JobLog', + }, + ], + }, + { + name: 'tool', + path: '/tool', + routes: [ + { + name: '导入表', + path: '/tool/gen/import', + component: './Tool/Gen/import', + }, + { + name: '编辑表', + path: '/tool/gen/edit.tsx', + component: './Tool/Gen/edit.tsx', + }, + ], + }, +]; diff --git a/src/pages/Area/Business/UpLine/edit.tsx b/src/pages/Area/Business/UpLine/edit.tsx new file mode 100644 index 0000000..1cc3bae --- /dev/null +++ b/src/pages/Area/Business/UpLine/edit.tsx @@ -0,0 +1,172 @@ +import { ModalForm, ProForm, ProFormDigit, ProFormText } from '@ant-design/pro-components'; +import { Button, Form } from 'antd'; +import { DictOptionType, DictValueEnumObj } from '@/components/DictTag'; +import { useEffect, useState } from 'react'; +import ProFromMap from '@/components/ProFromMap'; + +export type ListFormProps = { + onCancel: (flag?: boolean, formVars?: unknown) => void; + onSubmit: (values: API.AreaSubWay.LinePoint) => Promise; + open: boolean; + values?: Partial; + jobGroupOptions?: DictOptionType[]; + statusOptions?: DictValueEnumObj; +}; + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; + +const SubWayEdit: React.FC = (props) => { + const [form] = Form.useForm(); + + const [open, setOpen] = useState(false); + const [viewInfo, setViewInfo] = useState({}); + + useEffect(() => { + form.resetFields(); + if (props.values) { + form.setFieldsValue(props.values); + setViewInfo(props.values); + } + }, [form, props]); + + const handleCancel = () => { + props.onCancel(); + form.resetFields(); + }; + + const handleFinish = async (values: Record) => { + props.onSubmit(values as API.AreaSubWay.LinePoint); + }; + + const select = (result) => { + if (result.location) { + const { lat, lng } = result.location; + form.setFieldValue('latitude', lat); + form.setFieldValue('longitude', lng); + form.setFieldValue('address', result.address); + const obj = { + latitude: lat, + longitude: lng, + address: result.address, + }; + setViewInfo(obj); + setOpen(false); + } + }; + + const cancel = () => { + setOpen(false); + }; + + return ( + + title={`${props.values ? '编辑' : '新增'}站点`} + form={form} + // layout="inline" + autoFocusFirstInput + open={props.open} + modalProps={{ + destroyOnClose: true, + onCancel: () => handleCancel(), + }} + initialValues={{ + sort: 0, + }} + submitTimeout={2000} + onFinish={handleFinish} + > + + + + + + + setOpen(true)}>选择位置信息 + + {viewInfo.address ? ( + 地址:{viewInfo.address} + ) : null} + {viewInfo.latitude ? ( + + 经纬度:{viewInfo.latitude},{viewInfo.longitude} + + ) : ( + 请选择位置! + )} + + + + + + + + + + + ); +}; + +export default SubWayEdit; diff --git a/src/pages/Area/Business/UpLine/index.tsx b/src/pages/Area/Business/UpLine/index.tsx new file mode 100644 index 0000000..274efff --- /dev/null +++ b/src/pages/Area/Business/UpLine/index.tsx @@ -0,0 +1,178 @@ +import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'; +import { useAccess, useParams } from '@umijs/max'; +import { Button, FormInstance, message, Modal } from 'antd'; +import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; +import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; +import UpStationEdit from '@/pages/Area/Business/UpLine/edit'; +import { addCmsAreaListRow, deleteCmsAreaListRow, getCmsAreaList } from '@/services/area/business'; + +const handleRemoveOne = async (selectedRow: API.AreaSubWay.LinePoint) => { + const hide = message.loading('正在删除'); + if (!selectedRow) return true; + try { + const resp = await deleteCmsAreaListRow(selectedRow.commercialAreaId); + hide(); + if (resp.code === 200) { + message.success('删除成功,即将刷新'); + } else { + message.error(resp.msg); + } + return true; + } catch (error) { + hide(); + message.error('删除失败,请重试'); + return false; + } +}; + +function ManagementList() { + const access = useAccess(); + + const formTableRef = useRef(); + const actionRef = useRef(); + const [regionalId, setRegionalId] = useState(); + const [currentRow, setCurrentRow] = useState(); + const [modalVisible, setModalVisible] = useState(false); + const [page, setPage] = useState({}); + const params = useParams(); + const id = params.id || '0'; + + useEffect(() => { + if (regionalId !== id) { + setRegionalId(id); + } + }, [regionalId, params]); + + const getStationInfo = useCallback(async () => { + // const resData = await getCmsLineSubWay() + }, []); + + const columns: ProColumns[] = [ + { + title: '商业区名称', + dataIndex: 'commercialAreaName', + align: 'center', + valueType: 'text', + }, + { + title: '商业区地址', + dataIndex: 'address', + hideInSearch: true, + align: 'center', + valueType: 'text', + }, + { + title: '操作', + hideInSearch: true, + align: 'center', + width: 300, + render: (_, record) => [ + } + hidden={!access.hasPerms('area:business:List.update')} + onClick={() => { + setModalVisible(true); + setCurrentRow(record); + }} + > + 编辑 + , + } + hidden={!access.hasPerms('area:subway:List')} + onClick={async () => { + Modal.confirm({ + title: '删除', + content: '确定删除该项吗?', + okText: '确认', + cancelText: '取消', + onOk: async () => { + const success = await handleRemoveOne(record); + if (success) { + if (actionRef.current) { + actionRef.current.reload(); + } + } + }, + }); + }} + > + 删除 + , + ], + }, + ]; + return ( + + + + // params 是需要自带的参数 + // 这个参数优先级更高,会覆盖查询表单的参数 + actionRef={actionRef} + formRef={formTableRef} + columns={columns} + headerTitle="信息" + rowKey="stationId" + key="stationId" + request={(params) => { + return getCmsAreaList({ + regionalId, + ...params, + } as API.AreaPlatForm.LineParams).then((res) => { + setPage(params as API.AreaPlatForm.LineParams); + const result = { + data: res.rows, + total: res.total, + success: true, + }; + return result; + }); + }} + toolBarRender={() => [ + { + setCurrentRow(undefined); + setModalVisible(true); + }} + > + 新建 + , + ]} + /> + + { + setModalVisible(false); + setCurrentRow(undefined); + }} + onSubmit={async (values) => { + // values.regionalId = + // values.lineName = + const resData = await addCmsAreaListRow(values); + if (resData.code === 200) { + setModalVisible(false); + setCurrentRow(undefined); + message.success('添加成功'); + if (actionRef.current) { + actionRef.current.reload(); + } + } + }} + values={currentRow} + > + + ); +} + +export default ManagementList; diff --git a/src/pages/Area/Business/detail.tsx b/src/pages/Area/Business/detail.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/pages/Area/Business/edit.tsx b/src/pages/Area/Business/edit.tsx index 3d36067..6506149 100644 --- a/src/pages/Area/Business/edit.tsx +++ b/src/pages/Area/Business/edit.tsx @@ -1,14 +1,13 @@ import { ModalForm, ProForm, ProFormDigit, ProFormText } from '@ant-design/pro-components'; -import React, { useEffect, useState } from 'react'; -import { Button, Form } from 'antd'; +import { Form } from 'antd'; import { DictOptionType, DictValueEnumObj } from '@/components/DictTag'; -import ProFromMap from '@/components/ProFromMap'; +import { useEffect } from 'react'; export type ListFormProps = { onCancel: (flag?: boolean, formVals?: unknown) => void; - onSubmit: (values: API.AreaBusiness.CircleEditParams) => Promise; + onSubmit: (values: API.AreaSubWay.Line) => Promise; open: boolean; - values?: Partial; + values?: Partial; jobGroupOptions?: DictOptionType[]; statusOptions?: DictValueEnumObj; }; @@ -24,57 +23,31 @@ const waitTime = (time: number = 100) => { const SubWayEdit: React.FC = (props) => { const [form] = Form.useForm(); - const [open, setOpen] = useState(false); - const [viewInfo, setViewInfo] = useState({}); - useEffect(() => { form.resetFields(); if (props.values) { - const obj = { - commercialAreaId: props.values.commercialAreaId, - commercialAreaName: props.values.commercialAreaName, - latitude: props.values.latitude, - longitude: props.values.longitude, - address: props.values.address, - }; - form.setFieldsValue(obj); - setViewInfo(obj); - } else { - setViewInfo({}); + form.setFieldsValue({ + regionalId: props.values.regionalId, + regionalName: props.values.regionalName, + }); } }, [form, props]); + const handleCancel = () => { props.onCancel(); form.resetFields(); }; const handleFinish = async (values: Record) => { - props.onSubmit(values as API.AreaBusiness.CircleEditParams); - }; - - const select = (result) => { - if (result.location) { - const { lat, lng } = result.location; - form.setFieldValue('latitude', lat); - form.setFieldValue('longitude', lng); - form.setFieldValue('address', result.address); - const obj = { - latitude: lat, - longitude: lng, - address: result.address, - }; - setViewInfo(obj); - setOpen(false); - } - }; - - const cancel = () => { - setOpen(false); + props.onSubmit(values as API.AreaSubWay.Line); }; return ( - - title={`${props.values ? '编辑' : '新增'}商圈`} + + title={`${props.values ? '编辑' : '新增'}线路`} form={form} // layout="inline" autoFocusFirstInput @@ -87,85 +60,15 @@ const SubWayEdit: React.FC = (props) => { onFinish={handleFinish} > - + - - - setOpen(true)}>选择位置信息 - - {viewInfo.address ? ( - 地址:{viewInfo.address} - ) : null} - {viewInfo.latitude ? ( - - 经纬度:{viewInfo.latitude},{viewInfo.longitude} - - ) : ( - 请选择位置! - )} - - - - - - - - - ); }; diff --git a/src/pages/Area/Business/index.tsx b/src/pages/Area/Business/index.tsx index e1a4580..fec8f91 100644 --- a/src/pages/Area/Business/index.tsx +++ b/src/pages/Area/Business/index.tsx @@ -1,23 +1,27 @@ -import React, {Fragment, useRef, useState} from "react"; -import { FormattedMessage, useAccess } from '@umijs/max'; -import { FormInstance, Button, message, Modal } from 'antd'; +import React, { Fragment, useRef, useState } from 'react'; +import { history, useAccess } from '@umijs/max'; +import { Button, FormInstance, message, Modal } from 'antd'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; -import { PlusOutlined, DeleteOutlined, FormOutlined, AlignLeftOutlined } from '@ant-design/icons'; +import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; import { - getCmsAreaList, - addCmsAreaListRow, - updateCmsAreaListRow, - deleteCmsAreaListRow, - exportCmsAreaListRow -} from "@/services/area/business"; -import BusinessEdit from "@/pages/Area/Business/edit"; + addCmsLineSubWay, + deleteCmsLineSubWay, + getCmsLineList, + putCmsLineSubWay, +} from '@/services/area/subway'; +import SubWayEdit from '@/pages/Area/Business/edit'; +import { + addCmsSaveRegionalData, + deleteCmsRegionalData, + getCmsRegionalList, + updateRegionalData, +} from '@/services/area/business'; - -const handleRemoveOne = async (selectedRow: API.AreaBusiness.Circle) => { +const handleRemoveOne = async (selectedRow: API.AreaRegional.RegionalRows) => { const hide = message.loading('正在删除'); if (!selectedRow) return true; try { - const resp = await deleteCmsAreaListRow(selectedRow.commercialAreaId); + const resp = await deleteCmsRegionalData(selectedRow.regionalId); hide(); if (resp.code === 200) { message.success('删除成功,即将刷新'); @@ -32,60 +36,42 @@ const handleRemoveOne = async (selectedRow: API.AreaBusiness.Circle) => { } }; -const handleExport = async (values: API.AreaBusiness.CircleEditParams) => { - const hide = message.loading('正在导出'); - try { - await exportCmsAreaListRow(values); - hide(); - message.success('导出成功'); - return true; - } catch (error) { - hide(); - message.error('导出失败,请重试'); - return false; - } -}; function ManagementList() { const access = useAccess(); const formTableRef = useRef(); const actionRef = useRef(); - const [currentRow, setCurrentRow] = useState() - const [modalVisible, setModalVisible] = useState(false) + const [currentRow, setCurrentRow] = useState(); + const [modalVisible, setModalVisible] = useState(false); - const columns: ProColumns[] = [ + const columns: ProColumns[] = [ { - title: '商圈名称', - dataIndex: 'commercialAreaName', - valueType: 'text', + title: '区域名称', + dataIndex: 'regionalName', align: 'center', - hideInSearch: true, + valueType: 'text', + render: (dom, record) => ( + history.push(`/area/updata-router/business/${record.regionalId}`)} + block + > + {dom} + + ), }, { title: '操作', + hideInSearch: true, align: 'center', width: 300, - hideInSearch: true, render: (_, record) => [ - } - hidden={!access.hasPerms('area:business:List.detail')} - onClick={() => { - setModalVisible(true); - setCurrentRow(record); - }} - > - 详细 - , } + icon={} hidden={!access.hasPerms('area:business:List.update')} onClick={() => { setModalVisible(true); @@ -99,8 +85,8 @@ function ManagementList() { size="small" danger key="batchRemove" - icon ={} - hidden={!access.hasPerms('area:business:List')} + icon= + hidden={!access.hasPerms('area:subway:List')} onClick={async () => { Modal.confirm({ title: '删除', @@ -119,30 +105,33 @@ function ManagementList() { }} > 删除 - - ] - } - ] + , + ], + }, + ]; return ( - + // params 是需要自带的参数 // 这个参数优先级更高,会覆盖查询表单的参数 actionRef={actionRef} formRef={formTableRef} columns={columns} - rowKey={"commercialAreaName"} - key={"index"} - request={(params) => - getCmsAreaList({ ...params } as API.AreaBusiness.CircleParams).then((res) => { - return { + headerTitle="信息" + rowKey="regionalId" + key="lineIdList" + request={(params) => { + return getCmsRegionalList(params as API.AreaRegional.RegionalParams).then((res) => { + console.log(params); + const result = { data: res.rows, total: res.total, success: true, - } - }) - } + }; + return result; + }); + }} toolBarRender={() => [ 新建 , - { - const searchVal = formTableRef.current && formTableRef.current.getFieldsValue(); - handleExport(searchVal); - }} - > - - - , ]} /> - { - let resData - if(values.commercialAreaId) { - resData = await updateCmsAreaListRow(values) + let resData; + if (values.regionalId) { + resData = await updateRegionalData(values); } else { - resData = await addCmsAreaListRow(values) + resData = await addCmsSaveRegionalData(values); } if (resData.code === 200) { setModalVisible(false); setCurrentRow(undefined); - if(values.commercialAreaId) { - message.success('修改成功') + if (values.regionalId) { + message.success('修改成功'); } else { - message.success('新增成功') + message.success('新增成功'); } if (actionRef.current) { actionRef.current.reload(); } } }} - values={currentRow} onCancel={() => { setModalVisible(false); - setCurrentRow(undefined) + setCurrentRow(undefined); }} - > + values={currentRow} + > - ) + ); } -export default ManagementList + +export default ManagementList; diff --git a/src/pages/Jobfair/List/index.tsx b/src/pages/Jobfair/List/index.tsx index e91c94b..b4d1251 100644 --- a/src/pages/Jobfair/List/index.tsx +++ b/src/pages/Jobfair/List/index.tsx @@ -1,20 +1,19 @@ -import React, {Fragment, useRef, useState, useEffect} from "react"; -import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max'; -import {delCmsJobIds, getCmsJobList} from "@/services/Management/list"; -import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd'; -import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; -import { PlusOutlined, DeleteOutlined, FormOutlined, DownOutlined, EditOutlined } from '@ant-design/icons'; -import EditCompanyListRow from './edit' +import React, { Fragment, useEffect, useRef, useState } from 'react'; +import { FormattedMessage, useAccess } from '@umijs/max'; +import { Button, FormInstance, message, Modal } from 'antd'; +import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; +import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; +import EditCompanyListRow from './edit'; import { addCmsFairList, delCmsFairList, exportCmsFairList, + getCmsFairId, getCmsFairList, putCmsFairList, - getCmsFairId, getCmstitilelist -} from "@/services/jobfair/list"; -import {getDictValueEnum} from "@/services/system/dict"; -import DictTag from "@/components/DictTag"; +} from '@/services/jobfair/list'; +import { getDictValueEnum } from '@/services/system/dict'; +import DictTag from '@/components/DictTag'; const handleRemoveOne = async (jobFairId: string) => { const hide = message.loading('正在删除'); @@ -55,20 +54,17 @@ function ManagementList() { const formTableRef = useRef(); const actionRef = useRef(); - const [currentRow, setCurrentRow] = useState() - const [modalVisible, setModalVisible] = useState(false) - const [jobFairType, setJobFairTypeEnum] = useState([]) + const [currentRow, setCurrentRow] = useState(); + const [modalVisible, setModalVisible] = useState(false); + const [jobFairType, setJobFairTypeEnum] = useState([]); useEffect(() => { getDictValueEnum('job_fair_type', true).then((data) => { - setJobFairTypeEnum(data) + setJobFairTypeEnum(data); }); - }, []); - const editSubmit = () => { - - } + const editSubmit = () => {}; const columns: ProColumns[] = [ { @@ -84,7 +80,7 @@ function ManagementList() { align: 'center', valueEnum: jobFairType, render: (_, record) => { - return (); + return ; }, }, { @@ -105,10 +101,10 @@ function ManagementList() { type="link" size="small" key="edit" - icon={} + icon={} hidden={!access.hasPerms('area:business:List.update')} onClick={async () => { - let resData = await getCmsFairId(jobFairId as string) + let resData = await getCmsFairId(jobFairId as string); setModalVisible(true); setCurrentRow(resData.data); }} @@ -120,7 +116,7 @@ function ManagementList() { size="small" danger key="batchRemove" - icon ={} + icon={} hidden={!access.hasPerms('area:subway:List')} onClick={async () => { Modal.confirm({ @@ -140,10 +136,10 @@ function ManagementList() { }} > 删除 - - ] - } - ] + , + ], + }, + ]; return ( @@ -166,17 +162,17 @@ function ManagementList() { }) } toolBarRender={() => [ - { - setCurrentRow(undefined); - setModalVisible(true); - }} - > - 新建 - , + // { + // setCurrentRow(undefined); + // setModalVisible(true); + // }} + // > + // 新建 + // , { let resData; if (values.jobFairId) { - resData = await putCmsFairList(values) + resData = await putCmsFairList(values); } else { - resData = await addCmsFairList(values) + resData = await addCmsFairList(values); } if (resData.code === 200) { setModalVisible(false); setCurrentRow(undefined); - if(values.jobFairId) { - message.success('修改成功') + if (values.jobFairId) { + message.success('修改成功'); } else { - message.success('新增成功') + message.success('新增成功'); } if (actionRef.current) { actionRef.current.reload(); @@ -222,6 +218,7 @@ function ManagementList() { values={currentRow} > - ) + ); } -export default ManagementList + +export default ManagementList; diff --git a/src/pages/Logs/Mobilelog/index.tsx b/src/pages/Logs/Mobilelog/index.tsx index bf1eb0b..b68ee0a 100644 --- a/src/pages/Logs/Mobilelog/index.tsx +++ b/src/pages/Logs/Mobilelog/index.tsx @@ -1,20 +1,20 @@ -import React, { useState, useRef, useEffect, useMemo } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { addMobilelog, exportMobilelog, getMobileLogList, removeMobilelog, - updateMobilelog -} from "@/services/logs/mobilelog"; + updateMobilelog, +} from '@/services/logs/mobilelog'; import type { FormInstance } from 'antd'; -import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; -import { useIntl, FormattedMessage, useAccess } from '@umijs/max'; -import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; import { Button, message, Modal } from 'antd'; -import DictTag from "@/components/DictTag"; -import {getDictValueEnum} from "@/services/system/dict"; +import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; +import { FormattedMessage, useAccess } from '@umijs/max'; +import { DeleteOutlined, ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import DictTag from '@/components/DictTag'; +import { getDictValueEnum } from '@/services/system/dict'; import UpdateForm from './detail'; -import {addOperlog, exportOperlog, removeOperlog, updateOperlog} from "@/services/logs/operlog"; + /** * 添加节点 * @@ -102,14 +102,13 @@ const handleExport = async () => { } }; - -const MobileLog: React.FC = () => { +const MobileLog: React.FC = () => { // ref const formTableRef = useRef(); const access = useAccess(); const actionRef = useRef(); // status - const [params, useParams] = useState({}) + const [params, useParams] = useState({}); const [modalVisible, setModalVisible] = useState(false); const [currentRow, setCurrentRow] = useState(); const [selectedRows, setSelectedRows] = useState([]); @@ -131,200 +130,203 @@ const MobileLog: React.FC = () => { }); }, []); + const columns: ProColumns[] = useMemo( + () => [ + { + title: '日志主键', + dataIndex: 'operId', + valueType: 'text', + hideInSearch: true, + }, + { + title: '操作模块', + dataIndex: 'title', + valueType: 'text', + }, + { + title: '业务类型', + dataIndex: 'businessType', + valueType: 'select', + valueEnum: businessTypeOptions, + render: (_, record) => { + return ; + }, + }, + { + title: '请求方式', + dataIndex: 'requestMethod', + valueType: 'text', + }, + // { + // title: "操作类别", + // dataIndex: 'operatorType', + // valueType: 'select', + // valueEnum: operatorTypeOptions, + // render: (_, record) => { + // return (); + // }, + // }, + { + title: '操作人员', + dataIndex: 'operName', + valueType: 'text', + }, + { + title: '主机地址', + dataIndex: 'operIp', + valueType: 'text', + }, + { + title: '操作地点', + dataIndex: 'operLocation', + valueType: 'text', + }, + { + title: '操作状态', + dataIndex: 'status', + valueType: 'select', + valueEnum: statusOptions, + render: (_, record) => { + return ; + }, + }, + { + title: '操作时间', + dataIndex: 'operTime', + valueType: 'dateTime', + }, + { + title: , + dataIndex: 'option', + width: '120px', + valueType: 'option', + render: (_, record) => [ + { + setModalVisible(true); + setCurrentRow(record); + }} + > + 详细 + , + ], + }, + ], + [businessTypeOptions, operatorTypeOptions, statusOptions], + ); - const columns: ProColumns[] = useMemo(() => [ - { - title: '日志主键', - dataIndex: 'operId', - valueType: 'text', - hideInSearch: true, - }, - { - title: "操作模块", - dataIndex: 'title', - valueType: 'text', - }, - { - title: "业务类型", - dataIndex: 'businessType', - valueType: 'select', - valueEnum: businessTypeOptions, - render: (_, record) => { - return (); - }, - }, - { - title: "请求方式", - dataIndex: 'requestMethod', - valueType: 'text', - }, - { - title: "操作类别", - dataIndex: 'operatorType', - valueType: 'select', - valueEnum: operatorTypeOptions, - render: (_, record) => { - return (); - }, - }, - { - title: "操作人员", - dataIndex: 'operName', - valueType: 'text', - }, - { - title: "主机地址", - dataIndex: 'operIp', - valueType: 'text', - }, - { - title: "操作地点", - dataIndex: 'operLocation', - valueType: 'text', - }, - { - title: "操作状态", - dataIndex: 'status', - valueType: 'select', - valueEnum: statusOptions, - render: (_, record) => { - return (); - }, - }, - { - title: "操作时间", - dataIndex: 'operTime', - valueType: 'dateTime', - }, - { - title: , - dataIndex: 'option', - width: '120px', - valueType: 'option', - render: (_, record) => [ - { - setModalVisible(true); - setCurrentRow(record); + return ( + <> + + + { + setSelectedRows(selectedRows); + }, + }} + request={(params) => + getMobileLogList({ ...params } as API.Logs.MobilelogListParams).then((res) => { + const result = { + data: res.rows, + total: res.total, + success: true, + }; + return result; + }) + } + toolBarRender={() => [ + // { + // setCurrentRow(undefined); + // setModalVisible(true); + // }} + // > + // + // , + { + Modal.confirm({ + title: '是否确认删除所选数据项?', + icon: , + content: '请谨慎操作', + async onOk() { + const success = await handleRemove(selectedRows); + if (success) { + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + } + }, + onCancel() {}, + }); + }} + > + + + , + { + handleExport(); + }} + > + + + , + ]} + /> + + { + let success = false; + if (values.operId) { + success = await handleUpdate({ ...values } as API.Logs.Mobilelog); + } else { + success = await handleAdd({ ...values } as API.Logs.Mobilelog); + } + if (success) { + setModalVisible(false); + setCurrentRow(undefined); + if (actionRef.current) { + actionRef.current.reload(); + } + } }} - > - 详细 - , - ], - }, - ], [businessTypeOptions, operatorTypeOptions, statusOptions]) - - return <> - - - { - setSelectedRows(selectedRows); - }, - }} - request={(params) => - getMobileLogList({ ...params } as API.Logs.MobilelogListParams).then((res) => { - const result = { - data: res.rows, - total: res.total, - success: true, - }; - return result; - }) - } - toolBarRender={() => [ - // { - // setCurrentRow(undefined); - // setModalVisible(true); - // }} - // > - // - // , - { - Modal.confirm({ - title: '是否确认删除所选数据项?', - icon: , - content: '请谨慎操作', - async onOk() { - const success = await handleRemove(selectedRows); - if (success) { - setSelectedRows([]); - actionRef.current?.reloadAndRest?.(); - } - }, - onCancel() { }, - }); - }} - > - - - , - { - handleExport(); - }} - > - - - , - ]} - /> - - { - let success = false; - if (values.operId) { - success = await handleUpdate({ ...values } as API.Logs.Mobilelog); - } else { - success = await handleAdd({ ...values } as API.Logs.Mobilelog); - } - if (success) { + onCancel={() => { setModalVisible(false); setCurrentRow(undefined); - if (actionRef.current) { - actionRef.current.reload(); - } - } - }} - onCancel={() => { - setModalVisible(false); - setCurrentRow(undefined); - }} - open={modalVisible} - values={currentRow || {}} - businessTypeOptions={businessTypeOptions} - operatorTypeOptions={operatorTypeOptions} - statusOptions={statusOptions} - /> - - - > + }} + open={modalVisible} + values={currentRow || {}} + businessTypeOptions={businessTypeOptions} + operatorTypeOptions={operatorTypeOptions} + statusOptions={statusOptions} + /> + + > + ); }; -export default MobileLog +export default MobileLog; diff --git a/src/pages/User/Login/index.tsx b/src/pages/User/Login/index.tsx index 33775f0..4c4af84 100644 --- a/src/pages/User/Login/index.tsx +++ b/src/pages/User/Login/index.tsx @@ -222,13 +222,13 @@ const Login: React.FC = () => { defaultMessage: '账户密码登录', }), }, - { - key: 'mobile', - label: intl.formatMessage({ - id: 'pages.login.phoneLogin.tab', - defaultMessage: '手机号登录', - }), - }, + // { + // key: 'mobile', + // label: intl.formatMessage({ + // id: 'pages.login.phoneLogin.tab', + // defaultMessage: '手机号登录', + // }), + // }, ]} /> diff --git a/src/services/Management/list.ts b/src/services/Management/list.ts index 95208f1..f86e551 100644 --- a/src/services/Management/list.ts +++ b/src/services/Management/list.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; export async function getCmsJobList(params?: API.ManagementList.ListParams) { return request(`/api/cms/job/list`, { @@ -35,7 +36,11 @@ export async function delCmsJobIds(ids: string) { } export async function exportCmsJob(params?: API.ManagementList.ListParams) { - return downLoadXlsx(`/api/cms/job/export`, { params }, `job_data_${new Date().getTime()}.xlsx`); + return downLoadXlsx( + `/api/cms/job/export`, + { params }, + `岗位数据_${getDateTimeForFilename()}.xlsx`, + ); } export async function exportCmsJobCandidates(ids: string) { diff --git a/src/services/area/business.ts b/src/services/area/business.ts index 2280e2a..8aa445d 100644 --- a/src/services/area/business.ts +++ b/src/services/area/business.ts @@ -1,22 +1,22 @@ import { request } from '@umijs/max'; -import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; -export async function getCmsAreaList(params?: API.AreaBusiness.CircleParams) { - return request(`/api/cms/area/list`, { +export async function getCmsAreaList(params?: API.BusinessParams.BusinessParams) { + return request(`/api/cms/area/list`, { method: 'GET', params: params, }); } -export async function addCmsAreaListRow(params?: API.AreaBusiness.CircleEditParams) { - return request(`/api/cms/area`, { +export async function addCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { + return request(`/api/cms/area`, { method: 'post', data: params, }); } -export async function updateCmsAreaListRow(params?: API.AreaBusiness.CircleEditParams) { - return request(`/api/cms/area`, { +export async function updateCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { + return request(`/api/cms/area`, { method: 'put', data: params, }); @@ -28,6 +28,37 @@ export async function deleteCmsAreaListRow(ids: number) { }); } -export async function exportCmsAreaListRow(params?: API.AreaBusiness.CircleEditParams) { - return downLoadXlsx(`/api/cms/area/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`); +export async function exportCmsAreaListRow(params?: API.BusinessParams.BusinessParams) { + return downLoadXlsx(`/api/cms/area/export`, { params }, `区域_${getDateTimeForFilename()}.xlsx`); +} + +//区划 +// 获取 +export async function getCmsRegionalList(params?: API.AreaRegional.RegionalParams) { + return request(`/api/cms/regional/getList`, { + method: 'GET', + params: params, + }); +} + +// 更新 +export async function updateRegionalData(params?: API.AreaRegional.RegionalParams) { + return request(`/api/cms/regional/updateRegionalData`, { + method: 'POST', + data: params, + }); +} + +export async function addCmsSaveRegionalData(params?: API.AreaRegional.RegionalParams) { + return request(`/api/cms/regional/saveRegionalData`, { + method: 'post', + data: params, + }); +} + +// 删除 +export async function deleteCmsRegionalData(ids: number) { + return request(`/api/cms/regional/delRegionalData/${ids}`, { + method: 'POST', + }); } diff --git a/src/services/classify/industry.ts b/src/services/classify/industry.ts index bca8e00..9b12ba3 100644 --- a/src/services/classify/industry.ts +++ b/src/services/classify/industry.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; export async function getCmsIndustryList(params?: API.ClassifyIndustry.Params) { return request(`/api/cms/industry/list`, { @@ -38,6 +39,6 @@ export async function exportCmsIndustry(params?: API.ClassifyIndustry.Params) { return downLoadXlsx( `/api/cms/industry/export`, { params }, - `dict_data_${new Date().getTime()}.xlsx`, + `分析_${getDateTimeForFilename()}.xlsx`, ); } diff --git a/src/services/classify/jobs.ts b/src/services/classify/jobs.ts index ee500bf..7a8e0e2 100644 --- a/src/services/classify/jobs.ts +++ b/src/services/classify/jobs.ts @@ -9,9 +9,5 @@ export async function getCmsJobTitleList(params?: API.ClassifyJobs.Params) { } export async function exportCmsJobTitleList(params?: API.ClassifyJobs.Params) { - return downLoadXlsx( - `/api/cms/job/titile/export`, - { params }, - `dict_data_${new Date().getTime()}.xlsx`, - ); + return downLoadXlsx(`/api/cms/job/titile/export`, { params }, `dict_data_${f}.xlsx`); } diff --git a/src/services/company/list.ts b/src/services/company/list.ts index 2d301af..a23a572 100644 --- a/src/services/company/list.ts +++ b/src/services/company/list.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; export async function getCmsCompanyList(params?: API.CompanyList.Params) { return request(`/api/cms/company/list`, { @@ -29,5 +30,9 @@ export async function putCmsCompanyList(params?: API.CompanyList.Params) { } export async function exportCmsCompanyList(params?: API.CompanyList.Params) { - return downLoadXlsx(`/cms/company/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`); + return downLoadXlsx( + `/cms/company/export`, + { params }, + `dict_data_${getDateTimeForFilename()}.xlsx`, + ); } diff --git a/src/services/jobfair/list.ts b/src/services/jobfair/list.ts index 3d7a255..06550ad 100644 --- a/src/services/jobfair/list.ts +++ b/src/services/jobfair/list.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; export async function getCmsFairList(params?: API.JobFairList.Params) { return request(`/api/cms/fair/list`, { @@ -29,7 +30,11 @@ export async function delCmsFairList(ids?: string) { } export async function exportCmsFairList(params?: API.JobFairList.Params) { - return downLoadXlsx(`/api/cms/fair/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`); + return downLoadXlsx( + `/api/cms/fair/export`, + { params }, + `招聘会_${getDateTimeForFilename()}.xlsx`, + ); } export async function getCmsFairId(jobFairId?: string) { diff --git a/src/services/system/admindicdata.ts b/src/services/system/admindicdata.ts index f7856e8..be9028a 100644 --- a/src/services/system/admindicdata.ts +++ b/src/services/system/admindicdata.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; // 查询字典数据列表 export async function getDictDataList( @@ -37,7 +38,10 @@ export async function addDictData(params: API.System.DictData, options?: { [key: } // 修改字典数据 -export async function updateDictData(params: API.System.DictData, options?: { [key: string]: any }) { +export async function updateDictData( + params: API.System.DictData, + options?: { [key: string]: any }, +) { return request('/api/system/dict/data', { method: 'PUT', headers: { @@ -61,5 +65,9 @@ export function exportDictData( params?: API.System.DictDataListParams, options?: { [key: string]: any }, ) { - return downLoadXlsx(`/api/system/dict/data/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`); + return downLoadXlsx( + `/api/system/dict/data/export`, + { params }, + `枚举_${getDateTimeForFilename()}.xlsx`, + ); } diff --git a/src/services/system/dictdata.ts b/src/services/system/dictdata.ts index 761e22c..72810c3 100644 --- a/src/services/system/dictdata.ts +++ b/src/services/system/dictdata.ts @@ -1,5 +1,6 @@ import { request } from '@umijs/max'; import { downLoadXlsx } from '@/utils/downloadfile'; +import { getDateTimeForFilename } from '@/utils/tools'; // 查询字典数据列表 export async function getDictDataList( @@ -67,6 +68,6 @@ export function exportDictData( return downLoadXlsx( `/api/cms/dict/data/export`, { params }, - `dict_data_${new Date().getTime()}.xlsx`, + `枚举_${getDateTimeForFilename()}.xlsx`, ); } diff --git a/src/types/area/business.d.ts b/src/types/area/business.d.ts index 8b46dc4..365c468 100644 --- a/src/types/area/business.d.ts +++ b/src/types/area/business.d.ts @@ -1,39 +1,51 @@ -declare namespace API.AreaBusiness { - export interface Circle { +declare namespace API.AreaRegional { + export interface Regional { + total: number; + rows: RegionalRows[]; + code: number; + msg: string; + data?: any; + } + + export interface RegionalRows { + createTime: string; + regionalId: number; + regionalName: string; + areaList?: any; + } + + export interface RegionalParams { + regionalId?: number; + regionalName?: string; + areaList?: any; + } + + export interface Business { + total: number; + rows: BusinessRows[]; + code: number; + msg: string; + data?: any; + } + + export interface BusinessRows { + createTime: string; commercialAreaId: number; commercialAreaName: string; latitude: number; longitude: number; - createTime: string; + address: string; + regionalId?: any; + regionalName?: any; } - export interface LinePoint { - latitude: number; - longitude: numberl; - lineName: string; - stationId: number; - stationName: string; - } - - export interface CircleParams { - createTime?: string; - updateTime?: string; - pageSize?: string; - current?: string; - } - - export interface CircleEditParams { - commercialAreaName: string; - latitude: number; - longitude: number; + export interface BusinessParams { commercialAreaId?: number; + commercialAreaName?: string; + latitude?: number; + longitude?: number; address?: string; - } - - export interface CirclePageResult { - code: number; - msg: string; - total: number; - rows: Array; + regionalId?: any; + regionalName?: any; } } diff --git a/src/utils/tools.ts b/src/utils/tools.ts index 751f341..a434c83 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -18,3 +18,20 @@ export function debounce any>(fn: T, delay = 300) }, delay); }; } + +/** + * 获取当前年、月、日、时、分、秒,并格式化为适用于文件名的字符串。 + * 格式为:YYYYMMDD_HHmmss (例如:20251029_172406) + * @returns {string} 格式化后的日期时间字符串。 + */ +export function getDateTimeForFilename() { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + const hour = String(now.getHours()).padStart(2, '0'); + const minute = String(now.getMinutes()).padStart(2, '0'); + const second = String(now.getSeconds()).padStart(2, '0'); + + return `${year}${month}${day}_${hour}${minute}${second}`; +}