flat: 暂存
This commit is contained in:
@@ -11,7 +11,7 @@ import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||||
|
||||
export type ListFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||
onSubmit: (values: API.Management.Manage) => Promise<void>;
|
||||
onSubmit: (values: API.ManagementList.Manage) => Promise<void>;
|
||||
open: boolean;
|
||||
// values: Partial<API.Management.Manage>;
|
||||
// jobGroupOptions: DictOptionType[];
|
||||
@@ -35,7 +35,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
};
|
||||
|
||||
const handleFinish = async (values: Record<string, any>) => {
|
||||
props.onSubmit(values as API.Management.Manage);
|
||||
props.onSubmit(values as API.ManagementList.Manage);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -57,65 +57,67 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="jobName"
|
||||
name="jobTitle"
|
||||
label="岗位名称"
|
||||
placeholder="请输入名称"
|
||||
/>
|
||||
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="company"
|
||||
label="我方公司名称"
|
||||
placeholder="请输入名称"
|
||||
name="minSalary"
|
||||
label="最小薪资"
|
||||
placeholder="请输入最小薪资(元)"
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="maxSalary"
|
||||
label="最大薪资"
|
||||
placeholder="请输入最大薪资(元)"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="contract"
|
||||
label="合同名称"
|
||||
placeholder="请输入名称"
|
||||
name="education"
|
||||
label="学历要求"
|
||||
placeholder="请输入学历要求"
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="experience"
|
||||
label="工作经验"
|
||||
placeholder="请输入工作经验"
|
||||
/>
|
||||
<ProFormDateRangePicker name="contractTime" label="合同生效时间" />
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormSelect
|
||||
request={async () => [
|
||||
{
|
||||
value: 'chapter',
|
||||
label: '盖章后生效',
|
||||
},
|
||||
]}
|
||||
width="xs"
|
||||
name="useMode"
|
||||
label="合同约定生效方式"
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="companyName"
|
||||
label="单位名称"
|
||||
placeholder="请输入单位名称"
|
||||
/>
|
||||
<ProFormSelect
|
||||
width="xs"
|
||||
options={[
|
||||
{
|
||||
value: 'time',
|
||||
label: '履行完终止',
|
||||
},
|
||||
]}
|
||||
name="unusedMode"
|
||||
label="合同约定失效效方式"
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="jobLocation"
|
||||
label="工作地点"
|
||||
placeholder="请输入工作地点"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="vacancies"
|
||||
label="招聘人数"
|
||||
placeholder="请输入招聘人数"
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="jobLocation"
|
||||
label="工作地点"
|
||||
placeholder="请输入工作地点"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProFormText width="sm" name="id" label="主合同编号" />
|
||||
<ProFormText
|
||||
name="project"
|
||||
disabled
|
||||
label="项目名称"
|
||||
initialValue="xxxx项目"
|
||||
/>
|
||||
<ProFormText
|
||||
width="xs"
|
||||
name="mangerName"
|
||||
disabled
|
||||
label="商务经理"
|
||||
initialValue="启途"
|
||||
/>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,38 +1,191 @@
|
||||
import React, {Fragment, useRef, useState} from "react";
|
||||
import React, {Fragment, useRef, useState, useEffect} from "react";
|
||||
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
||||
import {getCmsJobList} from "@/services/Management/list";
|
||||
import {delCmsJobIds, getCmsJobList} from "@/services/Management/list";
|
||||
import { Dropdown, FormInstance, Space, Button, message, Modal } from 'antd';
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
||||
import EditManageRow from './edit'
|
||||
import {getDictValueEnum} from "@/services/system/dict";
|
||||
import DictTag from "@/components/DictTag";
|
||||
|
||||
const handleRemoveOne = async (jobId: string) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!jobId) return true;
|
||||
try {
|
||||
const resp = await delCmsJobIds(jobId);
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function ManagementList() {
|
||||
const access = useAccess();
|
||||
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
const [currentRow, setCurrentRow] = useState<API.Management.Manage>()
|
||||
const [educationEnum, setEducationEnum] = useState<any>([])
|
||||
const [experienceEnum, setExperienceEnum] = useState<any>([])
|
||||
const [hotEnum, setHotEnum] = useState<any>([])
|
||||
const [currentRow, setCurrentRow] = useState<API.ManagementList.Manage>()
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false)
|
||||
|
||||
const columns: ProColumns<API.Management.Manage>[] = [
|
||||
useEffect(() => {
|
||||
getDictValueEnum('education',true).then((data) => {
|
||||
setEducationEnum(data)
|
||||
})
|
||||
getDictValueEnum('experience',true).then((data) => {
|
||||
setExperienceEnum(data)
|
||||
})
|
||||
// getDictValueEnum('job_hot',true).then((data) => {
|
||||
// setHotEnum(data)
|
||||
// })
|
||||
}, [])
|
||||
|
||||
const columns: ProColumns<API.ManagementList.Manage>[] = [
|
||||
{
|
||||
title: '任务编号',
|
||||
dataIndex: 'jobId',
|
||||
title: '岗位名称',
|
||||
dataIndex: 'jobTitle',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},{
|
||||
title: '最大最小薪资',
|
||||
dataIndex: 'maxSalary',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (_, record) => <>{record.minSalary}-{record.maxSalary}</>
|
||||
},
|
||||
{
|
||||
title: '单位名称',
|
||||
dataIndex: 'companyName',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '学历要求',
|
||||
dataIndex: 'education',
|
||||
valueType: 'select',
|
||||
align: 'center',
|
||||
valueEnum: educationEnum,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={educationEnum} value={record.education} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '经验要求',
|
||||
dataIndex: 'experience',
|
||||
hideInSearch: true,
|
||||
valueType: 'select',
|
||||
align: 'center',
|
||||
valueEnum: experienceEnum,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={experienceEnum} value={record.experience} />);
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '是否热门',
|
||||
// dataIndex: 'isHot',
|
||||
// valueType: 'select',
|
||||
// align: 'center',
|
||||
// valueEnum: hotEnum,
|
||||
// render: (_, record) => {
|
||||
// return (<DictTag enums={hotEnum} value={record.isHot} />);
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '发布时间',
|
||||
dataIndex: 'postingDate',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '招聘人数',
|
||||
dataIndex: 'vacancies',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '浏览量',
|
||||
dataIndex: 'view',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
dataIndex: 'jobId',
|
||||
width: 300,
|
||||
render: (jobId, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
icon={<FormOutlined/>}
|
||||
hidden={!access.hasPerms('area:business:List.update')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>,
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
key="batchRemove"
|
||||
icon ={<DeleteOutlined/>}
|
||||
hidden={!access.hasPerms('area:subway:List')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确定删除该项吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await handleRemoveOne(jobId as string);
|
||||
if (success) {
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
]
|
||||
}
|
||||
]
|
||||
return (
|
||||
<Fragment>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable<API.Management.Manage>
|
||||
<ProTable<API.ManagementList.Manage>
|
||||
// params 是需要自带的参数
|
||||
// 这个参数优先级更高,会覆盖查询表单的参数
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
rowKey="jobId"
|
||||
key="index"
|
||||
columns={columns}
|
||||
request={(params) =>
|
||||
getCmsJobList({ ...params } as API.Management.ListParams).then((res) => {
|
||||
getCmsJobList({ ...params } as API.ManagementList.ListParams).then((res) => {
|
||||
console.log(params)
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
@@ -45,7 +198,7 @@ function ManagementList() {
|
||||
<Button
|
||||
type="primary"
|
||||
key="add"
|
||||
hidden={!access.hasPerms('manage:list:add')}
|
||||
hidden={!access.hasPerms('manage:List:add')}
|
||||
onClick={async () => {
|
||||
setCurrentRow(undefined);
|
||||
setModalVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user