fix(缺陷管理): 缺陷详情与附件同时保存报错问题

--bug=1036051 --user=宋昌昌 【缺陷管理】缺陷详情-编辑缺陷内容失败报sql异常 https://www.tapd.cn/55049933/s/1470009
This commit is contained in:
song-cc-rock 2024-03-06 11:40:11 +08:00 committed by 刘瑞斌
parent d2dd6e5829
commit 26c65a979b
1 changed files with 17 additions and 32 deletions

View File

@ -116,6 +116,20 @@
</template>
</MsFileList>
</div>
<div>
<MsUpload
v-model:file-list="fileList"
accept="none"
:auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })"
multiple
draggable
size-unit="MB"
:max-size="50"
:is-all-screen="true"
class="mb-[16px]"
/>
</div>
<RelateFileDrawer
v-model:visible="associatedDrawer"
:get-tree-request="getModules"
@ -135,6 +149,7 @@
import MsIconfont from '@/components/pure/ms-icon-font/index.vue';
import MsRichText from '@/components/pure/ms-rich-text/MsRichText.vue';
import MsFileList from '@/components/pure/ms-upload/fileList.vue';
import MsUpload from '@/components/pure/ms-upload/index.vue';
import { MsFileItem } from '@/components/pure/ms-upload/types';
import AddAttachment from '@/components/business/ms-add-attachment/index.vue';
import RelateFileDrawer from '@/components/business/ms-link-file/associatedFileDrawer.vue';
@ -183,6 +198,7 @@
const appStore = useAppStore();
const transferVisible = ref<boolean>(false);
const previewVisible = ref<boolean>(false);
const acceptType = ref('none'); // -
// id
const fileIds = ref<string[]>([]);
const imageUrl = ref<string>('');
@ -322,26 +338,6 @@
associatedDrawer.value = true;
}
//
function getFilesParams() {
const associateFileIds = attachmentsList.value.filter((item) => !item.local).map((item) => item.id);
const newAssociateFileListIds = fileList.value
.filter((item) => !item.local && !associateFileIds.includes(item.uid))
.map((item) => item.uid);
const currentOldLocalFileList = fileList.value
.filter((item) => item.local && item.status !== 'init')
.map((item) => item.uid);
// form
form.value.deleteLocalFileIds = attachmentsList.value
.filter((item) => item.local && !currentOldLocalFileList.includes(item.uid))
.map((item) => item.uid);
form.value.unLinkRefIds = associateFileIds.filter((id) => !newAssociateFileListIds.includes(id));
form.value.linkFileIds = newAssociateFileListIds;
}
async function startUpload() {
await sleep(300);
fileListRef.value?.startUpload();
@ -388,17 +384,6 @@
return data;
}
//
watch(
() => fileList.value,
(val) => {
if (val) {
getListFunParams.value.combine.hiddenIds = fileList.value.filter((item) => !item.local).map((item) => item.uid);
getFilesParams();
}
},
{ deep: true }
);
//
async function handleSave() {
try {
@ -423,7 +408,7 @@
customFields,
};
//
const res = await createOrUpdateBug({ request: tmpObj, fileList: fileList.value as unknown as File[] });
const res = await createOrUpdateBug({ request: tmpObj, fileList: [] as unknown as File[] });
if (res) {
Message.success(t('common.updateSuccess'));
defaultContentValue.value = form.value.description;