diff --git a/.hintrc b/.hintrc new file mode 100644 index 0000000..aa8de6b --- /dev/null +++ b/.hintrc @@ -0,0 +1,5 @@ +{ + "extends": [ + "development" + ] +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6b61141 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/qingdao-admin/v17/.suo b/.vs/qingdao-admin/v17/.suo new file mode 100644 index 0000000..e24f0d6 Binary files /dev/null and b/.vs/qingdao-admin/v17/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..31e0c50 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/src/pages/Classify/Industry/edit.tsx b/src/pages/Classify/Industry/edit.tsx index a0340d6..fc57f4d 100644 --- a/src/pages/Classify/Industry/edit.tsx +++ b/src/pages/Classify/Industry/edit.tsx @@ -6,11 +6,17 @@ import { ProFormRadio, ProFormSelect, ProFormText, + ProDescriptions, } from '@ant-design/pro-components'; import { Form } from 'antd'; import { DictValueEnumObj } from '@/components/DictTag'; import { FormattedMessage } from '@@/exports'; import { getCmsIndustryTree } from '@/services/classify/industry'; +import { values } from 'lodash'; + +interface IndustryDetail extends API.ClassifyIndustry.IndustryRow { + parentName: string; +} export type ListFormProps = { onCancel: (flag?: boolean, formVars?: unknown) => void; @@ -19,17 +25,30 @@ export type ListFormProps = { values?: Partial; // industryStatusEnum: DictOptionType[]; industryStatusEnum: DictValueEnumObj; + mode?: 'view' | 'edit' | 'create'; }; const listEdit: React.FC = (props) => { const [form] = Form.useForm(); - const { industryStatusEnum } = props; + const { industryStatusEnum, mode = props.values ? 'edit' : 'create',values } = props; useEffect(() => { form.resetFields(); - if (props.values) { - form.setFieldsValue(props.values); + if (values) { + form.setFieldsValue(values); } - }, [form, props]); + }, [form,values?.industryId]); + + const getSafeDetailData = ( + data?: Partial + ): IndustryDetail => { + return{ + industryId: data?.industryId ?? 0, + industryName: data?.industryName ?? '', + orderNum: data?.orderNum ?? 0, + parentId: data?.parentId ?? 0, + parentName: (data as any)?.parentName ?? '无', // 或通过 parentId 映射 + status: data?.status ?? '0',} + }; const handleCancel = () => { props.onCancel(); @@ -39,13 +58,45 @@ const listEdit: React.FC = (props) => { const handleFinish = async (values: Record) => { props.onSubmit(values as API.ClassifyIndustry.IndustryRow); }; - +// check +if (mode === 'view') { return ( - - title={`${props.values ? '编辑' : '新增'}行业`} + handleCancel(), + footer: null, + }} + submitter={false} + > + + column={1} + dataSource={getSafeDetailData(values)} + loading={!values} + > + + + + + + + + ); + } + return ( + { function ManagementList() { const access = useAccess(); - const formTableRef = useRef(); const actionRef = useRef(); @@ -96,6 +95,19 @@ function ManagementList() { dataIndex: 'industryId', width: 300, render: (industryId, record) => [ + , , + ]} + > +
+ + {record?.name} + {record?.industry} + + + + {record?.location} + {record?.code} + {record?.description} + +
+ + ); +}; + +export default ListEdit; \ No newline at end of file diff --git a/src/pages/Company/List/index.tsx b/src/pages/Company/List/index.tsx index d50b0e4..86188d7 100644 --- a/src/pages/Company/List/index.tsx +++ b/src/pages/Company/List/index.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useEffect, useRef, useState } from 'react'; import { FormattedMessage, useAccess } from '@umijs/max'; -import { Button, FormInstance, message, Modal } from 'antd'; +import { Button, FormInstance, message, Modal, Descriptions } from 'antd'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; -import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; +import { DeleteOutlined, FormOutlined, PlusOutlined, EyeOutlined, AlignLeftOutlined } from '@ant-design/icons'; import EditCompanyListRow from './edit'; import { addCmsCompanyList, @@ -14,37 +14,40 @@ import { import { getDictValueEnum } from '@/services/system/dict'; import DictTag from '@/components/DictTag'; -const handleRemoveOne = async (jobId: string) => { - const hide = message.loading('正在删除'); - if (!jobId) return true; - try { - const resp = await delCmsCompanyList(jobId); - hide(); - if (resp.code === 200) { - message.success('删除成功,即将刷新'); - } else { - message.error(resp.msg); - } - return true; - } catch (error) { - hide(); - message.error('删除失败,请重试'); - return false; - } -}; - -const handleExport = async (values: API.CompanyList.Params) => { - const hide = message.loading('正在导出'); - try { - await exportCmsCompanyList(values); - hide(); - message.success('导出成功'); - return true; - } catch (error) { - hide(); - message.error('导出失败,请重试'); - return false; - } +// 详情查看组件 +const CompanyDetailModal = ({ + visible, + onCancel, + record, + scaleEnum +}: { + visible: boolean; + onCancel: () => void; + record?: API.CompanyList.Company; + scaleEnum: Record; +}) => { + return ( + + 关闭 + , + ]} + > + + {record?.name} + {record?.industry} + + + + {record?.location} + + + ); }; function ManagementList() { @@ -55,7 +58,41 @@ function ManagementList() { const [currentRow, setCurrentRow] = useState(); const [modalVisible, setModalVisible] = useState(false); - const [scaleEnum, setScaleEnum] = useState([]); + const [detailVisible, setDetailVisible] = useState(false); + const [scaleEnum, setScaleEnum] = useState>({}); + + const handleRemoveOne = async (jobId: string) => { + const hide = message.loading('正在删除'); + if (!jobId) return true; + try { + const resp = await delCmsCompanyList(jobId); + hide(); + if (resp.code === 200) { + message.success('删除成功,即将刷新'); + } else { + message.error(resp.msg); + } + return true; + } catch (error) { + hide(); + message.error('删除失败,请重试'); + return false; + } + }; + + const handleExport = async (values: API.CompanyList.Params) => { + const hide = message.loading('正在导出'); + try { + await exportCmsCompanyList(values); + hide(); + message.success('导出成功'); + return true; + } catch (error) { + hide(); + message.error('导出失败,请重试'); + return false; + } + }; useEffect(() => { getDictValueEnum('scale', true, true).then((data) => { @@ -63,8 +100,6 @@ function ManagementList() { }); }, []); - const editSubmit = () => {}; - const columns: ProColumns[] = [ { title: '公司名称', @@ -102,6 +137,19 @@ function ManagementList() { dataIndex: 'companyId', width: 300, render: (companyId, record) => [ + , + , + + , +
, + , + +
], }, ]; @@ -260,6 +278,7 @@ function ManagementList() { onClick={async () => { setCurrentRow(undefined); setModalVisible(true); + setMode('create'); }} > 新建 @@ -281,6 +300,7 @@ function ManagementList() { { let resData; if (values.jobId) {