在职位管理和行业管理中,转为树形表格数据结构
This commit is contained in:
8
.hintrc
8
.hintrc
@@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"development"
|
"development"
|
||||||
|
],
|
||||||
|
"hints": {
|
||||||
|
"no-inline-styles": "off"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"defaults",
|
||||||
|
"not ie 11",
|
||||||
|
"not ie <= 11"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,15 @@ body,
|
|||||||
.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed {
|
.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed {
|
||||||
left: unset;
|
left: unset;
|
||||||
}
|
}
|
||||||
|
.ant-table-row {
|
||||||
|
&-level-1 .ant-table-cell:first-child {
|
||||||
|
padding-left: 24px !important;
|
||||||
|
}
|
||||||
|
&-level-2 .ant-table-cell:first-child {
|
||||||
|
padding-left: 48px !important;
|
||||||
|
}
|
||||||
|
// 可根据需要添加更多层级
|
||||||
|
}
|
||||||
canvas {
|
canvas {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,50 +4,56 @@ import {
|
|||||||
ProForm,
|
ProForm,
|
||||||
ProFormDigit,
|
ProFormDigit,
|
||||||
ProFormRadio,
|
ProFormRadio,
|
||||||
ProFormSelect,
|
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 { getCmsIndustryTree } from '@/services/classify/industry';
|
import { getCmsIndustryTreeList } from '@/services/classify/industry'; // 修改导入为 getCmsIndustryTreeList
|
||||||
import { values } from 'lodash';
|
|
||||||
|
|
||||||
interface IndustryDetail extends API.ClassifyIndustry.IndustryRow {
|
interface IndustryDetail {
|
||||||
parentName: string;
|
id?: number;
|
||||||
|
industryName?: string;
|
||||||
|
orderNum?: number;
|
||||||
|
status?: string;
|
||||||
|
parentId?: number;
|
||||||
|
parentName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ListFormProps = {
|
export type ListFormProps = {
|
||||||
onCancel: (flag?: boolean, formVars?: unknown) => void;
|
onCancel: (flag?: boolean, formVars?: unknown) => void;
|
||||||
onSubmit: (values: API.ClassifyIndustry.IndustryRow) => Promise<void>;
|
onSubmit: (values: any) => Promise<void>;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
values?: Partial<API.ClassifyIndustry.IndustryRow>;
|
values?: Partial<IndustryDetail>;
|
||||||
// industryStatusEnum: DictOptionType[];
|
|
||||||
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();
|
||||||
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(values);
|
form.setFieldsValue({
|
||||||
|
...values,
|
||||||
|
parentId: values?.parentId ?? 0
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [form,values?.industryId]);
|
}, [form, values?.id]);
|
||||||
|
|
||||||
const getSafeDetailData = (
|
const getSafeDetailData = (data?: Partial<IndustryDetail>): IndustryDetail => {
|
||||||
data?: Partial<API.ClassifyIndustry.IndustryRow>
|
return {
|
||||||
): IndustryDetail => {
|
id: data?.id ?? 0,
|
||||||
return{
|
industryName: data?.industryName ?? '',
|
||||||
industryId: data?.industryId ?? 0,
|
orderNum: data?.orderNum ?? 0,
|
||||||
industryName: data?.industryName ?? '',
|
parentId: data?.parentId ?? 0,
|
||||||
orderNum: data?.orderNum ?? 0,
|
parentName: data?.parentName ?? '顶级节点',
|
||||||
parentId: data?.parentId ?? 0,
|
status: data?.status ?? '0',
|
||||||
parentName: (data as any)?.parentName ?? '无', // 或通过 parentId 映射
|
};
|
||||||
status: data?.status ?? '0',}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
@@ -56,34 +62,51 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleFinish = async (values: Record<string, any>) => {
|
const handleFinish = async (values: Record<string, any>) => {
|
||||||
props.onSubmit(values as API.ClassifyIndustry.IndustryRow);
|
const submitValues = {
|
||||||
|
...values,
|
||||||
|
parentId: values.parentId === 0 ? undefined : values.parentId
|
||||||
|
};
|
||||||
|
props.onSubmit(submitValues);
|
||||||
};
|
};
|
||||||
// check
|
|
||||||
if (mode === 'view') {
|
// 获取行业树数据
|
||||||
return (
|
const fetchIndustryTree = async () => {
|
||||||
<ModalForm
|
const res = await getCmsIndustryTreeList();
|
||||||
title="行业详情"
|
return [
|
||||||
open={props.open}
|
{
|
||||||
width={800}
|
id: 0,
|
||||||
modalProps={{
|
label: '顶级节点',
|
||||||
destroyOnClose: true,
|
value: 0,
|
||||||
onCancel: () => handleCancel(),
|
children: res.data || []
|
||||||
footer: null,
|
}
|
||||||
}}
|
];
|
||||||
submitter={false}
|
};
|
||||||
|
|
||||||
|
if (mode === 'view') {
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
title="行业详情"
|
||||||
|
open={props.open}
|
||||||
|
width={800}
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
footer: null,
|
||||||
|
}}
|
||||||
|
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="industryId" />
|
<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"
|
||||||
valueType="text"// 假设API返回中有parentName字段
|
renderText={(text, record) => record.parentId === 0 ? '顶级节点' : text}
|
||||||
/>
|
/>
|
||||||
<ProDescriptions.Item
|
<ProDescriptions.Item
|
||||||
label="行业状态"
|
label="行业状态"
|
||||||
@@ -94,6 +117,7 @@ if (mode === 'view') {
|
|||||||
</ModalForm>
|
</ModalForm>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm
|
<ModalForm
|
||||||
title={`${values ? '编辑' : '新增'}行业`}
|
title={`${values ? '编辑' : '新增'}行业`}
|
||||||
@@ -106,90 +130,60 @@ if (mode === 'view') {
|
|||||||
}}
|
}}
|
||||||
submitTimeout={2000}
|
submitTimeout={2000}
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
// readonly
|
|
||||||
>
|
>
|
||||||
<ProFormDigit label="InputNumber" name="industryId" disabled hidden={true} />
|
<ProFormDigit name="id" disabled hidden={true} />
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
<ProFormText width="md" name="industryName" label="行业名称" placeholder="请输入行业名称" />
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="industryName"
|
||||||
|
label="行业名称"
|
||||||
|
placeholder="请输入行业名称"
|
||||||
|
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: '请输入显示顺序' }]}
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
{/* 多级 */}
|
<ProFormTreeSelect
|
||||||
{/*<ProFormTreeSelect*/}
|
|
||||||
{/* name="parentId"*/}
|
|
||||||
{/* label="父行业"*/}
|
|
||||||
{/* placeholder="请选择父行业"*/}
|
|
||||||
{/* allowClear*/}
|
|
||||||
{/* width="md"*/}
|
|
||||||
{/* request={async () => {*/}
|
|
||||||
{/* return getCmsIndustryTree().then((res) => {*/}
|
|
||||||
{/* return res.data;*/}
|
|
||||||
{/* });*/}
|
|
||||||
{/* }}*/}
|
|
||||||
{/* fieldProps={{*/}
|
|
||||||
{/* suffixIcon: null,*/}
|
|
||||||
{/* filterTreeNode: true,*/}
|
|
||||||
{/* showSearch: true,*/}
|
|
||||||
{/* popupMatchSelectWidth: false,*/}
|
|
||||||
{/* labelInValue: false,*/}
|
|
||||||
{/* autoClearSearchValue: true,*/}
|
|
||||||
{/* multiple: false,*/}
|
|
||||||
{/* treeNodeFilterProp: 'title',*/}
|
|
||||||
{/* fieldNames: {*/}
|
|
||||||
{/* label: 'label',*/}
|
|
||||||
{/* value: 'id',*/}
|
|
||||||
{/* children: 'children',*/}
|
|
||||||
{/* },*/}
|
|
||||||
{/* }}*/}
|
|
||||||
{/*/>*/}
|
|
||||||
{/* 2级 */}
|
|
||||||
<ProFormSelect
|
|
||||||
name="parentId"
|
name="parentId"
|
||||||
label="父行业"
|
label="父行业"
|
||||||
|
placeholder="请选择父行业"
|
||||||
allowClear
|
allowClear
|
||||||
width="md"
|
width="md"
|
||||||
placeholder="请选择父行业"
|
request={fetchIndustryTree}
|
||||||
request={async () => {
|
|
||||||
return getCmsIndustryTree().then((res) => {
|
|
||||||
return res.data;
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
colProps={{ md: 12, xl: 12 }}
|
|
||||||
rules={[{ required: true, message: '请选择父行业!' }]}
|
|
||||||
fieldProps={{
|
fieldProps={{
|
||||||
suffixIcon: null,
|
treeDefaultExpandAll: true,
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
popupMatchSelectWidth: false,
|
filterTreeNode: true,
|
||||||
labelInValue: false,
|
|
||||||
autoClearSearchValue: true,
|
|
||||||
fieldNames: {
|
fieldNames: {
|
||||||
label: 'label',
|
label: 'label',
|
||||||
value: 'id',
|
value: 'id',
|
||||||
|
children: 'children',
|
||||||
|
},
|
||||||
|
dropdownStyle: {
|
||||||
|
maxHeight: 400,
|
||||||
|
overflow: 'auto',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
rules={[{ required: true, message: '请选择父行业' }]}
|
||||||
/>
|
/>
|
||||||
<ProFormRadio.Group
|
<ProFormRadio.Group
|
||||||
valueEnum={industryStatusEnum}
|
valueEnum={industryStatusEnum}
|
||||||
name="status"
|
name="status"
|
||||||
label="行业状态"
|
label="行业状态"
|
||||||
width="md"
|
width="md"
|
||||||
placeholder="请输入状态"
|
initialValue="0"
|
||||||
rules={[
|
rules={[{ required: true, message: '请选择行业状态' }]}
|
||||||
{
|
|
||||||
required: false,
|
|
||||||
message: <FormattedMessage id="请输入状态!" defaultMessage="请选择行业状态!" />,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
</ModalForm>
|
</ModalForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default listEdit;
|
export default listEdit;
|
||||||
@@ -8,17 +8,25 @@ import {
|
|||||||
addCmsIndustryIndustryt,
|
addCmsIndustryIndustryt,
|
||||||
delCmsIndustryList,
|
delCmsIndustryList,
|
||||||
exportCmsIndustry,
|
exportCmsIndustry,
|
||||||
getCmsIndustryList,
|
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';
|
||||||
|
|
||||||
const handleRemoveOne = async (industryId: string) => {
|
// 定义行业数据类型(替代API.ClassifyIndustry.IndustryRow)
|
||||||
|
interface IndustryItem {
|
||||||
|
id: number;
|
||||||
|
industryName: string;
|
||||||
|
orderNum?: number;
|
||||||
|
status?: string;
|
||||||
|
children?: IndustryItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRemoveOne = async (id: string) => { // 参数改为id
|
||||||
const hide = message.loading('正在删除');
|
const hide = message.loading('正在删除');
|
||||||
if (!industryId) return true;
|
|
||||||
try {
|
try {
|
||||||
const resp = await delCmsIndustryList(industryId);
|
const resp = await delCmsIndustryList(id);
|
||||||
hide();
|
hide();
|
||||||
if (resp.code === 200) {
|
if (resp.code === 200) {
|
||||||
message.success('删除成功,即将刷新');
|
message.success('删除成功,即将刷新');
|
||||||
@@ -33,7 +41,7 @@ const handleRemoveOne = async (industryId: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExport = async (values: API.ClassifyIndustry.Params) => {
|
const handleExport = async (values: any) => { // 简化类型定义
|
||||||
const hide = message.loading('正在导出');
|
const hide = message.loading('正在导出');
|
||||||
try {
|
try {
|
||||||
await exportCmsIndustry(values);
|
await exportCmsIndustry(values);
|
||||||
@@ -47,12 +55,24 @@ const handleExport = async (values: API.ClassifyIndustry.Params) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 处理树形数据的函数(移到组件外部)
|
||||||
|
function processTreeData(data: any[]): IndustryItem[] {
|
||||||
|
return data.map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
industryName: item.label,
|
||||||
|
orderNum: item.sort || 0,
|
||||||
|
status: item.status || '0',
|
||||||
|
key: item.id, // ProTable需要的唯一key
|
||||||
|
children: item.children ? processTreeData(item.children) : []
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
function ManagementList() {
|
function ManagementList() {
|
||||||
const access = useAccess();
|
const access = useAccess();
|
||||||
const formTableRef = useRef<FormInstance>();
|
const formTableRef = useRef<FormInstance>();
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
|
|
||||||
const [currentRow, setCurrentRow] = useState<API.ClassifyIndustry.IndustryRow>();
|
const [currentRow, setCurrentRow] = useState<IndustryItem>(); // 使用新类型
|
||||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
const [industryStatusEnum, setIndustryStatusEnum] = useState<any>([]);
|
const [industryStatusEnum, setIndustryStatusEnum] = useState<any>([]);
|
||||||
|
|
||||||
@@ -62,9 +82,7 @@ function ManagementList() {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const editSubmit = () => {};
|
const columns: ProColumns<IndustryItem>[] = [ // 使用新类型
|
||||||
|
|
||||||
const columns: ProColumns<API.ClassifyIndustry.IndustryRow>[] = [
|
|
||||||
{
|
{
|
||||||
title: '行业名称',
|
title: '行业名称',
|
||||||
dataIndex: 'industryName',
|
dataIndex: 'industryName',
|
||||||
@@ -92,9 +110,9 @@ function ManagementList() {
|
|||||||
title: '操作',
|
title: '操作',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'industryId',
|
dataIndex: 'id', // 改为id
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (industryId, record) => [
|
render: (id, record) => [
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -104,10 +122,10 @@ function ManagementList() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setModalVisible(true);
|
setModalVisible(true);
|
||||||
setCurrentRow(record);
|
setCurrentRow(record);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
详情
|
详情
|
||||||
</Button>,
|
</Button>,
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -132,14 +150,10 @@ function ManagementList() {
|
|||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '删除',
|
title: '删除',
|
||||||
content: '确定删除该项吗?',
|
content: '确定删除该项吗?',
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
const success = await handleRemoveOne(industryId as string);
|
const success = await handleRemoveOne(id.toString());
|
||||||
if (success) {
|
if (success && actionRef.current) {
|
||||||
if (actionRef.current) {
|
actionRef.current.reload();
|
||||||
actionRef.current.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -150,31 +164,37 @@ function ManagementList() {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div style={{ width: '100%', float: 'right' }}>
|
<div style={{ width: '100%', float: 'right' }}>
|
||||||
<ProTable<API.ClassifyIndustry.IndustryRow>
|
<ProTable<IndustryItem>
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
formRef={formTableRef}
|
formRef={formTableRef}
|
||||||
rowKey="industryId"
|
rowKey="id" // 改为id
|
||||||
key="index"
|
|
||||||
columns={columns}
|
columns={columns}
|
||||||
request={(params) =>
|
search={false}
|
||||||
getCmsIndustryList({ ...params } as API.ClassifyIndustry.Params).then((res) => {
|
defaultExpandAllRows={true}
|
||||||
const result = {
|
childrenColumnName="children"
|
||||||
data: res.rows,
|
pagination={false}
|
||||||
total: res.total,
|
request={async () => {
|
||||||
|
try {
|
||||||
|
const res = await getCmsIndustryTreeList();
|
||||||
|
return {
|
||||||
|
data: processTreeData(res.data || []),
|
||||||
success: true,
|
success: true,
|
||||||
};
|
};
|
||||||
return result;
|
} catch (error) {
|
||||||
})
|
console.error('获取数据失败:', error);
|
||||||
}
|
return { data: [], success: false };
|
||||||
|
}
|
||||||
|
}}
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
key="add"
|
key="add"
|
||||||
hidden={!access.hasPerms('manage:List:add')}
|
hidden={!access.hasPerms('manage:List:add')}
|
||||||
onClick={async () => {
|
onClick={() => {
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
setModalVisible(true);
|
setModalVisible(true);
|
||||||
}}
|
}}
|
||||||
@@ -185,8 +205,8 @@ function ManagementList() {
|
|||||||
key="export"
|
key="export"
|
||||||
hidden={!access.hasPerms('system:user:export')}
|
hidden={!access.hasPerms('system:user:export')}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const searchVal = formTableRef.current && formTableRef.current.getFieldsValue();
|
const searchVal = formTableRef.current?.getFieldsValue();
|
||||||
handleExport(searchVal as API.ClassifyIndustry.Params);
|
handleExport(searchVal);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
@@ -195,42 +215,36 @@ function ManagementList() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<EditCompanyListRow
|
<EditCompanyListRow
|
||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
onSubmit={async (values) => {
|
onSubmit={async (values) => {
|
||||||
let resData;
|
let resData;
|
||||||
if (values.industryId) {
|
if (values.id) { // 改为id
|
||||||
resData = await updateCmsIndustryIndustryt(values);
|
resData = await updateCmsIndustryIndustryt(values);
|
||||||
} else {
|
} else {
|
||||||
resData = await addCmsIndustryIndustryt(values);
|
resData = await addCmsIndustryIndustryt(values);
|
||||||
}
|
}
|
||||||
if (resData.code === 200) {
|
if (resData.code === 200) {
|
||||||
setModalVisible(false);
|
setModalVisible(false);
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
if (values.industryId) {
|
message.success(values.id ? '修改成功' : '新增成功');
|
||||||
message.success('修改成功');
|
actionRef.current?.reload();
|
||||||
} else {
|
}
|
||||||
message.success('新增成功');
|
}}
|
||||||
}
|
onCancel={() => {
|
||||||
if (actionRef.current) {
|
setModalVisible(false);
|
||||||
actionRef.current.reload();
|
setCurrentRow(undefined);
|
||||||
}
|
}}
|
||||||
}
|
industryStatusEnum={industryStatusEnum}
|
||||||
}}
|
values={currentRow}
|
||||||
onCancel={() => {
|
mode={
|
||||||
setModalVisible(false);
|
currentRow?.id // 改为id
|
||||||
setCurrentRow(undefined);
|
? access.hasPerms('area:business:List.update') ? 'edit' : 'view'
|
||||||
}}
|
: 'create'
|
||||||
industryStatusEnum={industryStatusEnum}
|
}
|
||||||
values={currentRow}
|
/>
|
||||||
mode={
|
|
||||||
currentRow?.industryId
|
|
||||||
? access.hasPerms('area:business:List.update') ? 'edit' : 'view'
|
|
||||||
: 'create'
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ManagementList;
|
export default ManagementList;
|
||||||
@@ -1,58 +1,100 @@
|
|||||||
import { useEffect } from 'react';
|
import React,{ useEffect,useState } from 'react';
|
||||||
import {
|
import {
|
||||||
ModalForm,
|
ModalForm,
|
||||||
ProForm,
|
ProForm,
|
||||||
ProFormDigit,
|
ProFormDigit,
|
||||||
ProFormText,
|
ProFormText,
|
||||||
ProFormTextArea,
|
ProFormTextArea,
|
||||||
|
ProFormTreeSelect,
|
||||||
|
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 { getDictValueEnum } from '@/services/system/dict';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// tree
|
||||||
|
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: API.CompanyList.Company) => Promise<void>;
|
onSubmit: (values: any) => Promise<void>;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
values?: Partial<API.CompanyList.Company>;
|
values?: Partial<API.ClassifyJobs.Job>;
|
||||||
// jobGroupOptions: DictOptionType[];
|
// jobGroupOptions: DictOptionType[];
|
||||||
// statusOptions: DictValueEnumObj;
|
// statusOptions: DictValueEnumObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve(true);
|
|
||||||
}, time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
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 [statusOptions, setStatusOptions] = useState<Record<string, any>>({});
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const buildTree = (data: API.ClassifyJobs.Job[], parentId: number = 0): API.ClassifyJobs.Job[] => {
|
||||||
|
return data
|
||||||
|
.filter(item => item.parentId === parentId)
|
||||||
|
.map(item => ({
|
||||||
|
...item,
|
||||||
|
children: buildTree(data, item.jobId),
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.resetFields();
|
const fetchData = async () => {
|
||||||
if (props.values) {
|
const res = await getCmsJobTitleList({
|
||||||
form.setFieldsValue(props.values);
|
tree: false,
|
||||||
}
|
// 明确传递所有必要参数
|
||||||
}, [form, props]);
|
pageSize: 1000, // 确保获取全部数据
|
||||||
|
current: 1
|
||||||
|
} as JobListParams);
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
// 获取状态枚举
|
||||||
|
const statusData = await getDictValueEnum('sys_jobs_status', true);
|
||||||
|
setStatusOptions(statusData);
|
||||||
|
// 获取岗位数据
|
||||||
|
const res = await getCmsJobTitleList({ tree: false } as JobListParams);
|
||||||
|
console.log('原始数据:', res.rows);
|
||||||
|
|
||||||
|
const treeData = buildTree(res.rows || []);
|
||||||
|
console.log('转换后的树形数据:', treeData);
|
||||||
|
setTreeData(treeData);
|
||||||
|
|
||||||
|
// 设置表单初始值
|
||||||
|
if (props.values) {
|
||||||
|
form.setFieldsValue({
|
||||||
|
...props.values,
|
||||||
|
parentId: props.values.parentId || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('数据加载失败:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
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>) => {
|
||||||
props.onSubmit(values as API.CompanyList.Company);
|
await props.onSubmit(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalForm<{
|
<ModalForm
|
||||||
name: string;
|
|
||||||
company: string;
|
|
||||||
}>
|
|
||||||
title={`${props.values ? '编辑' : '新增'}企业`}
|
title={`${props.values ? '编辑' : '新增'}企业`}
|
||||||
form={form}
|
form={form}
|
||||||
autoFocusFirstInput
|
autoFocusFirstInput
|
||||||
open={props.open}
|
open={props.open}
|
||||||
|
width={600}
|
||||||
modalProps={{
|
modalProps={{
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
onCancel: () => handleCancel(),
|
onCancel: () => handleCancel(),
|
||||||
@@ -60,10 +102,46 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
submitTimeout={2000}
|
submitTimeout={2000}
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
>
|
>
|
||||||
<ProFormDigit label="InputNumber" name="companyId" disabled hidden={true} />
|
<ProFormDigit label="InputNumber" name="jobId" disabled hidden={true} />
|
||||||
|
|
||||||
|
{/* 新增:父级岗位选择 */}
|
||||||
|
<ProFormTreeSelect
|
||||||
|
name="parentId"
|
||||||
|
label="父级岗位"
|
||||||
|
width="md"
|
||||||
|
placeholder="请选择父级岗位"
|
||||||
|
allowClear
|
||||||
|
fieldProps={{
|
||||||
|
treeData,
|
||||||
|
fieldNames: { label: 'jobName', value: 'jobId', children: 'children' },
|
||||||
|
treeDefaultExpandAll: true,
|
||||||
|
showSearch: true,
|
||||||
|
variant:'outlined',
|
||||||
|
dropdownStyle: { maxHeight: 400, overflow: 'auto' },
|
||||||
|
filterTreeNode: (input, option) =>
|
||||||
|
String(option?.title ?? '').toLowerCase().includes(input.toLowerCase())
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
<ProFormText width="md" name="name" label="单位名称" placeholder="请输入单位名称" />
|
<ProFormText width="md" name="jobname" label="单位名称" placeholder="请输入单位名称" />
|
||||||
|
<ProFormDigit
|
||||||
|
width="md"
|
||||||
|
name="orderNum"
|
||||||
|
label="显示顺序"
|
||||||
|
placeholder="请输入显示顺序"
|
||||||
|
min={0}
|
||||||
|
fieldProps={{ precision: 0 }}
|
||||||
|
rules={[{ required: true, message: '请输入显示顺序' }]}
|
||||||
|
/>
|
||||||
|
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
|
<ProFormSelect
|
||||||
|
name="status"
|
||||||
|
label="状态"
|
||||||
|
width="md"
|
||||||
|
valueEnum={statusOptions}
|
||||||
|
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="请输入主要行业" />
|
||||||
@@ -76,3 +154,6 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default listEdit;
|
export default listEdit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,38 @@ 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, 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 {
|
||||||
|
tree?: boolean;
|
||||||
|
pageSize?: number;
|
||||||
|
current?: number;
|
||||||
|
jobName?: string;
|
||||||
|
status?: string;
|
||||||
|
}
|
||||||
|
interface Jobs {
|
||||||
|
jobId: number;
|
||||||
|
parentId: number;
|
||||||
|
jobName: string;
|
||||||
|
orderNum?: number;
|
||||||
|
status?: string;
|
||||||
|
createTime?: string;
|
||||||
|
parentName?: string;
|
||||||
|
children?: Jobs[];
|
||||||
|
depth?: number; // 添加这行
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// params类型
|
||||||
|
type JobListParams = API.ClassifyJobs.Params & {
|
||||||
|
tree?:boolean;
|
||||||
|
};
|
||||||
|
|
||||||
const handleRemoveOne = async (jobId: string) => {
|
const handleRemoveOne = async (jobId: string) => {
|
||||||
const hide = message.loading('正在删除');
|
const hide = message.loading('正在删除');
|
||||||
@@ -41,8 +67,17 @@ const handleExport = async (values: API.ClassifyJobs.Params) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const buildTree = (data: API.ClassifyJobs.Jobs[], parentId: number = 0,depth = 0): API.ClassifyJobs.Jobs[] => {
|
||||||
|
return data
|
||||||
|
.filter(item => item.parentId === parentId)
|
||||||
|
.map(item => ({
|
||||||
|
...item,
|
||||||
|
depth,
|
||||||
|
children: buildTree(data, item.jobId,depth + 1),
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
function ManagementList() {
|
const ManagementList: React.FC = () => {
|
||||||
const access = useAccess();
|
const access = useAccess();
|
||||||
|
|
||||||
const formTableRef = useRef<FormInstance>();
|
const formTableRef = useRef<FormInstance>();
|
||||||
@@ -53,9 +88,7 @@ function ManagementList() {
|
|||||||
const [jobsStatusEnum, setJobsStatusEnum] = useState<any>([]);
|
const [jobsStatusEnum, setJobsStatusEnum] = useState<any>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDictValueEnum('sys_jobs_status', true).then((data) => {
|
getDictValueEnum('sys_jobs_status', true).then(setJobsStatusEnum);
|
||||||
setJobsStatusEnum(data);
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const editSubmit = () => {};
|
const editSubmit = () => {};
|
||||||
@@ -64,7 +97,19 @@ function ManagementList() {
|
|||||||
{
|
{
|
||||||
title: '岗位名称',
|
title: '岗位名称',
|
||||||
dataIndex: 'jobName',
|
dataIndex: 'jobName',
|
||||||
|
|
||||||
|
align: 'center',
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ paddingLeft: `${(record.depth || 0) * 20}px`,display:'inline-block' ,
|
||||||
|
width:'100%'}}>
|
||||||
|
{text}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{title: '父级岗位',
|
||||||
|
dataIndex: 'parentName',
|
||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
|
hideInSearch: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -88,48 +133,49 @@ function ManagementList() {
|
|||||||
title: '操作',
|
title: '操作',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'companyId',
|
dataIndex: 'jobId',
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (companyId, record) => [
|
render: (_, record) => [
|
||||||
// <Button
|
|
||||||
// type="link"
|
|
||||||
// size="small"
|
|
||||||
// key="edit"
|
|
||||||
// icon={<FormOutlined />}
|
|
||||||
// hidden={!access.hasPerms('area:business:List.update')}
|
|
||||||
// onClick={() => {
|
|
||||||
// setModalVisible(true);
|
|
||||||
// setCurrentRow(record);
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// 编辑
|
|
||||||
// </Button>,
|
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
danger
|
key="edit"
|
||||||
key="batchRemove"
|
icon={<FormOutlined />}
|
||||||
icon={<DeleteOutlined />}
|
hidden={!access.hasPerms('system:job:edit')}
|
||||||
hidden={!access.hasPerms('area:subway:List')}
|
onClick={() => {
|
||||||
onClick={async () => {
|
setModalVisible(true);
|
||||||
Modal.confirm({
|
setCurrentRow(record);
|
||||||
title: '删除',
|
|
||||||
content: '确定删除该项吗?',
|
|
||||||
okText: '确认',
|
|
||||||
cancelText: '取消',
|
|
||||||
onOk: async () => {
|
|
||||||
const success = await handleRemoveOne(companyId as string);
|
|
||||||
if (success) {
|
|
||||||
if (actionRef.current) {
|
|
||||||
actionRef.current.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
删除
|
编辑
|
||||||
</Button>,
|
</Button>,
|
||||||
|
// <Button
|
||||||
|
// type="link"
|
||||||
|
// size="small"
|
||||||
|
// danger
|
||||||
|
// key="delete"
|
||||||
|
// icon={<DeleteOutlined />}
|
||||||
|
// hidden={!access.hasPerms('system:job:remove')}
|
||||||
|
// onClick={async () => {
|
||||||
|
// Modal.confirm({
|
||||||
|
// title: '删除',
|
||||||
|
// content: '确定删除该项吗?',
|
||||||
|
// okText: '确认',
|
||||||
|
// cancelText: '取消',
|
||||||
|
// onOk: async () => {
|
||||||
|
// if(record.jobId){
|
||||||
|
// const success = await handleRemoveOne(record.jobId.toString());
|
||||||
|
|
||||||
|
// if (success && actionRef.current) {
|
||||||
|
// actionRef.current.reload();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// 删除
|
||||||
|
// </Button>,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -144,28 +190,41 @@ function ManagementList() {
|
|||||||
rowKey="jobId"
|
rowKey="jobId"
|
||||||
key="index"
|
key="index"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
request={(params) =>
|
search={{
|
||||||
getCmsJobTitleList({ ...params } as API.ClassifyJobs.Params).then((res) => {
|
labelWidth: 120,
|
||||||
const result = {
|
}}
|
||||||
data: res.rows,
|
request={async (params) => {
|
||||||
total: res.total,
|
const res = await getCmsJobTitleList({ ...params, tree: false ,
|
||||||
success: true,
|
pageSize:1000
|
||||||
};
|
});
|
||||||
return result;
|
const treeData = buildTree(res.rows);
|
||||||
})
|
console.log('完整树形结构:', JSON.stringify(treeData, null, 2));
|
||||||
}
|
return {
|
||||||
|
data: treeData,
|
||||||
|
total: res.total,
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
pagination={false}
|
||||||
|
expandable={{
|
||||||
|
childrenColumnName: 'children',
|
||||||
|
defaultExpandAllRows: true,
|
||||||
|
indentSize:30,
|
||||||
|
rowExpandable: (record) => !!record.children?.length
|
||||||
|
}}
|
||||||
|
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
// <Button
|
<Button
|
||||||
// type="primary"
|
type="primary"
|
||||||
// key="add"
|
key="add"
|
||||||
// hidden={!access.hasPerms('manage:List:add')}
|
hidden={!access.hasPerms('manage:List:add')}
|
||||||
// onClick={async () => {
|
onClick={async () => {
|
||||||
// setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
// setModalVisible(true);
|
setModalVisible(true);
|
||||||
// }}
|
}}
|
||||||
// >
|
>
|
||||||
// <PlusOutlined /> 新建
|
<PlusOutlined /> 新建
|
||||||
// </Button>,
|
</Button>,
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
key="export"
|
key="export"
|
||||||
@@ -185,7 +244,7 @@ function ManagementList() {
|
|||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
onSubmit={async (values) => {
|
onSubmit={async (values) => {
|
||||||
let resData;
|
let resData;
|
||||||
if (values.companyId) {
|
if (values.jobId) {
|
||||||
resData = await putCmsCompanyList(values);
|
resData = await putCmsCompanyList(values);
|
||||||
} else {
|
} else {
|
||||||
resData = await addCmsCompanyList(values);
|
resData = await addCmsCompanyList(values);
|
||||||
@@ -193,7 +252,7 @@ function ManagementList() {
|
|||||||
if (resData.code === 200) {
|
if (resData.code === 200) {
|
||||||
setModalVisible(false);
|
setModalVisible(false);
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
if (values.companyId) {
|
if (values.jobId) {
|
||||||
message.success('修改成功');
|
message.success('修改成功');
|
||||||
} else {
|
} else {
|
||||||
message.success('新增成功');
|
message.success('新增成功');
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import {
|
|||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Form, Button, message, Modal, Descriptions } from 'antd';
|
import { Form, Button, message, Modal, Descriptions } from 'antd';
|
||||||
import DictTag, { DictValueEnumObj } from '@/components/DictTag';
|
import DictTag, { DictValueEnumObj } from '@/components/DictTag';
|
||||||
import { getCmsIndustryTree } from '@/services/classify/industry';
|
import { getCmsIndustryTreeList } from '@/services/classify/industry';
|
||||||
|
|
||||||
export type ListFormProps = {
|
export type ListFormProps = {
|
||||||
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||||
onSubmit: (values: API.CompanyList.Company) => Promise<void>;
|
onSubmit: (values: API.CompanyList.Company) => Promise<void>;
|
||||||
@@ -78,7 +77,7 @@ const ListEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
allowClear
|
allowClear
|
||||||
width="md"
|
width="md"
|
||||||
request={async () => {
|
request={async () => {
|
||||||
return getCmsIndustryTree().then((res) => {
|
return getCmsIndustryTreeList().then((res) => {
|
||||||
return res.data;
|
return res.data;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ export async function delCmsIndustryList(industryId?: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCmsIndustryTree() {
|
export async function getCmsIndustryTreeList() {
|
||||||
return request<API.ClassifyIndustry.IndustryTreeResult>(`/api/cms/industry/treeselect`, {
|
return request(`/api/cms/industry/treeselect`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/types/classify/jobs.d.ts
vendored
1
src/types/classify/jobs.d.ts
vendored
@@ -7,6 +7,7 @@ declare namespace API.ClassifyJobs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Jobs {
|
export interface Jobs {
|
||||||
|
[x: string]: number;
|
||||||
createTime?: any;
|
createTime?: any;
|
||||||
jobId: number;
|
jobId: number;
|
||||||
parentId: number;
|
parentId: number;
|
||||||
|
|||||||
24
src/typings.d.ts
vendored
24
src/typings.d.ts
vendored
@@ -18,3 +18,27 @@ 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 {
|
||||||
|
namespace ClassifyJobs {
|
||||||
|
interface Params {
|
||||||
|
tree?: boolean;
|
||||||
|
pageSize?: number;
|
||||||
|
current?: number;
|
||||||
|
jobName?: string;
|
||||||
|
status?: string;
|
||||||
|
[key: string]: any; // 允许其他未定义属性
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格和表单使用的职业数据
|
||||||
|
interface Job {
|
||||||
|
jobId: number;
|
||||||
|
parentId: number;
|
||||||
|
jobName: string;
|
||||||
|
orderNum?: number;
|
||||||
|
status?: string;
|
||||||
|
createTime?: string;
|
||||||
|
parentName?: string;
|
||||||
|
children?: Job[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user