添加查看详情功能
This commit is contained in:
6
.vs/VSWorkspaceState.json
Normal file
6
.vs/VSWorkspaceState.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
||||||
BIN
.vs/qingdao-admin/v17/.suo
Normal file
BIN
.vs/qingdao-admin/v17/.suo
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
@@ -6,11 +6,17 @@ import {
|
|||||||
ProFormRadio,
|
ProFormRadio,
|
||||||
ProFormSelect,
|
ProFormSelect,
|
||||||
ProFormText,
|
ProFormText,
|
||||||
|
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 { getCmsIndustryTree } from '@/services/classify/industry';
|
||||||
|
import { values } from 'lodash';
|
||||||
|
|
||||||
|
interface IndustryDetail extends API.ClassifyIndustry.IndustryRow {
|
||||||
|
parentName: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type ListFormProps = {
|
export type ListFormProps = {
|
||||||
onCancel: (flag?: boolean, formVars?: unknown) => void;
|
onCancel: (flag?: boolean, formVars?: unknown) => void;
|
||||||
@@ -19,17 +25,30 @@ export type ListFormProps = {
|
|||||||
values?: Partial<API.ClassifyIndustry.IndustryRow>;
|
values?: Partial<API.ClassifyIndustry.IndustryRow>;
|
||||||
// industryStatusEnum: DictOptionType[];
|
// industryStatusEnum: DictOptionType[];
|
||||||
industryStatusEnum: DictValueEnumObj;
|
industryStatusEnum: DictValueEnumObj;
|
||||||
|
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 } = props;
|
const { industryStatusEnum, mode = props.values ? 'edit' : 'create',values } = props;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
if (props.values) {
|
if (values) {
|
||||||
form.setFieldsValue(props.values);
|
form.setFieldsValue(values);
|
||||||
}
|
}
|
||||||
}, [form, props]);
|
}, [form,values?.industryId]);
|
||||||
|
|
||||||
|
const getSafeDetailData = (
|
||||||
|
data?: Partial<API.ClassifyIndustry.IndustryRow>
|
||||||
|
): 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 = () => {
|
const handleCancel = () => {
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
@@ -39,13 +58,45 @@ 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);
|
props.onSubmit(values as API.ClassifyIndustry.IndustryRow);
|
||||||
};
|
};
|
||||||
|
// check
|
||||||
|
if (mode === 'view') {
|
||||||
return (
|
return (
|
||||||
<ModalForm<{
|
<ModalForm
|
||||||
name: string;
|
title="行业详情"
|
||||||
company: string;
|
open={props.open}
|
||||||
}>
|
width={800}
|
||||||
title={`${props.values ? '编辑' : '新增'}行业`}
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
footer: null,
|
||||||
|
}}
|
||||||
|
submitter={false}
|
||||||
|
>
|
||||||
|
<ProDescriptions<IndustryDetail>
|
||||||
|
column={1}
|
||||||
|
dataSource={getSafeDetailData(values)}
|
||||||
|
loading={!values}
|
||||||
|
>
|
||||||
|
<ProDescriptions.Item label="行业ID" dataIndex="industryId" />
|
||||||
|
<ProDescriptions.Item label="行业名称" dataIndex="industryName" />
|
||||||
|
<ProDescriptions.Item label="显示顺序" dataIndex="orderNum" />
|
||||||
|
<ProDescriptions.Item
|
||||||
|
label="父行业"
|
||||||
|
dataIndex="parentName"
|
||||||
|
valueType="text"// 假设API返回中有parentName字段
|
||||||
|
/>
|
||||||
|
<ProDescriptions.Item
|
||||||
|
label="行业状态"
|
||||||
|
dataIndex="status"
|
||||||
|
valueEnum={industryStatusEnum}
|
||||||
|
/>
|
||||||
|
</ProDescriptions>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
title={`${values ? '编辑' : '新增'}行业`}
|
||||||
form={form}
|
form={form}
|
||||||
autoFocusFirstInput
|
autoFocusFirstInput
|
||||||
open={props.open}
|
open={props.open}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 { AlignLeftOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
|
||||||
import EditCompanyListRow from './edit';
|
import EditCompanyListRow from './edit';
|
||||||
import {
|
import {
|
||||||
addCmsIndustryIndustryt,
|
addCmsIndustryIndustryt,
|
||||||
@@ -49,7 +49,6 @@ const handleExport = async (values: API.ClassifyIndustry.Params) => {
|
|||||||
|
|
||||||
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>();
|
||||||
|
|
||||||
@@ -96,6 +95,19 @@ function ManagementList() {
|
|||||||
dataIndex: 'industryId',
|
dataIndex: 'industryId',
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (industryId, record) => [
|
render: (industryId, record) => [
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
key="view"
|
||||||
|
icon={<AlignLeftOutlined />}
|
||||||
|
hidden={!access.hasPerms('area:business:List.view')}
|
||||||
|
onClick={() => {
|
||||||
|
setModalVisible(true);
|
||||||
|
setCurrentRow(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</Button>,
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -142,8 +154,6 @@ function ManagementList() {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<div style={{ width: '100%', float: 'right' }}>
|
<div style={{ width: '100%', float: 'right' }}>
|
||||||
<ProTable<API.ClassifyIndustry.IndustryRow>
|
<ProTable<API.ClassifyIndustry.IndustryRow>
|
||||||
// params 是需要自带的参数
|
|
||||||
// 这个参数优先级更高,会覆盖查询表单的参数
|
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
formRef={formTableRef}
|
formRef={formTableRef}
|
||||||
rowKey="industryId"
|
rowKey="industryId"
|
||||||
@@ -185,35 +195,40 @@ 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.industryId) {
|
||||||
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) {
|
if (values.industryId) {
|
||||||
message.success('修改成功');
|
message.success('修改成功');
|
||||||
} else {
|
} else {
|
||||||
message.success('新增成功');
|
message.success('新增成功');
|
||||||
}
|
}
|
||||||
if (actionRef.current) {
|
if (actionRef.current) {
|
||||||
actionRef.current.reload();
|
actionRef.current.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setModalVisible(false);
|
setModalVisible(false);
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
}}
|
}}
|
||||||
industryStatusEnum={industryStatusEnum}
|
industryStatusEnum={industryStatusEnum}
|
||||||
values={currentRow}
|
values={currentRow}
|
||||||
></EditCompanyListRow>
|
mode={
|
||||||
|
currentRow?.industryId
|
||||||
|
? access.hasPerms('area:business:List.update') ? 'edit' : 'view'
|
||||||
|
: 'create'
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
ProFormTextArea,
|
ProFormTextArea,
|
||||||
ProFormTreeSelect,
|
ProFormTreeSelect,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Form } from 'antd';
|
import { Form, Button, message, Modal, Descriptions } from 'antd';
|
||||||
import { DictValueEnumObj } from '@/components/DictTag';
|
import DictTag, { DictValueEnumObj } from '@/components/DictTag';
|
||||||
import { getCmsIndustryTree } from '@/services/classify/industry';
|
import { getCmsIndustryTree } from '@/services/classify/industry';
|
||||||
|
|
||||||
export type ListFormProps = {
|
export type ListFormProps = {
|
||||||
@@ -17,27 +17,17 @@ export type ListFormProps = {
|
|||||||
onSubmit: (values: API.CompanyList.Company) => Promise<void>;
|
onSubmit: (values: API.CompanyList.Company) => Promise<void>;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
values?: Partial<API.CompanyList.Company>;
|
values?: Partial<API.CompanyList.Company>;
|
||||||
// jobGroupOptions: DictOptionType[];
|
|
||||||
scaleEnum?: DictValueEnumObj;
|
scaleEnum?: DictValueEnumObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
const ListEdit: React.FC<ListFormProps> = (props) => {
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve(true);
|
|
||||||
}, time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const listEdit: React.FC<ListFormProps> = (props) => {
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { scaleEnum } = props;
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
if (props.values) {
|
if (props.values) {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
...props.values,
|
...props.values,
|
||||||
// industry: props.values.industry.split(','),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [form, props]);
|
}, [form, props]);
|
||||||
@@ -48,8 +38,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleFinish = async (values: Record<string, any>) => {
|
const handleFinish = async (values: Record<string, any>) => {
|
||||||
// values.industry = values.industry.join(',');
|
await props.onSubmit(values as API.CompanyList.Company);
|
||||||
props.onSubmit(values as API.CompanyList.Company);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -75,14 +64,13 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
width="md"
|
width="md"
|
||||||
name="scale"
|
name="scale"
|
||||||
label={'单位规模'}
|
label={'单位规模'}
|
||||||
valueEnum={scaleEnum}
|
valueEnum={props.scaleEnum}
|
||||||
placeholder="请选择单位规模"
|
placeholder="请选择单位规模"
|
||||||
rules={[{ required: true, message: '请选择单位规模!' }]}
|
rules={[{ required: true, message: '请选择单位规模!' }]}
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
<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="请输入主要行业" />*/}
|
|
||||||
<ProFormTreeSelect
|
<ProFormTreeSelect
|
||||||
name="industry"
|
name="industry"
|
||||||
label="主要行业"
|
label="主要行业"
|
||||||
@@ -124,4 +112,44 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default listEdit;
|
// 独立的详情查看组件
|
||||||
|
export const CompanyDetailView = ({
|
||||||
|
open,
|
||||||
|
onCancel,
|
||||||
|
record,
|
||||||
|
scaleEnum
|
||||||
|
}: {
|
||||||
|
open: boolean;
|
||||||
|
onCancel: () => void;
|
||||||
|
record?: API.CompanyList.Company;
|
||||||
|
scaleEnum?: DictValueEnumObj;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="公司详情"
|
||||||
|
open={open}
|
||||||
|
width={600}
|
||||||
|
onCancel={onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="back" onClick={onCancel}>
|
||||||
|
关闭
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<div style={{ padding: '20px' }}>
|
||||||
|
<Descriptions column={1} bordered>
|
||||||
|
<Descriptions.Item label="单位名称">{record?.name}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="主要行业">{record?.industry}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="单位规模">
|
||||||
|
<DictTag enums={scaleEnum} value={record?.scale} />
|
||||||
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="公司位置">{record?.location}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="信用代码">{record?.code}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="单位介绍">{record?.description}</Descriptions.Item>
|
||||||
|
</Descriptions>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ListEdit;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
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, Descriptions } 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, EyeOutlined, AlignLeftOutlined } from '@ant-design/icons';
|
||||||
import EditCompanyListRow from './edit';
|
import EditCompanyListRow from './edit';
|
||||||
import {
|
import {
|
||||||
addCmsCompanyList,
|
addCmsCompanyList,
|
||||||
@@ -14,37 +14,40 @@ import {
|
|||||||
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 (jobId: string) => {
|
// 详情查看组件
|
||||||
const hide = message.loading('正在删除');
|
const CompanyDetailModal = ({
|
||||||
if (!jobId) return true;
|
visible,
|
||||||
try {
|
onCancel,
|
||||||
const resp = await delCmsCompanyList(jobId);
|
record,
|
||||||
hide();
|
scaleEnum
|
||||||
if (resp.code === 200) {
|
}: {
|
||||||
message.success('删除成功,即将刷新');
|
visible: boolean;
|
||||||
} else {
|
onCancel: () => void;
|
||||||
message.error(resp.msg);
|
record?: API.CompanyList.Company;
|
||||||
}
|
scaleEnum: Record<string, any>;
|
||||||
return true;
|
}) => {
|
||||||
} catch (error) {
|
return (
|
||||||
hide();
|
<Modal
|
||||||
message.error('删除失败,请重试');
|
title="公司详情"
|
||||||
return false;
|
open={visible}
|
||||||
}
|
width={600}
|
||||||
};
|
onCancel={onCancel}
|
||||||
|
footer={[
|
||||||
const handleExport = async (values: API.CompanyList.Params) => {
|
<Button key="back" onClick={onCancel}>
|
||||||
const hide = message.loading('正在导出');
|
关闭
|
||||||
try {
|
</Button>,
|
||||||
await exportCmsCompanyList(values);
|
]}
|
||||||
hide();
|
>
|
||||||
message.success('导出成功');
|
<Descriptions column={1} bordered>
|
||||||
return true;
|
<Descriptions.Item label="公司名称">{record?.name}</Descriptions.Item>
|
||||||
} catch (error) {
|
<Descriptions.Item label="公司行业">{record?.industry}</Descriptions.Item>
|
||||||
hide();
|
<Descriptions.Item label="公司规模">
|
||||||
message.error('导出失败,请重试');
|
<DictTag enums={scaleEnum} value={record?.scale} />
|
||||||
return false;
|
</Descriptions.Item>
|
||||||
}
|
<Descriptions.Item label="公司位置">{record?.location}</Descriptions.Item>
|
||||||
|
</Descriptions>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function ManagementList() {
|
function ManagementList() {
|
||||||
@@ -55,7 +58,41 @@ function ManagementList() {
|
|||||||
|
|
||||||
const [currentRow, setCurrentRow] = useState<API.CompanyList.Company>();
|
const [currentRow, setCurrentRow] = useState<API.CompanyList.Company>();
|
||||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
const [scaleEnum, setScaleEnum] = useState<any>([]);
|
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
||||||
|
const [scaleEnum, setScaleEnum] = useState<Record<string, any>>({});
|
||||||
|
|
||||||
|
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(() => {
|
useEffect(() => {
|
||||||
getDictValueEnum('scale', true, true).then((data) => {
|
getDictValueEnum('scale', true, true).then((data) => {
|
||||||
@@ -63,8 +100,6 @@ function ManagementList() {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const editSubmit = () => {};
|
|
||||||
|
|
||||||
const columns: ProColumns<API.CompanyList.Company>[] = [
|
const columns: ProColumns<API.CompanyList.Company>[] = [
|
||||||
{
|
{
|
||||||
title: '公司名称',
|
title: '公司名称',
|
||||||
@@ -102,6 +137,19 @@ function ManagementList() {
|
|||||||
dataIndex: 'companyId',
|
dataIndex: 'companyId',
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (companyId, record) => [
|
render: (companyId, record) => [
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
key="detail"
|
||||||
|
icon={<AlignLeftOutlined />}
|
||||||
|
hidden={!access.hasPerms('area:business:List.view')}
|
||||||
|
onClick={() => {
|
||||||
|
setCurrentRow(record);
|
||||||
|
setDetailVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</Button>,
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -144,12 +192,11 @@ function ManagementList() {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div style={{ width: '100%', float: 'right' }}>
|
<div style={{ width: '100%', float: 'right' }}>
|
||||||
<ProTable<API.CompanyList.Company>
|
<ProTable<API.CompanyList.Company>
|
||||||
// params 是需要自带的参数
|
|
||||||
// 这个参数优先级更高,会覆盖查询表单的参数
|
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
formRef={formTableRef}
|
formRef={formTableRef}
|
||||||
rowKey="companyId"
|
rowKey="companyId"
|
||||||
@@ -157,12 +204,11 @@ function ManagementList() {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
request={(params) =>
|
request={(params) =>
|
||||||
getCmsCompanyList({ ...params } as API.CompanyList.Params).then((res) => {
|
getCmsCompanyList({ ...params } as API.CompanyList.Params).then((res) => {
|
||||||
const result = {
|
return {
|
||||||
data: res.rows,
|
data: res.rows,
|
||||||
total: res.total,
|
total: res.total,
|
||||||
success: true,
|
success: true,
|
||||||
};
|
};
|
||||||
return result;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
@@ -182,7 +228,7 @@ 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.CompanyList.Params);
|
handleExport(searchVal as API.CompanyList.Params);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -192,10 +238,10 @@ function ManagementList() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EditCompanyListRow
|
<EditCompanyListRow
|
||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
onSubmit={async (values) => {
|
onSubmit={async (values) => {
|
||||||
console.log(values);
|
|
||||||
let resData;
|
let resData;
|
||||||
if (values.companyId) {
|
if (values.companyId) {
|
||||||
resData = await putCmsCompanyList(values);
|
resData = await putCmsCompanyList(values);
|
||||||
@@ -205,14 +251,8 @@ function ManagementList() {
|
|||||||
if (resData.code === 200) {
|
if (resData.code === 200) {
|
||||||
setModalVisible(false);
|
setModalVisible(false);
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
if (values.companyId) {
|
message.success(values.companyId ? '修改成功' : '新增成功');
|
||||||
message.success('修改成功');
|
actionRef.current?.reload();
|
||||||
} else {
|
|
||||||
message.success('新增成功');
|
|
||||||
}
|
|
||||||
if (actionRef.current) {
|
|
||||||
actionRef.current.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
@@ -221,9 +261,19 @@ function ManagementList() {
|
|||||||
}}
|
}}
|
||||||
values={currentRow}
|
values={currentRow}
|
||||||
scaleEnum={scaleEnum}
|
scaleEnum={scaleEnum}
|
||||||
></EditCompanyListRow>
|
/>
|
||||||
|
|
||||||
|
<CompanyDetailModal
|
||||||
|
visible={detailVisible}
|
||||||
|
onCancel={() => {
|
||||||
|
setDetailVisible(false);
|
||||||
|
setCurrentRow(undefined);
|
||||||
|
}}
|
||||||
|
record={currentRow}
|
||||||
|
scaleEnum={scaleEnum}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ManagementList;
|
export default ManagementList;
|
||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
ProFormSelect,
|
ProFormSelect,
|
||||||
ProFormText,
|
ProFormText,
|
||||||
ProFormTextArea,
|
ProFormTextArea,
|
||||||
|
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';
|
||||||
@@ -19,6 +20,7 @@ export type ListFormProps = {
|
|||||||
educationEnum: DictValueEnumObj;
|
educationEnum: DictValueEnumObj;
|
||||||
experienceEnum: DictValueEnumObj;
|
experienceEnum: DictValueEnumObj;
|
||||||
areaEnum: DictValueEnumObj;
|
areaEnum: DictValueEnumObj;
|
||||||
|
mode?: 'view' | 'edit' | 'create';
|
||||||
};
|
};
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
const waitTime = (time: number = 100) => {
|
||||||
@@ -32,6 +34,7 @@ const waitTime = (time: number = 100) => {
|
|||||||
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<{ name: string; company: string; companyName: number }>();
|
||||||
const { educationEnum, experienceEnum, areaEnum } = props;
|
const { educationEnum, experienceEnum, areaEnum } = props;
|
||||||
|
const { mode = props.values ? 'edit' : 'create' } = props;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
if (props.values) {
|
if (props.values) {
|
||||||
@@ -40,7 +43,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
|
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [form, props]);
|
}, [form, props.values?.jobID]);
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
@@ -54,13 +57,59 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
const handleChange = (_: string, value: any) => {
|
const handleChange = (_: string, value: any) => {
|
||||||
form.setFieldValue('companyName', value.label);
|
form.setFieldValue('companyName', value.label);
|
||||||
};
|
};
|
||||||
|
if (mode === 'view') {
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
title="岗位详情"
|
||||||
|
open={props.open}
|
||||||
|
width={800}
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => handleCancel(),
|
||||||
|
footer: null,
|
||||||
|
}}
|
||||||
|
submitter={false}
|
||||||
|
>
|
||||||
|
<ProDescriptions<API.ManagementList.Manage>
|
||||||
|
column={2}
|
||||||
|
dataSource={props.values || {}}
|
||||||
|
>
|
||||||
|
<ProDescriptions.Item dataIndex="jobTitle" label="岗位名称" />
|
||||||
|
<ProDescriptions.Item dataIndex="companyName" label="招聘公司" />
|
||||||
|
<ProDescriptions.Item dataIndex="minSalary" label="最低薪资(元/月)" />
|
||||||
|
<ProDescriptions.Item dataIndex="maxSalary" label="最高薪资(元/月)" />
|
||||||
|
<ProDescriptions.Item
|
||||||
|
dataIndex="education"
|
||||||
|
label="学历要求"
|
||||||
|
valueEnum={educationEnum}
|
||||||
|
/>
|
||||||
|
<ProDescriptions.Item
|
||||||
|
dataIndex="experience"
|
||||||
|
label="工作经验"
|
||||||
|
valueEnum={experienceEnum}
|
||||||
|
/>
|
||||||
|
<ProDescriptions.Item
|
||||||
|
dataIndex="jobLocationAreaCode"
|
||||||
|
label="工作区县"
|
||||||
|
valueEnum={areaEnum}
|
||||||
|
/>
|
||||||
|
<ProDescriptions.Item dataIndex="vacancies" label="招聘人数" />
|
||||||
|
<ProDescriptions.Item dataIndex="jobLocation" label="工作地点" />
|
||||||
|
<ProDescriptions.Item
|
||||||
|
dataIndex="description"
|
||||||
|
label="岗位描述"
|
||||||
|
span={2} // 跨两列显示
|
||||||
|
/>
|
||||||
|
</ProDescriptions>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ModalForm<{
|
<ModalForm<{
|
||||||
name: string;
|
name: string;
|
||||||
company: string;
|
company: string;
|
||||||
}>
|
}>
|
||||||
title="新建表单"
|
title={mode === 'edit' ? '编辑岗位' : '新建岗位'}
|
||||||
form={form}
|
form={form}
|
||||||
autoFocusFirstInput
|
autoFocusFirstInput
|
||||||
open={props.open}
|
open={props.open}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '@/services/Management/list';
|
} from '@/services/Management/list';
|
||||||
import { Button, FormInstance, message, Modal, Switch } from 'antd';
|
import { Button, FormInstance, message, Modal, Switch } from 'antd';
|
||||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||||
import { BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
|
import { AlignLeftOutlined, BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
|
||||||
import EditManageRow from './edit';
|
import EditManageRow from './edit';
|
||||||
import { getDictValueEnum } from '@/services/system/dict';
|
import { getDictValueEnum } from '@/services/system/dict';
|
||||||
import DictTag from '@/components/DictTag';
|
import DictTag from '@/components/DictTag';
|
||||||
@@ -60,7 +60,7 @@ function ManagementList() {
|
|||||||
const [hotEnum, setHotEnum] = useState<any>([]);
|
const [hotEnum, setHotEnum] = useState<any>([]);
|
||||||
const [currentRow, setCurrentRow] = useState<API.ManagementList.Manage>();
|
const [currentRow, setCurrentRow] = useState<API.ManagementList.Manage>();
|
||||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
|
const [mode, setMode] = useState<'view' | 'edit' | 'create'>('create');
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDictValueEnum('education', true, true).then((data) => {
|
getDictValueEnum('education', true, true).then((data) => {
|
||||||
setEducationEnum(data);
|
setEducationEnum(data);
|
||||||
@@ -178,7 +178,22 @@ function ManagementList() {
|
|||||||
dataIndex: 'jobId',
|
dataIndex: 'jobId',
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (jobId, record) => [
|
render: (jobId, record) => [
|
||||||
|
<div key="first-row" style={{ marginBottom: 8, display: 'flex', justifyContent: 'center' }}>
|
||||||
<Button
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
key="view"
|
||||||
|
icon={<AlignLeftOutlined />}
|
||||||
|
hidden={!access.hasPerms('area:business:List.view')}
|
||||||
|
onClick={() => {
|
||||||
|
setCurrentRow(record);
|
||||||
|
setModalVisible(true);
|
||||||
|
setMode('view'); // 新增状态控制模式
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看详情
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
key="edit"
|
key="edit"
|
||||||
@@ -187,7 +202,9 @@ function ManagementList() {
|
|||||||
onClick={() => history.push(`/management/see-matching/index/${record.jobId}`)}
|
onClick={() => history.push(`/management/see-matching/index/${record.jobId}`)}
|
||||||
>
|
>
|
||||||
查看申请人
|
查看申请人
|
||||||
</Button>,
|
</Button>
|
||||||
|
</div>,
|
||||||
|
<div key="second-row" style={{ display: 'flex', justifyContent: 'space-evenly'}}>
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -200,7 +217,7 @@ function ManagementList() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</Button>,
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -226,7 +243,8 @@ function ManagementList() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</Button>,
|
</Button>
|
||||||
|
</div>
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -260,6 +278,7 @@ function ManagementList() {
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setCurrentRow(undefined);
|
setCurrentRow(undefined);
|
||||||
setModalVisible(true);
|
setModalVisible(true);
|
||||||
|
setMode('create');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PlusOutlined /> 新建
|
<PlusOutlined /> 新建
|
||||||
@@ -281,6 +300,7 @@ function ManagementList() {
|
|||||||
</div>
|
</div>
|
||||||
<EditManageRow
|
<EditManageRow
|
||||||
open={modalVisible}
|
open={modalVisible}
|
||||||
|
mode={mode}
|
||||||
onSubmit={async (values) => {
|
onSubmit={async (values) => {
|
||||||
let resData;
|
let resData;
|
||||||
if (values.jobId) {
|
if (values.jobId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user