fix(all): 修复bugs

This commit is contained in:
baiqi 2024-04-16 18:40:18 +08:00 committed by 刘瑞斌
parent 6859a0cd5d
commit 147379e190
33 changed files with 285 additions and 211 deletions

View File

@ -8,6 +8,9 @@
<script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router';
import { useEventListener, useWindowSize } from '@vueuse/core';
import { Message } from '@arco-design/web-vue';
import MsSysUpgradeTip from '@/components/pure/ms-sys-upgrade-tip/index.vue';
import { getProjectInfo } from '@/api/modules/project-management/basicInfo';
import { saveBaseUrl } from '@/api/modules/setting/config';
@ -125,6 +128,35 @@
// @desc: TODO便
appStore.getProjectInfos();
});
function showUpdateMessage() {
Message.clear();
Message.warning({
content: () => h(MsSysUpgradeTip),
duration: 0,
closable: false,
});
}
onMounted(() => {
window.onerror = (message) => {
if (typeof message === 'string' && message.includes('Failed to fetch dynamically imported')) {
showUpdateMessage();
}
};
window.onunhandledrejection = (event: PromiseRejectionEvent) => {
if (
event &&
event.reason &&
event.reason.message &&
event.reason.message.includes('Failed to fetch dynamically imported')
) {
showUpdateMessage();
}
};
});
/** 屏幕大小改变时重新赋值innerHeight */
useEventListener(window, 'resize', () => {
const { height } = useWindowSize();

View File

@ -45,8 +45,6 @@ export const postAddProjectMemberUrl = '/system/project/add-member';
export const getRevokeProjectUrl = '/system/project/revoke/';
// 移除项目成员
export const getDeleteProjectMemberUrl = '/system/project/remove-member/';
// 根据ID获取项目信息
export const getProjectInfoUrl = '/system/project/get/';
// 删除项目
export const getDeleteProjectUrl = '/system/project/delete/';
// 系统-组织及项目,获取用户下拉选项

View File

@ -83,8 +83,8 @@
const loading = ref(false);
const detail = ref<any>({});
function initDetail() {
prevNextButtonRef.value?.initDetail();
function initDetail(id?: string) {
prevNextButtonRef.value?.initDetail(id);
}
function openPrevDetail() {
@ -118,7 +118,7 @@
watch(
() => props.detailId,
(val) => {
() => {
nextTick(() => {
// prevNextButtonRef
openNextDetail();
@ -133,4 +133,4 @@
});
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>

View File

@ -91,11 +91,11 @@
}
);
async function initDetail() {
async function initDetail(id?: string) {
try {
innerLoading.value = true;
emit('loadingDetail');
const res = await props.getDetailFunc(activeDetailId.value);
const res = await props.getDetailFunc(id || activeDetailId.value);
emit('loaded', res);
} catch (error) {
// eslint-disable-next-line no-console
@ -172,4 +172,4 @@
});
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>

View File

@ -1,29 +1,65 @@
<template>
<div :class="['ms-thumbnail-card', `ms-thumbnail-card--${props.mode}`]" @click="handleCardClick">
<div :class="['ms-thumbnail-card', `ms-thumbnail-card--${props.mode}`]" @click.stop="handleCardClick">
<div class="ms-thumbnail-card-content">
<div v-if="props.moreActions" class="ms-thumbnail-card-more">
<MsTableMoreAction :list="props.moreActions" @select="handleMoreActionSelect" />
</div>
<a-image
v-if="fileType === 'image'"
:src="props.url"
fit="contain"
class="absolute top-0 h-full w-full"
:preview="false"
width="100%"
height="100%"
hide-footer
/>
<MsIcon
v-else
:type="FileIconMap[fileType][UploadStatus.done]"
class="absolute top-0 h-full w-full p-[24px] text-[var(--color-text-4)]"
/>
<a-tooltip v-if="props.footerText" :content="props.footerText" :mouse-enter-delay="300" position="bl" mini>
<div class="ms-thumbnail-card-footer one-line-text">
{{ props.footerText }}
<MsUpload
v-if="props.useUpload"
accept="none"
:show-file-list="false"
:limit="50"
size-unit="MB"
:auto-upload="false"
:multiple="false"
@change="handleChange"
>
<div v-if="props.moreActions" class="ms-thumbnail-card-more">
<MsTableMoreAction :list="props.moreActions" @select="handleMoreActionSelect" />
</div>
</a-tooltip>
<a-image
v-if="fileType === 'image'"
:src="props.url"
fit="contain"
class="absolute top-0 h-full w-full"
:preview="false"
width="100%"
height="100%"
hide-footer
/>
<MsIcon
v-else
:type="FileIconMap[fileType][UploadStatus.done]"
class="absolute top-0 h-full w-full p-[24px] text-[var(--color-text-4)]"
/>
<a-tooltip v-if="props.footerText" :content="props.footerText" :mouse-enter-delay="300" position="bl" mini>
<div class="ms-thumbnail-card-footer one-line-text">
{{ props.footerText }}
</div>
</a-tooltip>
</MsUpload>
<template v-else>
<div v-if="props.moreActions" class="ms-thumbnail-card-more">
<MsTableMoreAction :list="props.moreActions" @select="handleMoreActionSelect" />
</div>
<a-image
v-if="fileType === 'image'"
:src="props.url"
fit="contain"
class="absolute top-0 h-full w-full"
:preview="false"
width="100%"
height="100%"
hide-footer
/>
<MsIcon
v-else
:type="FileIconMap[fileType][UploadStatus.done]"
class="absolute top-0 h-full w-full p-[24px] text-[var(--color-text-4)]"
/>
<a-tooltip v-if="props.footerText" :content="props.footerText" :mouse-enter-delay="300" position="bl" mini>
<div class="ms-thumbnail-card-footer one-line-text">
{{ props.footerText }}
</div>
</a-tooltip>
</template>
</div>
</div>
</template>
@ -35,6 +71,8 @@
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import { FileIconMap, getFileEnum } from '@/components/pure/ms-upload/iconMap';
import MsUpload from '@/components/pure/ms-upload/index.vue';
import { MsFileItem } from '@/components/pure/ms-upload/types';
import { UploadStatus } from '@/enums/uploadEnum';
@ -45,6 +83,7 @@
url?: string;
footerText?: string;
moreActions?: ActionsItem[];
useUpload?: boolean; // 使
}>(),
{
mode: 'default',
@ -53,6 +92,7 @@
const emit = defineEmits<{
(e: 'click'): void;
(e: 'actionSelect', item: ActionsItem): void;
(e: 'change', fileItem: MsFileItem): void;
}>();
const fileType = computed(() => {
@ -69,6 +109,10 @@
function handleMoreActionSelect(item: ActionsItem) {
emit('actionSelect', item);
}
function handleChange(_fileList: MsFileItem[], fileItem: MsFileItem) {
emit('change', fileItem);
}
</script>
<style lang="less" scoped>

View File

@ -1,63 +1,65 @@
<template>
<div class="group-auth-table">
<a-table
:span-method="dataSpanMethod"
:scroll="props.scroll"
:data="tableData"
:loading="loading"
:bordered="{ wrapper: true, cell: true }"
size="small"
:pagination="false"
>
<template #columns>
<a-table-column :width="100" :title="t('system.userGroup.function')" data-index="ability" />
<a-table-column :width="150" :title="t('system.userGroup.operationObject')" data-index="operationObject" />
<a-table-column>
<template #title>
<div class="flex w-full flex-row justify-between">
<div>{{ t('system.userGroup.auth') }}</div>
<a-checkbox
v-if="tableData && tableData?.length > 0"
:model-value="allChecked"
:indeterminate="allIndeterminate"
:disabled="systemAdminDisabled || disabled"
class="mr-[7px]"
@change="handleAllAuthChangeByCheckbox"
></a-checkbox>
</div>
</template>
<template #cell="{ record, rowIndex }">
<div class="flex flex-row items-center justify-between">
<a-checkbox-group
:model-value="record.perChecked"
@change="(v, e) => handleCellAuthChange(v, rowIndex, record, e)"
>
<div>
<div class="group-auth-table">
<a-table
:span-method="dataSpanMethod"
:scroll="props.scroll"
:data="tableData"
:loading="loading"
:bordered="{ wrapper: true, cell: true }"
size="small"
:pagination="false"
>
<template #columns>
<a-table-column :width="100" :title="t('system.userGroup.function')" data-index="ability" />
<a-table-column :width="150" :title="t('system.userGroup.operationObject')" data-index="operationObject" />
<a-table-column>
<template #title>
<div class="flex w-full flex-row justify-between">
<div>{{ t('system.userGroup.auth') }}</div>
<a-checkbox
v-for="item in record.permissions"
:key="item.id"
:disabled="item.license || systemAdminDisabled || disabled"
:value="item.id"
>{{ t(item.name) }}</a-checkbox
v-if="tableData && tableData?.length > 0"
:model-value="allChecked"
:indeterminate="allIndeterminate"
:disabled="systemAdminDisabled || disabled"
class="mr-[7px]"
@change="handleAllAuthChangeByCheckbox"
></a-checkbox>
</div>
</template>
<template #cell="{ record, rowIndex }">
<div class="flex flex-row items-center justify-between">
<a-checkbox-group
:model-value="record.perChecked"
@change="(v, e) => handleCellAuthChange(v, rowIndex, record, e)"
>
</a-checkbox-group>
<a-checkbox
class="mr-[7px]"
:model-value="record.enable"
:indeterminate="record.indeterminate"
:disabled="systemAdminDisabled || disabled"
@change="(value) => handleRowAuthChange(value, rowIndex)"
/>
</div>
</template>
</a-table-column>
</template>
</a-table>
</div>
<div v-if="props.showBottom" v-permission="props.savePermission || []" class="footer">
<ms-button :disabled="!canSave" @click="handleReset">{{ t('system.userGroup.reset') }}</ms-button>
<a-button v-permission="props.savePermission || []" :disabled="!canSave" type="primary" @click="handleSave">
{{ t('system.userGroup.save') }}
</a-button>
<a-checkbox
v-for="item in record.permissions"
:key="item.id"
:disabled="item.license || systemAdminDisabled || disabled"
:value="item.id"
>{{ t(item.name) }}</a-checkbox
>
</a-checkbox-group>
<a-checkbox
class="mr-[7px]"
:model-value="record.enable"
:indeterminate="record.indeterminate"
:disabled="systemAdminDisabled || disabled"
@change="(value) => handleRowAuthChange(value, rowIndex)"
/>
</div>
</template>
</a-table-column>
</template>
</a-table>
</div>
<div v-if="props.showBottom" v-permission="props.savePermission || []" class="footer">
<ms-button :disabled="!canSave" @click="handleReset">{{ t('system.userGroup.reset') }}</ms-button>
<a-button v-permission="props.savePermission || []" :disabled="!canSave" type="primary" @click="handleSave">
{{ t('system.userGroup.save') }}
</a-button>
</div>
</div>
</template>
@ -386,10 +388,10 @@
if (!tableData.value) return;
const tmpArr = tableData.value;
const length = tmpArr[rowIndex].permissions?.length || 0;
if (values.length === length) {
if (record.perChecked.length === length) {
tmpArr[rowIndex].enable = true;
tmpArr[rowIndex].indeterminate = false;
} else if (values.length === 0) {
} else if (record.perChecked.length === 0) {
tmpArr[rowIndex].enable = false;
tmpArr[rowIndex].indeterminate = false;
} else {
@ -502,7 +504,7 @@
}
}
.footer {
@apply w-full;
@apply absolute bottom-0 left-0 w-full;
display: flex;
justify-content: flex-end;

View File

@ -78,8 +78,8 @@
import { decodeStringToCharset } from '@/utils';
import './userWorker';
import MsCodeEditorTheme from './themes';
import { CustomTheme, editorProps, Language, LanguageEnum, Theme } from './types';
// import MsCodeEditorTheme from './themes';
import { editorProps, Language, LanguageEnum, Theme } from './types';
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
import XmlBeautify from 'xml-beautify';
@ -103,10 +103,11 @@
{ label: 'vs-dark', value: 'vs-dark' },
{ label: 'hc-black', value: 'hc-black' },
].concat(
Object.keys(MsCodeEditorTheme).map((item) => ({
label: item,
value: item,
}))
[]
// Object.keys(MsCodeEditorTheme).map((item) => ({
// label: item,
// value: item,
// }))
);
function handleThemeChange(val: Theme) {
editor.updateOptions({
@ -254,9 +255,9 @@
const init = () => {
// TODO:
Object.keys(MsCodeEditorTheme).forEach((e) => {
monaco.editor.defineTheme(e, MsCodeEditorTheme[e as CustomTheme]);
});
// Object.keys(MsCodeEditorTheme).forEach((e) => {
// monaco.editor.defineTheme(e, MsCodeEditorTheme[e as CustomTheme]);
// });
editor = monaco.editor.create(codeContainerRef.value, {
value: props.modelValue,
automaticLayout: true,
@ -361,11 +362,11 @@
width: v-bind(width);
height: v-bind(height);
&.MS-text[data-mode-id='plaintext'] {
:deep(.mtk1) {
color: rgb(var(--primary-5));
}
}
// &.MS-text[data-mode-id='plaintext'] {
// :deep(.mtk1) {
// color: rgb(var(--primary-5));
// }
// }
:deep(.overflowingContentWidgets) {
z-index: 9999;
}

View File

@ -0,0 +1,20 @@
<template>
<div class="flex items-center gap-[12px]">
<div class="text-[var(--color-text-1)]">{{ t('ms.sys.upgrade.tip.content') }} </div>
<MsButton type="text" @click="refresh">{{ t('common.refresh') }}</MsButton>
</div>
</template>
<script setup lang="ts">
import MsButton from '@/components/pure/ms-button/index.vue';
import { useI18n } from '@/hooks/useI18n';
const { t } = useI18n();
function refresh() {
window.location.reload();
}
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,3 @@
export default {
'ms.sys.upgrade.tip.content': 'The system has been updated, please refresh the page',
};

View File

@ -0,0 +1,3 @@
export default {
'ms.sys.upgrade.tip.content': '系统已更新,请刷新页面',
};

View File

@ -56,7 +56,7 @@
get: () => {
//
return (
selectAllStatus.value === SelectAllEnum.ALL ||
(props.selectedKeys.size > 0 && selectAllStatus.value === SelectAllEnum.ALL) ||
(props.selectedKeys.size > 0 && props.selectedKeys.size === props.total)
);
},

View File

@ -403,7 +403,7 @@ export default function useTableProps<T>(
// 重置筛选
clearSelector: () => {
propsRes.value.selectorStatus = SelectAllEnum.NONE; // 重置选择器状态
resetSelector();
resetSelector(true);
},
// 表格SelectAll change

View File

@ -19,6 +19,7 @@
v-model:model-value="appStore.currentProjectId"
class="w-[200px] focus-within:!bg-[var(--color-text-n8)] hover:!bg-[var(--color-text-n8)]"
:bordered="false"
:fallback-option="() => undefined"
allow-search
@change="selectProject"
>

View File

@ -1,28 +1,32 @@
import { useRouter } from 'vue-router';
import { Message } from '@arco-design/web-vue';
import { useI18n } from '@/hooks/useI18n';
import router from '@/router';
import { useAppStore, useUserStore } from '@/store';
export default function useUser() {
const router = useRouter();
const { t } = useI18n();
const logout = async (logoutTo?: string) => {
const appStore = useAppStore();
const userStore = useUserStore();
await userStore.logout();
const currentRoute = router.currentRoute.value;
// 清空顶部菜单
appStore.setTopMenus([]);
Message.success(t('message.logoutSuccess'));
router.push({
name: logoutTo && typeof logoutTo === 'string' ? logoutTo : 'login',
query: {
...router.currentRoute.value.query,
redirect: currentRoute.name as string,
},
});
try {
const userStore = useUserStore();
await userStore.logout();
const appStore = useAppStore();
const currentRoute = router.currentRoute.value;
// 清空顶部菜单
appStore.setTopMenus([]);
Message.success(t('message.logoutSuccess'));
router.push({
name: logoutTo && typeof logoutTo === 'string' ? logoutTo : 'login',
query: {
...router.currentRoute.value.query,
redirect: currentRoute.name as string,
},
});
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
};
const isLoginPage = () => {

View File

@ -153,4 +153,5 @@ export default {
'common.image': 'Image',
'common.text': 'Text',
'common.resourceDeleted': 'Resource has been deleted',
'common.refresh': 'Refresh',
};

View File

@ -153,4 +153,5 @@ export default {
'common.image': '图片',
'common.text': '文本',
'common.resourceDeleted': '资源已被删除',
'common.refresh': '刷新',
};

View File

@ -486,4 +486,5 @@ export interface ScenarioStepResourceInfo {
name: string;
projectId: string;
projectName: string;
delete: boolean;
}

View File

@ -246,34 +246,11 @@ const useAppStore = defineStore('app', {
console.log(error);
}
},
async validateUserProjectPermission() {
try {
const router = useRouter();
const HasProjectPermission = await getUserHasProjectPermission(this.currentProjectId);
if (!HasProjectPermission) {
// 没有项目权限(用户所在的当前项目被禁用&用户被移除出去该项目)
router.push({
name: NO_PROJECT_ROUTE_NAME,
});
return false;
}
const res = await getProjectInfo(this.currentProjectId);
if (res.deleted) {
// 如果项目被删除或者被禁用,跳转到无项目页面
router.push({
name: NO_PROJECT_ROUTE_NAME,
});
return false;
}
return true;
} catch (error) {
console.log(error);
return false;
}
},
async getProjectInfos() {
try {
if (!this.currentProjectId) {
return;
}
const res = await getProjectInfo(this.currentProjectId);
if (!res || res.deleted) {
const router = useRouter();
@ -285,6 +262,7 @@ const useAppStore = defineStore('app', {
this.setCurrentMenuConfig(res?.moduleIds || []);
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},

View File

@ -373,7 +373,7 @@
:selectable="false"
:scroll="{ x: '700px' }"
:response="props.response"
:height-used="(props.heightUsed || 0) + 68"
:height-used="props.heightUsed"
@change="handleExtractParamTableChange"
@more-action-select="(e,r)=> handleExtractParamMoreActionSelect(e,r as ExpressionConfig)"
>

View File

@ -258,7 +258,7 @@
watch(
() => props.layout,
(val) => {
const otherHeight = props.isDrawer ? 328 : 430;
const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
},
{
@ -270,7 +270,7 @@
() => props.secondBoxHeight,
(val) => {
if (props.layout === 'vertical') {
heightUsed.value = (props.isDrawer ? 328 : 430) + val;
heightUsed.value = (props.isDrawer ? 328 : 372) + val;
}
},
{

View File

@ -85,9 +85,9 @@
const heightUsed = computed(() => {
if (props.layout === 'horizontal') {
return props.isDrawer ? 328 : 428;
return props.isDrawer ? 328 : 372;
}
return (props.isDrawer ? 328 : 428) + props.secondBoxHeight;
return (props.isDrawer ? 328 : 372) + props.secondBoxHeight;
});
const scroll = computed(() => (props.layout === 'horizontal' ? { x: '700px' } : { x: '100%' }));

View File

@ -57,9 +57,9 @@
const innerConfig = useVModel(props, 'config', emit);
const heightUsed = computed(() => {
if (props.layout === 'horizontal') {
return 428;
return 328;
}
return 428 + (props.secondBoxHeight || 0);
return 328 + (props.secondBoxHeight || 0);
});
const conditionTypes = computed(() => {

View File

@ -124,7 +124,7 @@
watch(
() => props.layout,
(val) => {
const otherHeight = props.isDrawer ? 328 : 430;
const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
},
{
@ -136,7 +136,7 @@
() => props.secondBoxHeight,
(val) => {
if (props.layout === 'vertical') {
heightUsed.value = (props.isDrawer ? 328 : 430) + val;
heightUsed.value = (props.isDrawer ? 328 : 372) + val;
}
},
{

View File

@ -14,8 +14,6 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import MsCodeEditor from '@/components/pure/ms-code-editor/index.vue';
import { LanguageEnum } from '@/components/pure/ms-code-editor/types';

View File

@ -125,7 +125,7 @@
watch(
() => props.layout,
(val) => {
const otherHeight = props.isDrawer ? 328 : 430;
const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
},
{
@ -137,7 +137,7 @@
() => props.secondBoxHeight,
(val) => {
if (props.layout === 'vertical') {
heightUsed.value = (props.isDrawer ? 328 : 430) + val;
heightUsed.value = (props.isDrawer ? 328 : 372) + val;
}
},
{

View File

@ -184,7 +184,7 @@
</div>
</div>
<a-input
v-if="props.step?.stepType && (_stepType.isCopyApi || _stepType.isQuoteApi) && isHttpProtocol"
v-if="props.step?.stepType && _stepType.isQuoteApi && isHttpProtocol"
v-model:model-value="requestVModel.name"
:max-length="255"
:placeholder="t('apiTestManagement.apiNamePlaceholder')"

View File

@ -68,7 +68,7 @@
<div v-show="!pluginError || isHttpProtocol" class="flex h-full flex-col">
<div class="flex items-center gap-[16px] p-[16px] pb-[8px]">
<a-input
v-if="activeStep?.stepType && (_stepType.isCopyCase || _stepType.isQuoteCase)"
v-if="activeStep?.stepType && _stepType.isQuoteCase"
v-model:model-value="requestVModel.name"
:max-length="255"
:show-word-limit="isEditableApi"

View File

@ -274,6 +274,7 @@
</MsButton>
<a-divider v-permission="['PROJECT_API_SCENARIO:READ+ADD']" direction="vertical" :margin="8"></a-divider>
<MsTableMoreAction
v-permission="['PROJECT_API_SCENARIO:READ+EXECUTE', 'PROJECT_API_SCENARIO:READ+DELETE']"
:list="getTableMoreActionList(record)"
@select="handleTableMoreActionSelect($event, record)"
/>

View File

@ -23,7 +23,10 @@
</div>
<div>
<div class="mb-[2px] text-[var(--color-text-4)]">{{ t('apiScenario.detailName') }}</div>
<div class="cursor-pointer text-[14px] text-[rgb(var(--primary-5))]" @click="goDetail">
<div v-if="originProjectInfo?.delete" class="text-[14px] text-[var(--color-text-1)]">
{{ t('common.resourceDeleted') }}
</div>
<div v-else class="cursor-pointer text-[14px] text-[rgb(var(--primary-5))]" @click="goDetail">
{{ `${originProjectInfo?.num}${originProjectInfo?.name}` }}
</div>
</div>

View File

@ -230,8 +230,6 @@
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum';
import { hasAllPermission } from '../../../../../../.history/src/utils/permission_20240205094418';
const props = defineProps<{
activeFolder: string;
moduleTree: ModuleTreeNode[];

View File

@ -71,13 +71,8 @@
:type="detail.fileType || ''"
:url="`${CompressImgUrl}/${userStore.id}/${detail.id}`"
:footer-text="detail.storage === 'GIT' ? undefined : t('project.fileManagement.replaceFile')"
@click="
() => {
if (detail.storage !== 'GIT') {
handleFileIconClick();
}
}
"
:use-upload="detail.storage !== 'GIT'"
@change="handleFileChange"
/>
</a-spin>
</div>
@ -217,7 +212,6 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { useFileSystemAccess } from '@vueuse/core';
import { Message } from '@arco-design/web-vue';
import dayjs from 'dayjs';
@ -227,6 +221,7 @@
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { MsPaginationI, MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable';
import { MsFileItem } from '@/components/pure/ms-upload/types';
import MsDetailDrawer from '@/components/business/ms-detail-drawer/index.vue';
import MsThumbnailCard from '@/components/business/ms-thumbnail-card/index.vue';
import popConfirm from './popConfirm.vue';
@ -267,7 +262,6 @@
const emit = defineEmits(['update:visible']);
const { file: newFile, open } = useFileSystemAccess();
const { t } = useI18n();
const { currentLocale } = useLocale();
const userStore = useUserStore();
@ -325,38 +319,26 @@
const renameTitle = ref(''); //
const fileLoading = ref(false);
watch(
() => newFile.value,
async (data) => {
if (data) {
try {
fileLoading.value = true;
await reuploadFile({
request: {
fileId: innerFileId.value,
enable: false,
},
file: data,
});
Message.success(t('project.fileManagement.replaceFileSuccess'));
detailDrawerRef.value?.initDetail();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
fileLoading.value = false;
}
async function handleFileChange(file: MsFileItem) {
if (file.file) {
try {
fileLoading.value = true;
const res = await reuploadFile({
request: {
fileId: innerFileId.value,
enable: false,
},
file: file.file,
});
Message.success(t('project.fileManagement.replaceFileSuccess'));
detailDrawerRef.value?.initDetail(res.data);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
fileLoading.value = false;
}
}
);
async function handleFileIconClick() {
try {
await open();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
const previewVisible = ref(false);

View File

@ -455,6 +455,7 @@
pageConfig.value = {
...pageConfig.value,
...appStore.defaultLoginConfig,
slogan: t(appStore.defaultLoginConfig.slogan),
};
}
@ -469,7 +470,7 @@
* 全部重置
*/
function resetAll() {
pageConfig.value = { ...appStore.getDefaultPageConfig };
pageConfig.value = { ...appStore.getDefaultPageConfig, slogan: t(appStore.defaultLoginConfig.slogan) };
}
function makeParams() {

View File

@ -3,7 +3,7 @@
:loading="loading"
:title="title"
:is-edit="isEdit"
:save-text="t('system.resourcePool.add')"
:save-text="isEdit ? t('common.update') : t('system.resourcePool.add')"
:save-and-continue-text="t('system.resourcePool.addAndContinue')"
:handle-back="handleBack"
has-breadcrumb
@ -180,13 +180,13 @@
<div id="typeRadioGroupRef" class="relative">
<a-radio-group v-model:model-value="form.addType" type="button" @change="handleTypeChange">
<a-radio value="single">{{ t('system.resourcePool.singleAdd') }}</a-radio>
<a-radio value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
<a-radio v-xpack value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
</a-radio-group>
</div>
</a-popconfirm>
<a-radio-group v-else v-model:model-value="form.addType" type="button" @change="handleTypeChange">
<a-radio value="single">{{ t('system.resourcePool.singleAdd') }}</a-radio>
<a-radio value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
<a-radio v-xpack value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
</a-radio-group>
</a-form-item>
<MsBatchForm
@ -809,10 +809,12 @@
if (isContinueAdd.value) {
resetForm();
} else {
setIsSave(true);
await sleep(300);
router.push({ name: 'settingSystemResourcePool' });
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
loading.value = false;