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) { if (data?.level === 1 || data?.level === 2) {
canShowFloatMenu.value = true; canShowFloatMenu.value = true;
if (data?.type === PlanMinderCollectionType.FUNCTIONAL) { if (data?.type === PlanMinderCollectionType.FUNCTIONAL || (data?.level === 2 && data?.extended === true)) {
// //
canShowExecuteMethodMenu.value = false; canShowExecuteMethodMenu.value = false;
} else { } else {
canShowExecuteMethodMenu.value = true; canShowExecuteMethodMenu.value = true;
@ -474,7 +474,6 @@
// //
const activePlanSet = ref<PlanMinderNode>(); const activePlanSet = ref<PlanMinderNode>();
const currentPriority = ref<RunMode>(RunMode.SERIAL);
// / // /
const priorityTextMap: Record<number, string> = { const priorityTextMap: Record<number, string> = {
2: t('ms.minders.serial'), 2: t('ms.minders.serial'),
@ -493,18 +492,6 @@
return data.priority === 2 ? RunMode.SERIAL : RunMode.PARALLEL; 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 configFormRef = ref<FormInstance>();
const configForm = ref<PlanMinderNodeData>(); const configForm = ref<PlanMinderNodeData>();
const resourcePoolOptions = ref<SelectOptionData[]>(); 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 currentSelectCase = ref<CaseLinkEnum>(CaseLinkEnum.FUNCTIONAL);
const caseAssociateVisible = ref<boolean>(false); const caseAssociateVisible = ref<boolean>(false);
@ -782,7 +785,7 @@
/** /**
* 初始化测试规划脑图 * 初始化测试规划脑图
*/ */
async function initMinder() { async function initMinder(firstInit = false) {
try { try {
loading.value = true; loading.value = true;
const res = await getPlanMinder(props.planId); const res = await getPlanMinder(props.planId);
@ -797,13 +800,15 @@
return node; return node;
}); });
window.minder.importJson(importJson.value); window.minder.importJson(importJson.value);
window.minder.execCommand('template', Object.keys(window.kityminder.Minder.getTemplateList())[3]); if (firstInit) {
setTimeout(() => { window.minder.execCommand('template', Object.keys(window.kityminder.Minder.getTemplateList())[3]);
// setTimeout(() => {
const position = window.minder.getViewDragger().getMovement(); //
position.x -= position.x - 40; const position = window.minder.getViewDragger().getMovement();
window.minder.getViewDragger().moveTo(position); position.x -= position.x - 40;
}, 200); window.minder.getViewDragger().moveTo(position);
}, 200);
}
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -847,11 +852,11 @@
loading.value = true; loading.value = true;
await editPlanMinder(makeMinderParams(fullJson)); await editPlanMinder(makeMinderParams(fullJson));
Message.success(t('common.saveSuccess')); Message.success(t('common.saveSuccess'));
emit('save');
clearSelectedCases(); clearSelectedCases();
handleConfigCancel(); handleConfigCancel();
initMinder();
callback(); callback();
emit('save'); initMinder(false);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -901,7 +906,7 @@
}); });
onMounted(() => { onMounted(() => {
initMinder(); initMinder(true);
nextTick(() => { nextTick(() => {
window.minder.on('contentchange', () => { window.minder.on('contentchange', () => {
// //

View File

@ -204,20 +204,24 @@
importJson.value = fullJson; importJson.value = fullJson;
} }
emit('save', data, () => { emit('save', data, () => {
importJson.value.root.children = mapTree<MinderJsonNode>(importJson.value.root.children || [], (node) => ({ importJson.value.root.children = mapTree<MinderJsonNode>(
...node, importJson.value.root.children || [],
data: { (node, path, level) => ({
...node.data, ...node,
isNew: false, data: {
changed: false, ...node.data,
}, level,
})); isNew: false,
if (innerImportJson.value.treePath?.length > 1) { changed: false,
switchNode(innerImportJson.value.root.data); },
} else { })
innerImportJson.value = importJson.value; );
window.minder.importJson(importJson.value); // if (innerImportJson.value.treePath?.length > 1) {
} // switchNode(innerImportJson.value.root.data);
// } else {
// innerImportJson.value = importJson.value;
// window.minder.importJson(importJson.value);
// }
minderStore.setMinderUnsaved(false); minderStore.setMinderUnsaved(false);
floatMenuVisible.value = false; floatMenuVisible.value = false;
}); });

View File

@ -1,33 +1,34 @@
export default { export default {
msTable: { msTable: {
current: 'Select Current Page', current: 'Select current page',
all: 'Select All Pages', all: 'Select all pages',
cancelAll: 'Deselect all pages',
enable: 'Enable', enable: 'Enable',
disable: 'Disable', disable: 'Disable',
batch: { batch: {
title: 'Batch Operation', title: 'Batch operation',
selected: 'Selected {count} ', selected: 'Selected {count} ',
export: 'Export', export: 'Export',
edit: 'Edit', edit: 'Edit',
delete: 'Delete', delete: 'Delete',
moveTo: 'Move To', moveTo: 'Move to',
copyTo: 'Copy To', copyTo: 'Copy to',
related: 'Related Requirements', related: 'Related requirements',
generateDep: 'Generate Dependency', generateDep: 'Generate dependency',
addPublic: 'Add to Public Case Library', addPublic: 'Add to public case library',
clear: 'clear', clear: 'clear',
}, },
columnSetting: { columnSetting: {
default: 'Default', default: 'Default',
display: 'Table Settings', display: 'Table settings',
mode: 'Mode Settings', mode: 'Mode settings',
drawer: 'Drawer', drawer: 'Drawer',
newWindow: 'New Window', newWindow: 'New window',
header: 'Header Settings', header: 'Header settings',
resetDefault: 'Undo Changes', resetDefault: 'Undo changes',
nonSort: 'The above properties cannot be sorted', nonSort: 'The above properties cannot be sorted',
tooltipContentDrawer: 'Drawer: open a new page as a drawer', 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', pageSize: 'Number of items per page',
showSubdirectoryTips: 'Show sub module resource', showSubdirectoryTips: 'Show sub module resource',
showSubdirectoryTips1: 'On: Show resources under the module and submodules.', showSubdirectoryTips1: 'On: Show resources under the module and submodules.',
@ -38,7 +39,7 @@ export default {
modify: 'Modify{name}', modify: 'Modify{name}',
nameIsNotNull: 'Name cannot be empty', nameIsNotNull: 'Name cannot be empty',
nameIsExist: '{name} already exists', nameIsExist: '{name} already exists',
empty: 'No Content', empty: 'No content',
loading: 'Loading, please wait', loading: 'Loading, please wait',
errorStatus: 'Failed to load data, please', errorStatus: 'Failed to load data, please',
retry: 'Retry', retry: 'Retry',

View File

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

View File

@ -18,7 +18,10 @@
</div> </div>
<template #content> <template #content>
<a-doption :value="SelectAllEnum.CURRENT">{{ t('msTable.current') }}</a-doption> <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> </template>
</a-dropdown> </a-dropdown>
</div> </div>

View File

@ -452,7 +452,10 @@ export default function useTableProps<T>(
// 表格SelectAll change // 表格SelectAll change
selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => { selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => {
const { data, rowKey, selectorStatus } = propsRes.value; const { data, rowKey, selectorStatus } = propsRes.value;
if (v === SelectAllEnum.NONE) { if (v === SelectAllEnum.CANCEL_ALL) {
// 清空全选
resetSelector(true);
} else if (v === SelectAllEnum.NONE) {
// 清空选中项 // 清空选中项
resetSelector(false); resetSelector(false);
} else if (v === SelectAllEnum.CURRENT) { } else if (v === SelectAllEnum.CURRENT) {

View File

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

View File

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