refactor: 用例的子节点禁止打用例和优先级标签

This commit is contained in:
chenjianxing 2021-04-23 14:12:18 +08:00 committed by jianxing
parent 6c48395284
commit 4df9605589
4 changed files with 40 additions and 3 deletions

View File

@ -50,7 +50,7 @@
"vue-float-action-button": "^0.6.6", "vue-float-action-button": "^0.6.6",
"vue-i18n": "^8.15.3", "vue-i18n": "^8.15.3",
"vue-jsonpath-picker": "^1.1.5", "vue-jsonpath-picker": "^1.1.5",
"vue-minder-editor-plus": "^1.0.21", "vue-minder-editor-plus": "^1.0.23",
"vue-papa-parse": "^2.0.0", "vue-papa-parse": "^2.0.0",
"vue-pdf": "^4.2.0", "vue-pdf": "^4.2.0",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",

View File

@ -8,6 +8,8 @@
:progress-enable="false" :progress-enable="false"
:tags="tags" :tags="tags"
:height="height" :height="height"
:tag-edit-check="tagEditCheck"
:priority-disable-check="priorityDisableCheck"
:distinct-tags="distinctTags" :distinct-tags="distinctTags"
@afterMount="$emit('afterMount')" @afterMount="$emit('afterMount')"
@save="save" @save="save"
@ -55,7 +57,10 @@ export default {
}, },
selectNode: { selectNode: {
type: Object, type: Object,
} },
tagDisableCheck: Function,
tagEditCheck: Function,
priorityDisableCheck: Function
}, },
data() { data() {
return { return {

View File

@ -6,6 +6,8 @@
:tags="tags" :tags="tags"
:select-node="selectNode" :select-node="selectNode"
:distinct-tags="tags" :distinct-tags="tags"
:tag-edit-check="tagEditCheck()"
:priority-disable-check="priorityDisableCheck()"
@save="save" @save="save"
ref="minder" ref="minder"
/> />
@ -16,7 +18,7 @@ import MsModuleMinder from "@/business/components/common/components/MsModuleMind
import { import {
appendChild, appendChild,
getTestCaseDataMap, getTestCaseDataMap,
parseCase, updateNode parseCase, priorityDisableCheck, tagEditCheck, updateNode
} from "@/business/components/track/common/minder/minderUtils"; } from "@/business/components/track/common/minder/minderUtils";
import {getNodePath} from "@/common/js/utils"; import {getNodePath} from "@/common/js/utils";
export default { export default {
@ -167,6 +169,12 @@ name: "TestCaseMinder",
throw new Error(tip); throw new Error(tip);
} }
}, },
tagEditCheck() {
return tagEditCheck;
},
priorityDisableCheck() {
return priorityDisableCheck;
},
addCase(data, type) { addCase(data, type) {
let nodeData = parseCase(data, new Map()); let nodeData = parseCase(data, new Map());
let minder = window.minder; let minder = window.minder;

View File

@ -230,3 +230,27 @@ export function tagBatch(distinctTags) {
} }
}); });
} }
export function tagEditCheck(resourceName) {
let minder = window.minder;
let selectNodes = minder.getSelectedNodes();
if (selectNodes && selectNodes.length > 0) {
let resource = selectNodes[0].getParent().data.resource;
if (resource && resource.indexOf('用例') > -1 && resourceName === '用例') {
return false;
}
}
return true;
}
export function priorityDisableCheck() {
let minder = window.minder;
let selectNodes = minder.getSelectedNodes();
if (selectNodes && selectNodes.length > 0) {
let resource = selectNodes[0].getParent().data.resource;
if (resource && resource.indexOf('用例') > -1) {
return true;
}
}
return false;
}