fix(脑图&表格): 测试计划脑图执行方式&表格取消全选

This commit is contained in:
baiqi 2024-07-01 10:52:52 +08:00 committed by 刘瑞斌
parent 5ee624d593
commit 29ac3d47be
8 changed files with 84 additions and 62 deletions

View File

@ -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<PlanMinderNode>();
const currentPriority = ref<RunMode>(RunMode.SERIAL);
// /
const priorityTextMap: Record<number, string> = {
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<FormInstance>();
const configForm = ref<PlanMinderNodeData>();
const resourcePoolOptions = ref<SelectOptionData[]>();
@ -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>(CaseLinkEnum.FUNCTIONAL);
const caseAssociateVisible = ref<boolean>(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', () => {
//

View File

@ -204,20 +204,24 @@
importJson.value = fullJson;
}
emit('save', data, () => {
importJson.value.root.children = mapTree<MinderJsonNode>(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<MinderJsonNode>(
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;
});

View File

@ -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',

View File

@ -2,6 +2,7 @@ export default {
msTable: {
current: '全选当前页',
all: '全选所有页',
cancelAll: '取消全选所有页',
enable: '启用',
disable: '禁用',
batch: {

View File

@ -18,7 +18,10 @@
</div>
<template #content>
<a-doption :value="SelectAllEnum.CURRENT">{{ t('msTable.current') }}</a-doption>
<a-doption :value="SelectAllEnum.ALL">{{ t('msTable.all') }}</a-doption>
<a-doption v-if="selectAllStatus === SelectAllEnum.ALL" :value="SelectAllEnum.CANCEL_ALL">
{{ t('msTable.cancelAll') }}
</a-doption>
<a-doption v-else :value="SelectAllEnum.ALL">{{ t('msTable.all') }}</a-doption>
</template>
</a-dropdown>
</div>

View File

@ -452,7 +452,10 @@ export default function useTableProps<T>(
// 表格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) {

View File

@ -109,6 +109,7 @@ export enum SpecialColumnEnum {
export enum SelectAllEnum {
ALL = 'all',
CANCEL_ALL = 'cancelAll',
CURRENT = 'current',
NONE = 'none',
}

View File

@ -105,28 +105,32 @@
<MsCard class="mt-[16px]" :special-height="174" simple has-breadcrumb no-content-padding>
<Plan v-if="activeTab === 'plan'" :plan-id="planId" :status="detail.status || 'PREPARED'" @refresh="initDetail" />
<FeatureCase
v-if="activeTab === 'featureCase'"
v-else-if="activeTab === 'featureCase'"
ref="featureCaseRef"
:tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'"
@refresh="initDetail"
/>
<BugManagement v-if="activeTab === 'defectList'" :can-edit="detail.status !== 'ARCHIVED'" @refresh="initDetail" />
<BugManagement
v-else-if="activeTab === 'defectList'"
:can-edit="detail.status !== 'ARCHIVED'"
@refresh="initDetail"
/>
<ApiCase
v-if="activeTab === 'apiCase'"
v-else-if="activeTab === 'apiCase'"
ref="apiCaseRef"
:tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'"
@refresh="initDetail"
/>
<ApiScenario
v-if="activeTab === 'apiScenario'"
v-else-if="activeTab === 'apiScenario'"
ref="apiScenarioRef"
:tree-type="treeType"
:can-edit="detail.status !== 'ARCHIVED'"
@refresh="initDetail"
/>
<ExecuteHistory v-if="activeTab === 'executeHistory'" />
<ExecuteHistory v-else-if="activeTab === 'executeHistory'" />
</MsCard>
<CreateAndEditPlanDrawer
v-model:visible="showPlanDrawer"