fix:修复控制台问题

This commit is contained in:
yy
2025-04-23 14:05:56 +08:00
parent 994ec60616
commit 2224e1acb4
8 changed files with 1197 additions and 1220 deletions

View File

@@ -1,189 +1,190 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { import {
ModalForm, ModalForm,
ProForm, ProForm,
ProFormDigit, ProFormDigit,
ProFormRadio, ProFormRadio,
ProFormTreeSelect, ProFormTreeSelect,
ProFormText, ProFormText,
ProDescriptions, ProDescriptions,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Form } from 'antd'; import { Form } from 'antd';
import { DictValueEnumObj } from '@/components/DictTag'; import { DictValueEnumObj } from '@/components/DictTag';
import { FormattedMessage } from '@@/exports'; import { FormattedMessage } from '@@/exports';
import { getCmsIndustryTreeList } from '@/services/classify/industry'; // 修改导入为 getCmsIndustryTreeList import { getCmsIndustryTreeList } from '@/services/classify/industry'; // 修改导入为 getCmsIndustryTreeList
interface IndustryDetail { interface IndustryDetail {
id?: number; id?: number;
industryName?: string; industryName?: string;
orderNum?: number; orderNum?: number;
status?: string; status?: string;
parentId?: number; parentId?: number;
parentName?: string; parentName?: string;
} }
export type ListFormProps = { export type ListFormProps = {
onCancel: (flag?: boolean, formVars?: unknown) => void; onCancel: (flag?: boolean, formVars?: unknown) => void;
onSubmit: (values: any) => Promise<void>; onSubmit: (values: any) => Promise<void>;
open: boolean; open: boolean;
values?: Partial<IndustryDetail>; values?: Partial<IndustryDetail>;
industryStatusEnum: DictValueEnumObj; industryStatusEnum: DictValueEnumObj;
mode?: 'view' | 'edit' | 'create'; mode?: 'view' | 'edit' | 'create';
}; };
const listEdit: React.FC<ListFormProps> = (props) => { const listEdit: React.FC<ListFormProps> = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm<IndustryDetail>();
const { industryStatusEnum, mode = props.values ? 'edit' : 'create', values } = props; const { industryStatusEnum, mode = props.values ? 'edit' : 'create', values } = props;
useEffect(() => { useEffect(() => {
form.resetFields(); form.resetFields();
if (values) { if (values) {
form.setFieldsValue({ form.setFieldsValue({
...values, ...values,
parentId: values?.parentId ?? 0 parentId: values?.parentId ?? 0
}); });
} }
}, [form, values?.id]); }, [form, values?.id]);
const getSafeDetailData = (data?: Partial<IndustryDetail>): IndustryDetail => { const getSafeDetailData = (data?: Partial<IndustryDetail>): IndustryDetail => {
return { return {
id: data?.id ?? 0, id: data?.id ?? 0,
industryName: data?.industryName ?? '', industryName: data?.industryName ?? '',
orderNum: data?.orderNum ?? 0, orderNum: data?.orderNum ?? 0,
parentId: data?.parentId ?? 0, parentId: data?.parentId ?? 0,
parentName: data?.parentName ?? '顶级节点', parentName: data?.parentName ?? '顶级节点',
status: data?.status ?? '0', status: data?.status ?? '0',
}; };
}; };
const handleCancel = () => { const handleCancel = () => {
props.onCancel(); props.onCancel();
form.resetFields(); form.resetFields();
}; };
const handleFinish = async (values: Record<string, any>) => { const handleFinish = async (values: Record<string, any>) => {
const submitValues = { const submitValues = {
...values, ...values,
parentId: values.parentId === 0 ? undefined : values.parentId parentId: values.parentId === 0 ? undefined : values.parentId
}; };
props.onSubmit(submitValues); props.onSubmit(submitValues);
}; };
// 获取行业树数据 // 获取行业树数据
const fetchIndustryTree = async () => { const fetchIndustryTree = async () => {
const res = await getCmsIndustryTreeList(); const res = await getCmsIndustryTreeList();
return [ return [
{ {
id: 0, id: 0,
label: '顶级节点', label: '顶级节点',
value: 0, value: 0,
children: res.data || [] children: res.data || []
} }
]; ];
}; };
if (mode === 'view') { if (mode === 'view') {
return ( return (
<ModalForm <ModalForm
title="行业详情" title="行业详情"
open={props.open} open={props.open}
width={800} width={800}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => handleCancel(), onCancel: () => handleCancel(),
footer: null, footer: null,
}} }}
submitter={false} submitter={false}
> >
<ProDescriptions<IndustryDetail> <ProDescriptions<IndustryDetail>
column={1} column={1}
dataSource={getSafeDetailData(values)} dataSource={getSafeDetailData(values)}
loading={!values} loading={!values}
> >
<ProDescriptions.Item label="行业ID" dataIndex="id" /> <ProDescriptions.Item label="行业ID" dataIndex="id" />
<ProDescriptions.Item label="行业名称" dataIndex="industryName" /> <ProDescriptions.Item label="行业名称" dataIndex="industryName" />
<ProDescriptions.Item label="显示顺序" dataIndex="orderNum" /> <ProDescriptions.Item label="显示顺序" dataIndex="orderNum" />
<ProDescriptions.Item <ProDescriptions.Item
label="父行业" label="父行业"
dataIndex="parentName" dataIndex="parentName"
renderText={(text, record) => record.parentId === 0 ? '顶级节点' : text} renderText={(text, record) => record.parentId === 0 ? '顶级节点' : text}
/> />
<ProDescriptions.Item <ProDescriptions.Item
label="行业状态" label="行业状态"
dataIndex="status" dataIndex="status"
valueEnum={industryStatusEnum} valueEnum={industryStatusEnum}
/> />
</ProDescriptions> </ProDescriptions>
</ModalForm> </ModalForm>
); );
} }
return ( return (
<ModalForm <ModalForm
title={`${values ? '编辑' : '新增'}行业`} title={`${values ? '编辑' : '新增'}行业`}
form={form} form={form}
autoFocusFirstInput autoFocusFirstInput
open={props.open} open={props.open}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => handleCancel(), onCancel: () => handleCancel(),
}} }}
submitTimeout={2000} submitTimeout={2000}
onFinish={handleFinish} onFinish={handleFinish}
> >
<ProFormDigit name="id" disabled hidden={true} /> <ProFormDigit name="id" disabled hidden={true} />
<ProForm.Group> <ProForm.Group>
<ProFormText <ProFormText
width="md" width="md"
name="industryName" name="industryName"
label="行业名称" label="行业名称"
placeholder="请输入行业名称" placeholder="请输入行业名称"
rules={[{ required: true, message: '请输入行业名称' }]} rules={[{ required: true, message: '请输入行业名称' }]}
/> />
<ProFormDigit <ProFormDigit
label="显示顺序" label="显示顺序"
name="orderNum" name="orderNum"
width="md" width="md"
min={0} min={0}
placeholder="请输入显示顺序" placeholder="请输入显示顺序"
rules={[{ required: true, message: '请输入显示顺序' }]} rules={[{ required: true, message: '请输入显示顺序' }]}
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormTreeSelect <ProFormTreeSelect
name="parentId" name="parentId"
label="父行业" label="父行业"
placeholder="请选择父行业" placeholder="请选择父行业"
allowClear allowClear
width="md" width="md"
request={fetchIndustryTree} request={fetchIndustryTree}
fieldProps={{ fieldProps={{
treeDefaultExpandAll: true, virtual:true,
showSearch: true, treeDefaultExpandAll: true,
filterTreeNode: true, showSearch: true,
fieldNames: { filterTreeNode: true,
label: 'label', fieldNames: {
value: 'id', label: 'label',
children: 'children', value: 'id',
}, children: 'children',
dropdownStyle: { },
maxHeight: 400, dropdownStyle: {
overflow: 'auto', maxHeight: 400,
}, overflow: 'auto',
}} },
rules={[{ required: true, message: '请选择父行业' }]} }}
/> rules={[{ required: true, message: '请选择父行业' }]}
<ProFormRadio.Group />
valueEnum={industryStatusEnum} <ProFormRadio.Group
name="status" valueEnum={industryStatusEnum}
label="行业状态" name="status"
width="md" label="行业状态"
initialValue="0" width="md"
rules={[{ required: true, message: '请选择行业状态' }]} initialValue="0"
/> rules={[{ required: true, message: '请选择行业状态' }]}
</ProForm.Group> />
</ModalForm> </ProForm.Group>
); </ModalForm>
}; );
};
export default listEdit; export default listEdit;

