fix(测试跟踪): 测试计划和评审同时选中模块用例和步骤添加标签时,标签显示重叠
--bug=1025886 --user=陈建星 【测试跟踪】脑图评审框选到用例步骤点击通过/不通过会将步骤打上用例标签 https://www.tapd.cn/55049933/s/1369897
This commit is contained in:
parent
d315868c0c
commit
d06b05b152
|
@ -59,7 +59,7 @@
|
|||
"vue-float-action-button": "^0.6.6",
|
||||
"vue-i18n": "^8.15.3",
|
||||
"vue-jsonpath-picker": "^1.1.5",
|
||||
"vue-minder-editor-plus": "1.1.2",
|
||||
"vue-minder-editor-plus": "1.1.7",
|
||||
"vue-papa-parse": "^2.0.0",
|
||||
"vue-router": "^3.1.3",
|
||||
"vue-virtual-scroll-list": "^2.3.3",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
:tag-enable="true"
|
||||
:disabled="disableMinder"
|
||||
:select-node="selectNode"
|
||||
:distinct-tags="[...tags, this.$t('test_track.plan.plan_status_prepare')]"
|
||||
:distinct-tags="distinctTags"
|
||||
:ignore-num="true"
|
||||
@afterMount="handleAfterMount"
|
||||
@save="save"
|
||||
|
@ -37,8 +37,17 @@
|
|||
import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils";
|
||||
|
||||
import {
|
||||
handleExpandToLevel, listenBeforeExecCommand, listenNodeSelected, loadSelectNodes,
|
||||
tagBatch, getSelectedNodeData, handleIssueAdd, handleIssueBatch, listenDblclick, handleMinderIssueDelete
|
||||
handleExpandToLevel,
|
||||
listenBeforeExecCommand,
|
||||
listenNodeSelected,
|
||||
loadSelectNodes,
|
||||
tagBatch,
|
||||
getSelectedNodeData,
|
||||
handleIssueAdd,
|
||||
handleIssueBatch,
|
||||
listenDblclick,
|
||||
handleMinderIssueDelete,
|
||||
saveTagBeforeBatchTag, clearOtherTagAfterBatchTag
|
||||
} from "@/business/common/minder/minderUtils";
|
||||
import {getPlanCasesForMinder} from "@/api/testCase";
|
||||
import IssueRelateList from "@/business/case/components/IssueRelateList";
|
||||
|
@ -92,6 +101,9 @@ export default {
|
|||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
distinctTags() {
|
||||
return [...this.tags, this.$t('test_track.plan.plan_status_prepare')];
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -127,8 +139,14 @@ export default {
|
|||
if (handleMinderIssueDelete(even.commandName, true)) return; // 删除缺陷不算有编辑脑图信息
|
||||
|
||||
if (even.commandName.toLocaleLowerCase() === 'resource') {
|
||||
saveTagBeforeBatchTag();
|
||||
|
||||
// afterExecCommand 没有效果,这里只能 setTimeout 执行
|
||||
setTimeout(() => {
|
||||
clearOtherTagAfterBatchTag(this.tags, this.distinctTags);
|
||||
// 设置完标签后,优先级显示有问题,重新设置下
|
||||
setTimeout(() => setPriorityView(true, 'P'), 100);
|
||||
setPriorityView(true, 'P');
|
||||
}, 100);
|
||||
this.setIsChange(true);
|
||||
}
|
||||
});
|
||||
|
@ -144,7 +162,7 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')], {
|
||||
tagBatch(this.distinctTags, {
|
||||
param: this.getParam(),
|
||||
getCaseFuc: getPlanCasesForMinder,
|
||||
setParamCallback: this.setParamCallback
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
|
||||
<script>
|
||||
import {
|
||||
clearOtherTagAfterBatchTag,
|
||||
handleExpandToLevel,
|
||||
listenBeforeExecCommand,
|
||||
listenNodeSelected,
|
||||
loadSelectNodes,
|
||||
loadSelectNodes, saveTagBeforeBatchTag,
|
||||
tagBatch
|
||||
} from "@/business/common/minder/minderUtils";
|
||||
import {getReviewCasesForMinder} from "@/api/testCase";
|
||||
|
@ -31,6 +32,7 @@ import {useStore} from "@/store";
|
|||
import {mapState} from "pinia";
|
||||
import {testReviewCaseMinderEdit} from "@/api/remote/plan/test-review-case";
|
||||
import {hasPermission} from "@/business/utils/sdk-utils";
|
||||
import i18n from "@/i18n";
|
||||
|
||||
export default {
|
||||
name: "TestReviewMinder",
|
||||
|
@ -99,11 +101,17 @@ export default {
|
|||
}
|
||||
|
||||
if (even.commandName.toLocaleLowerCase() === 'resource') {
|
||||
saveTagBeforeBatchTag();
|
||||
// afterExecCommand 没有效果,这里只能 setTimeout 执行
|
||||
setTimeout(() => {
|
||||
clearOtherTagAfterBatchTag(this.tags, this.distinctTags);
|
||||
// 设置完标签后,优先级显示有问题,重新设置下
|
||||
setTimeout(() => setPriorityView(true, 'P'), 100);
|
||||
setPriorityView(true, 'P');
|
||||
}, 100);
|
||||
this.setIsChange(true);
|
||||
}
|
||||
});
|
||||
|
||||
tagBatch(this.distinctTags, {
|
||||
param: this.getParam(),
|
||||
getCaseFuc: getReviewCasesForMinder,
|
||||
|
|
|
@ -202,7 +202,24 @@ export async function tagChildren(node, resourceName, distinctTags, loadNodePara
|
|||
for (const item of children) {
|
||||
let isCaseNode = item.data.resource && item.data.resource.indexOf(i18n.t('api_test.definition.request.case')) > -1;
|
||||
if (item.data.type === 'node' || isCaseNode) {
|
||||
let origin = item.data.resource;
|
||||
item.data.resource = getResourceAfterDistinct(item.data.resource, resourceName, distinctTags);
|
||||
if (isCaseNode) {
|
||||
item.data.changed = true;
|
||||
}
|
||||
await tagChildren(item, resourceName, distinctTags, loadNodeParam);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打标签,并去掉互斥的标签
|
||||
* @param origin
|
||||
* @param resourceName
|
||||
* @param distinctTags
|
||||
* @returns {*[]}
|
||||
*/
|
||||
function getResourceAfterDistinct(origin, resourceName, distinctTags) {
|
||||
if (!origin) {
|
||||
origin = [];
|
||||
}
|
||||
|
@ -218,16 +235,8 @@ export async function tagChildren(node, resourceName, distinctTags, loadNodePara
|
|||
if (origin.indexOf(resourceName) < 0) {
|
||||
origin.push(resourceName);
|
||||
}
|
||||
item.data.resource = origin;
|
||||
if (isCaseNode) {
|
||||
item.data.changed = true;
|
||||
return origin;
|
||||
}
|
||||
await tagChildren(item, resourceName, distinctTags, loadNodeParam);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function modifyParentNodeTag(node, resourceName) {
|
||||
let topNode = null;
|
||||
|
@ -733,3 +742,51 @@ export function saveMinderConfirm(vueObj, isSave) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决测试计划和评审选中多个节点批量打标签时,显示所有标签的问题
|
||||
* @param tags
|
||||
* @param distinctTags
|
||||
*/
|
||||
export function clearOtherTagAfterBatchTag(tags, distinctTags) {
|
||||
let selectNodes = minder.getSelectedNodes();
|
||||
if (selectNodes.length <= 1) {
|
||||
// 批量才处理
|
||||
return;
|
||||
}
|
||||
selectNodes.forEach(node => {
|
||||
if (!isModuleNode(node) && node.data.type !== 'case') {
|
||||
// 如果不是模块和用例,直接重置标签
|
||||
if (node.data.originResource) {
|
||||
node.data.resource = node.data.originResource;
|
||||
node.render();
|
||||
}
|
||||
} else {
|
||||
let newResource = node.data.resource;
|
||||
if (newResource) {
|
||||
// 先重置标签,再重新打标签
|
||||
node.data.resource = node.data.originResource;
|
||||
let addResource = newResource.filter(item => tags.indexOf(item) > -1);
|
||||
addResource.forEach((resourceName) => {
|
||||
getResourceAfterDistinct(node.data.resource, resourceName, distinctTags);
|
||||
});
|
||||
node.render();
|
||||
}
|
||||
}
|
||||
});
|
||||
minder.layout(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录当前的标签
|
||||
*/
|
||||
export function saveTagBeforeBatchTag() {
|
||||
let selectNodes = minder.getSelectedNodes();
|
||||
if (selectNodes.length <= 1) {
|
||||
// 批量才处理
|
||||
return;
|
||||
}
|
||||
selectNodes.forEach(node => {
|
||||
node.data.originResource = node.data.resource;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue