feat: Enhance Outdoor Fair and Public Job Fair features
- Added QR code functionality for companies signing up for outdoor fairs. - Implemented job management for outdoor fairs, including job listing and editing. - Updated Public Job Fair detail view to reflect new data structure. - Refactored EditModal to support dynamic lists for host, co-organizer, and organizing units. - Introduced cross-domain city selection for job fairs. - Enhanced API services for managing cross-domain jobs and cities. - Improved data handling for outdoor fair items, including review status and QR code content. - Updated type definitions to accommodate new fields and structures.
This commit is contained in:
@@ -6,13 +6,13 @@ import {
|
||||
ProColumns,
|
||||
ProTable,
|
||||
ModalForm,
|
||||
ProFormDigit,
|
||||
ProFormText,
|
||||
ProFormSelect,
|
||||
} from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, LinkOutlined, DisconnectOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
getOutdoorFairDeviceList,
|
||||
batchGenerateOutdoorFairDevice,
|
||||
addOutdoorFairDevice,
|
||||
bindOutdoorFairDevice,
|
||||
deleteOutdoorFairDevice,
|
||||
getOutdoorFairCompanyOptions,
|
||||
@@ -26,7 +26,7 @@ interface Props {
|
||||
const DeviceTab: React.FC<Props> = ({ fairId }) => {
|
||||
const access = useAccess();
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [batchVisible, setBatchVisible] = useState(false);
|
||||
const [addVisible, setAddVisible] = useState(false);
|
||||
const [bindVisible, setBindVisible] = useState(false);
|
||||
const [currentRow, setCurrentRow] = useState<OutdoorFairDeviceItem>();
|
||||
|
||||
@@ -145,13 +145,13 @@ const DeviceTab: React.FC<Props> = ({ fairId }) => {
|
||||
scroll={{ x: 'max-content' }}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
key="batch"
|
||||
key="add"
|
||||
type="primary"
|
||||
icon={<PlusOutlined />}
|
||||
hidden={!access.hasPerms('cms:outdoorFair:add')}
|
||||
onClick={() => setBatchVisible(true)}
|
||||
onClick={() => setAddVisible(true)}
|
||||
>
|
||||
批量生成设备码
|
||||
新增设备码
|
||||
</Button>,
|
||||
]}
|
||||
request={async (params) => {
|
||||
@@ -167,34 +167,60 @@ const DeviceTab: React.FC<Props> = ({ fairId }) => {
|
||||
columns={columns}
|
||||
/>
|
||||
|
||||
<ModalForm<{ quantity: number }>
|
||||
title="批量生成设备码"
|
||||
open={batchVisible}
|
||||
modalProps={{ destroyOnClose: true, onCancel: () => setBatchVisible(false) }}
|
||||
initialValues={{ quantity: 10 }}
|
||||
<ModalForm<{ deviceCode: string; companyId?: number }>
|
||||
title="新增设备码"
|
||||
open={addVisible}
|
||||
modalProps={{ destroyOnClose: true, onCancel: () => setAddVisible(false) }}
|
||||
onFinish={async (values) => {
|
||||
const res = await batchGenerateOutdoorFairDevice({
|
||||
const res = await addOutdoorFairDevice({
|
||||
fairId,
|
||||
quantity: Number(values.quantity),
|
||||
deviceCode: values.deviceCode.trim(),
|
||||
companyId: values.companyId,
|
||||
});
|
||||
if (res.code === 200) {
|
||||
message.success(`成功生成 ${res.data?.length || values.quantity} 个设备码`);
|
||||
setBatchVisible(false);
|
||||
message.success('新增成功');
|
||||
setAddVisible(false);
|
||||
actionRef.current?.reload();
|
||||
return true;
|
||||
}
|
||||
message.error(res.msg || '生成失败');
|
||||
message.error(res.msg || '新增失败');
|
||||
return false;
|
||||
}}
|
||||
>
|
||||
<ProFormDigit
|
||||
name="quantity"
|
||||
label="生成数量"
|
||||
placeholder="请输入需要生成的设备码数量"
|
||||
min={1}
|
||||
max={1000}
|
||||
fieldProps={{ precision: 0 }}
|
||||
rules={[{ required: true, message: '请输入生成数量' }]}
|
||||
<ProFormText
|
||||
name="deviceCode"
|
||||
label="设备码"
|
||||
placeholder="请输入设备码"
|
||||
fieldProps={{ maxLength: 64 }}
|
||||
rules={[
|
||||
{ required: true, message: '请输入设备码' },
|
||||
{ max: 64, message: '设备码长度不能超过64个字符' },
|
||||
]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="companyId"
|
||||
label="绑定企业"
|
||||
placeholder="选填,不选则创建未绑定的设备码"
|
||||
showSearch
|
||||
allowClear
|
||||
request={async () => {
|
||||
const [companies, devicesRes] = await Promise.all([
|
||||
getOutdoorFairCompanyOptions(fairId),
|
||||
getOutdoorFairDeviceList({ fairId, current: 1, pageSize: 1000 }),
|
||||
]);
|
||||
// 排除已绑定到其他设备的企业
|
||||
const boundIds = new Set(
|
||||
(devicesRes.rows || [])
|
||||
.map((d) => d.companyId)
|
||||
.filter((cid): cid is number => cid != null),
|
||||
);
|
||||
return companies
|
||||
.filter((item) => !boundIds.has(item.companyId))
|
||||
.map((item) => ({
|
||||
label: item.companyName,
|
||||
value: item.companyId,
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
</ModalForm>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user