View File

@@ -1,250 +1,256 @@
import React, { Fragment, useEffect, useRef, useState } from 'react'; import React, { Fragment, useEffect, useRef, useState } from 'react';
import { FormattedMessage, useAccess } from '@umijs/max'; import { FormattedMessage, useAccess } from '@umijs/max';
import { Button, FormInstance, message, Modal } from 'antd'; import { Button, FormInstance, message } from 'antd';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { AlignLeftOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; import { AlignLeftOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
import EditCompanyListRow from './edit'; import EditCompanyListRow from './edit';
import { import {
addCmsIndustryIndustryt, addCmsIndustryIndustryt,
delCmsIndustryList, delCmsIndustryList,
exportCmsIndustry, exportCmsIndustry,
getCmsIndustryTreeList, getCmsIndustryTreeList,
updateCmsIndustryIndustryt, updateCmsIndustryIndustryt,
} from '@/services/classify/industry'; } from '@/services/classify/industry';
import { getDictValueEnum } from '@/services/system/dict'; import { getDictValueEnum } from '@/services/system/dict';
import DictTag from '@/components/DictTag'; import DictTag from '@/components/DictTag';
// 定义行业数据类型替代API.ClassifyIndustry.IndustryRow // 定义行业数据类型替代API.ClassifyIndustry.IndustryRow
interface IndustryItem { interface IndustryItem {
id: number; id: number;
industryName: string; industryName: string;
orderNum?: number; orderNum?: number;
status?: string; status?: string;
children?: IndustryItem[]; children?: IndustryItem[];
} }
const handleRemoveOne = async (id: string) => { // 参数改为id const handleRemoveOne = async (id: string) => {
const hide = message.loading('正在删除'); // 参数改为id
try { const hide = message.loading('正在删除');
const resp = await delCmsIndustryList(id); try {
hide(); const resp = await delCmsIndustryList(id);
if (resp.code === 200) { hide();
message.success('删除成功,即将刷新'); if (resp.code === 200) {
} else { message.success('删除成功,即将刷新');
message.error(resp.msg); } else {
} message.error(resp.msg);
return true; }
} catch (error) { return true;
hide(); } catch (error) {
message.error('删除失败,请重试'); hide();
return false; message.error('删除失败,请重试');
} return false;
}; }
};
const handleExport = async (values: any) => { // 简化类型定义
const hide = message.loading('正在导出'); const handleExport = async (values: any) => {
try { // 简化类型定义
await exportCmsIndustry(values); const hide = message.loading('正在导出');
hide(); try {
message.success('导出成功'); await exportCmsIndustry(values);
return true; hide();
} catch (error) { message.success('导出成功');
hide(); return true;
message.error('导出失败,请重试'); } catch (error) {
return false; hide();
} message.error('导出失败,请重试');
}; return false;
}
// 处理树形数据的函数(移到组件外部) };
function processTreeData(data: any[]): IndustryItem[] {
return data.map(item => ({ // 处理树形数据的函数(移到组件外部)
id: item.id, function processTreeData(data: any[]): IndustryItem[] {
industryName: item.label, return data.map((item) => ({
orderNum: item.sort || 0, id: item.id,
status: item.status || '0', industryName: item.label,
key: item.id, // ProTable需要的唯一key orderNum: item.sort || 0,
children: item.children ? processTreeData(item.children) : [] status: item.status || '0',
})); key: item.id, // ProTable需要的唯一key
} children: item.children ? processTreeData(item.children) : undefined,
}));
function ManagementList() { }
const access = useAccess();
const formTableRef = useRef<FormInstance>(); function ManagementList() {
const actionRef = useRef<ActionType>(); const access = useAccess();
const formTableRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<IndustryItem>(); // 使用新类型 const actionRef = useRef<ActionType>();
const [modalVisible, setModalVisible] = useState<boolean>(false);
const [industryStatusEnum, setIndustryStatusEnum] = useState<any>([]); const [currentRow, setCurrentRow] = useState<IndustryItem>(); // 使用新类型
const [modalVisible, setModalVisible] = useState<boolean>(false);
useEffect(() => { const [industryStatusEnum, setIndustryStatusEnum] = useState<any>([]);
getDictValueEnum('sys_industry_status', true).then((data) => {
setIndustryStatusEnum(data); useEffect(() => {
}); getDictValueEnum('sys_industry_status', true).then((data) => {
}, []); setIndustryStatusEnum(data);
});
const columns: ProColumns<IndustryItem>[] = [ // 使用新类型 }, []);
{
title: '行业名称', const columns: ProColumns<IndustryItem>[] = [
dataIndex: 'industryName', // 使用新类型
valueType: 'text', {
align: 'center', title: '行业名称',
}, dataIndex: 'industryName',
{ valueType: 'text',
title: '显示顺序', align: 'center',
dataIndex: 'orderNum', },
valueType: 'text', {
hideInSearch: true, title: '显示顺序',
align: 'center', dataIndex: 'orderNum',
}, valueType: 'text',
{ hideInSearch: true,
title: '状态', align: 'center',
dataIndex: 'status', },
align: 'center', {
valueType: 'select', title: '状态',
valueEnum: industryStatusEnum, dataIndex: 'status',
render: (_, record) => { align: 'center',
return <DictTag enums={industryStatusEnum} value={record.status} />; valueType: 'select',
}, valueEnum: industryStatusEnum,
}, render: (_, record) => {
{ return <DictTag enums={industryStatusEnum} value={record.status} />;
title: '操作', },
hideInSearch: true, },
align: 'center', {
dataIndex: 'id', // 改为id title: '操作',
width: 300, hideInSearch: true,
render: (id, record) => [ align: 'center',
<Button dataIndex: 'id', // 改为id
type="link" width: 300,
size="small" render: (id, record) => [
key="view" <Button
icon={<AlignLeftOutlined />} type="link"
hidden={!access.hasPerms('area:business:List.view')} size="small"
onClick={() => { key="view"
setModalVisible(true); icon={<AlignLeftOutlined />}
setCurrentRow(record); hidden={!access.hasPerms('area:business:List.view')}
}} onClick={() => {
> setModalVisible(true);
setCurrentRow(record);
</Button>, }}
<Button >
type="link"
size="small" </Button>,
key="edit" <Button
icon={<FormOutlined />} type="link"
hidden={!access.hasPerms('area:business:List.update')} size="small"
onClick={() => { key="edit"
setModalVisible(true); icon={<FormOutlined />}
setCurrentRow(record); hidden={!access.hasPerms('area:business:List.update')}
}} onClick={() => {
> setModalVisible(true);
setCurrentRow(record);
</Button>, }}
<Button >
type="link"
size="small" </Button>,
danger // <Button
key="batchRemove" // type="link"
icon={<DeleteOutlined />} // size="small"
hidden={!access.hasPerms('area:subway:List')} // danger
onClick={async () => { // key="batchRemove"
Modal.confirm({ // icon={<DeleteOutlined />}
title: '删除', // hidden={!access.hasPerms('area:subway:List')}
content: '确定删除该项吗?', // onClick={async () => {
onOk: async () => { // Modal.confirm({
const success = await handleRemoveOne(id.toString()); // title: '删除',
if (success && actionRef.current) { // content: '确定删除该项吗?',
actionRef.current.reload(); // onOk: async () => {
} // const success = await handleRemoveOne(id.toString());
}, // if (success && actionRef.current) {
}); // actionRef.current.reload();
}} // }
> // },
// });
</Button>, // }}
], // >
}, // 删除
]; // </Button>,
],
return ( },
<Fragment> ];
<div style={{ width: '100%', float: 'right' }}>
<ProTable<IndustryItem> return (
actionRef={actionRef} <Fragment>
formRef={formTableRef} <div style={{ width: '100%', float: 'right' }}>
rowKey="id" // 改为id <ProTable<IndustryItem>
columns={columns} actionRef={actionRef}
search={false} formRef={formTableRef}
defaultExpandAllRows={true} rowKey="id" // 改为id
childrenColumnName="children" columns={columns}
pagination={false} search={false}
request={async () => { defaultExpandAllRows={true}
try { childrenColumnName="children"
const res = await getCmsIndustryTreeList(); pagination={false}
return { request={async () => {
data: processTreeData(res.data || []), try {
success: true, const res = await getCmsIndustryTreeList();
}; return {
} catch (error) { data: processTreeData(res.data || []),
console.error('获取数据失败:', error); success: true,
return { data: [], success: false }; };
} } catch (error) {
}} console.error('获取数据失败:', error);
toolBarRender={() => [ return { data: [], success: false };
<Button }
type="primary" }}
key="add" toolBarRender={() => [
hidden={!access.hasPerms('manage:List:add')} <Button
onClick={() => { type="primary"
setCurrentRow(undefined); key="add"
setModalVisible(true); hidden={!access.hasPerms('manage:List:add')}
}} onClick={() => {
> setCurrentRow(undefined);
<PlusOutlined /> setModalVisible(true);
</Button>, }}
<Button >
key="export" <PlusOutlined />
hidden={!access.hasPerms('system:user:export')} </Button>,
onClick={async () => { <Button
const searchVal = formTableRef.current?.getFieldsValue(); key="export"
handleExport(searchVal); hidden={!access.hasPerms('system:user:export')}
}} onClick={async () => {
> const searchVal = formTableRef.current?.getFieldsValue();
<PlusOutlined /> handleExport(searchVal);
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" /> }}
</Button>, >
]} <PlusOutlined />
/> <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
</div> </Button>,
<EditCompanyListRow ]}
open={modalVisible} />
onSubmit={async (values) => { </div>
let resData; <EditCompanyListRow
if (values.id) { // 改为id open={modalVisible}
resData = await updateCmsIndustryIndustryt(values); onSubmit={async (values) => {
} else { let resData;
resData = await addCmsIndustryIndustryt(values); if (values.id) {
} // 改为id
if (resData.code === 200) { resData = await updateCmsIndustryIndustryt(values);
setModalVisible(false); } else {
setCurrentRow(undefined); resData = await addCmsIndustryIndustryt(values);
message.success(values.id ? '修改成功' : '新增成功'); }
actionRef.current?.reload(); if (resData.code === 200) {
} setModalVisible(false);
}} setCurrentRow(undefined);
onCancel={() => { message.success(values.id ? '修改成功' : '新增成功');
setModalVisible(false); actionRef.current?.reload();
setCurrentRow(undefined); }
}} }}
industryStatusEnum={industryStatusEnum} onCancel={() => {
values={currentRow} setModalVisible(false);
mode={ setCurrentRow(undefined);
currentRow?.id // 改为id }}
? access.hasPerms('area:business:List.update') ? 'edit' : 'view' industryStatusEnum={industryStatusEnum}
: 'create' values={currentRow}
} mode={
/> currentRow?.id // 改为id
</Fragment> ? access.hasPerms('area:business:List.update')
); ? 'edit'
} : 'view'
: 'create'
export default ManagementList; }
/>
</Fragment>
);
}
export default ManagementList;

View File

@@ -1,159 +1,159 @@
import React,{ useEffect,useState } from 'react'; import React,{ useEffect,useState } from 'react';
import { import {
ModalForm, ModalForm,
ProForm, ProForm,
ProFormDigit, ProFormDigit,
ProFormText, ProFormText,
ProFormTextArea, ProFormTextArea,
ProFormTreeSelect, ProFormTreeSelect,
ProFormSelect ProFormSelect
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Form } from 'antd'; import { Form } from 'antd';
import { getCmsJobTitleList } from '@/services/classify/jobs'; import { getCmsJobTitleList } from '@/services/classify/jobs';
import { getDictValueEnum } from '@/services/system/dict'; import { getDictValueEnum } from '@/services/system/dict';
// tree // tree
type JobListParams = API.ClassifyJobs.Params; type JobListParams = API.ClassifyJobs.Params;
export type ListFormProps = { export type ListFormProps = {
onCancel: (flag?: boolean, formVals?: unknown) => void; onCancel: (flag?: boolean, formVals?: unknown) => void;
onSubmit: (values: any) => Promise<void>; onSubmit: (values: any) => Promise<void>;
open: boolean; open: boolean;
values?: Partial<API.ClassifyJobs.Job>; values?: Partial<API.ClassifyJobs.Jobs>;
// jobGroupOptions: DictOptionType[]; // jobGroupOptions: DictOptionType[];
// statusOptions: DictValueEnumObj; // statusOptions: DictValueEnumObj;
}; };
const listEdit: React.FC<ListFormProps> = (props) => { const listEdit: React.FC<ListFormProps> = (props) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [treeData, setTreeData] = useState<API.ClassifyJobs.Job[]>([]); const [treeData, setTreeData] = useState<API.ClassifyJobs.Jobs[]>([]);
const [statusOptions, setStatusOptions] = useState<Record<string, any>>({}); const [statusOptions, setStatusOptions] = useState<Record<string, any>>({});
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const buildTree = (data: API.ClassifyJobs.Job[], parentId: number = 0): API.ClassifyJobs.Job[] => { const buildTree = (data: API.ClassifyJobs.Jobs[], parentId: number = 0): API.ClassifyJobs.Jobs[] => {
return data return data
.filter(item => item.parentId === parentId) .filter(item => item.parentId === parentId)
.map(item => ({ .map(item => ({
...item, ...item,
children: buildTree(data, item.jobId), children: buildTree(data, item.jobId),
})); }));
}; };
useEffect(() => { useEffect(() => {
const fetchData = async () => { const fetchData = async () => {
const res = await getCmsJobTitleList({ const res = await getCmsJobTitleList({
tree: false, tree: false,
// 明确传递所有必要参数 // 明确传递所有必要参数
pageSize: 1000, // 确保获取全部数据 pageSize: 1000, // 确保获取全部数据
current: 1 current: 1
} as JobListParams); } as JobListParams);
setLoading(true); setLoading(true);
try { try {
// 获取状态枚举 // 获取状态枚举
const statusData = await getDictValueEnum('sys_jobs_status', true); const statusData = await getDictValueEnum('sys_jobs_status', true);
setStatusOptions(statusData); setStatusOptions(statusData);
// 获取岗位数据 // 获取岗位数据
const res = await getCmsJobTitleList({ tree: false } as JobListParams); const res = await getCmsJobTitleList({ tree: false } as JobListParams);
console.log('原始数据:', res.rows); console.log('原始数据:', res.rows);
const treeData = buildTree(res.rows || []); const treeData = buildTree(res.rows || []);
console.log('转换后的树形数据:', treeData); console.log('转换后的树形数据:', treeData);
setTreeData(treeData); setTreeData(treeData);
// 设置表单初始值 // 设置表单初始值
if (props.values) { if (props.values) {
form.setFieldsValue({ form.setFieldsValue({
...props.values, ...props.values,
parentId: props.values.parentId || undefined, parentId: props.values.parentId || undefined,
}); });
} }
} catch (error) { } catch (error) {
console.error('数据加载失败:', error); console.error('数据加载失败:', error);
} finally { } finally {
setLoading(false); setLoading(false);
} }
}; };
fetchData(); fetchData();
}, []); }, []);
const handleCancel = () => { const handleCancel = () => {
props.onCancel(); props.onCancel();
form.resetFields(); form.resetFields();
}; };
const handleFinish = async (values: Record<string, any>) => { const handleFinish = async (values: Record<string, any>) => {
await props.onSubmit(values); await props.onSubmit(values);
}; };
return ( return (
<ModalForm <ModalForm
title={`${props.values ? '编辑' : '新增'}企业`} title={`${props.values ? '编辑' : '新增'}企业`}
form={form} form={form}
autoFocusFirstInput autoFocusFirstInput
open={props.open} open={props.open}
width={600} width={600}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => handleCancel(), onCancel: () => handleCancel(),
}} }}
submitTimeout={2000} submitTimeout={2000}
onFinish={handleFinish} onFinish={handleFinish}
> >
<ProFormDigit label="InputNumber" name="jobId" disabled hidden={true} /> <ProFormDigit label="InputNumber" name="jobId" disabled hidden={true} />
{/* 新增:父级岗位选择 */} {/* 新增:父级岗位选择 */}
<ProFormTreeSelect <ProFormTreeSelect
name="parentId" name="parentId"
label="父级岗位" label="父级岗位"
width="md" width="md"
placeholder="请选择父级岗位" placeholder="请选择父级岗位"
allowClear allowClear
fieldProps={{ fieldProps={{
treeData, treeData,
fieldNames: { label: 'jobName', value: 'jobId', children: 'children' }, fieldNames: { label: 'jobName', value: 'jobId', children: 'children' },
treeDefaultExpandAll: true, treeDefaultExpandAll: true,
showSearch: true, showSearch: true,
variant:'outlined', variant:'outlined',
dropdownStyle: { maxHeight: 400, overflow: 'auto' }, dropdownStyle: { maxHeight: 400, overflow: 'auto' },
filterTreeNode: (input, option) => filterTreeNode: (input, option) =>
String(option?.title ?? '').toLowerCase().includes(input.toLowerCase()) String(option?.title ?? '').toLowerCase().includes(input.toLowerCase())
}} }}
/> />
<ProForm.Group> <ProForm.Group>
<ProFormText width="md" name="jobname" label="单位名称" placeholder="请输入单位名称" /> <ProFormText width="md" name="jobname" label="单位名称" placeholder="请输入单位名称" />
<ProFormDigit <ProFormDigit
width="md" width="md"
name="orderNum" name="orderNum"
label="显示顺序" label="显示顺序"
placeholder="请输入显示顺序" placeholder="请输入显示顺序"
min={0} min={0}
fieldProps={{ precision: 0 }} fieldProps={{ precision: 0 }}
rules={[{ required: true, message: '请输入显示顺序' }]} rules={[{ required: true, message: '请输入显示顺序' }]}
/> />
</ProForm.Group> </ProForm.Group>
<ProFormSelect <ProFormSelect
name="status" name="status"
label="状态" label="状态"
width="md" width="md"
valueEnum={statusOptions} valueEnum={statusOptions}
placeholder="请选择状态" placeholder="请选择状态"
/> />
<ProForm.Group> <ProForm.Group>
<ProFormText width="md" name="code" label="信用代码" placeholder="请输入信用代码" /> <ProFormText width="md" name="code" label="信用代码" placeholder="请输入信用代码" />
<ProFormText width="md" name="industry" label="主要行业" placeholder="请输入主要行业" /> <ProFormText width="md" name="industry" label="主要行业" placeholder="请输入主要行业" />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormTextArea width="xl" name="location" label="单位地点" placeholder="请输入单位地点" /> <ProFormTextArea width="xl" name="location" label="单位地点" placeholder="请输入单位地点" />
</ProForm.Group> </ProForm.Group>
</ModalForm> </ModalForm>
); );
}; };
export default listEdit; export default listEdit;

View File

@@ -1,275 +1,250 @@
import React, { Fragment, useEffect, useRef, useState } from 'react'; import React, { Fragment, useEffect, useRef, useState } from 'react';
import { FormattedMessage, useAccess } from '@umijs/max'; import { FormattedMessage, useAccess } from '@umijs/max';
import { Button, FormInstance, message, Modal } from 'antd'; import { Button, FormInstance, message, Modal } from 'antd';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons'; import { DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
import EditCompanyListRow from './edit'; import EditCompanyListRow from './edit';
import { addCmsCompanyList, delCmsCompanyList, putCmsCompanyList } from '@/services/company/list'; import { addCmsCompanyList, delCmsCompanyList, putCmsCompanyList } from '@/services/company/list';
import { exportCmsJobTitleList, getCmsJobTitleList } from '@/services/classify/jobs'; import { exportCmsJobTitleList, getCmsJobTitleList } from '@/services/classify/jobs';
import { getDictValueEnum } from '@/services/system/dict'; import { getDictValueEnum } from '@/services/system/dict';
import DictTag from '@/components/DictTag'; import DictTag from '@/components/DictTag';
declare namespace API {
namespace ClassifyJobs {
interface Params { const handleRemoveOne = async (jobId: string) => {
tree?: boolean; const hide = message.loading('正在删除');
pageSize?: number; if (!jobId) return true;
current?: number; try {
jobName?: string; const resp = await delCmsCompanyList(jobId);
status?: string; hide();
} if (resp.code === 200) {
interface Jobs { message.success('删除成功,即将刷新');
jobId: number; } else {
parentId: number; message.error(resp.msg);
jobName: string; }
orderNum?: number; return true;
status?: string; } catch (error) {
createTime?: string; hide();
parentName?: string; message.error('删除失败,请重试');
children?: Jobs[]; return false;
depth?: number; // 添加这行 }
} };
}
} const handleExport = async (values: API.ClassifyJobs.Params) => {
// params类型 const hide = message.loading('正在导出');
type JobListParams = API.ClassifyJobs.Params & { try {
tree?:boolean; await exportCmsJobTitleList(values);
}; hide();
message.success('导出成功');
const handleRemoveOne = async (jobId: string) => { return true;
const hide = message.loading('正在删除'); } catch (error) {
if (!jobId) return true; hide();
try { message.error('导出失败,请重试');
const resp = await delCmsCompanyList(jobId); return false;
hide(); }
if (resp.code === 200) { };
message.success('删除成功,即将刷新'); const buildTree = (data: API.ClassifyJobs.Jobs[], parentId: number = 0,depth = 0): API.ClassifyJobs.Jobs[] => {
} else { return data
message.error(resp.msg); .filter(item => item.parentId === parentId)
} .map(item => ({
return true; ...item,
} catch (error) { depth,
hide(); children: buildTree(data, item.jobId,depth + 1),
message.error('删除失败,请重试'); }));
return false; };
}
}; const ManagementList: React.FC = () => {
const access = useAccess();
const handleExport = async (values: API.ClassifyJobs.Params) => {
const hide = message.loading('正在导出'); const formTableRef = useRef<FormInstance>();
try { const actionRef = useRef<ActionType>();
await exportCmsJobTitleList(values);
hide(); const [currentRow, setCurrentRow] = useState<API.ClassifyJobs.Jobs>();
message.success('导出成功'); const [modalVisible, setModalVisible] = useState<boolean>(false);
return true; const [jobsStatusEnum, setJobsStatusEnum] = useState<any>([]);
} catch (error) {
hide(); useEffect(() => {
message.error('导出失败,请重试'); getDictValueEnum('sys_jobs_status', true).then(setJobsStatusEnum);
return false; }, []);
}
}; const editSubmit = () => {};
const buildTree = (data: API.ClassifyJobs.Jobs[], parentId: number = 0,depth = 0): API.ClassifyJobs.Jobs[] => {
return data const columns: ProColumns<API.ClassifyJobs.Jobs>[] = [
.filter(item => item.parentId === parentId) {
.map(item => ({ title: '岗位名称',
...item, dataIndex: 'jobName',
depth,
children: buildTree(data, item.jobId,depth + 1), align: 'center',
})); render: (text, record) => (
}; <span style={{ paddingLeft: `${(record.depth || 0) * 20}px`,display:'inline-block' ,
width:'100%'}}>
const ManagementList: React.FC = () => { {text}
const access = useAccess(); </span>
),
const formTableRef = useRef<FormInstance>(); },
const actionRef = useRef<ActionType>(); {title: '父级岗位',
dataIndex: 'parentName',
const [currentRow, setCurrentRow] = useState<API.ClassifyJobs.Jobs>(); valueType: 'text',
const [modalVisible, setModalVisible] = useState<boolean>(false); hideInSearch: true,
const [jobsStatusEnum, setJobsStatusEnum] = useState<any>([]); align: 'center',
},
useEffect(() => { {
getDictValueEnum('sys_jobs_status', true).then(setJobsStatusEnum); title: '显示顺序',
}, []); dataIndex: 'orderNum',
valueType: 'text',
const editSubmit = () => {}; hideInSearch: true,
align: 'center',
const columns: ProColumns<API.ClassifyJobs.Jobs>[] = [ },
{ {
title: '岗位名称', title: '状态',
dataIndex: 'jobName', dataIndex: 'status',
align: 'center',
align: 'center', valueType: 'select',
render: (text, record) => ( valueEnum: jobsStatusEnum,
<span style={{ paddingLeft: `${(record.depth || 0) * 20}px`,display:'inline-block' , render: (_, record) => {
width:'100%'}}> return <DictTag enums={jobsStatusEnum} value={record.status} />;
{text} },
</span> },
), {
}, title: '操作',
{title: '父级岗位', hideInSearch: true,
dataIndex: 'parentName', align: 'center',
valueType: 'text', dataIndex: 'jobId',
hideInSearch: true, width: 300,
align: 'center', render: (_, record) => [
}, <Button
{ type="link"
title: '显示顺序', size="small"
dataIndex: 'orderNum', key="edit"
valueType: 'text', icon={<FormOutlined />}
hideInSearch: true, hidden={!access.hasPerms('system:job:edit')}
align: 'center', onClick={() => {
}, setModalVisible(true);
{ setCurrentRow(record);
title: '状态', }}
dataIndex: 'status', >
align: 'center',
valueType: 'select', </Button>,
valueEnum: jobsStatusEnum, // <Button
render: (_, record) => { // type="link"
return <DictTag enums={jobsStatusEnum} value={record.status} />; // size="small"
}, // danger
}, // key="delete"
{ // icon={<DeleteOutlined />}
title: '操作', // hidden={!access.hasPerms('system:job:remove')}
hideInSearch: true, // onClick={async () => {
align: 'center', // Modal.confirm({
dataIndex: 'jobId', // title: '删除',
width: 300, // content: '确定删除该项吗?',
render: (_, record) => [ // okText: '确认',
<Button // cancelText: '取消',
type="link" // onOk: async () => {
size="small" // if(record.jobId){
key="edit" // const success = await handleRemoveOne(record.jobId.toString());
icon={<FormOutlined />}
hidden={!access.hasPerms('system:job:edit')} // if (success && actionRef.current) {
onClick={() => { // actionRef.current.reload();
setModalVisible(true); // }
setCurrentRow(record); // }
}} // },
> // });
// }}
</Button>, // >
// <Button // 删除
// type="link" // </Button>,
// size="small" ],
// danger },
// key="delete" ];
// icon={<DeleteOutlined />} return (
// hidden={!access.hasPerms('system:job:remove')} <Fragment>
// onClick={async () => { <div style={{ width: '100%', float: 'right' }}>
// Modal.confirm({ <ProTable<API.ClassifyJobs.Jobs>
// title: '删除', // params 是需要自带的参数
// content: '确定删除该项吗?', // 这个参数优先级更高,会覆盖查询表单的参数
// okText: '确认', actionRef={actionRef}
// cancelText: '取消', formRef={formTableRef}
// onOk: async () => { rowKey="jobId"
// if(record.jobId){ key="index"
// const success = await handleRemoveOne(record.jobId.toString()); columns={columns}
search={{
// if (success && actionRef.current) { labelWidth: 120,
// actionRef.current.reload(); }}
// } request={async (params) => {
// } const res = await getCmsJobTitleList({ ...params, tree: false ,
// }, pageSize:1000
// }); });
// }} const treeData = buildTree(res.rows);
// > console.log('完整树形结构:', JSON.stringify(treeData, null, 2));
// 删除 return {
// </Button>, data: treeData,
], total: res.total,
}, success: true,
]; };
return ( }}
<Fragment> pagination={false}
<div style={{ width: '100%', float: 'right' }}> expandable={{
<ProTable<API.ClassifyJobs.Jobs> childrenColumnName: 'children',
// params 是需要自带的参数 defaultExpandAllRows: true,
// 这个参数优先级更高,会覆盖查询表单的参数 indentSize:30,
actionRef={actionRef} rowExpandable: (record) => !!record.children?.length
formRef={formTableRef} }}
rowKey="jobId"
key="index" toolBarRender={() => [
columns={columns} <Button
search={{ type="primary"
labelWidth: 120, key="add"
}} hidden={!access.hasPerms('manage:List:add')}
request={async (params) => { onClick={async () => {
const res = await getCmsJobTitleList({ ...params, tree: false , setCurrentRow(undefined);
pageSize:1000 setModalVisible(true);
}); }}
const treeData = buildTree(res.rows); >
console.log('完整树形结构:', JSON.stringify(treeData, null, 2)); <PlusOutlined />
return { </Button>,
data: treeData, <Button
total: res.total, type="primary"
success: true, key="export"
}; hidden={!access.hasPerms('system:user:export')}
}} onClick={async () => {
pagination={false} const searchVal = formTableRef.current && formTableRef.current.getFieldsValue();
expandable={{ handleExport(searchVal as API.ClassifyJobs.Params);
childrenColumnName: 'children', }}
defaultExpandAllRows: true, >
indentSize:30, <PlusOutlined />
rowExpandable: (record) => !!record.children?.length <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
}} </Button>,
]}
toolBarRender={() => [ />
<Button </div>
type="primary" <EditCompanyListRow
key="add" open={modalVisible}
hidden={!access.hasPerms('manage:List:add')} onSubmit={async (values) => {
onClick={async () => { let resData;
setCurrentRow(undefined); if (values.jobId) {
setModalVisible(true); resData = await putCmsCompanyList(values);
}} } else {
> resData = await addCmsCompanyList(values);
<PlusOutlined /> }
</Button>, if (resData.code === 200) {
<Button setModalVisible(false);
type="primary" setCurrentRow(undefined);
key="export" if (values.jobId) {
hidden={!access.hasPerms('system:user:export')} message.success('修改成功');
onClick={async () => { } else {
const searchVal = formTableRef.current && formTableRef.current.getFieldsValue(); message.success('新增成功');
handleExport(searchVal as API.ClassifyJobs.Params); }
}} if (actionRef.current) {
> actionRef.current.reload();
<PlusOutlined /> }
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" /> }
</Button>, }}
]} onCancel={() => {
/> setModalVisible(false);
</div> setCurrentRow(undefined);
<EditCompanyListRow }}
open={modalVisible} values={currentRow}
onSubmit={async (values) => { ></EditCompanyListRow>
let resData; </Fragment>
if (values.jobId) { );
resData = await putCmsCompanyList(values); }
} else {
resData = await addCmsCompanyList(values); export default ManagementList;
}
if (resData.code === 200) {
setModalVisible(false);
setCurrentRow(undefined);
if (values.jobId) {
message.success('修改成功');
} else {
message.success('新增成功');
}
if (actionRef.current) {
actionRef.current.reload();
}
}
}}
onCancel={() => {
setModalVisible(false);
setCurrentRow(undefined);
}}
values={currentRow}
></EditCompanyListRow>
</Fragment>
);
}
export default ManagementList;

View File

@@ -1,207 +1,207 @@
import { import {
ModalForm, ModalForm,
ProForm, ProForm,
ProFormDigit, ProFormDigit,
ProFormSelect, ProFormSelect,
ProFormText, ProFormText,
ProFormTextArea, ProFormTextArea,
ProDescriptions, ProDescriptions,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Form } from 'antd'; import { Form } from 'antd';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { DictValueEnumObj } from '@/components/DictTag'; import { DictValueEnumObj } from '@/components/DictTag';
import { getCmsCompanyList } from '@/services/company/list'; import { getCmsCompanyList } from '@/services/company/list';
export type ListFormProps = { export type ListFormProps = {
onCancel: (flag?: boolean, formVals?: unknown) => void; onCancel: (flag?: boolean, formVals?: unknown) => void;
onSubmit: (values: API.ManagementList.Manage) => Promise<void>; onSubmit: (values: API.ManagementList.Manage) => Promise<void>;
open: boolean; open: boolean;
values?: Partial<API.ManagementList.Manage>; values?: Partial<API.ManagementList.Manage>;
educationEnum: DictValueEnumObj; educationEnum: DictValueEnumObj;
experienceEnum: DictValueEnumObj; experienceEnum: DictValueEnumObj;
areaEnum: DictValueEnumObj; areaEnum: DictValueEnumObj;
mode?: 'view' | 'edit' | 'create'; mode?: 'view' | 'edit' | 'create';
}; };
const waitTime = (time: number = 100) => { const waitTime = (time: number = 100) => {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
resolve(true); resolve(true);
}, time); }, time);
}); });
}; };
const listEdit: React.FC<ListFormProps> = (props) => { const listEdit: React.FC<ListFormProps> = (props) => {
const [form] = Form.useForm<{ name: string; company: string; companyName: number }>(); const [form] = Form.useForm<API.ManagementList.Manage>();
const { educationEnum, experienceEnum, areaEnum } = props; const { educationEnum, experienceEnum, areaEnum } = props;
const { mode = props.values ? 'edit' : 'create' } = props; const { mode = props.values ? 'edit' : 'create' } = props;
useEffect(() => { useEffect(() => {
form.resetFields(); if(props.open){
if (props.values) { form.resetFields();
form.setFieldsValue({ if (props.values) {
...props.values, form.setFieldsValue({
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''), ...props.values,
}); jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
} });
}, [form, props.values?.jobID]); }
}
const handleCancel = () => { }, [form, props.values?.jobId,props.open]);
props.onCancel();
form.resetFields(); const handleCancel = () => {
}; props.onCancel();
form.resetFields();
const handleFinish = async (values: Record<string, any>) => { };
props.onSubmit(values as API.ManagementList.Manage);
}; const handleFinish = async (values: Record<string, any>) => {
props.onSubmit(values as API.ManagementList.Manage);
const handleChange = (_: string, value: any) => { };
form.setFieldValue('companyName', value.label);
}; const handleChange = (_: string, value: any) => {
if (mode === 'view') { form.setFieldValue('companyName', value.label);
return ( };
<ModalForm if (mode === 'view') {
title="岗位详情" return (
open={props.open} <ModalForm
width={800} title="岗位详情"
modalProps={{ open={props.open}
destroyOnClose: true, width={800}
onCancel: () => handleCancel(), modalProps={{
footer: null, destroyOnClose: true,
}} onCancel: () => handleCancel(),
submitter={false} footer: null,
> }}
<ProDescriptions<API.ManagementList.Manage> submitter={false}
column={2} >
dataSource={props.values || {}} <ProDescriptions<API.ManagementList.Manage>
> column={2}
<ProDescriptions.Item dataIndex="jobTitle" label="岗位名称" /> dataSource={props.values || {}}
<ProDescriptions.Item dataIndex="companyName" label="招聘公司" /> >
<ProDescriptions.Item dataIndex="minSalary" label="最低薪资(元/月)" /> <ProDescriptions.Item dataIndex="jobTitle" label="岗位名称" />
<ProDescriptions.Item dataIndex="maxSalary" label="最高薪资(元/月)" /> <ProDescriptions.Item dataIndex="companyName" label="招聘公司" />
<ProDescriptions.Item <ProDescriptions.Item dataIndex="minSalary" label="最低薪资(元/月)" />
dataIndex="education" <ProDescriptions.Item dataIndex="maxSalary" label="最高薪资(元/月)" />
label="学历要求" <ProDescriptions.Item
valueEnum={educationEnum} dataIndex="education"
/> label="学历要求"
<ProDescriptions.Item valueEnum={educationEnum}
dataIndex="experience" />
label="工作经验" <ProDescriptions.Item
valueEnum={experienceEnum} dataIndex="experience"
/> label="工作经验"
<ProDescriptions.Item valueEnum={experienceEnum}
dataIndex="jobLocationAreaCode" />
label="工作区县" <ProDescriptions.Item
valueEnum={areaEnum} dataIndex="jobLocationAreaCode"
/> label="工作区县"
<ProDescriptions.Item dataIndex="vacancies" label="招聘人数" /> valueEnum={areaEnum}
<ProDescriptions.Item dataIndex="jobLocation" label="工作地点" /> />
<ProDescriptions.Item <ProDescriptions.Item dataIndex="vacancies" label="招聘人数" />
dataIndex="description" <ProDescriptions.Item dataIndex="jobLocation" label="工作地点" />
label="岗位描述" <ProDescriptions.Item
span={2} // 跨两列显示 dataIndex="description"
/> label="岗位描述"
</ProDescriptions> span={2} // 跨两列显示
</ModalForm> />
); </ProDescriptions>
} </ModalForm>
return ( );
<ModalForm<{ }
name: string; return (
company: string; <ModalForm<API.ManagementList.Manage>
}>
title={mode === 'edit' ? '编辑岗位' : '新建岗位'} title={mode === 'edit' ? '编辑岗位' : '新建岗位'}
form={form} form={form}
autoFocusFirstInput autoFocusFirstInput
open={props.open} open={props.open}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,
onCancel: () => handleCancel(), onCancel: () => handleCancel(),
}} }}
submitTimeout={2000} submitTimeout={2000}
onFinish={handleFinish} onFinish={handleFinish}
> >
<ProForm.Group> <ProForm.Group>
<ProFormText width="md" hidden name="jobId" /> <ProFormText width="md" hidden name="jobId" />
<ProFormText width="md" hidden name="companyName" /> <ProFormText width="md" hidden name="companyName" />
<ProFormText width="md" name="jobTitle" label="岗位名称" placeholder="请输入岗位名称" /> <ProFormText width="md" name="jobTitle" label="岗位名称" placeholder="请输入岗位名称" />
<ProFormSelect <ProFormSelect
showSearch showSearch
width="md" width="md"
name="companyId" name="companyId"
onChange={handleChange} onChange={handleChange}
request={async ({ keyWords }) => { request={async ({ keyWords }) => {
let resData = await getCmsCompanyList({ name: keyWords }); let resData = await getCmsCompanyList({ name: keyWords });
return resData.rows.map((item) => ({ label: item.name, value: item.companyId })); return resData.rows.map((item) => ({ label: item.name, value: item.companyId }));
}} }}
placeholder="请输入公司名称选择公司" placeholder="请输入公司名称选择公司"
rules={[{ required: true, message: '请输入公司名称选择公司!' }]} rules={[{ required: true, message: '请输入公司名称选择公司!' }]}
label="招聘会公司" label="招聘会公司"
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormDigit <ProFormDigit
name="minSalary" name="minSalary"
width="md" width="md"
min={0} min={0}
label="最小薪资(元/月)" label="最小薪资(元/月)"
placeholder="请输入最小薪资(元)" placeholder="请输入最小薪资(元)"
/> />
<ProFormDigit <ProFormDigit
name="maxSalary" name="maxSalary"
width="md" width="md"
min={0} min={0}
label="最大薪资(元/月)" label="最大薪资(元/月)"
placeholder="请输入最大薪资(元)" placeholder="请输入最大薪资(元)"
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormSelect <ProFormSelect
width="md" width="md"
name="education" name="education"
label={'学历要求'} label={'学历要求'}
valueEnum={educationEnum} valueEnum={educationEnum}
placeholder="请选择学历要求" placeholder="请选择学历要求"
rules={[{ required: true, message: '请选择学历要求!' }]} rules={[{ required: true, message: '请选择学历要求!' }]}
/> />
<ProFormSelect <ProFormSelect
width="md" width="md"
name="experience" name="experience"
label={'工作经验'} label={'工作经验'}
valueEnum={experienceEnum} valueEnum={experienceEnum}
placeholder="请选择岗位" placeholder="请选择岗位"
rules={[{ required: true, message: '请选择工作经验!' }]} rules={[{ required: true, message: '请选择工作经验!' }]}
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormSelect <ProFormSelect
width="md" width="md"
name="jobLocationAreaCode" name="jobLocationAreaCode"
label={'工作区县'} label={'工作区县'}
valueEnum={areaEnum} valueEnum={areaEnum}
placeholder="请选择区县" placeholder="请选择区县"
rules={[{ required: true, message: '请选择区县!' }]} rules={[{ required: true, message: '请选择区县!' }]}
/> />
<ProFormDigit <ProFormDigit
label="招聘人数" label="招聘人数"
name="vacancies" name="vacancies"
width="md" width="md"
min={0} min={0}
placeholder="请输入招聘人数" placeholder="请输入招聘人数"
/> />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormText width="lg" name="jobLocation" label="工作地点" placeholder="请输入工作地点" /> <ProFormText width="lg" name="jobLocation" label="工作地点" placeholder="请输入工作地点" />
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormTextArea <ProFormTextArea
width="lg" width="lg"
name="description" name="description"
label="岗位描述" label="岗位描述"
placeholder="请输入岗位描述" placeholder="请输入岗位描述"
/> />
</ProForm.Group> </ProForm.Group>
</ModalForm> </ModalForm>
); );
}; };
export default listEdit; export default listEdit;

