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> <script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useEventListener, useWindowSize } from '@vueuse/core'; 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 { getProjectInfo } from '@/api/modules/project-management/basicInfo';
import { saveBaseUrl } from '@/api/modules/setting/config'; import { saveBaseUrl } from '@/api/modules/setting/config';
@ -125,6 +128,35 @@
// @desc: TODO便 // @desc: TODO便
appStore.getProjectInfos(); 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 */ /** 屏幕大小改变时重新赋值innerHeight */
useEventListener(window, 'resize', () => { useEventListener(window, 'resize', () => {
const { height } = useWindowSize(); const { height } = useWindowSize();

View File

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

View File

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

View File

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

View File

@ -1,6 +1,16 @@
<template> <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 class="ms-thumbnail-card-content">
<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"> <div v-if="props.moreActions" class="ms-thumbnail-card-more">
<MsTableMoreAction :list="props.moreActions" @select="handleMoreActionSelect" /> <MsTableMoreAction :list="props.moreActions" @select="handleMoreActionSelect" />
</div> </div>
@ -24,6 +34,32 @@
{{ props.footerText }} {{ props.footerText }}
</div> </div>
</a-tooltip> </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>
</div> </div>
</template> </template>
@ -35,6 +71,8 @@
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import { FileIconMap, getFileEnum } from '@/components/pure/ms-upload/iconMap'; 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'; import { UploadStatus } from '@/enums/uploadEnum';
@ -45,6 +83,7 @@
url?: string; url?: string;
footerText?: string; footerText?: string;
moreActions?: ActionsItem[]; moreActions?: ActionsItem[];
useUpload?: boolean; // 使
}>(), }>(),
{ {
mode: 'default', mode: 'default',
@ -53,6 +92,7 @@
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'click'): void; (e: 'click'): void;
(e: 'actionSelect', item: ActionsItem): void; (e: 'actionSelect', item: ActionsItem): void;
(e: 'change', fileItem: MsFileItem): void;
}>(); }>();
const fileType = computed(() => { const fileType = computed(() => {
@ -69,6 +109,10 @@
function handleMoreActionSelect(item: ActionsItem) { function handleMoreActionSelect(item: ActionsItem) {
emit('actionSelect', item); emit('actionSelect', item);
} }
function handleChange(_fileList: MsFileItem[], fileItem: MsFileItem) {
emit('change', fileItem);
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,4 +1,5 @@
<template> <template>
<div>
<div class="group-auth-table"> <div class="group-auth-table">
<a-table <a-table
:span-method="dataSpanMethod" :span-method="dataSpanMethod"
@ -59,6 +60,7 @@
{{ t('system.userGroup.save') }} {{ t('system.userGroup.save') }}
</a-button> </a-button>
</div> </div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -386,10 +388,10 @@
if (!tableData.value) return; if (!tableData.value) return;
const tmpArr = tableData.value; const tmpArr = tableData.value;
const length = tmpArr[rowIndex].permissions?.length || 0; const length = tmpArr[rowIndex].permissions?.length || 0;
if (values.length === length) { if (record.perChecked.length === length) {
tmpArr[rowIndex].enable = true; tmpArr[rowIndex].enable = true;
tmpArr[rowIndex].indeterminate = false; tmpArr[rowIndex].indeterminate = false;
} else if (values.length === 0) { } else if (record.perChecked.length === 0) {
tmpArr[rowIndex].enable = false; tmpArr[rowIndex].enable = false;
tmpArr[rowIndex].indeterminate = false; tmpArr[rowIndex].indeterminate = false;
} else { } else {
@ -502,7 +504,7 @@
} }
} }
.footer { .footer {
@apply w-full; @apply absolute bottom-0 left-0 w-full;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -246,34 +246,11 @@ const useAppStore = defineStore('app', {
console.log(error); 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() { async getProjectInfos() {
try { try {
if (!this.currentProjectId) {
return;
}
const res = await getProjectInfo(this.currentProjectId); const res = await getProjectInfo(this.currentProjectId);
if (!res || res.deleted) { if (!res || res.deleted) {
const router = useRouter(); const router = useRouter();
@ -285,6 +262,7 @@ const useAppStore = defineStore('app', {
this.setCurrentMenuConfig(res?.moduleIds || []); this.setCurrentMenuConfig(res?.moduleIds || []);
} }
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.log(error); console.log(error);
} }
}, },

View File

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

View File

@ -258,7 +258,7 @@
watch( watch(
() => props.layout, () => props.layout,
(val) => { (val) => {
const otherHeight = props.isDrawer ? 328 : 430; const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight; heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
}, },
{ {
@ -270,7 +270,7 @@
() => props.secondBoxHeight, () => props.secondBoxHeight,
(val) => { (val) => {
if (props.layout === 'vertical') { 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(() => { const heightUsed = computed(() => {
if (props.layout === 'horizontal') { 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%' })); const scroll = computed(() => (props.layout === 'horizontal' ? { x: '700px' } : { x: '100%' }));

View File

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

View File

@ -124,7 +124,7 @@
watch( watch(
() => props.layout, () => props.layout,
(val) => { (val) => {
const otherHeight = props.isDrawer ? 328 : 430; const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight; heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
}, },
{ {
@ -136,7 +136,7 @@
() => props.secondBoxHeight, () => props.secondBoxHeight,
(val) => { (val) => {
if (props.layout === 'vertical') { 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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import MsCodeEditor from '@/components/pure/ms-code-editor/index.vue'; import MsCodeEditor from '@/components/pure/ms-code-editor/index.vue';
import { LanguageEnum } from '@/components/pure/ms-code-editor/types'; import { LanguageEnum } from '@/components/pure/ms-code-editor/types';

View File

@ -125,7 +125,7 @@
watch( watch(
() => props.layout, () => props.layout,
(val) => { (val) => {
const otherHeight = props.isDrawer ? 328 : 430; const otherHeight = props.isDrawer ? 328 : 372;
heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight; heightUsed.value = val === 'horizontal' ? otherHeight : otherHeight + props.secondBoxHeight;
}, },
{ {
@ -137,7 +137,7 @@
() => props.secondBoxHeight, () => props.secondBoxHeight,
(val) => { (val) => {
if (props.layout === 'vertical') { 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>
</div> </div>
<a-input <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" v-model:model-value="requestVModel.name"
:max-length="255" :max-length="255"
:placeholder="t('apiTestManagement.apiNamePlaceholder')" :placeholder="t('apiTestManagement.apiNamePlaceholder')"

View File

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

View File

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

View File

@ -23,7 +23,10 @@
</div> </div>
<div> <div>
<div class="mb-[2px] text-[var(--color-text-4)]">{{ t('apiScenario.detailName') }}</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}` }} {{ `${originProjectInfo?.num}${originProjectInfo?.name}` }}
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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