Merge branch 'v1.8'

This commit is contained in:
Captain.B 2021-03-29 15:51:57 +08:00
commit 966b7318ca
31 changed files with 148 additions and 113 deletions

View File

@ -234,6 +234,10 @@ public class ApiAutomationService {
} else { } else {
scenario.setUserId(request.getUserId()); scenario.setUserId(request.getUserId());
} }
if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || StringUtils.isEmpty(request.getModulePath())) {
scenario.setApiScenarioModuleId("root");
scenario.setModulePath("/默认模块");
}
return scenario; return scenario;
} }

View File

@ -67,7 +67,7 @@
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer"; import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsApiScenarioList from "@/business/components/api/automation/scenario/ApiScenarioList"; import MsApiScenarioList from "@/business/components/api/automation/scenario/ApiScenarioList";
import {getUUID, downloadFile, checkoutTestManagerOrTestUser} from "@/common/js/utils"; import {getUUID, downloadFile, checkoutTestManagerOrTestUser,getCurrentUser} from "@/common/js/utils";
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule"; import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import MsEditApiScenario from "./scenario/EditApiScenario"; import MsEditApiScenario from "./scenario/EditApiScenario";
@ -127,7 +127,6 @@
'$route'(to, from) { // ctrl s '$route'(to, from) { // ctrl s
if (to.path.indexOf('/api/automation') == -1) { if (to.path.indexOf('/api/automation') == -1) {
if (this.$refs && this.$refs.autoScenarioConfig) { if (this.$refs && this.$refs.autoScenarioConfig) {
// console.log(this.$refs.autoScenarioConfig);
this.$refs.autoScenarioConfig.forEach(item => { this.$refs.autoScenarioConfig.forEach(item => {
item.removeListener(); item.removeListener();
}); });
@ -189,7 +188,16 @@
let label = this.$t('api_test.automation.add_scenario'); let label = this.$t('api_test.automation.add_scenario');
let name = getUUID().substring(0, 8); let name = getUUID().substring(0, 8);
this.activeName = name; this.activeName = name;
this.tabs.push({label: label, name: name, currentScenario: {apiScenarioModuleId: "", id: getUUID()}}); let currentScenario = {
status: "Underway", principal: getCurrentUser().id,
apiScenarioModuleId: "root", id: getUUID(),
modulePath: "/" + this.$t("commons.module_title")
};
if (this.nodeTree && this.nodeTree.length > 0) {
currentScenario.apiScenarioModuleId = this.nodeTree[0].id;
currentScenario.modulePath = this.nodeTree[0].path;
}
this.tabs.push({label: label, name: name, currentScenario: currentScenario});
} }
if (tab.name === 'edit') { if (tab.name === 'edit') {
let label = this.$t('api_test.automation.add_scenario'); let label = this.$t('api_test.automation.add_scenario');

View File

@ -29,7 +29,7 @@
@refresh="refresh" @refresh="refresh"
ref="basisScenario"/> ref="basisScenario"/>
<api-import ref="apiImport" :moduleOptions="moduleOptions" @refreshAll="$emit('refreshAll')"/> <api-import ref="apiImport" :moduleOptions="extendTreeNodes" @refreshAll="$emit('refreshAll')"/>
</div> </div>
</template> </template>
@ -38,7 +38,7 @@
import SelectMenu from "../../../track/common/SelectMenu"; import SelectMenu from "../../../track/common/SelectMenu";
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario"; import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
import MsNodeTree from "../../../track/common/NodeTree"; import MsNodeTree from "../../../track/common/NodeTree";
import {buildNodePath} from "../../definition/model/NodeTree"; import {buildNodePath, buildTree} from "../../definition/model/NodeTree";
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton"; import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
import ApiImport from "./common/ScenarioImport"; import ApiImport from "./common/ScenarioImport";
import MsSearchBar from "@/business/components/common/components/search/MsSearchBar"; import MsSearchBar from "@/business/components/common/components/search/MsSearchBar";
@ -82,9 +82,10 @@
trashEnable: false trashEnable: false
}, },
data: [], data: [],
extendTreeNodes: [],
currentModule: undefined, currentModule: undefined,
moduleOptions: [], moduleOptions: [],
operators: [ operators: [
{ {
label: this.$t('api_test.automation.add_scenario'), label: this.$t('api_test.automation.add_scenario'),
callback: this.addScenario callback: this.addScenario
@ -97,7 +98,7 @@
label: this.$t('report.export'), label: this.$t('report.export'),
children: [ children: [
{ {
label: this.$t('report.export_to_ms_format') , label: this.$t('report.export_to_ms_format'),
callback: () => { callback: () => {
this.$emit('exportAPI'); this.$emit('exportAPI');
} }
@ -187,11 +188,17 @@
this.result = this.$get(url, response => { this.result = this.$get(url, response => {
if (response.data != undefined && response.data != null) { if (response.data != undefined && response.data != null) {
this.data = response.data; this.data = response.data;
let moduleOptions = []; this.extendTreeNodes = [];
this.data.forEach(node => { this.extendTreeNodes.unshift({
buildNodePath(node, {path: ''}, moduleOptions); "id": "root",
"name": this.$t('commons.module_title'),
"level": 0,
"children": this.data,
}); });
this.$emit('setModuleOptions', moduleOptions); this.extendTreeNodes.forEach(node => {
buildTree(node, {path: ''});
});
this.$emit('setModuleOptions', this.extendTreeNodes);
this.$emit('setNodeTree', this.data); this.$emit('setNodeTree', this.data);
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);

View File

@ -22,9 +22,7 @@
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item :label="$t('test_track.module.module')" prop="apiScenarioModuleId"> <el-form-item :label="$t('test_track.module.module')" prop="apiScenarioModuleId">
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.apiScenarioModuleId"> <ms-select-tree size="small" :data="moduleOptions" :defaultKey="currentScenario.apiScenarioModuleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
@ -244,6 +242,7 @@
import MaximizeScenario from "./maximize/MaximizeScenario"; import MaximizeScenario from "./maximize/MaximizeScenario";
import ScenarioHeader from "./maximize/ScenarioHeader"; import ScenarioHeader from "./maximize/ScenarioHeader";
import MsDrawer from "../../../common/components/MsDrawer"; import MsDrawer from "../../../common/components/MsDrawer";
import MsSelectTree from "../../../common/select-tree/SelectTree";
let jsonPath = require('jsonpath'); let jsonPath = require('jsonpath');
export default { export default {
@ -266,7 +265,8 @@
EnvPopover, EnvPopover,
MaximizeScenario, MaximizeScenario,
ScenarioHeader, ScenarioHeader,
MsDrawer MsDrawer,
MsSelectTree
}, },
data() { data() {
return { return {
@ -274,6 +274,10 @@
label: "label", label: "label",
children: "hashTree" children: "hashTree"
}, },
moduleObj: {
id: 'id',
label: 'name',
},
rules: { rules: {
name: [ name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'}, {required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
@ -450,6 +454,10 @@
}, },
}, },
methods: { methods: {
setModule(id,data) {
this.currentScenario.apiScenarioModuleId = id;
this.currentScenario.modulePath = data.path;
},
setHideBtn() { setHideBtn() {
this.isBtnHide = false; this.isBtnHide = false;
}, },
@ -905,15 +913,6 @@
this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1); this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1);
} }
}, },
getPath(id) {
if (id === null) {
return null;
}
let path = this.moduleOptions.filter(function (item) {
return item.id === id ? item.path : "";
});
return path[0].path;
},
setFiles(item, bodyUploadFiles, obj) { setFiles(item, bodyUploadFiles, obj) {
if (item.body) { if (item.body) {
if (item.body.kvs) { if (item.body.kvs) {
@ -1071,7 +1070,6 @@
setParameter() { setParameter() {
this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.stepTotal = this.scenarioDefinition.length;
this.currentScenario.projectId = this.projectId; this.currentScenario.projectId = this.projectId;
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
// 便 // 便
let scenario = { let scenario = {
id: this.currentScenario.id, id: this.currentScenario.id,

View File

@ -31,7 +31,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('test_track.module.module')" prop="moduleId"> <el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<ms-select-tree size="small" :data="moduleOptions" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/> <ms-select-tree size="small" :data="moduleOptions" :defaultKey="httpForm.moduleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.description')" prop="description" style="margin-bottom: 29px"> <el-form-item :label="$t('commons.description')" prop="description" style="margin-bottom: 29px">
@ -64,6 +64,7 @@
import {createComponent, Request} from "../../../definition/components/jmeter/components"; import {createComponent, Request} from "../../../definition/components/jmeter/components";
import {getUUID} from "@/common/js/utils"; import {getUUID} from "@/common/js/utils";
import MsSelectTree from "@/business/components/common/select-tree/SelectTree"; import MsSelectTree from "@/business/components/common/select-tree/SelectTree";
import {buildTree} from "../../../definition/model/NodeTree";
export default { export default {
@ -83,7 +84,7 @@
callback(); callback();
}; };
return { return {
httpForm: {environmentId: ""}, httpForm: {environmentId: "", moduleId: "root"},
moduleOptions: [], moduleOptions: [],
httpVisible: false, httpVisible: false,
currentModule: {}, currentModule: {},
@ -250,13 +251,23 @@
let url = "/api/module/list/" + getCurrentProjectID() + "/" + data.protocol; let url = "/api/module/list/" + getCurrentProjectID() + "/" + data.protocol;
this.result = this.$get(url, response => { this.result = this.$get(url, response => {
if (response.data != undefined && response.data != null) { if (response.data != undefined && response.data != null) {
this.moduleOptions = response.data; let data = response.data;
this.moduleOptions = [];
this.moduleOptions.unshift({
"id": "root",
"name": this.$t('commons.module_title'),
"level": 0,
"children": data,
});
this.moduleOptions.forEach(node => {
buildTree(node, {path: ''});
});
} }
}); });
}, },
setModule(id) { setModule(id, data) {
this.httpForm.moduleId = id; this.httpForm.moduleId = id;
//this.reload(); this.httpForm.modulePath = data.path;
}, },
reload() { reload() {
this.loading = true this.loading = true
@ -271,7 +282,7 @@
data.protocol = "DUBBO"; data.protocol = "DUBBO";
} }
data.id = getUUID(); data.id = getUUID();
this.httpForm = {id: data.id, name: data.name, protocol: data.protocol, path: data.path, method: api.method, userId: getCurrentUser().id, request: data}; this.httpForm = {id: data.id, name: data.name, protocol: data.protocol, path: data.path, method: api.method, userId: getCurrentUser().id, request: data, moduleId: "root"};
this.getMaintainerOptions(); this.getMaintainerOptions();
this.list(data); this.list(data);
this.httpVisible = true; this.httpVisible = true;

View File

@ -28,9 +28,12 @@
<div class="header-right" @click.stop> <div class="header-right" @click.stop>
<slot name="message"></slot> <slot name="message"></slot>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn"> <el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root"/> <el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root" style="width: 30px"/>
</el-tooltip> </el-tooltip>
<slot name="button"></slot> <slot name="button"></slot>
<el-tooltip content="Copy" placement="top">
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px"/>
</el-tooltip>
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && (!data.disabled || data.root)"/> <step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && (!data.disabled || data.root)"/>
</div> </div>

View File

@ -22,11 +22,9 @@
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
<el-form-item :label="$t('commons.import_module')"> <el-form-item :label="$t('commons.import_module')">
<el-select size="small" v-model="formData.moduleId" class="project-select" clearable> <ms-select-tree size="small" :data="moduleOptions" :defaultKey="formData.moduleId" @getValue="setModule" :obj="moduleObj" clearable checkStrictly/>
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="!isHar" :label="$t('commons.import_mode')"> <el-form-item v-if="!isHar" :label="$t('commons.import_mode')">
<el-select size="small" v-model="formData.modeId" class="project-select" clearable> <el-select size="small" v-model="formData.modeId" class="project-select" clearable>
<el-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/> <el-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/>
</el-select> </el-select>
@ -70,16 +68,17 @@
<script> <script>
import MsDialogFooter from "../../../../common/components/MsDialogFooter"; import MsDialogFooter from "../../../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
export default { export default {
name: "ScenarioImport", name: "ScenarioImport",
components: {MsDialogFooter}, components: {MsDialogFooter, MsSelectTree},
props: { props: {
saved: { saved: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
moduleOptions: {} moduleOptions: Array,
}, },
data() { data() {
return { return {
@ -140,7 +139,11 @@
}, },
rules: {}, rules: {},
currentModule: {}, currentModule: {},
fileList: [] fileList: [],
moduleObj: {
id: 'id',
label: 'name',
},
} }
}, },
activated() { activated() {
@ -257,7 +260,11 @@
this.fileList = []; this.fileList = [];
removeGoBackListener(this.close); removeGoBackListener(this.close);
this.visible = false; this.visible = false;
} },
setModule(id, data) {
this.formData.moduleId = id;
this.formData.modulePath = data.path;
},
} }
} }
</script> </script>

View File

@ -23,7 +23,7 @@
<template v-slot:button> <template v-slot:button>
<el-tooltip :content="$t('api_test.run')" placement="top"> <el-tooltip :content="$t('api_test.run')" placement="top">
<el-button @click="run" icon="el-icon-video-play" class="ms-btn" size="mini" circle/> <el-button @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
</el-tooltip> </el-tooltip>
</template> </template>
@ -289,6 +289,9 @@
}, },
active(item) { active(item) {
this.request.active = !this.request.active; this.request.active = !this.request.active;
if (this.node) {
this.node.expanded = this.request.active;
}
this.reload(); this.reload();
}, },
run() { run() {

View File

@ -105,11 +105,11 @@
remove() { remove() {
this.$emit('remove', this.scenario, this.node); this.$emit('remove', this.scenario, this.node);
}, },
active(item) { active() {
if (item && item.active) { if (this.node) {
item.active = !item.active; this.node.expanded = !this.node.expanded;
}
this.reload(); this.reload();
}
}, },
copyRow() { copyRow() {
this.$emit('copyRow', this.scenario, this.node); this.$emit('copyRow', this.scenario, this.node);

View File

@ -61,6 +61,9 @@
}, },
active() { active() {
this.request.active = !this.request.active; this.request.active = !this.request.active;
if (this.node) {
this.node.expanded = this.request.active;
}
}, },
} }
} }

View File

@ -27,7 +27,7 @@
</template> </template>
<template v-slot:button> <template v-slot:button>
<el-button @click="runDebug" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;" size="mini" circle/> <el-button @click="runDebug" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;padding: 5px" size="mini" circle/>
</template> </template>
<div v-if="controller.loopType==='LOOP_COUNT'" draggable> <div v-if="controller.loopType==='LOOP_COUNT'" draggable>
<el-row> <el-row>
@ -246,6 +246,9 @@
}, },
active(item) { active(item) {
item.active = !item.active; item.active = !item.active;
if (this.node) {
this.node.expanded = item.active;
}
this.reload(); this.reload();
}, },
changeRadio() { changeRadio() {

View File

@ -5,7 +5,7 @@
<el-icon class="el-icon-more"></el-icon> <el-icon class="el-icon-more"></el-icon>
</el-link> </el-link>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="copy">复制步骤</el-dropdown-item> <!--<el-dropdown-item command="copy">复制步骤</el-dropdown-item>-->
<el-dropdown-item command="remove" v-tester>删除步骤</el-dropdown-item> <el-dropdown-item command="remove" v-tester>删除步骤</el-dropdown-item>
<el-dropdown-item command="scenarioVar" v-tester v-if="data.type==='scenario'">查看场景变量</el-dropdown-item> <el-dropdown-item command="scenarioVar" v-tester v-if="data.type==='scenario'">查看场景变量</el-dropdown-item>
<el-dropdown-item command="openScenario" v-tester v-if="data.type==='scenario' && data.referenced==='REF'">打开场景</el-dropdown-item> <el-dropdown-item command="openScenario" v-tester v-if="data.type==='scenario' && data.referenced==='REF'">打开场景</el-dropdown-item>

View File

@ -296,8 +296,12 @@
} }
let api = { let api = {
status: "Underway", method: "GET", userId: getCurrentUser().id, status: "Underway", method: "GET", userId: getCurrentUser().id,
url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'root', url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'root', modulePath: "/" + this.$t("commons.module_title")
}; };
if (this.nodeTree && this.nodeTree.length > 0) {
api.moduleId = this.nodeTree[0].id;
api.modulePath = this.nodeTree[0].path;
}
this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api); this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api);
}, },
handleTabClose() { handleTabClose() {

View File

@ -281,7 +281,7 @@
let data = this.api; let data = this.api;
data.name = this.apiCase.name; data.name = this.apiCase.name;
data.moduleId = module; data.moduleId = module;
data.modulePath = '/默认模块'; data.modulePath ="/"+ this.$t('commons.module_title');
this.setParameters(data); this.setParameters(data);
let bodyFiles = this.getBodyUploadFiles(data); let bodyFiles = this.getBodyUploadFiles(data);
this.$fileUpload("/api/definition/create", null, bodyFiles, data, () => { this.$fileUpload("/api/definition/create", null, bodyFiles, data, () => {

View File

@ -157,7 +157,7 @@ import {parseEnvironment} from "@/business/components/api/test/model/Environment
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components"; import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort, getLabel, getSystemLabel,} from "@/common/js/tableUtils"; import {_filter, _handleSelect, _handleSelectAll, _sort, getLabel} from "@/common/js/tableUtils";
import {API_CASE_LIST} from "@/common/js/constants"; import {API_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List} from "@/business/components/common/model/JsonData"; import {Api_Case_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
@ -263,7 +263,6 @@ export default {
}, },
created: function () { created: function () {
this.initTable(); this.initTable();
getSystemLabel(this, this.type)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.caseTable.bodyWrapper.scrollTop = 5 this.$refs.caseTable.bodyWrapper.scrollTop = 5
}) })

View File

@ -235,7 +235,7 @@
import { import {
_handleSelect, _handleSelect,
_handleSelectAll, buildBatchParam, getLabel, _handleSelectAll, buildBatchParam, getLabel,
getSelectDataCounts, getSystemLabel, initCondition, getSelectDataCounts, initCondition,
setUnSelectIds, toggleAllSelection setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import {_filter, _sort} from "@/common/js/tableUtils"; import {_filter, _sort} from "@/common/js/tableUtils";
@ -380,7 +380,6 @@
} else { } else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]}; this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
} }
this.getSystemLabel(this.type)
this.initTable(); this.initTable();
this.getMaintainerOptions(); this.getMaintainerOptions();
}, },
@ -405,15 +404,6 @@
} }
}, },
methods: { methods: {
getSystemLabel(type) {
let param = {}
param.type = type
this.$post('/system/system/header', param, response => {
if (response.data != null) {
this.tableLabel = eval(response.data.props);
}
})
},
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },

View File

@ -7,7 +7,6 @@
v-loading="result.loading" v-loading="result.loading"
:tree-nodes="data" :tree-nodes="data"
:type="isReadOnly ? 'view' : 'edit'" :type="isReadOnly ? 'view' : 'edit'"
:allLabel="'默认模块'"
@add="add" @add="add"
@edit="edit" @edit="edit"
@drag="drag" @drag="drag"
@ -135,7 +134,7 @@
this.extendTreeNodes = []; this.extendTreeNodes = [];
this.extendTreeNodes.unshift({ this.extendTreeNodes.unshift({
"id": "root", "id": "root",
"name": "默认模块", "name": this.$t('commons.module_title'),
"level": 0, "level": 0,
"children": this.data, "children": this.data,
}); });

View File

@ -236,7 +236,9 @@
setKey(thisKey) { setKey(thisKey) {
this.$refs.tree.setCurrentKey(thisKey); this.$refs.tree.setCurrentKey(thisKey);
let node = this.$refs.tree.getNode(thisKey); let node = this.$refs.tree.getNode(thisKey);
this.setData(node.data); if (node && node.data) {
this.setData(node.data);
}
}, },
// //
setData(data) { setData(data) {
@ -287,7 +289,7 @@
}, },
// //
popoverHide() { popoverHide() {
this.$emit('getValue', this.returnDataKeys, this.returnDatas); this.$emit('getValue', this.returnDataKeys, this.returnDatas ? this.returnDatas : {});
}, },
// //
clearSelectedNodes() { clearSelectedNodes() {

View File

@ -35,20 +35,8 @@
<el-col :span="7"> <el-col :span="7">
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module"> <el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-select <ms-select-tree :disabled="readOnly" :data="moduleOptions" :defaultKey="form.module" :obj="moduleObj"
v-model="form.module" @getValue="setModule" clearable checkStrictly size="small" />
:disabled="readOnly"
:placeholder="$t('test_track.case.input_module')"
filterable
class="ms-case-input">
<el-option
v-for="item in moduleOptions"
:key="item.id"
:label="item.path"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
@ -292,7 +280,7 @@ import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getCurrentUser, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {Message} from "element-ui"; import {Message} from "element-ui";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import {buildNodePath} from "../../../api/definition/model/NodeTree"; import {buildNodePath,buildTree} from "../../../api/definition/model/NodeTree";
import CaseComment from "@/business/components/track/case/components/CaseComment"; import CaseComment from "@/business/components/track/case/components/CaseComment";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsPreviousNextButton from "../../../common/components/MsPreviousNextButton"; import MsPreviousNextButton from "../../../common/components/MsPreviousNextButton";
@ -301,12 +289,13 @@ import TestCaseComment from "@/business/components/track/case/components/TestCas
import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem"; import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem";
import {API_STATUS, REVIEW_STATUS, TEST} from "@/business/components/api/definition/model/JsonData"; import {API_STATUS, REVIEW_STATUS, TEST} from "@/business/components/api/definition/model/JsonData";
import MsTableButton from "@/business/components/common/components/MsTableButton"; import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsSelectTree from "../../../common/select-tree/SelectTree";
export default { export default {
name: "TestCaseEdit", name: "TestCaseEdit",
components: { components: {
MsTableButton, MsTableButton,
MsSelectTree,
ReviewCommentItem, ReviewCommentItem,
TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment
}, },
@ -325,7 +314,8 @@ export default {
dialogFormVisible: false, dialogFormVisible: false,
form: { form: {
name: '', name: '',
module: '', module: 'root',
nodePath:'',
maintainer: getCurrentUser().id, maintainer: getCurrentUser().id,
priority: 'P0', priority: 'P0',
type: '', type: '',
@ -381,6 +371,10 @@ export default {
index: 0, index: 0,
showInputTag: true, showInputTag: true,
tableType:"", tableType:"",
moduleObj: {
id: 'id',
label: 'name',
},
}; };
}, },
props: { props: {
@ -421,6 +415,10 @@ export default {
}; };
}); });
}, 1000); }, 1000);
if(this.selectNode && this.selectNode.data){
this.form.module = this.selectNode.data.id;
this.form.nodePath = this.selectNode.data.path;
}
}, },
watch: { watch: {
treeNodes() { treeNodes() {
@ -435,6 +433,10 @@ export default {
this.addListener(); // ctrl s this.addListener(); // ctrl s
}, },
methods: { methods: {
setModule(id,data) {
this.form.module = id;
this.form.nodePath = data.path;
},
clearInput() { clearInput() {
//this.$refs['cascade'].panel.clearCheckedNodes() //this.$refs['cascade'].panel.clearCheckedNodes()
}, },
@ -740,7 +742,6 @@ export default {
}*/ }*/
this.tableType='edit'; this.tableType='edit';
this.$emit("refresh",this.form); this.$emit("refresh",this.form);
console.log(response.data)
this.form.id=response.data this.form.id=response.data
if (this.type === 'add' || this.type === 'copy') { if (this.type === 'add' || this.type === 'copy') {
param.id = response.data; param.id = response.data;
@ -761,11 +762,6 @@ export default {
Object.assign(param, this.form); Object.assign(param, this.form);
param.steps = JSON.stringify(this.form.steps); param.steps = JSON.stringify(this.form.steps);
param.nodeId = this.form.module; param.nodeId = this.form.module;
this.moduleOptions.forEach(item => {
if (this.form.module === item.id) {
param.nodePath = item.path;
}
});
if (this.projectId) { if (this.projectId) {
param.projectId = this.projectId; param.projectId = this.projectId;
} }
@ -838,11 +834,16 @@ export default {
this.getTestOptions() this.getTestOptions()
}, },
getModuleOptions() { getModuleOptions() {
let moduleOptions = []; this.moduleOptions = [];
this.treeNodes.forEach(node => { this.moduleOptions.unshift({
buildNodePath(node, {path: ''}, moduleOptions); "id": "root",
"name": this.$t('commons.module_title'),
"level": 0,
"children": this.treeNodes,
});
this.moduleOptions.forEach(node => {
buildTree(node, {path: ''});
}); });
this.moduleOptions = moduleOptions;
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID); let workspaceId = localStorage.getItem(WORKSPACE_ID);

View File

@ -161,7 +161,7 @@ import {
_handleSelect, _handleSelect,
_handleSelectAll, _handleSelectAll,
_sort, buildBatchParam, getLabel, _sort, buildBatchParam, getLabel,
getSelectDataCounts, getSystemLabel, initCondition, getSelectDataCounts, initCondition,
setUnSelectIds, setUnSelectIds,
toggleAllSelection toggleAllSelection
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";

View File

@ -92,7 +92,7 @@ export default {
allLabel: { allLabel: {
type: String, type: String,
default() { default() {
return this.$t("commons.all_label.case"); return this.$t('commons.module_title');
} }
}, },
nameLimit: { nameLimit: {

View File

@ -225,7 +225,7 @@ import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components"; import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain" import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {TEST_PLAN_LIST} from "@/common/js/constants"; import {TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List} from "@/business/components/common/model/JsonData"; import {Test_Plan_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
@ -291,7 +291,6 @@ export default {
} }
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
getSystemLabel(this, this.type)
}, },
methods: { methods: {
inite() { inite() {

View File

@ -161,7 +161,7 @@ import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan"; import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group"; import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants"; import {TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Api_Case} from "@/business/components/common/model/JsonData"; import {Test_Plan_Api_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -268,7 +268,6 @@ export default {
created: function () { created: function () {
this.getMaintainerOptions(); this.getMaintainerOptions();
this.initTable(); this.initTable();
getSystemLabel(this, this.type)
}, },
activated() { activated() {

View File

@ -109,7 +109,7 @@ import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn"
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns"; import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList"; import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader"; import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll, getLabel, getSystemLabel} from "../../../../../../../common/js/tableUtils"; import {_handleSelect, _handleSelectAll, getLabel} from "../../../../../../../common/js/tableUtils";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants"; import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
@ -188,7 +188,6 @@ export default {
}, },
created() { created() {
this.search(); this.search();
getSystemLabel(this, this.type)
}, },
watch: { watch: {

View File

@ -296,7 +296,7 @@ import BatchEdit from "../../../../case/components/BatchEdit";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import {hub} from "@/business/components/track/plan/event-bus"; import {hub} from "@/business/components/track/plan/event-bus";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData"; import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -424,9 +424,6 @@ export default {
beforeDestroy() { beforeDestroy() {
hub.$off("openFailureTestCase"); hub.$off("openFailureTestCase");
}, },
created() {
getSystemLabel(this, this.type)
},
methods: { methods: {
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)

View File

@ -131,7 +131,7 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus"; import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton"; import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport"; import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants"; import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData"; import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
@ -198,7 +198,7 @@ export default {
created() { created() {
this.initTable(); this.initTable();
this.refreshStatus(); this.refreshStatus();
getSystemLabel(this, this.type)
}, },
watch: { watch: {

View File

@ -122,7 +122,7 @@ import {
checkoutTestManagerOrTestUser, checkoutTestManagerOrTestUser,
getCurrentWorkspaceId getCurrentWorkspaceId
} from "../../../../../common/js/utils"; } from "../../../../../common/js/utils";
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem"; import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import {Test_Case_Review} from "@/business/components/common/model/JsonData"; import {Test_Case_Review} from "@/business/components/common/model/JsonData";
import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants"; import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
@ -173,7 +173,6 @@ export default {
}, },
created() { created() {
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
getSystemLabel(this, this.type)
this.initTableData(); this.initTableData();
}, },
computed: { computed: {

View File

@ -202,7 +202,7 @@ import {
} from "../../../../../../common/js/constants"; } from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit"; import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort, getLabel, getSystemLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData"; import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -296,9 +296,6 @@ export default {
this.refreshTableAndReview(); this.refreshTableAndReview();
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
}, },
created() {
getSystemLabel(this, this.type)
},
methods: { methods: {
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)

View File

@ -5,6 +5,7 @@ export default {
pass_rate: 'Pass rate', pass_rate: 'Pass rate',
execution_times: 'Execution times', execution_times: 'Execution times',
cover: 'Cover', cover: 'Cover',
module_title: 'Default module',
not_cover: 'Not Cover', not_cover: 'Not Cover',
import: 'Import', import: 'Import',
import_success: 'Import success', import_success: 'Import success',

View File

@ -5,6 +5,7 @@ export default {
pass_rate: '通过率', pass_rate: '通过率',
execution_times: '执行次数', execution_times: '执行次数',
cover: '覆盖', cover: '覆盖',
module_title: '默认模块',
not_cover: '不覆盖', not_cover: '不覆盖',
import: '导入', import: '导入',
import_success: '导入成功', import_success: '导入成功',

View File

@ -5,6 +5,7 @@ export default {
pass_rate: '通過率', pass_rate: '通過率',
execution_times: '執行次數', execution_times: '執行次數',
cover: '覆蓋', cover: '覆蓋',
module_title: '默認模塊',
not_cover: '不覆蓋', not_cover: '不覆蓋',
import: '導入', import: '導入',
import_success: '導入成功', import_success: '導入成功',