View File

@@ -1,72 +1,72 @@
declare namespace API.ManagementList { declare namespace API.ManagementList {
export interface Manage { export interface Manage {
applyNum: number; applyNum?: number;
companyId: number; companyId?: number;
companyName: string; companyName?: string;
education: string; education?: string;
experience: string; experience?: string;
isApply: number; isApply?: number;
isCollection: number; isCollection?: number;
isHot: number; isHot?: number;
jobId: number; jobId?: number;
jobLocation: string; jobLocation?: string;
jobLocationAreaCode: number; jobLocationAreaCode?: string;
jobTitle: string; jobTitle?: string;
latitude: number; latitude?: number;
longitude: number; longitude?: number;
maxSalary: number; maxSalary?: number;
minSalary: number; minSalary?: number;
postingDate: string; postingDate?: string;
vacancies: number; vacancies?: number;
view: number; view?: number;
release: number; release?: number;
isPublish: number; isPublish?: number;
} }
export interface AddParams { export interface AddParams {
applyNum?: number; applyNum?: number;
companyId?: number; companyId?: number;
companyName?: string; companyName?: string;
education?: string; education?: string;
experience?: string; experience?: string;
isApply?: number; isApply?: number;
isCollection?: number; isCollection?: number;
isHot?: number; isHot?: number;
jobId?: number; jobId?: number;
jobLocation?: string; jobLocation?: string;
jobLocationAreaCode?: number; jobLocationAreaCode?: string;
jobTitle?: string; jobTitle?: string;
latitude?: number; latitude?: number;
longitude?: number; longitude?: number;
maxSalary?: number; maxSalary?: number;
minSalary?: number; minSalary?: number;
postingDate?: string; postingDate?: string;
vacancies?: number; vacancies?: number;
view?: number; view?: number;
release?: number; release?: number;
isPublish?: number; isPublish?: number;
} }
export interface ListParams { export interface ListParams {
createTime?: string; createTime?: string;
updateTime?: string; updateTime?: string;
remark?: string; remark?: string;
pageSize?: number; pageSize?: number;
current?: number; current?: number;
} }
export interface ManageIdResult { export interface ManageIdResult {
code: number; code: number;
msg: string; msg: string;
data: Manage; data: Manage;
rows: Array<any>; rows: Array<any>;
total: number; total: number;
} }
export interface ManagePageResult { export interface ManagePageResult {
code: number; code: number;
msg: string; msg: string;
total: number; total: number;
rows: Array<Manage>; rows: Array<Manage>;
} }
} }

