二次调研功能开发
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
francis-fh
2026-06-09 16:08:39 +08:00
parent 79e67e307f
commit f2da3d6929
11 changed files with 133 additions and 25 deletions

View File

@@ -7,11 +7,12 @@ import {
exportCmsJob,
exportJobApply,
getCmsJobList,
importJobRow,
updateCmsJobList,
} from '@/services/Management/list';
import { Button, FormInstance, message, Modal, Switch } from 'antd';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { AlignLeftOutlined, BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined,DownloadOutlined } from '@ant-design/icons';
import { AlignLeftOutlined, BarChartOutlined, DeleteOutlined, FormOutlined, PlusOutlined, DownloadOutlined, UploadOutlined } from '@ant-design/icons';
import EditManageRow from './edit';
import { getDictValueEnum } from '@/services/system/dict';
import DictTag from '@/components/DictTag';
@@ -76,6 +77,7 @@ function ManagementList() {
const formTableRef = useRef<FormInstance>();
const actionRef = useRef<ActionType>();
const fileInputRef = useRef<HTMLInputElement>(null);
const [educationEnum, setEducationEnum] = useState<any>([]);
const [experienceEnum, setExperienceEnum] = useState<any>([]);
@@ -120,6 +122,29 @@ function ManagementList() {
}
}
const handleBatchUpload = async (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0];
if (!file) return;
const hide = message.loading('正在上传');
try {
const resp = await importJobRow(file);
hide();
if (resp.code === 200) {
message.success('批量上传成功');
actionRef.current?.reload();
} else {
message.error(resp.msg || '上传失败,请重试');
}
} catch (error) {
hide();
message.error('上传失败,请重试');
}
// 清空 input 以便重复选择同一文件
if (fileInputRef.current) {
fileInputRef.current.value = '';
}
};
const columns: ProColumns<API.ManagementList.Manage>[] = [
{
title: '时间范围',
@@ -390,9 +415,24 @@ function ManagementList() {
>
<DownloadOutlined />
</Button>,
<Button
type="primary"
key="batchUpload"
hidden={!access.hasPerms('manage:List:add')}
onClick={() => fileInputRef.current?.click()}
>
<UploadOutlined />
</Button>,
]}
/>
</div>
<input
type="file"
ref={fileInputRef}
style={{ display: 'none' }}
accept=".xlsx,.xls"
onChange={handleBatchUpload}
/>
<EditManageRow
open={modalVisible}
mode={mode}