From 29ac3d47be501df57fc6dcf5dd4271a5cdf71285 Mon Sep 17 00:00:00 2001 From: baiqi Date: Mon, 1 Jul 2024 10:52:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=91=E5=9B=BE&=E8=A1=A8=E6=A0=BC):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=84=91=E5=9B=BE=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=96=B9=E5=BC=8F&=E8=A1=A8=E6=A0=BC=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=85=A8=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-minders/testPlanMinder/index.vue | 57 ++++++++++--------- .../pure/ms-minder-editor/main/mainEditor.vue | 32 ++++++----- .../components/pure/ms-table/locale/en-US.ts | 31 +++++----- .../components/pure/ms-table/locale/zh-CN.ts | 1 + .../components/pure/ms-table/select-all.vue | 5 +- .../src/components/pure/ms-table/useTable.ts | 5 +- frontend/src/enums/tableEnum.ts | 1 + .../views/test-plan/testPlan/detail/index.vue | 14 +++-- 8 files changed, 84 insertions(+), 62 deletions(-) diff --git a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue index db009b2fed..52cdb3e95f 100644 --- a/frontend/src/components/business/ms-minders/testPlanMinder/index.vue +++ b/frontend/src/components/business/ms-minders/testPlanMinder/index.vue @@ -340,8 +340,8 @@ if (data?.level === 1 || data?.level === 2) { canShowFloatMenu.value = true; - if (data?.type === PlanMinderCollectionType.FUNCTIONAL) { - // 功能用例分类没有执行方式 + if (data?.type === PlanMinderCollectionType.FUNCTIONAL || (data?.level === 2 && data?.extended === true)) { + // 功能用例分类没有执行方式、继承上级配置的测试点节点不显示切换执行方式菜单 canShowExecuteMethodMenu.value = false; } else { canShowExecuteMethodMenu.value = true; @@ -474,7 +474,6 @@ // 当前激活的测试点节点 const activePlanSet = ref(); - const currentPriority = ref(RunMode.SERIAL); // 优先级与串行/并行文本映射 const priorityTextMap: Record = { 2: t('ms.minders.serial'), @@ -493,18 +492,6 @@ return data.priority === 2 ? RunMode.SERIAL : RunMode.PARALLEL; } - /** - * 处理执行方式切换 - * @param val 执行方式 - */ - function handleExecuteMethodMenuSelect(val: RunMode) { - currentPriority.value = val; - // 对节点执行优先级设置命令 - window.minder.execCommand('priority', priorityMap[val]); - // 手动设置一次脑图的优先级 DOM 内容替换 - setCustomPriorityView(priorityTextMap); - } - const configFormRef = ref(); const configForm = ref(); const resourcePoolOptions = ref(); @@ -563,6 +550,22 @@ }); } + /** + * 处理执行方式切换 + * @param val 执行方式 + */ + function handleExecuteMethodMenuSelect(val: RunMode) { + // 对节点执行优先级设置命令 + window.minder.execCommand('priority', priorityMap[val]); + // 手动设置一次脑图的优先级 DOM 内容替换 + setCustomPriorityView(priorityTextMap); + const node: PlanMinderNode = window.minder.getSelectedNode(); + if (configForm.value?.id === node?.data.id) { + // 更新表单的执行方式 + configForm.value.executeMethod = val; + } + } + const currentSelectCase = ref(CaseLinkEnum.FUNCTIONAL); const caseAssociateVisible = ref(false); @@ -782,7 +785,7 @@ /** * 初始化测试规划脑图 */ - async function initMinder() { + async function initMinder(firstInit = false) { try { loading.value = true; const res = await getPlanMinder(props.planId); @@ -797,13 +800,15 @@ return node; }); window.minder.importJson(importJson.value); - window.minder.execCommand('template', Object.keys(window.kityminder.Minder.getTemplateList())[3]); - setTimeout(() => { - // 初始化脑图完毕后,中心节点移动至左侧边缘 - const position = window.minder.getViewDragger().getMovement(); - position.x -= position.x - 40; - window.minder.getViewDragger().moveTo(position); - }, 200); + if (firstInit) { + window.minder.execCommand('template', Object.keys(window.kityminder.Minder.getTemplateList())[3]); + setTimeout(() => { + // 初始化脑图完毕后,中心节点移动至左侧边缘 + const position = window.minder.getViewDragger().getMovement(); + position.x -= position.x - 40; + window.minder.getViewDragger().moveTo(position); + }, 200); + } } catch (error) { // eslint-disable-next-line no-console console.log(error); @@ -847,11 +852,11 @@ loading.value = true; await editPlanMinder(makeMinderParams(fullJson)); Message.success(t('common.saveSuccess')); + emit('save'); clearSelectedCases(); handleConfigCancel(); - initMinder(); callback(); - emit('save'); + initMinder(false); } catch (error) { // eslint-disable-next-line no-console console.log(error); @@ -901,7 +906,7 @@ }); onMounted(() => { - initMinder(); + initMinder(true); nextTick(() => { window.minder.on('contentchange', () => { // 异步执行,否则执行完,还会被重置 diff --git a/frontend/src/components/pure/ms-minder-editor/main/mainEditor.vue b/frontend/src/components/pure/ms-minder-editor/main/mainEditor.vue index 0f23575406..49e22171fc 100644 --- a/frontend/src/components/pure/ms-minder-editor/main/mainEditor.vue +++ b/frontend/src/components/pure/ms-minder-editor/main/mainEditor.vue @@ -204,20 +204,24 @@ importJson.value = fullJson; } emit('save', data, () => { - importJson.value.root.children = mapTree(importJson.value.root.children || [], (node) => ({ - ...node, - data: { - ...node.data, - isNew: false, - changed: false, - }, - })); - if (innerImportJson.value.treePath?.length > 1) { - switchNode(innerImportJson.value.root.data); - } else { - innerImportJson.value = importJson.value; - window.minder.importJson(importJson.value); - } + importJson.value.root.children = mapTree( + importJson.value.root.children || [], + (node, path, level) => ({ + ...node, + data: { + ...node.data, + level, + isNew: false, + changed: false, + }, + }) + ); + // if (innerImportJson.value.treePath?.length > 1) { + // switchNode(innerImportJson.value.root.data); + // } else { + // innerImportJson.value = importJson.value; + // window.minder.importJson(importJson.value); + // } minderStore.setMinderUnsaved(false); floatMenuVisible.value = false; }); diff --git a/frontend/src/components/pure/ms-table/locale/en-US.ts b/frontend/src/components/pure/ms-table/locale/en-US.ts index 2344cbc3e6..4c7a17378c 100644 --- a/frontend/src/components/pure/ms-table/locale/en-US.ts +++ b/frontend/src/components/pure/ms-table/locale/en-US.ts @@ -1,33 +1,34 @@ export default { msTable: { - current: 'Select Current Page', - all: 'Select All Pages', + current: 'Select current page', + all: 'Select all pages', + cancelAll: 'Deselect all pages', enable: 'Enable', disable: 'Disable', batch: { - title: 'Batch Operation', + title: 'Batch operation', selected: 'Selected {count} ', export: 'Export', edit: 'Edit', delete: 'Delete', - moveTo: 'Move To', - copyTo: 'Copy To', - related: 'Related Requirements', - generateDep: 'Generate Dependency', - addPublic: 'Add to Public Case Library', + moveTo: 'Move to', + copyTo: 'Copy to', + related: 'Related requirements', + generateDep: 'Generate dependency', + addPublic: 'Add to public case library', clear: 'clear', }, columnSetting: { default: 'Default', - display: 'Table Settings', - mode: 'Mode Settings', + display: 'Table settings', + mode: 'Mode settings', drawer: 'Drawer', - newWindow: 'New Window', - header: 'Header Settings', - resetDefault: 'Undo Changes', + newWindow: 'New window', + header: 'Header settings', + resetDefault: 'Undo changes', nonSort: 'The above properties cannot be sorted', tooltipContentDrawer: 'Drawer: open a new page as a drawer', - tooltipContentWindow: 'New Window: open a new page with a new page', + tooltipContentWindow: 'New window: open a new page with a new page', pageSize: 'Number of items per page', showSubdirectoryTips: 'Show sub module resource', showSubdirectoryTips1: 'On: Show resources under the module and submodules.', @@ -38,7 +39,7 @@ export default { modify: 'Modify{name}', nameIsNotNull: 'Name cannot be empty', nameIsExist: '{name} already exists', - empty: 'No Content', + empty: 'No content', loading: 'Loading, please wait', errorStatus: 'Failed to load data, please', retry: 'Retry', diff --git a/frontend/src/components/pure/ms-table/locale/zh-CN.ts b/frontend/src/components/pure/ms-table/locale/zh-CN.ts index ab42529e18..68e43986ce 100644 --- a/frontend/src/components/pure/ms-table/locale/zh-CN.ts +++ b/frontend/src/components/pure/ms-table/locale/zh-CN.ts @@ -2,6 +2,7 @@ export default { msTable: { current: '全选当前页', all: '全选所有页', + cancelAll: '取消全选所有页', enable: '启用', disable: '禁用', batch: { diff --git a/frontend/src/components/pure/ms-table/select-all.vue b/frontend/src/components/pure/ms-table/select-all.vue index c0e9967ccc..7f427d7547 100644 --- a/frontend/src/components/pure/ms-table/select-all.vue +++ b/frontend/src/components/pure/ms-table/select-all.vue @@ -18,7 +18,10 @@ diff --git a/frontend/src/components/pure/ms-table/useTable.ts b/frontend/src/components/pure/ms-table/useTable.ts index 9de498bd1d..3c9e18dab1 100644 --- a/frontend/src/components/pure/ms-table/useTable.ts +++ b/frontend/src/components/pure/ms-table/useTable.ts @@ -452,7 +452,10 @@ export default function useTableProps( // 表格SelectAll change selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => { const { data, rowKey, selectorStatus } = propsRes.value; - if (v === SelectAllEnum.NONE) { + if (v === SelectAllEnum.CANCEL_ALL) { + // 清空全选 + resetSelector(true); + } else if (v === SelectAllEnum.NONE) { // 清空选中项 resetSelector(false); } else if (v === SelectAllEnum.CURRENT) { diff --git a/frontend/src/enums/tableEnum.ts b/frontend/src/enums/tableEnum.ts index a29ef17e95..921a8989e9 100644 --- a/frontend/src/enums/tableEnum.ts +++ b/frontend/src/enums/tableEnum.ts @@ -109,6 +109,7 @@ export enum SpecialColumnEnum { export enum SelectAllEnum { ALL = 'all', + CANCEL_ALL = 'cancelAll', CURRENT = 'current', NONE = 'none', } diff --git a/frontend/src/views/test-plan/testPlan/detail/index.vue b/frontend/src/views/test-plan/testPlan/detail/index.vue index 0af5b03321..ff6c1ab826 100644 --- a/frontend/src/views/test-plan/testPlan/detail/index.vue +++ b/frontend/src/views/test-plan/testPlan/detail/index.vue @@ -105,28 +105,32 @@ - + - +