View File

@@ -1,26 +1,33 @@
declare namespace API.ClassifyJobs { declare namespace API.ClassifyJobs {
export interface Result { export interface Result {
total: number; total: number;
rows: Jobs[]; rows: Jobs[];
code: number; code: number;
msg: string; msg: string;
} }
export interface Jobs { export interface Jobs {
[x: string]: number; createTime?: string;
createTime?: any; jobId: number;
jobId: number; parentId: number;
parentId: number; jobName: string;
jobName: string; orderNum: number;
orderNum: number; status: string;
status: string; children?:Jobs[];
} depth?: number;
parentName?: string;
export interface Params { }
jobId?: number; export interface JobTreeNode extends Jobs {
parentId?: number; children: JobTreeNode[];
jobName?: string; depth: number;
orderNum?: number; }
status?: string;
} export interface Params {
} jobId?: number;
parentId?: number;
jobName?: string;
orderNum?: number;
status?: string;
tree?:boolean;
}
}

74
src/typings.d.ts vendored
View File

@@ -1,44 +1,32 @@
declare module 'slash2'; declare module 'slash2';
declare module '*.css'; declare module '*.css';
declare module '*.less'; declare module '*.less';
declare module '*.scss'; declare module '*.scss';
declare module '*.sass'; declare module '*.sass';
declare module '*.svg'; declare module '*.svg';
declare module '*.png'; declare module '*.png';
declare module '*.jpg'; declare module '*.jpg';
declare module '*.jpeg'; declare module '*.jpeg';
declare module '*.gif'; declare module '*.gif';
declare module '*.bmp'; declare module '*.bmp';
declare module '*.tiff'; declare module '*.tiff';
declare module 'omit.js'; declare module 'omit.js';
declare module 'numeral'; declare module 'numeral';
declare module '@antv/data-set'; declare module '@antv/data-set';
declare module 'mockjs'; declare module 'mockjs';
declare module 'react-fittext'; declare module 'react-fittext';
declare module 'bizcharts-plugin-slider'; declare module 'bizcharts-plugin-slider';
declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false; declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
declare namespace API { declare namespace API {
namespace ClassifyJobs { namespace ClassifyJobs {
interface Params { interface Params {
tree?: boolean; tree?: boolean;
pageSize?: number; pageSize?: number;
current?: number; current?: number;
jobName?: string; jobName?: string;
status?: string; status?: string;
[key: string]: any; // 允许其他未定义属性 [key: string]: any; // 允许其他未定义属性
} }
}
// 表格和表单使用的职业数据
interface Job {
jobId: number;
parentId: number;
jobName: string;
orderNum?: number;
status?: string;
createTime?: string;
parentName?: string;
children?: Job[];
}
}
} }