flat: 暂存
This commit is contained in:
@@ -1,13 +1,33 @@
|
||||
import React, {Fragment, useRef, useState, useEffect} from "react";
|
||||
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
||||
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, FormOutlined, DownOutlined, EditOutlined } from '@ant-design/icons';
|
||||
import EditManageRow from './edit'
|
||||
import {getDictValueEnum} from "@/services/system/dict";
|
||||
import DictTag from "@/components/DictTag";
|
||||
import React, { Fragment, useEffect, useRef, useState } from 'react';
|
||||
import { FormattedMessage, history, useAccess } from '@umijs/max';
|
||||
|
||||
import {
|
||||
addCmsJobList,
|
||||
delCmsJobIds,
|
||||
exportCmsJob,
|
||||
getCmsJobList,
|
||||
updateCmsJobList,
|
||||
} from '@/services/Management/list';
|
||||
import { Button, FormInstance, message, Modal, Switch } from 'antd';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import EditManageRow from './edit';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
|
||||
const handleExport = async (values: API.ManagementList.ListParams) => {
|
||||
const hide = message.loading('正在导出');
|
||||
try {
|
||||
await exportCmsJob(values);
|
||||
hide();
|
||||
message.success('导出成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('导出失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const handleRemoveOne = async (jobId: string) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!jobId) return true;
|
||||
@@ -33,23 +53,44 @@ function ManagementList() {
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
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 [educationEnum, setEducationEnum] = useState<any>([]);
|
||||
const [experienceEnum, setExperienceEnum] = useState<any>([]);
|
||||
const [areaEnum, setAreaEnum] = useState<any>([]);
|
||||
const [isPublishEnum, setIsPublishEnum] = useState<any>([]);
|
||||
const [hotEnum, setHotEnum] = useState<any>([]);
|
||||
const [currentRow, setCurrentRow] = useState<API.ManagementList.Manage>();
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('education',true).then((data) => {
|
||||
setEducationEnum(data)
|
||||
})
|
||||
getDictValueEnum('experience',true).then((data) => {
|
||||
setExperienceEnum(data)
|
||||
})
|
||||
getDictValueEnum('education', true, true).then((data) => {
|
||||
setEducationEnum(data);
|
||||
});
|
||||
getDictValueEnum('experience', true, true).then((data) => {
|
||||
setExperienceEnum(data);
|
||||
});
|
||||
getDictValueEnum('area', true, true).then((data) => {
|
||||
setAreaEnum(data);
|
||||
});
|
||||
getDictValueEnum('is_publish', true).then((data) => {
|
||||
setIsPublishEnum(data);
|
||||
});
|
||||
// getDictValueEnum('job_hot',true).then((data) => {
|
||||
// setHotEnum(data)
|
||||
// })
|
||||
}, [])
|
||||
}, []);
|
||||
|
||||
async function changeRelease(record: API.ManagementList.Manage) {
|
||||
let resData = await updateCmsJobList({
|
||||
jobId: record.jobId,
|
||||
isPublish: record.isPublish === 1 ? 0 : 1,
|
||||
});
|
||||
if (resData.code === 200) {
|
||||
message.success('修改成功');
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const columns: ProColumns<API.ManagementList.Manage>[] = [
|
||||
{
|
||||
@@ -57,13 +98,18 @@ function ManagementList() {
|
||||
dataIndex: 'jobTitle',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},{
|
||||
},
|
||||
{
|
||||
title: '最大最小薪资',
|
||||
dataIndex: 'maxSalary',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (_, record) => <>{record.minSalary}-{record.maxSalary}</>
|
||||
render: (_, record) => (
|
||||
<>
|
||||
{record.minSalary}-{record.maxSalary}
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '单位名称',
|
||||
@@ -78,18 +124,17 @@ function ManagementList() {
|
||||
align: 'center',
|
||||
valueEnum: educationEnum,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={educationEnum} value={record.education} />);
|
||||
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} />);
|
||||
return <DictTag enums={experienceEnum} value={record.experience} />;
|
||||
},
|
||||
},
|
||||
// {
|
||||
@@ -103,11 +148,14 @@ function ManagementList() {
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '发布时间',
|
||||
dataIndex: 'postingDate',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
title: '是否发布',
|
||||
dataIndex: 'isPublish',
|
||||
valueType: 'select',
|
||||
align: 'center',
|
||||
valueEnum: isPublishEnum,
|
||||
render: (text, record) => (
|
||||
<Switch checked={record.isPublish === 1} onChange={changeRelease.bind(null, record)} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '招聘人数',
|
||||
@@ -134,7 +182,17 @@ function ManagementList() {
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
icon={<FormOutlined/>}
|
||||
icon={<BarChartOutlined />}
|
||||
hidden={!access.hasPerms('area:business:List.update')}
|
||||
onClick={() => history.push(`/management/see-matching/index/${record.jobId}`)}
|
||||
>
|
||||
查看申请人
|
||||
</Button>,
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
icon={<FormOutlined />}
|
||||
hidden={!access.hasPerms('area:business:List.update')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
@@ -148,7 +206,7 @@ function ManagementList() {
|
||||
size="small"
|
||||
danger
|
||||
key="batchRemove"
|
||||
icon ={<DeleteOutlined/>}
|
||||
icon={<DeleteOutlined />}
|
||||
hidden={!access.hasPerms('area:subway:List')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
@@ -168,10 +226,10 @@ function ManagementList() {
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
]
|
||||
}
|
||||
]
|
||||
</Button>,
|
||||
],
|
||||
},
|
||||
];
|
||||
return (
|
||||
<Fragment>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
@@ -185,7 +243,7 @@ function ManagementList() {
|
||||
columns={columns}
|
||||
request={(params) =>
|
||||
getCmsJobList({ ...params } as API.ManagementList.ListParams).then((res) => {
|
||||
console.log(params)
|
||||
console.log(params);
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
@@ -206,21 +264,54 @@ function ManagementList() {
|
||||
>
|
||||
<PlusOutlined /> 新建
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('system:user:export')}
|
||||
onClick={async () => {
|
||||
const searchVal = formTableRef.current && formTableRef.current.getFieldsValue();
|
||||
handleExport(searchVal as API.ManagementList.ListParams);
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<EditManageRow
|
||||
open={modalVisible}
|
||||
onSubmit={(values) => {
|
||||
console.log(values)
|
||||
return Promise.resolve()
|
||||
onSubmit={async (values) => {
|
||||
let resData;
|
||||
if (values.jobId) {
|
||||
resData = await updateCmsJobList(values);
|
||||
} else {
|
||||
resData = await addCmsJobList(values);
|
||||
}
|
||||
if (resData.code === 200) {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
if (values.jobId) {
|
||||
message.success('修改成功');
|
||||
} else {
|
||||
message.success('新增成功');
|
||||
}
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
values={currentRow}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
}}
|
||||
educationEnum={educationEnum}
|
||||
experienceEnum={experienceEnum}
|
||||
areaEnum={areaEnum}
|
||||
></EditManageRow>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
}
|
||||
export default ManagementList
|
||||
|
||||
export default ManagementList;
|
||||
|
||||
Reference in New Issue
Block a user