fix: 修复缺陷管理&用例管理文件转存bug

This commit is contained in:
xinxin.wu 2024-04-15 17:37:47 +08:00 committed by Craftsman
parent 0b85f941ec
commit b1ea71ecfa
4 changed files with 74 additions and 41 deletions

View File

@ -212,7 +212,6 @@
watch(
() => props.fileList,
(val) => {
console.log(props.initFileSaveTips);
innerFileList.value = val.sort((a, b) => {
if (a.status === UploadStatus.init && b.status !== UploadStatus.init) {
return -1; // "init"
@ -383,4 +382,4 @@
justify-content: space-between;
padding-bottom: 4px;
}
</style>
</style>

View File

@ -105,21 +105,10 @@
type="button"
status="primary"
class="!mr-[4px]"
@click="transferVisible = true"
@click="transferHandler(item)"
>
{{ t('caseManagement.featureCase.storage') }}
</MsButton>
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="{
projectId: currentProjectId,
bugId: bugId,
fileId: item.uid,
local: true,
}"
@success="emit('updateSuccess')"
/>
<MsButton
v-if="item.status === 'done'"
type="button"
@ -197,6 +186,12 @@
@save="saveSelectAssociatedFile"
/>
<a-image-preview v-model:visible="previewVisible" :src="imageUrl" />
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="activeTransferFileParams"
@success="emit('updateSuccess')"
/>
</template>
<script setup lang="ts">
@ -235,6 +230,7 @@
import { findParents, Option } from '@/utils/recursion';
import { BugEditCustomField, BugEditCustomFieldItem, BugEditFormObject } from '@/models/bug-management';
import type { OperationFile } from '@/models/caseManagement/featureCase';
import { AssociatedList, AttachFileInfo } from '@/models/caseManagement/featureCase';
import { TableQueryParams } from '@/models/common';
@ -540,6 +536,22 @@
await handleFileFunc(attachments);
Message.success(t('common.linkSuccess'));
}
const activeTransferFileParams = ref<OperationFile>({
projectId: '',
bugId: '',
fileId: '',
local: true,
});
function transferHandler(item: MsFileItem) {
activeTransferFileParams.value = {
projectId: currentProjectId.value,
fileId: item.uid,
bugId: props.detailInfo.id,
local: true,
};
transferVisible.value = true;
}
watchEffect(() => {
initCurrentDetail(props.detailInfo);
@ -571,4 +583,4 @@
:deep(.arco-form-item-label) {
font-weight: bold !important;
}
</style>
</style>

View File

@ -108,21 +108,10 @@
type="button"
status="primary"
class="!mr-[4px]"
@click="transferFile"
@click="transferFile(item)"
>
{{ t('caseManagement.featureCase.storage') }}
</MsButton>
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="{
projectId: currentProjectId,
caseId: props.caseId,
fileId: item.uid,
local: true,
}"
@success="getCaseInfo()"
/>
<MsButton
v-if="item.status !== 'init'"
type="button"
@ -250,6 +239,12 @@
@save="saveSelectAssociatedFile"
/>
<a-image-preview v-model:visible="previewVisible" :src="imageUrl" />
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="activeTransferFileParams"
@success="getCaseInfo()"
/>
</template>
<script setup lang="ts">
@ -296,6 +291,7 @@
CreateOrUpdateCase,
CustomAttributes,
DetailCase,
OperationFile,
OptionsFieldId,
StepList,
} from '@/models/caseManagement/featureCase';
@ -695,10 +691,25 @@
});
const transferVisible = ref<boolean>(false);
const activeTransferFileParams = ref<OperationFile>({
projectId: '',
caseId: '',
fileId: '',
local: true,
});
//
function transferFile() {
function transferFile(item: MsFileItem) {
activeTransferFileParams.value = {
projectId: currentProjectId.value,
caseId: form.value.id,
fileId: item.uid,
local: true,
};
transferVisible.value = true;
}
//
async function downloadFile(item: MsFileItem) {
try {

View File

@ -182,20 +182,9 @@
>
{{ t('ms.upload.preview') }}
</MsButton>
<MsButton type="button" status="primary" class="!mr-[4px]" @click="transferVisible = true">
<MsButton type="button" status="primary" class="!mr-[4px]" @click="transferFileHandler(item)">
{{ t('caseManagement.featureCase.storage') }}
</MsButton>
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="{
projectId: currentProjectId,
caseId: detailForm.id,
fileId: item.uid,
local: true,
}"
@success="emit('updateSuccess')"
/>
<MsButton
v-if="item.status === 'done'"
type="button"
@ -270,6 +259,12 @@
/>
</div>
<a-image-preview v-model:visible="previewVisible" :src="imageUrl" />
<TransferModal
v-model:visible="transferVisible"
:request-fun="transferFileRequest"
:params="activeTransferFileParams"
@success="emit('updateSuccess')"
/>
</template>
<script setup lang="ts">
@ -308,7 +303,7 @@
import { downloadByteFile, getGenerateId, sleep } from '@/utils';
import { scrollIntoView } from '@/utils/dom';
import type { AssociatedList, DetailCase, StepList } from '@/models/caseManagement/featureCase';
import type { AssociatedList, DetailCase, OperationFile, StepList } from '@/models/caseManagement/featureCase';
import type { TableQueryParams } from '@/models/common';
import { convertToFile } from '../utils';
@ -674,6 +669,22 @@
fileListRef.value?.startUpload();
}
const activeTransferFileParams = ref<OperationFile>({
projectId: '',
caseId: '',
fileId: '',
local: true,
});
function transferFileHandler(item: MsFileItem) {
activeTransferFileParams.value = {
projectId: currentProjectId.value,
caseId: props.form.id,
fileId: item.uid,
local: true,
};
transferVisible.value = true;
}
watch(
() => props.form,
(val) => {