fix(全局): 问题修复

This commit is contained in:
baiqi 2024-02-02 18:38:36 +08:00 committed by 刘瑞斌
parent afd1704284
commit e06854d8b1
9 changed files with 85 additions and 50 deletions

View File

@ -81,7 +81,7 @@ export class MSAxios {
* @description:
*/
uploadFile<T = any>(
config: AxiosRequestConfig,
config: AxiosRequestConfig & RequestOptions,
params: UploadFileParams,
customFileKey = '',
isMultiple = false
@ -110,7 +110,6 @@ export class MSAxios {
const { requestOptions } = this.options;
const opt = { ...requestOptions, isTransformResponse: false };
const { transformRequestHook } = transform || {};
return new Promise((resolve, reject) => {
this.axiosInstance
@ -120,8 +119,10 @@ export class MSAxios {
data: formData,
headers: {
'Content-type': ContentTypeEnum.FORM_DATA,
// @ts-ignore
'ignoreCancelToken': true, // 文件上传请求不需要添加到pending中以免路由切换导致文件上传请求被取消
},
// @ts-ignore
requestOptions: {
ignoreCancelToken: true, // 文件上传请求不需要添加到pending中以免路由切换导致文件上传请求被取消
},
})
.then((res: AxiosResponse<Result>) => {

View File

@ -2,7 +2,7 @@
<a-cascader
v-if="props.mode === 'MS'"
ref="cascader"
v-model="innerValue"
v-model:model-value="innerValue"
class="ms-cascader"
:options="props.options"
:trigger-props="{ contentClass: `ms-cascader-popper ms-cascader-popper--${props.optionSize}` }"
@ -14,7 +14,7 @@
:placeholder="props.placeholder"
:loading="props.loading"
:value-key="props.valueKey"
:path-mode="props.pathMode"
:path-mode="false"
@change="handleMsCascaderChange"
@clear="clearValues"
>
@ -44,7 +44,7 @@
<a-cascader
v-else
ref="cascader"
v-model="innerValue"
v-model:model-value="innerValue"
class="ms-cascader"
:options="props.options"
:trigger-props="{ contentClass: `ms-cascader-popper ms-cascader-popper--${props.optionSize}` }"
@ -56,7 +56,7 @@
:virtual-list-props="props.virtualListProps"
:loading="props.loading"
:value-key="props.valueKey"
:path-mode="props.pathMode"
:path-mode="false"
@change="(val) => emit('change', val)"
>
<template v-if="props.prefix" #prefix>
@ -109,7 +109,8 @@
placeholder?: string;
loading?: boolean;
optionSize?: 'small' | 'default';
pathMode?: boolean; //
pathMode?: boolean; // ,TODO: arco pathmode BUG pathmode
labelPathMode?: boolean; // label
valueKey?: string;
labelKey?: string; // labelKey
}
@ -149,6 +150,7 @@
typeof val[0] === 'string' &&
props.levelTop?.includes(val[0])
) {
//
innerLevel.value = val[0] as string;
}
},
@ -162,13 +164,16 @@
(val) => {
if (Array.isArray(val)) {
// label
const tempObj: Record<string, any> = {};
selectedLabelObj = {};
for (let i = 0; i < val.length; i++) {
if (selectedLabelObj[val[i]]) {
tempObj[val[i]] = selectedLabelObj[val[i]];
const item = val[i];
const value = typeof item === 'object' ? item.value : item;
if (!props.labelPathMode) {
selectedLabelObj[value] = t((item.label || '').split('/').pop() || '');
} else {
selectedLabelObj[value] = t(item.label || '');
}
}
selectedLabelObj = { ...tempObj };
}
emit('update:modelValue', val);
if (val === '') {
@ -211,21 +216,21 @@
// TODO: arco-design cascader label/ path-mode
function getInputLabel(data: CascaderOption) {
const isTagCount = data[props.labelKey].includes('+');
if (!props.pathMode) {
return isTagCount ? data.label : t((data.label || '').split('/').pop() || ''); //
if (isTagCount) {
return data.label;
}
return isTagCount ? data.label || '' : t(data.label || '');
if (!props.labelPathMode) {
return t((data.label || '').split('/').pop() || ''); //
}
return t(data.label || '');
}
function getInputLabelTooltip(data: CascaderOption) {
const isTagCount = data[props.labelKey].includes('+');
const label = getInputLabel(data);
if (isTagCount && Array.isArray(innerValue.value)) {
return Object.values(selectedLabelObj).join('');
}
const label = getInputLabel(data);
if (data.value && typeof data.value === 'string') {
selectedLabelObj[data.value] = label;
}
return label;
}

View File

@ -208,22 +208,24 @@
</div>
</div>
<div class="content-footer">
<div class="mb-[12px] flex items-center">
<div class="mb-[12px] flex items-center justify-between">
<div class="font-medium text-[var(--color-text-1)]">
{{ t('caseManagement.caseReview.startReview') }}
</div>
<a-switch v-model:model-value="autoNext" class="mx-[8px]" size="small" type="line" />
<div class="text-[var(--color-text-4)]">{{ t('caseManagement.caseReview.autoNext') }}</div>
<a-tooltip position="right">
<template #content>
<div>{{ t('caseManagement.caseReview.autoNextTip1') }}</div>
<div>{{ t('caseManagement.caseReview.autoNextTip2') }}</div>
</template>
<icon-question-circle
class="mb-[2px] ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
size="16"
/>
</a-tooltip>
<div class="flex items-center">
<a-switch v-model:model-value="autoNext" class="mx-[8px]" size="small" type="line" />
<div class="text-[var(--color-text-4)]">{{ t('caseManagement.caseReview.autoNext') }}</div>
<a-tooltip position="right">
<template #content>
<div>{{ t('caseManagement.caseReview.autoNextTip1') }}</div>
<div>{{ t('caseManagement.caseReview.autoNextTip2') }}</div>
</template>
<icon-question-circle
class="mb-[2px] ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
size="16"
/>
</a-tooltip>
</div>
</div>
<reviewForm
:review-id="reviewId"
@ -334,7 +336,7 @@
reviewId: reviewId.value,
viewFlag: onlyMine.value,
keyword: keyword.value,
current: pageNation.value.current,
current: pageNation.value.current || 1,
pageSize: pageNation.value.pageSize,
filter: type.value
? {
@ -355,7 +357,10 @@
watch(
() => onlyMine.value,
() => loadCaseList()
() => {
pageNation.value.current = 1;
loadCaseList();
}
);
const activeCaseId = ref(route.query.caseId as string);
@ -502,23 +507,29 @@
);
}
function reviewDone() {
async function reviewDone() {
if (autoNext.value) {
// id
const index = caseList.value.findIndex((e) => e.caseId === activeCaseId.value);
if (index < caseList.value.length - 1) {
activeCaseId.value = caseList.value[index + 1].caseId;
} else if (pageNation.value.current * pageNation.value.pageSize < pageNation.value.total) {
//
pageNation.value.current += 1;
await loadCaseList();
activeCaseId.value = caseList.value[0].caseId;
} else {
//
loadCaseDetail();
initReviewHistoryList();
loadCaseList();
}
} else {
//
loadCaseDetail();
initReviewHistoryList();
loadCaseList();
}
loadCaseList();
}
const editCaseVisible = ref(false);
@ -552,7 +563,7 @@
moduleIds,
} = lastPageParams;
pageNation.value = {
total,
total: total || 0,
pageSize,
current,
};

View File

@ -39,7 +39,7 @@
type="primary"
class="mt-[12px]"
:disabled="submitDisabled"
:submit-review-loading="submitReviewLoading"
:loading="submitReviewLoading"
@click="submitReview"
>
{{ t('caseManagement.caseReview.submitReview') }}

View File

@ -1009,7 +1009,7 @@
* @param type 文件类型
*/
function setAcceptType(type: UploadType) {
if (isUploading.value) return;
if (isUploading.value || acceptType.value === type) return;
acceptType.value = type;
fileList.value = [];
}

View File

@ -26,7 +26,9 @@
<div :key="index" class="storage" @click="setActiveFolder(item.id)">
<div :class="props.activeFolder === item.id ? 'storage-text storage-text--active' : 'storage-text'">
<MsIcon type="icon-icon_git" class="storage-icon" />
<div class="storage-name">{{ item.name }}</div>
<a-tooltip :content="item.name">
<div class="storage-name one-line-text">{{ item.name }}</div>
</a-tooltip>
<div class="storage-count">({{ item.count }})</div>
</div>
</div>
@ -151,6 +153,7 @@
import {
addRepository,
connectRepository,
deleteModule,
getRepositories,
getRepositoryInfo,
updateRepository,
@ -264,7 +267,7 @@
* 删除存储库
* @param item 列表项信息
*/
function deleteStorage(item: any) {
function deleteStorage(item: Repository) {
openModal({
type: 'error',
title: t('project.fileManagement.deleteStorageTipTitle', { name: item.name }),
@ -276,7 +279,9 @@
maskClosable: false,
onBeforeOk: async () => {
try {
await deleteModule(item.id);
Message.success(t('project.fileManagement.deleteSuccess'));
initRepositories();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -386,7 +391,7 @@
storageFormRef.value?.validateField('url');
}
function validatePlatformUrl(value: any, callback: (error?: string | undefined) => void) {
function validatePlatformUrl(value: string, callback: (error?: string | undefined) => void) {
if (!validateGitUrl(value)) {
callback(t('project.fileManagement.storageUrlError'));
}
@ -394,7 +399,6 @@
function handleDrawerCancel() {
showDrawer.value = false;
storageFormRef.value?.resetFields();
isEdit.value = false;
}
@ -415,6 +419,7 @@
projectId: appStore.currentProjectId,
});
}
storageFormRef.value?.resetFields();
if (!isContinue) {
handleDrawerCancel();
}
@ -478,6 +483,7 @@
color: var(--color-text-4);
}
.storage-name {
max-width: 170px;
color: var(--color-text-1);
}
.storage-count {

View File

@ -52,7 +52,7 @@
:level-top="[...MENU_LEVEL]"
:virtual-list-props="{ height: 200 }"
:loading="rangeLoading"
path-mode
label-path-mode
class="filter-item"
/>
<a-select v-model:model-value="type" class="filter-item">
@ -116,8 +116,12 @@
{{ t(typeOptions.find((e) => e.value === record.type)?.label || '') }}
</template>
<template #content="{ record }">
<div v-if="record.module === 'SYSTEM'">{{ record.content }}</div>
<MsButton v-else @click="handleNameClick(record)">{{ record.content }}</MsButton>
<div v-if="record.module === 'SYSTEM'" class="one-line-text">{{ record.content }}</div>
<MsButton v-else @click="handleNameClick(record)">
<div class="one-line-text">
{{ record.content }}
</div>
</MsButton>
</template>
</ms-base-table>
</div>
@ -450,7 +454,6 @@
title: 'system.log.operateName',
dataIndex: 'content',
slotName: 'content',
showTooltip: true,
width: 150,
},
{

View File

@ -4,6 +4,7 @@
:title="t('system.user.invite')"
title-align="start"
class="ms-modal-form ms-modal-medium"
@close="cancelInvite"
>
<a-form ref="inviteFormRef" class="rounded-[4px]" :model="emailForm" layout="vertical">
<a-form-item

View File

@ -34,7 +34,7 @@
:tag-list="record.userRoleList"
type="primary"
theme="outline"
@click="record.selectUserGroupVisible = true"
@click="handleTagClick(record)"
/>
<MsSelect
v-else
@ -61,7 +61,9 @@
</template>
<template #action="{ record }">
<template v-if="!record.enable">
<MsButton @click="enableUser(record)">{{ t('system.user.enable') }}</MsButton>
<MsButton v-permission="['SYSTEM_USER:READ+UPDATE']" @click="enableUser(record)">
{{ t('system.user.enable') }}
</MsButton>
<MsButton v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteUser(record)">
{{ t('system.user.delete') }}
</MsButton>
@ -838,6 +840,12 @@
loadList();
}
function handleTagClick(record: UserListItem & Record<string, any>) {
if (hasAnyPermission(['SYSTEM_USER:READ+UPDATE'])) {
record.selectUserGroupVisible = true;
}
}
/**
* 快捷修改用户组
*/