From 41283fab6c39905f14af16e2dd93d76265a735c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B2=E5=85=B8=E5=8D=93?= Date: Fri, 25 Apr 2025 15:40:05 +0800 Subject: [PATCH] =?UTF-8?q?flat=EF=BC=9A=E6=8B=9B=E8=81=98=E4=BC=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.less | 133 ++++++++++------------- src/pages/Classify/Jobs/index.tsx | 13 ++- src/pages/Jobfair/List/edit.tsx | 169 +++++++++++++++++++++--------- 3 files changed, 183 insertions(+), 132 deletions(-) diff --git a/src/global.less b/src/global.less index 6b69bce..6d5ad58 100644 --- a/src/global.less +++ b/src/global.less @@ -1,77 +1,56 @@ -html, -body, -#root { - height: 100%; - margin: 0; - padding: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, - 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', - 'Noto Color Emoji'; -} - -.colorWeak { - filter: invert(80%); -} - -.ant-layout { - min-height: 100vh !important; -} - -.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed { - left: unset; -} -.ant-table-cell .ant-table-row-expand-icon { - vertical-align: middle; - margin-right: 8px; -} -.ant-table-row { - &-level-0 .ant-table-cell:first-child { - padding-left: 16px !important; - } - &-level-1 .ant-table-cell:first-child { - padding-left: 40px !important; - } - &-level-2 .ant-table-cell:first-child { - padding-left: 64px !important; - } -} -.ant-table-row .ant-table-cell:first-child { - display: flex; - align-items: center; -} -.ant-table-row-level-2 .ant-table-row-expand-icon { - display: none; -} -canvas { - display: block; -} - -body { - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -ul, -ol { - list-style: none; -} - -@media (max-width: 768px) { - .ant-table { - width: 100%; - overflow-x: auto; - - &-thead > tr, - &-tbody > tr { - > th, - > td { - white-space: pre; - - > span { - display: block; - } - } - } - } -} +html, +body, +#root { + height: 100%; + margin: 0; + padding: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, + 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', + 'Noto Color Emoji'; +} + +.colorWeak { + filter: invert(80%); +} + +.ant-layout { + min-height: 100vh !important; +} + +.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed { + left: unset; +} + +canvas { + display: block; +} + +body { + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +ul, +ol { + list-style: none; +} + +@media (max-width: 768px) { + .ant-table { + width: 100%; + overflow-x: auto; + + &-thead > tr, + &-tbody > tr { + > th, + > td { + white-space: pre; + + > span { + display: block; + } + } + } + } +} diff --git a/src/pages/Classify/Jobs/index.tsx b/src/pages/Classify/Jobs/index.tsx index 572fb8d..9aa10cf 100644 --- a/src/pages/Classify/Jobs/index.tsx +++ b/src/pages/Classify/Jobs/index.tsx @@ -48,11 +48,14 @@ const buildTree = ( ): API.ClassifyJobs.Jobs[] => { const children = data .filter((item) => item.parentId === parentId) - .map((item) => ({ - ...item, - depth, - children: buildTree(data, item.jobId, depth + 1), - })); + .map((item) => { + const child = buildTree(data, item.jobId, depth + 1); + return { + ...item, + depth, + children: child.length ? child : undefined, + }; + }); return children || []; }; diff --git a/src/pages/Jobfair/List/edit.tsx b/src/pages/Jobfair/List/edit.tsx index 36b6942..0823ffa 100644 --- a/src/pages/Jobfair/List/edit.tsx +++ b/src/pages/Jobfair/List/edit.tsx @@ -1,26 +1,27 @@ -import {useEffect, useCallback, useState} from 'react' +import { useEffect, useState } from 'react'; import { ModalForm, ProForm, - ProFormTextArea, - ProFormText, + ProFormDateTimeRangePicker, ProFormDigit, - ProFormRadio, - ProFormDateRangePicker, ProFormList, + ProFormRadio, ProFormSelect, + ProFormText, + ProFormTextArea, } from '@ant-design/pro-components'; -import { Button, Form, message } from 'antd'; -import {DictOptionType, DictValueEnumObj} from "@/components/DictTag"; -import { useIntl, FormattedMessage } from '@umijs/max'; -import {getCmsCompanyList} from "@/services/company/list"; +import { Button, Form } from 'antd'; +import { DictValueEnumObj } from '@/components/DictTag'; +import { FormattedMessage, useIntl } from '@umijs/max'; +import { getCmsCompanyList } from '@/services/company/list'; +import ProFromMap from '@/components/ProFromMap'; export type ListFormProps = { onCancel: (flag?: boolean, formVals?: unknown) => void; onSubmit: (values: API.JobFairList.JobFairListRows) => Promise; open: boolean; values?: Partial; - jobFairType?: DictValueEnumObj; + jobFairType?: DictValueEnumObj; }; const waitTime = (time: number = 100) => { return new Promise((resolve) => { @@ -35,34 +36,35 @@ const listEdit: React.FC = (props) => { const intl = useIntl(); const { jobFairType } = props; - const [companyOptions, setCompanyOptions] = useState([]) + const [open, setOpen] = useState(false); + const [viewInfo, setViewInfo] = useState({}); + const [companyOptions, setCompanyOptions] = useState([]); useEffect(() => { form.resetFields(); - if(props.values) { - console.log(props.values) + if (props.values) { + console.log(props.values); form.setFieldsValue({ ...props.values, createTimeRanger: [props.values.startTime, props.values.endTime], }); + setViewInfo(props.values); } }, [form, props]); - - const handleChange =(_: string, value: any) => { + const handleChange = (_: string, value: any) => { const ls = form.getFieldsValue().companyList.map((item: any) => { - if(value.value === item.companyId) { + if (value.value === item.companyId) { return { ...item, - companyName: value.title - } + companyName: value.title, + }; } return item; - }) - form.setFieldValue('companyList', ls) - console.log(ls) - } - + }); + form.setFieldValue('companyList', ls); + console.log(ls); + }; const handleCancel = () => { props.onCancel(); @@ -73,6 +75,25 @@ const listEdit: React.FC = (props) => { props.onSubmit(values as API.JobFairList.JobFairListRows); }; + 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 ( = (props) => { submitTimeout={2000} onFinish={handleFinish} > -