fix(测试跟踪): 【测试跟踪】缺陷管理-创建/编辑缺陷-关联用例-模块树显示异常
--bug=1030239 --user=白奇 【测试跟踪】缺陷管理-创建/编辑缺陷-关联用例-模块树显示异常 https://www.tapd.cn/55049933/s/1414760
This commit is contained in:
parent
70da63dd64
commit
302fc575d2
|
@ -1,9 +1,13 @@
|
|||
<template>
|
||||
<div>
|
||||
|
||||
<slot name="header">
|
||||
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small" :clearable="true"/>
|
||||
</slot>
|
||||
<slot name="header">
|
||||
<el-input
|
||||
:placeholder="$t('test_track.module.search')"
|
||||
v-model="filterText"
|
||||
size="small"
|
||||
:clearable="true"
|
||||
/>
|
||||
</slot>
|
||||
<ms-left-2-right-container v-if="scroll">
|
||||
<el-tree
|
||||
class="filter-tree node-tree"
|
||||
|
@ -17,79 +21,126 @@
|
|||
:filter-node-method="filterNode"
|
||||
:expand-on-click-node="false"
|
||||
highlight-current
|
||||
:draggable="!disabled&&!hideOpretor"
|
||||
ref="tree">
|
||||
:draggable="!disabled && !hideOpretor"
|
||||
ref="tree"
|
||||
>
|
||||
<template v-slot:default="{ node, data }">
|
||||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||
<span v-if="data.isEdit" @click.stop>
|
||||
<el-input
|
||||
@blur.stop="save(node, data)"
|
||||
@keyup.enter.native.stop="$event.target.blur()"
|
||||
v-model="data.name"
|
||||
class="name-input"
|
||||
size="mini"
|
||||
ref="nameInput"
|
||||
:draggable="true"
|
||||
/>
|
||||
</span>
|
||||
|
||||
<template v-slot:default="{node,data}">
|
||||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||
<span v-if="!data.isEdit" class="node-icon">
|
||||
<i class="el-icon-folder" />
|
||||
</span>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:content="data.name"
|
||||
placement="top-start"
|
||||
:open-delay="1000"
|
||||
>
|
||||
<span
|
||||
v-if="!data.isEdit"
|
||||
class="node-title"
|
||||
v-text="isDefault(data) ? getLocalDefaultName() : data.name"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<span
|
||||
class="count-title"
|
||||
v-if="
|
||||
showCaseNum &&
|
||||
data.caseNum !== null &&
|
||||
data.caseNum !== undefined
|
||||
"
|
||||
>
|
||||
<span style="color: var(--primary_color)">{{
|
||||
data.caseNum
|
||||
}}</span>
|
||||
</span>
|
||||
<span v-if="!disabled" class="node-operate child">
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.id !== 'root' &&
|
||||
data.name !== defaultLabel &&
|
||||
!hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
v-permission="updatePermission"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.name === defaultLabel && data.level !== 1 && !hideOpretor
|
||||
"
|
||||
v-permission="updatePermission"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="addPermission"
|
||||
v-if="!isDefault(data) && !hideOpretor"
|
||||
:content="$t('test_track.module.add_submodule')"
|
||||
placement="top"
|
||||
>
|
||||
<i
|
||||
@click.stop="append(node, data)"
|
||||
class="el-icon-circle-plus-outline"
|
||||
></i>
|
||||
</el-tooltip>
|
||||
|
||||
<span v-if="data.isEdit" @click.stop>
|
||||
<el-input @blur.stop="save(node, data)" @keyup.enter.native.stop="$event.target.blur()" v-model="data.name"
|
||||
class="name-input" size="mini" ref="nameInput" :draggable="true"/>
|
||||
</span>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.name === defaultLabel && data.level !== 1 && !hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="deletePermission"
|
||||
:content="$t('commons.delete')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
|
||||
<span v-if="!data.isEdit" class="node-icon">
|
||||
<i class="el-icon-folder"/>
|
||||
</span>
|
||||
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
||||
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? getLocalDefaultName() : data.name"/>
|
||||
</el-tooltip>
|
||||
<span class="count-title" v-if="showCaseNum && data.caseNum !== null && data.caseNum !== undefined">
|
||||
<span style="color: var(--primary_color);">{{ data.caseNum }}</span>
|
||||
</span>
|
||||
<span v-if="!disabled" class="node-operate child">
|
||||
<el-tooltip
|
||||
v-if="data.id !== 'root' && data.name !== defaultLabel && !hideOpretor"
|
||||
class="item"
|
||||
effect="dark"
|
||||
v-permission="updatePermission"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top">
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="data.name === defaultLabel && data.level !== 1 && !hideOpretor"
|
||||
v-permission="updatePermission"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top">
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="addPermission"
|
||||
v-if="!isDefault(data) && !hideOpretor"
|
||||
:content="$t('test_track.module.add_submodule')"
|
||||
placement="top">
|
||||
<i @click.stop="append(node, data)" class="el-icon-circle-plus-outline"></i>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip
|
||||
v-if="data.name === defaultLabel && data.level !==1 && !hideOpretor"
|
||||
class="item" effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="deletePermission"
|
||||
:content="$t('commons.delete')"
|
||||
placement="top">
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip
|
||||
v-if="data.id !== 'root' && data.name !== defaultLabel && !hideOpretor"
|
||||
class="item" effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('commons.delete')"
|
||||
v-permission="deletePermission"
|
||||
placement="top">
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</span>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.id !== 'root' &&
|
||||
data.name !== defaultLabel &&
|
||||
!hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('commons.delete')"
|
||||
v-permission="deletePermission"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</ms-left-2-right-container>
|
||||
|
@ -106,82 +157,120 @@
|
|||
:filter-node-method="filterNode"
|
||||
:expand-on-click-node="false"
|
||||
highlight-current
|
||||
:draggable="!disabled&&!hideOpretor"
|
||||
ref="tree">
|
||||
:draggable="!disabled && !hideOpretor"
|
||||
ref="tree"
|
||||
>
|
||||
<template v-slot:default="{ node, data }">
|
||||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||
<span v-if="data.isEdit" @click.stop>
|
||||
<el-input
|
||||
@blur.stop="save(node, data)"
|
||||
@keyup.enter.native.stop="$event.target.blur()"
|
||||
v-model="data.name"
|
||||
class="name-input"
|
||||
size="mini"
|
||||
ref="nameInput"
|
||||
:draggable="true"
|
||||
/>
|
||||
</span>
|
||||
|
||||
<template v-slot:default="{node,data}">
|
||||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||
|
||||
<span v-if="data.isEdit" @click.stop>
|
||||
<el-input @blur.stop="save(node, data)" @keyup.enter.native.stop="$event.target.blur()" v-model="data.name"
|
||||
class="name-input" size="mini" ref="nameInput" :draggable="true"/>
|
||||
</span>
|
||||
|
||||
<span v-if="!data.isEdit" class="node-icon">
|
||||
<i class="el-icon-folder"/>
|
||||
</span>
|
||||
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
||||
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? getLocalDefaultName() : data.name"/>
|
||||
</el-tooltip>
|
||||
<span class="count-title" v-if="showCaseNum && data.caseNum !== null && data.caseNum !== undefined">
|
||||
<span style="color: var(--primary_color);">{{ data.caseNum }}</span>
|
||||
</span>
|
||||
<span v-if="!disabled" class="node-operate child">
|
||||
<el-tooltip
|
||||
v-if="data.id !== 'root' && data.name !== defaultLabel && !hideOpretor"
|
||||
class="item"
|
||||
effect="dark"
|
||||
v-permission="updatePermission"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top">
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="data.name === defaultLabel && data.level !== 1 && !hideOpretor"
|
||||
v-permission="updatePermission"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top">
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<span v-if="!data.isEdit" class="node-icon">
|
||||
<i class="el-icon-folder" />
|
||||
</span>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="addPermission"
|
||||
v-if="!isDefault(data) && !hideOpretor"
|
||||
:content="$t('test_track.module.add_submodule')"
|
||||
placement="top">
|
||||
<i @click.stop="append(node, data)" class="el-icon-circle-plus-outline"></i>
|
||||
:content="data.name"
|
||||
placement="top-start"
|
||||
:open-delay="1000"
|
||||
>
|
||||
<span
|
||||
v-if="!data.isEdit"
|
||||
class="node-title"
|
||||
v-text="isDefault(data) ? getLocalDefaultName() : data.name"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<span
|
||||
class="count-title"
|
||||
v-if="
|
||||
showCaseNum && data.caseNum !== null && data.caseNum !== undefined
|
||||
"
|
||||
>
|
||||
<span style="color: var(--primary_color)">{{ data.caseNum }}</span>
|
||||
</span>
|
||||
<span v-if="!disabled" class="node-operate child">
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.id !== 'root' && data.name !== defaultLabel && !hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
v-permission="updatePermission"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.name === defaultLabel && data.level !== 1 && !hideOpretor
|
||||
"
|
||||
v-permission="updatePermission"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('test_track.module.rename')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="addPermission"
|
||||
v-if="!isDefault(data) && !hideOpretor"
|
||||
:content="$t('test_track.module.add_submodule')"
|
||||
placement="top"
|
||||
>
|
||||
<i
|
||||
@click.stop="append(node, data)"
|
||||
class="el-icon-circle-plus-outline"
|
||||
></i>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip
|
||||
v-if="data.name === defaultLabel && data.level !==1 && !hideOpretor"
|
||||
class="item" effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="deletePermission"
|
||||
:content="$t('commons.delete')"
|
||||
placement="top">
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.name === defaultLabel && data.level !== 1 && !hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
v-permission="deletePermission"
|
||||
:content="$t('commons.delete')"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip
|
||||
v-if="data.id !== 'root' && data.name !== defaultLabel && !hideOpretor"
|
||||
class="item" effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('commons.delete')"
|
||||
v-permission="deletePermission"
|
||||
placement="top">
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="
|
||||
data.id !== 'root' && data.name !== defaultLabel && !hideOpretor
|
||||
"
|
||||
class="item"
|
||||
effect="dark"
|
||||
:open-delay="200"
|
||||
:content="$t('commons.delete')"
|
||||
v-permission="deletePermission"
|
||||
placement="top"
|
||||
>
|
||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -190,7 +279,7 @@ import MsLeft2RightContainer from "../MsLeft2RightContainer";
|
|||
|
||||
export default {
|
||||
name: "MsNodeTree",
|
||||
components: {MsLeft2RightContainer},
|
||||
components: { MsLeft2RightContainer },
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
|
@ -199,7 +288,7 @@ export default {
|
|||
reloaded: false,
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
label: "label",
|
||||
},
|
||||
extendTreeNodes: [],
|
||||
};
|
||||
|
@ -208,54 +297,54 @@ export default {
|
|||
//是否允许拖拽隐藏侧边栏
|
||||
scroll: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
existSlotContainer: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "view"
|
||||
default: "view",
|
||||
},
|
||||
treeNodes: {
|
||||
type: Array
|
||||
type: Array,
|
||||
},
|
||||
allLabel: {
|
||||
type: String,
|
||||
default() {
|
||||
return this.$t("commons.all_label.case");
|
||||
}
|
||||
},
|
||||
},
|
||||
defaultLabel: {
|
||||
type: String,
|
||||
default() {
|
||||
return '未规划用例';
|
||||
}
|
||||
return "未规划用例";
|
||||
},
|
||||
},
|
||||
nameLimit: {
|
||||
type: Number,
|
||||
default() {
|
||||
return 50;
|
||||
}
|
||||
},
|
||||
},
|
||||
defaultExpandAll: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
showRemoveTip: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
},
|
||||
showCaseNum: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
},
|
||||
updatePermission: Array,
|
||||
addPermission: Array,
|
||||
|
@ -269,26 +358,26 @@ export default {
|
|||
},
|
||||
filterText(val) {
|
||||
this.filter(val);
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.type !== 'edit';
|
||||
}
|
||||
return this.type !== "edit";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
let num = 0;
|
||||
this.treeNodes.forEach(t => {
|
||||
this.treeNodes.forEach((t) => {
|
||||
num += t.caseNum;
|
||||
});
|
||||
this.extendTreeNodes = [];
|
||||
this.extendTreeNodes.unshift({
|
||||
"id": "root",
|
||||
"name": this.allLabel,
|
||||
"level": 0,
|
||||
"children": this.treeNodes,
|
||||
"caseNum": num > 0 ? num : ""
|
||||
id: "root",
|
||||
name: this.allLabel,
|
||||
level: 0,
|
||||
children: this.treeNodes,
|
||||
caseNum: num > 0 ? num : "",
|
||||
});
|
||||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
|
@ -350,12 +439,12 @@ export default {
|
|||
|
||||
// 遍历子节点
|
||||
if (data.children && data.children.length > 0) {
|
||||
this.changeTreeNodeStatus(data)
|
||||
this.changeTreeNodeStatus(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
edit(node, data, isAppend) {
|
||||
this.$set(data, 'isEdit', true);
|
||||
this.$set(data, "isEdit", true);
|
||||
this.$nextTick(() => {
|
||||
this.$refs.nameInput.focus();
|
||||
|
||||
|
@ -365,28 +454,36 @@ export default {
|
|||
this.filter(this.filterText);
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.$emit('filter');
|
||||
this.$emit("filter");
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
increase(id) {
|
||||
this.traverse(id, node => {
|
||||
if (node.caseNum) {
|
||||
node.caseNum++;
|
||||
}
|
||||
}, true);
|
||||
if (this.extendTreeNodes[0].id === 'root') {
|
||||
this.traverse(
|
||||
id,
|
||||
(node) => {
|
||||
if (node.caseNum) {
|
||||
node.caseNum++;
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
if (this.extendTreeNodes[0].id === "root") {
|
||||
this.extendTreeNodes[0].caseNum++;
|
||||
}
|
||||
},
|
||||
decrease(id) {
|
||||
this.traverse(id, node => {
|
||||
if (node.caseNum) {
|
||||
node.caseNum--;
|
||||
}
|
||||
}, true);
|
||||
if (this.extendTreeNodes[0].id === 'root') {
|
||||
this.traverse(
|
||||
id,
|
||||
(node) => {
|
||||
if (node.caseNum) {
|
||||
node.caseNum--;
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
if (this.extendTreeNodes[0].id === "root") {
|
||||
this.extendTreeNodes[0].caseNum--;
|
||||
}
|
||||
},
|
||||
|
@ -422,10 +519,10 @@ export default {
|
|||
id: undefined,
|
||||
isEdit: false,
|
||||
name: "",
|
||||
children: []
|
||||
children: [],
|
||||
};
|
||||
if (!data.children) {
|
||||
this.$set(data, 'children', [])
|
||||
this.$set(data, "children", []);
|
||||
}
|
||||
data.children.push(newChild);
|
||||
this.edit(node, newChild, true);
|
||||
|
@ -435,85 +532,86 @@ export default {
|
|||
});
|
||||
},
|
||||
save(node, data) {
|
||||
if (data.name.trim() === '') {
|
||||
this.$warning(this.$t('test_track.case.input_name'));
|
||||
if (data.name.trim() === "") {
|
||||
this.$warning(this.$t("test_track.case.input_name"));
|
||||
return;
|
||||
}
|
||||
if (data.name.trim().length > this.nameLimit) {
|
||||
this.$warning(this.$t('test_track.length_less_than') + this.nameLimit);
|
||||
this.$warning(this.$t("test_track.length_less_than") + this.nameLimit);
|
||||
return;
|
||||
}
|
||||
if (data.name.indexOf("\\") > -1) {
|
||||
this.$warning(this.$t('commons.node_name_tip'));
|
||||
this.$warning(this.$t("commons.node_name_tip"));
|
||||
return;
|
||||
}
|
||||
let param = {};
|
||||
this.buildSaveParam(param, node.parent.data, data);
|
||||
if (param.type === 'edit') {
|
||||
this.$emit('edit', param);
|
||||
if (param.type === "edit") {
|
||||
this.$emit("edit", param);
|
||||
} else {
|
||||
this.expandedNode.push(param.parentId);
|
||||
this.$emit('add', param);
|
||||
this.$emit("add", param);
|
||||
}
|
||||
if (!data.level) {
|
||||
data.level = param.level;
|
||||
}
|
||||
this.$set(data, 'isEdit', false);
|
||||
this.$set(data, "isEdit", false);
|
||||
},
|
||||
remove(node, data) {
|
||||
if (data.label === undefined) {
|
||||
this.$refs.tree.remove(node);
|
||||
return;
|
||||
}
|
||||
let tip = '确定删除节点 ' + data.label + ' 及其子节点下所有资源' + '?';
|
||||
let tip = "确定删除节点 " + data.label + " 及其子节点下所有资源" + "?";
|
||||
// let info = this.$t("test_track.module.delete_confirm") + data.label + "," + this.$t("test_track.module.delete_all_resource") + "?";
|
||||
if (this.showRemoveTip) {
|
||||
this.$alert(tip, "", {
|
||||
confirmButtonText: this.$t("commons.confirm"),
|
||||
callback: action => {
|
||||
if (action === "confirm") {
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(node.data, nodeIds);
|
||||
this.$emit('remove', nodeIds, data);
|
||||
}
|
||||
confirmButtonText: this.$t("commons.confirm"),
|
||||
callback: (action) => {
|
||||
if (action === "confirm") {
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(node.data, nodeIds);
|
||||
this.$emit("remove", nodeIds, data);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
let nodeIds = [];
|
||||
this.getChildNodeId(node.data, nodeIds);
|
||||
this.$emit('remove', nodeIds, data);
|
||||
this.$emit("remove", nodeIds, data);
|
||||
}
|
||||
|
||||
},
|
||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||
if (dropType === "none" || dropType === undefined) {
|
||||
return;
|
||||
}
|
||||
if (dropNode.data.id === 'root' && dropType === 'before' || draggingNode.data.name === this.defaultLabel) {
|
||||
this.$emit('refresh');
|
||||
if (
|
||||
(dropNode.data.id === "root" && dropType === "before") ||
|
||||
draggingNode.data.name === this.defaultLabel
|
||||
) {
|
||||
this.$emit("refresh");
|
||||
return false;
|
||||
}
|
||||
let param = this.buildParam(draggingNode, dropNode, dropType);
|
||||
let list = [];
|
||||
this.getNodeTree(this.treeNodes, draggingNode.data.id, list);
|
||||
if (param.parentId === 'root') {
|
||||
if (param.parentId === "root") {
|
||||
param.parentId = undefined;
|
||||
}
|
||||
this.$emit('drag', param, list);
|
||||
this.$emit("drag", param, list);
|
||||
},
|
||||
buildSaveParam(param, parentData, data) {
|
||||
if (data.id) {
|
||||
param.nodeIds = [];
|
||||
param.type = 'edit';
|
||||
param.type = "edit";
|
||||
param.id = data.id;
|
||||
param.level = data.level;
|
||||
param.parentId = data.parentId;
|
||||
this.getChildNodeId(data, param.nodeIds);
|
||||
} else {
|
||||
param.level = 1;
|
||||
param.type = 'add';
|
||||
if (parentData.id != 'root') {
|
||||
param.type = "add";
|
||||
if (parentData.id != "root") {
|
||||
// 非根节点
|
||||
param.parentId = parentData.id;
|
||||
param.level = parentData.level + 1;
|
||||
|
@ -546,7 +644,10 @@ export default {
|
|||
param.nodeTree = draggingNode.data;
|
||||
} else {
|
||||
for (let i = 0; i < this.treeNodes.length; i++) {
|
||||
param.nodeTree = this.findTreeByNodeId(this.treeNodes[i], dropNode.data.id);
|
||||
param.nodeTree = this.findTreeByNodeId(
|
||||
this.treeNodes[i],
|
||||
dropNode.data.id
|
||||
);
|
||||
if (param.nodeTree) {
|
||||
break;
|
||||
}
|
||||
|
@ -561,9 +662,9 @@ export default {
|
|||
}
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].id === id) {
|
||||
i - 1 >= 0 ? list[0] = nodes[i - 1].id : list[0] = "";
|
||||
i - 1 >= 0 ? (list[0] = nodes[i - 1].id) : (list[0] = "");
|
||||
list[1] = nodes[i].id;
|
||||
i + 1 < nodes.length ? list[2] = nodes[i + 1].id : list[2] = "";
|
||||
i + 1 < nodes.length ? (list[2] = nodes[i + 1].id) : (list[2] = "");
|
||||
return;
|
||||
}
|
||||
if (nodes[i].children) {
|
||||
|
@ -605,14 +706,14 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.handleNodeSelect(currentNode);
|
||||
this.$refs.tree.setCurrentKey(currentNode.data.id);
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
justSetCurrentKey(id) {
|
||||
if (id) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.setCurrentKey(id);
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
isDefault(data) {
|
||||
|
@ -620,12 +721,12 @@ export default {
|
|||
},
|
||||
getLocalDefaultName() {
|
||||
if (this.localSuffix) {
|
||||
return this.$t('commons.default_module.' + this.localSuffix);
|
||||
return this.$t("commons.default_module." + this.localSuffix);
|
||||
} else {
|
||||
return this.$t('commons.module_title');
|
||||
return this.$t("commons.module_title");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -651,6 +752,8 @@ export default {
|
|||
|
||||
.node-tree {
|
||||
margin-top: 15px;
|
||||
overflow: auto;
|
||||
height: calc(100% - 45px);
|
||||
}
|
||||
|
||||
.father .child {
|
||||
|
@ -688,7 +791,7 @@ export default {
|
|||
line-height: 25px;
|
||||
}
|
||||
|
||||
.name-input :deep( .el-input__inner ) {
|
||||
.name-input :deep(.el-input__inner) {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
|
|
@ -1,81 +1,81 @@
|
|||
<template>
|
||||
<test-case-relevance-base
|
||||
@setProject="setProject"
|
||||
@save="save"
|
||||
ref="baseRelevance">
|
||||
<test-case-relevance-base
|
||||
@setProject="setProject"
|
||||
@save="save"
|
||||
ref="baseRelevance"
|
||||
>
|
||||
<template v-slot:aside>
|
||||
<ms-node-tree
|
||||
class="node-tree"
|
||||
v-loading="result.loading"
|
||||
@nodeSelectEvent="nodeChange"
|
||||
:tree-nodes="treeNodes"
|
||||
default-label="未规划用例"
|
||||
local-suffix="test_case"
|
||||
ref="nodeTree"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-slot:aside>
|
||||
<ms-node-tree class="node-tree"
|
||||
v-loading="result.loading"
|
||||
@nodeSelectEvent="nodeChange"
|
||||
:tree-nodes="treeNodes"
|
||||
default-label="未规划用例"
|
||||
local-suffix="test_case"
|
||||
ref="nodeTree"/>
|
||||
</template>
|
||||
<el-card>
|
||||
<ms-table-header
|
||||
:condition="condition"
|
||||
@search="initTableData"
|
||||
title=""
|
||||
:show-create="false"
|
||||
/>
|
||||
<ms-table
|
||||
v-loading="result.loading"
|
||||
:data="tableData"
|
||||
:condition="condition"
|
||||
:total="total"
|
||||
:page-size.sync="pageSize"
|
||||
:show-select-all="false"
|
||||
@handlePageChange="initTableData"
|
||||
@refresh="initTableData"
|
||||
ref="table"
|
||||
>
|
||||
<ms-table-column :label="$t('commons.id')" prop="num">
|
||||
</ms-table-column>
|
||||
|
||||
<el-card>
|
||||
<ms-table-column :label="$t('commons.name')" prop="name">
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-header :condition="condition" @search="initTableData" title="" :show-create="false"/>
|
||||
<ms-table
|
||||
v-loading="result.loading"
|
||||
:data="tableData"
|
||||
:condition="condition"
|
||||
:total="total"
|
||||
:page-size.sync="pageSize"
|
||||
:show-select-all="false"
|
||||
@handlePageChange="initTableData"
|
||||
@refresh="initTableData"
|
||||
ref="table">
|
||||
<ms-table-column :label="$t('test_track.case.priority')" prop="name">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority" />
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('commons.id')"
|
||||
prop="num">
|
||||
</ms-table-column>
|
||||
<ms-table-column :label="$t('test_track.case.type')" prop="type">
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type" />
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('commons.name')"
|
||||
prop="name">
|
||||
</ms-table-column>
|
||||
<ms-table-column :label="$t('test_track.case.module')" prop="nodePath">
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.case.priority')"
|
||||
prop="name">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
prop="projectName"
|
||||
>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.case.type')"
|
||||
prop="type">
|
||||
<template v-slot:default="scope">
|
||||
<type-table-item :value="scope.row.type"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.case.module')"
|
||||
prop="nodePath">
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.plan.plan_project')"
|
||||
prop="projectName">
|
||||
</ms-table-column>
|
||||
|
||||
</ms-table>
|
||||
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" :total="total"/>
|
||||
</el-card>
|
||||
|
||||
</test-case-relevance-base>
|
||||
<ms-table-pagination
|
||||
:change="initTableData"
|
||||
:current-page.sync="currentPage"
|
||||
:page-size.sync="pageSize"
|
||||
:total="total"
|
||||
/>
|
||||
</el-card>
|
||||
</test-case-relevance-base>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||
import {CUSTOM_FIELD_LIST} from "metersphere-frontend/src/utils/default-table-header";
|
||||
import { CUSTOM_FIELD_LIST } from "metersphere-frontend/src/utils/default-table-header";
|
||||
import MsTableButton from "metersphere-frontend/src/components/MsTableButton";
|
||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
||||
|
@ -84,8 +84,8 @@ import TestCaseRelevanceBase from "@/business/plan/view/comonents/base/TestCaseR
|
|||
import MsNodeTree from "metersphere-frontend/src/components/module/MsNodeTree";
|
||||
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
||||
import TypeTableItem from "@/business/common/tableItems/planview/TypeTableItem";
|
||||
import {getTestCaseRelateIssue} from "@/api/testCase";
|
||||
import {testCaseNodeListProject} from "@/api/test-case-node";
|
||||
import { getTestCaseRelateIssue } from "@/api/testCase";
|
||||
import { testCaseNodeListProject } from "@/api/test-case-node";
|
||||
export default {
|
||||
name: "TestCaseRelateList",
|
||||
components: {
|
||||
|
@ -95,7 +95,11 @@ export default {
|
|||
TestCaseRelevanceBase,
|
||||
MsEditDialog,
|
||||
MsTableHeader,
|
||||
MsTablePagination, MsTableButton, MsTableColumn, MsTable},
|
||||
MsTablePagination,
|
||||
MsTableButton,
|
||||
MsTableColumn,
|
||||
MsTable,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
|
@ -104,7 +108,7 @@ export default {
|
|||
total: 0,
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
projectId: '',
|
||||
projectId: "",
|
||||
result: {},
|
||||
treeNodes: [],
|
||||
projects: [],
|
||||
|
@ -114,8 +118,8 @@ export default {
|
|||
props: {
|
||||
testCaseContainIds: {
|
||||
type: Set,
|
||||
default: new Set()
|
||||
}
|
||||
default: new Set(),
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
|
@ -129,7 +133,6 @@ export default {
|
|||
fields() {
|
||||
return CUSTOM_FIELD_LIST;
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
|
@ -142,13 +145,16 @@ export default {
|
|||
if (this.projectId) {
|
||||
this.getProjectNode();
|
||||
this.condition.projectId = this.projectId;
|
||||
this.condition.testCaseContainIds = Array.from(this.testCaseContainIds)
|
||||
getTestCaseRelateIssue(this.currentPage, this.pageSize, this.condition)
|
||||
.then((response) => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
})
|
||||
this.condition.testCaseContainIds = Array.from(this.testCaseContainIds);
|
||||
getTestCaseRelateIssue(
|
||||
this.currentPage,
|
||||
this.pageSize,
|
||||
this.condition
|
||||
).then((response) => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
}
|
||||
},
|
||||
nodeChange(node, nodeIds, nodeNames) {
|
||||
|
@ -159,11 +165,10 @@ export default {
|
|||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
let data = {projectId: this.projectId}
|
||||
testCaseNodeListProject(data)
|
||||
.then((response) => {
|
||||
this.treeNodes = response.data;
|
||||
})
|
||||
let data = { projectId: this.projectId };
|
||||
testCaseNodeListProject(data).then((response) => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
},
|
||||
open() {
|
||||
this.$refs.baseRelevance.open();
|
||||
|
@ -171,17 +176,21 @@ export default {
|
|||
this.initTableData();
|
||||
},
|
||||
save() {
|
||||
this.$emit('save', this.$refs.table.selectRows);
|
||||
this.$emit("save", this.$refs.table.selectRows);
|
||||
this.$refs.table.clear();
|
||||
this.$refs.baseRelevance.close();
|
||||
},
|
||||
setProject(projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.node-tree {
|
||||
height: calc(100% - 45px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue