This commit is contained in:
parent
1152ae3ec9
commit
040804697d
@ -26,35 +26,32 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
width="1000px"
|
width="1000px"
|
||||||
key={new Date().getTime()}
|
key={new Date().getTime()}
|
||||||
form={form}
|
form={form}
|
||||||
request={async () => {
|
// request={async () => {
|
||||||
const res = await Apis.Activity.Activities.Show({
|
// const res = await Apis.Activity.Activities.Show({
|
||||||
id: props.item?.id ?? 0,
|
// id: props.item?.id ?? 0,
|
||||||
});
|
// });
|
||||||
return {
|
// return {
|
||||||
project_ids: res.data.activity_projects[0]?.asset_projects_id,
|
// project_ids: res.data.activity_projects[0]?.asset_projects_id,
|
||||||
};
|
// };
|
||||||
}}
|
// }}
|
||||||
onOpenChange={(open: any) => {
|
onOpenChange={(open: any) => {
|
||||||
if (open && props.item) {
|
if (open && props.item) {
|
||||||
form.setFieldsValue(props.item);
|
form.setFieldsValue({
|
||||||
// form.setFieldValue(
|
...props.item,
|
||||||
// 'project_ids',
|
activity_time: [
|
||||||
// props.item?.activity_projects[0]?.asset_projects_id,
|
props.item?.start_time || '',
|
||||||
// );
|
props.item?.end_time || '',
|
||||||
form.setFieldValue('activity_time', [
|
],
|
||||||
props.item?.start_time,
|
project_ids: props?.item?.activity_projects?.map(
|
||||||
props.item?.end_time,
|
(res: any) => res?.asset_projects_id,
|
||||||
]);
|
),
|
||||||
form.setFieldValue('content', props.item?.content);
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onFinish={async (values) =>
|
onFinish={async (values) =>
|
||||||
Apis.Activity.Activities.Update({
|
Apis.Activity.Activities.Update({
|
||||||
...values,
|
...values,
|
||||||
id: props.item?.id ?? 0,
|
id: props.item?.id ?? 0,
|
||||||
project_ids: values?.project_ids
|
|
||||||
? [values?.project_ids]
|
|
||||||
: [props.item?.id],
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
props.reload?.();
|
props.reload?.();
|
||||||
@ -67,14 +64,26 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
Selects?.AssetProjects({
|
Selects?.AssetProjects({
|
||||||
key: 'project_ids',
|
key: 'project_ids',
|
||||||
title: '关联项目',
|
title: '关联项目',
|
||||||
|
formItemProps: { ...rulesHelper.array },
|
||||||
colProps: { span: 24 },
|
colProps: { span: 24 },
|
||||||
required: true,
|
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
|
mode: 'multiple',
|
||||||
fieldNames: {
|
fieldNames: {
|
||||||
label: 'label',
|
label: 'label',
|
||||||
value: 'value',
|
value: 'value',
|
||||||
},
|
},
|
||||||
|
labelRender: (res: any) => {
|
||||||
|
if (res?.label) {
|
||||||
|
return res?.label;
|
||||||
|
} else {
|
||||||
|
return props?.item?.activity_projects?.map((i: any) => {
|
||||||
|
if (res?.value === i?.asset_projects_id) {
|
||||||
|
return i?.asset_project?.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user