# Conflicts:
#	frontend/src/business/main.js
This commit is contained in:
fit2-zhao 2021-03-11 18:34:03 +08:00
commit 4cd4a7592b
10 changed files with 243 additions and 138 deletions

View File

@ -48,7 +48,8 @@
"vuex": "^3.1.2",
"xml-js": "^1.6.11",
"yan-progress": "^1.0.3",
"jsonpath": "^1.1.0"
"jsonpath": "^1.1.0",
"vue-minder-editor-plus": "^1.0.14"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",

View File

@ -24,57 +24,53 @@
:label="item.title"
:closable="item.closable"
:name="item.name">
<!-- 列表集合 -->
<ms-api-list
v-if="item.type === 'list' && activeDom==='api' "
@runTest="runTest"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
:queryDataType="queryDataType"
:selectDataRange="selectDataRange"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
@activeDomChange="activeDomChange"
@isApiListEnableChange="isApiListEnableChange"
ref="apiList"/>
<!--测试用例列表-->
<api-case-simple-list
v-if="item.type === 'list' && activeDom==='testCase' "
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
:queryDataType="queryDataType"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@isApiListEnableChange="isApiListEnableChange"
@activeDomChange="activeDomChange"
@handleCase="handleCase"
@showExecResult="showExecResult"
ref="apiList"/>
<api-documents-page class="api-doc-page"
v-if="item.type === 'list' && activeDom==='doc' "
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
:project-id="projectId"
:module-ids="selectNodeIds"
@activeDomChange="activeDomChange"
@isApiListEnableChange="isApiListEnableChange"
/>
<ms-tab-button
v-if="item.type === 'list'"
:active-dom.sync="activeDom"
:left-tip="$t('api_test.definition.api_title')"
:right-tip="$t('api_test.definition.doc_title')"
:middle-tip="$t('api_test.definition.case_title')"
left-content="API"
middle-content="CASE"
:right-content="$t('api_test.definition.doc_title')">
<!-- 列表集合 -->
<ms-api-list
v-if="activeDom==='left'"
@runTest="runTest"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:queryDataType="queryDataType"
:selectDataRange="selectDataRange"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
ref="apiList"/>
<!--测试用例列表-->
<api-case-simple-list
v-if="activeDom==='middle'"
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:queryDataType="queryDataType"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase"
@showExecResult="showExecResult"
ref="apiList"/>
<api-documents-page class="api-doc-page"
v-if="activeDom==='right'"
:project-id="projectId"
:module-ids="selectNodeIds"/>
</ms-tab-button>
<!-- 添加/编辑测试窗口-->
<div v-else-if="item.type=== 'ADD'" class="ms-api-div">
<div v-if="item.type=== 'ADD'" class="ms-api-div">
<ms-api-config :syncTabs="syncTabs" @runTest="runTest" @saveApi="saveApi" @createRootModel="createRootModel" ref="apiConfig"
:current-api="item.api"
:project-id="projectId"
@ -147,6 +143,8 @@ import MsApiModule from "./components/module/ApiModule";
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
import ApiDocumentsPage from "@/business/components/api/definition/components/list/ApiDocumentsPage";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsTabButton from "@/business/components/common/components/MsTabButton";
export default {
name: "ApiDefinition",
@ -155,17 +153,12 @@ import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
let routeParam = this.$route.params.dataType;
let redirectIDParam = this.$route.params.redirectID;
this.changeRedirectParam(redirectIDParam);
if (routeParam === 'apiTestCase') {
this.isApiListEnableChange(false);
this.activeDomChange("testCase");
} else {
this.isApiListEnableChange(true);
this.activeDomChange("api");
}
return routeParam;
},
},
components: {
MsTabButton,
MsTableButton,
ApiCaseSimpleList,
MsApiModule,
MsApiList,
@ -211,8 +204,7 @@ import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
type: "list",
closable: false
}],
isApiListEnable: true,
activeDom: "testCase",
activeDom: "left",
syncTabs: [],
projectId: "",
nodeTree: []
@ -247,12 +239,6 @@ import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
changeRedirectParam(redirectIDParam) {
this.redirectID = redirectIDParam;
},
isApiListEnableChange(data) {
this.isApiListEnable = data;
},
activeDomChange(tabType){
this.activeDom = tabType;
},
addTab(tab) {
if (tab.name === 'add') {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");

View File

@ -1,10 +1,6 @@
<template>
<div>
<api-list-container-with-doc
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
@activeDomChange="activeDomChange"
@isApiListEnableChange="isApiListEnableChange">
<div>
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{$t('commons.adv_search.title')}}</el-link>
<el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search" class="search-input" size="small"
@ -114,7 +110,7 @@
:type=type></header-custom>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</api-list-container-with-doc>
</div>
<api-case-list @showExecResult="showExecResult" @refresh="initTable" :currentApi="selectCase" ref="caseList"/>
<!--批量编辑-->
@ -145,9 +141,6 @@ import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
// import ApiListContainer from "./ApiListContainer";
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
@ -159,8 +152,8 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort, getLabel,} from "@/common/js/tableUtils";
import {API_CASE_LIST, API_LIST, API_SCENARIO_LIST, TEST_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List, Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {API_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -168,13 +161,11 @@ export default {
name: "ApiCaseSimpleList",
components: {
HeaderLabelOperate,
ApiListContainerWithDoc,
HeaderCustom,
MsTableHeaderSelectPopover,
MsSetEnvironment,
ApiCaseList,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
@ -247,10 +238,6 @@ export default {
type: Boolean,
default: false,
},
isApiListEnable: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false
@ -298,12 +285,6 @@ export default {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
activeDomChange(tabType) {
this.$emit("activeDomChange", tabType);
},
initTable() {
getLabel(this, API_CASE_LIST);
this.selectRows = new Set();

View File

@ -1,27 +1,16 @@
<template>
<div>
<api-list-container-with-doc
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
@activeDomChange="activeDomChange"
@isApiListEnableChange="isApiListEnableChange">
<api-document-item :project-id="projectId" :module-ids="moduleIds"/>
</api-list-container-with-doc>
</div>
</template>
<script>
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
import ApiDocumentItem from "@/business/components/api/definition/components/document/ApiDocumentItem";
export default {
name: "ApiDocumentsPage",
components: {
ApiListContainerWithDoc,
ApiDocumentItem,
},
data() {
@ -32,10 +21,6 @@ export default {
projectId:String,
moduleIds:Array,
activeDom:String,
isApiListEnable: {
type: Boolean,
default: false,
},
},
created: function () {
},
@ -45,12 +30,6 @@ export default {
},
methods: {
isApiListEnableChange(data){
this.$emit("isApiListEnableChange",data);
},
activeDomChange(data){
this.$emit("activeDomChange",data);
}
},
}
</script>

View File

@ -1,10 +1,6 @@
<template>
<div>
<api-list-container-with-doc
:is-api-list-enable="isApiListEnable"
:active-dom="activeDom"
@activeDomChange="activeDomChange"
@isApiListEnableChange="isApiListEnableChange">
<div>
<el-link type="primary" @click="open" style="float: right;margin-top: 5px">{{ $t('commons.adv_search.title') }}
</el-link>
@ -197,7 +193,7 @@
</el-table>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</api-list-container-with-doc>
</div>
<ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/>
<!--批量编辑-->
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
@ -226,14 +222,12 @@ import {downloadFile, getUUID} from "@/common/js/utils";
import {PROJECT_NAME} from '@/common/js/constants';
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
import ApiListContainer from "./ApiListContainer";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTipButton from "@/business/components/common/components/MsTipButton";
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
import {
_handleSelect,
_handleSelectAll, buildBatchParam, getLabel,
@ -241,7 +235,7 @@ import {
setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils";
import {_filter, _sort} from "@/common/js/tableUtils";
import {Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {Api_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
@ -255,7 +249,6 @@ export default {
CaseBatchMove,
ApiStatus,
MsTableHeaderSelectPopover,
ApiListContainerWithDoc,
MsTableButton,
MsTableOperatorButton,
MsTableOperator,
@ -349,7 +342,6 @@ export default {
type: Boolean,
default: false,
},
isApiListEnable: Boolean,
isReadOnly: {
type: Boolean,
default: false
@ -400,12 +392,6 @@ export default {
handleBatchMove() {
this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions);
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
activeDomChange(tabType){
this.$emit("activeDomChange",tabType);
},
initTable() {
getLabel(this, API_LIST);
this.selectRows = new Set();

View File

@ -0,0 +1,118 @@
<template>
<el-card class="card-content" v-if="isShow">
<el-button-group v-if="isShowChangeButton">
<el-tooltip v-if="leftButtonEnable" class="item" effect="dark" :content="leftTip" placement="left">
<el-button plain style="width: 44px;height: 32px;padding: 5px 8px;" :class="{active: leftActive}" @click="changeTab('left')">{{leftContent}}</el-button>
</el-tooltip>
<el-tooltip v-if="middleButtonEnable" class="item" effect="dark" :content="middleTip" placement="top">
<el-button plain style="width: 44px;height: 32px;padding: 1px;" :class="{active: middleActive}" @click="changeTab('middle')">{{middleContent}}</el-button>
</el-tooltip>
<el-tooltip v-if="rightButtonEnable" class="item" effect="dark" :content="rightTip" placement="right">
<el-button plain style="width: 44px;height: 32px;padding: 1px;" :class="{active: rightActive}" @click="changeTab('right')">
{{rightContent}}
</el-button>
</el-tooltip>
</el-button-group>
<template v-slot:header>
<slot name="header"></slot>
</template>
<slot></slot>
</el-card>
</template>
<script>
export default {
name: "MsTabButton",
data() {
return {
isShow: true,
showApiList:false,
showTestCaseList:false,
showDocList:true,
}
},
props: {
activeDom: String,
isShowChangeButton: {
type: Boolean,
default: true
},
leftButtonEnable: {
type: Boolean,
default: true
},
middleButtonEnable: {
type: Boolean,
default: true
},
rightButtonEnable: {
type: Boolean,
default: true
},
leftContent: {
type: String,
default: 'left'
},
middleContent: {
type: String,
default: 'middle'
},
rightContent: {
type: String,
default: 'right'
},
leftTip: {
type: String,
default: 'left'
},
middleTip: {
type: String,
default: 'middle'
},
rightTip: {
type: String,
default: 'right'
},
},
computed: {
leftActive() {
return this.activeDom === 'left';
},
middleActive() {
return this.activeDom === 'middle';
},
rightActive() {
return this.activeDom === 'right';
},
},
methods: {
changeTab(tabType){
this.$emit("update:activeDom", tabType);
},
},
}
</script>
<style scoped>
.active {
border: solid 1px #6d317c;
background-color: var(--color);
color: #FFFFFF;
}
.case-button {
border-left: solid 1px var(--color);
}
.item{
border: solid 1px var(--color);
}
</style>

View File

@ -14,7 +14,15 @@
<ms-main-container>
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane name="default" :label="$t('api_test.definition.case_title')">
<ms-tab-button
:active-dom.sync="activeDom"
:left-tip="'用例列表'"
:left-content="'CAS'"
:right-tip="'E脑图'"
:right-content="'脑图'"
:middle-button-enable="false">
<test-case-list
v-if="activeDom === 'left'"
:checkRedirectID="checkRedirectID"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
@ -29,6 +37,10 @@
@setCondition="setCondition"
ref="testCaseList">
</test-case-list>
<testcase-minder
v-if="activeDom === 'right'"
ref="testCaseList"/>
</ms-tab-button>
</el-tab-pane>
<el-tab-pane
:key="item.name"
@ -85,10 +97,14 @@ import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getUUID, hasRoles} from "../../../../common/js/utils";
import TestCaseNodeTree from "../common/TestCaseNodeTree";
import {TrackEvent,LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import TestcaseMinder from "@/business/components/track/case/components/minder/TestcaseMinder";
import MsTabButton from "@/business/components/common/components/MsTabButton";
export default {
name: "TestCase",
components: {
MsTabButton,
TestcaseMinder,
TestCaseNodeTree,
MsMainContainer,
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu
@ -109,8 +125,8 @@ export default {
tabs: [],
renderComponent:true,
loading: false,
type:''
type:'',
activeDom: 'left'
}
},
mounted() {

View File

@ -1,12 +1,9 @@
<template>
<div class="card-container">
<el-card class="card-content" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:tip="$t('commons.search_by_name_or_id')" title="" :show-create="false"
/>
</template>
<div class="card-container" v-loading="result.loading">
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:tip="$t('commons.search_by_name_or_id')" title="" :show-create="false"/>
<el-table
border
:data="tableData"
@ -168,7 +165,6 @@
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
:typeArr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>

View File

@ -0,0 +1,41 @@
<template>
<div class="minder">
<minder-editor class="minder-container" :import-json="importJson"/>
</div>
</template>
<script>
export default {
name: "TestcaseMinder",
components: {},
data() {
return {
importJson: {
"root": {
"data": {
"text": "test111"
},
"children": [
{ "data": { "text": "新闻"}},
{ "data": { "text": "网页"} },
{ "data": { "text": "贴吧"} },
{ "data": { "text": "知道"} },
{ "data": { "text": "音乐" } },
{ "data": { "text": "图片"} },
{ "data": { "text": "视频"} },
{ "data": { "text": "地图" } },
{ "data": { "text": "百科","expandState":"collapse"}}
]
},
"template":"default"
}
}
},
mounted() {
}
}
</script>
<style scoped>
</style>

View File

@ -22,10 +22,11 @@ import {left2RightDrag, bottom2TopDrag, right2LeftDrag} from "../common/js/direc
import JsonSchemaEditor from './components/common/json-schema/schema/index';
import JSONPathPicker from 'vue-jsonpath-picker';
import VueClipboard from 'vue-clipboard2'
import vueMinderEditor from 'vue-minder-editor-plus'
Vue.use(vueMinderEditor)
Vue.use(JsonSchemaEditor);
import VuePapaParse from 'vue-papa-parse'
Vue.use(VuePapaParse)
Vue.config.productionTip = false;