|
|
@@ -73,7 +73,7 @@ function onFileRemove(uploadFile: UploadFile) {
|
|
|
async function uploadAttachments(exceptionId: number) {
|
|
|
for (const file of attachmentFiles.value) {
|
|
|
const { data } = await getAPI(SysFileApi).apiSysFileUploadFilePostForm(file);
|
|
|
- if (data.type !== 'success' || !data.result) continue;
|
|
|
+ if (data.type !== 'success' || !data.result || !data.result.url) continue;
|
|
|
await s8ReportApi.attachments(exceptionId, {
|
|
|
fileName: data.result.fileName ?? file.name,
|
|
|
fileUrl: data.result.url,
|
|
|
@@ -87,14 +87,16 @@ async function submit() {
|
|
|
ElMessage.warning('请填写标题并选择场景');
|
|
|
return;
|
|
|
}
|
|
|
- if (!form.occurrenceDeptId || !form.responsibleDeptId) {
|
|
|
+ const occurrenceDeptId = form.occurrenceDeptId;
|
|
|
+ const responsibleDeptId = form.responsibleDeptId;
|
|
|
+ if (!occurrenceDeptId || !responsibleDeptId) {
|
|
|
ElMessage.warning('请选择发生部门和责任部门');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
saving.value = true;
|
|
|
try {
|
|
|
- const res = (await s8ReportApi.create(form)) as { exceptionId: number };
|
|
|
+ const res = (await s8ReportApi.create({ ...form, occurrenceDeptId, responsibleDeptId })) as { exceptionId: number };
|
|
|
if (attachmentFiles.value.length > 0) {
|
|
|
await uploadAttachments(res.exceptionId);
|
|
|
}
|