|
|
@@ -371,10 +371,36 @@ const resetQuery = () => {
|
|
|
queryFormRef.value?.resetFields()
|
|
|
handleQuery()
|
|
|
}
|
|
|
+const cloneAttachments = (attachments: Project['attachments']) => ({
|
|
|
+ application:
|
|
|
+ attachments?.application?.map((file) =>
|
|
|
+ file && typeof file === 'object' ? { ...file } : file
|
|
|
+ ) || [],
|
|
|
+ report:
|
|
|
+ attachments?.report?.map((file) => (file && typeof file === 'object' ? { ...file } : file)) ||
|
|
|
+ [],
|
|
|
+ others:
|
|
|
+ attachments?.others?.map((file) => (file && typeof file === 'object' ? { ...file } : file)) ||
|
|
|
+ []
|
|
|
+})
|
|
|
+const cloneProjectForm = (project: Project) => ({
|
|
|
+ projectLevel: project.projectLevel,
|
|
|
+ executingUnit: project.executingUnit,
|
|
|
+ projectName: project.projectName,
|
|
|
+ projectLeader: project.projectLeader,
|
|
|
+ projectMembers: project.projectMembers,
|
|
|
+ projectType: project.projectType,
|
|
|
+ purpose: project.purpose,
|
|
|
+ researchContent: project.researchContent,
|
|
|
+ innovation: project.innovation,
|
|
|
+ schedule: project.schedule.map((item) => ({ ...item })),
|
|
|
+ budget: { ...project.budget },
|
|
|
+ attachments: cloneAttachments(project.attachments)
|
|
|
+})
|
|
|
const openForm = (project?: Project) => {
|
|
|
editingId.value = project?.id
|
|
|
dialogTitle.value = project ? '编辑科研项目' : '新增科研项目'
|
|
|
- formData.value = project ? structuredClone(project) : createForm()
|
|
|
+ formData.value = project ? cloneProjectForm(project) : createForm()
|
|
|
dialogVisible.value = true
|
|
|
}
|
|
|
const addSchedule = () => formData.value.schedule.push(createSchedule())
|