Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-03-23 20:20:08 +08:00
commit 691cf5a380
34 changed files with 373 additions and 309 deletions

View File

@ -36,9 +36,12 @@
SELECT * FROM ( SELECT * FROM (
SELECT testCase.testCaseID,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType SELECT testCase.testCaseID,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType
FROM ( FROM (
SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName FROM api_test_case apiCase SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName, testPlanCase.update_time as updateTime
FROM api_test_case apiCase
inner join api_definition on api_definition.id = apiCase.api_definition_id
INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id
INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id
and api_definition.status != 'Trash'
GROUP BY apiCase.id GROUP BY apiCase.id
ORDER BY apiCase.create_time DESC ORDER BY apiCase.create_time DESC
)testCase )testCase
@ -48,7 +51,7 @@
SELECT id FROM api_test_case WHERE project_id = #{projectId} SELECT id FROM api_test_case WHERE project_id = #{projectId}
) and `status` = 'error' GROUP BY resource_id ) and `status` = 'error' GROUP BY resource_id
) caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID ) caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID
WHERE caseErrorCountData.executeTime >= #{startTimestamp} WHERE testCase.updateTime >= #{startTimestamp}
UNION UNION
SELECT scene.id AS testCaseID,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType SELECT scene.id AS testCaseID,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
FROM api_scenario_report report FROM api_scenario_report report

View File

@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -87,18 +86,10 @@ public class TrackService {
public List<ChartsData> getCaseMaintenanceBar(String projectId) { public List<ChartsData> getCaseMaintenanceBar(String projectId) {
List<TrackCountResult> funcMaintainer = extTestCaseMapper.countFuncMaintainer(projectId); List<TrackCountResult> funcMaintainer = extTestCaseMapper.countFuncMaintainer(projectId);
List<TrackCountResult> relevanceMaintainer = extTestCaseMapper.countRelevanceMaintainer(projectId); List<TrackCountResult> relevanceMaintainer = extTestCaseMapper.countRelevanceMaintainer(projectId);
List<String> list = relevanceMaintainer.stream().map(TrackCountResult::getGroupField).collect(Collectors.toList());
List<ChartsData> charts = new ArrayList<>(); List<ChartsData> charts = new ArrayList<>();
for (TrackCountResult result : funcMaintainer) { for (TrackCountResult result : funcMaintainer) {
String groupField = result.getGroupField(); String groupField = result.getGroupField();
if (!list.contains(groupField)) {
// 创建了功能用例但是未关联测试
TrackCountResult trackCount = new TrackCountResult();
trackCount.setCountNumber(0);
trackCount.setGroupField(groupField);
relevanceMaintainer.add(trackCount);
}
ChartsData chartsData = new ChartsData(); ChartsData chartsData = new ChartsData();
chartsData.setxAxis(groupField); chartsData.setxAxis(groupField);
chartsData.setyAxis(BigDecimal.valueOf(result.getCountNumber())); chartsData.setyAxis(BigDecimal.valueOf(result.getCountNumber()));

View File

@ -133,6 +133,9 @@
}); });
} }
} }
},
selectNodeIds() {
this.activeName = "default";
} }
}, },
methods: { methods: {

View File

@ -244,6 +244,9 @@
}); });
}, },
list(data) { list(data) {
if (data.protocol === "dubbo://") {
data.protocol = "DUBBO";
}
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) {

View File

@ -6,7 +6,7 @@
<div class="el-step__icon-inner">{{data.index}}</div> <div class="el-step__icon-inner">{{data.index}}</div>
</div> </div>
<el-tag class="ms-left-btn" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-tag> <el-tag class="ms-left-btn" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-tag>
<el-tag size="mini" v-if="data.method">{{data.method}}</el-tag> <el-tag size="mini" v-if="data.method">{{getMethod()}}</el-tag>
</slot> </slot>
<span> <span>
@ -125,6 +125,17 @@
//this.$set(this.data, 'active', !this.data.active); //this.$set(this.data, 'active', !this.data.active);
this.$emit('active'); this.$emit('active');
}, },
getMethod() {
if (this.data.protocol === "HTTP") {
return this.data.method;
}
else if (this.data.protocol === "dubbo://") {
return "DUBBO";
}
else {
return this.data.protocol;
}
},
copyRow() { copyRow() {
this.$emit('copy'); this.$emit('copy');
}, },

View File

@ -13,7 +13,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<ms-variable-list ref="scenarioParameters"/> <ms-variable-list ref="scenarioParameters"/>
<ms-add-basis-api ref="api"/> <ms-add-basis-api :currentProtocol="currentProtocol" ref="api"/>
</div> </div>
</template> </template>
@ -32,6 +32,7 @@
data() { data() {
return { return {
allSamplers: ELEMENTS.get('AllSamplerProxy'), allSamplers: ELEMENTS.get('AllSamplerProxy'),
currentProtocol: "HTTP",
} }
}, },
methods: { methods: {
@ -63,7 +64,8 @@
} }
}); });
}, },
saveAsApi(){ saveAsApi() {
this.currentProtocol = this.data.protocol;
this.$refs.api.open(this.data); this.$refs.api.open(this.data);
} }
} }

View File

@ -1,152 +1,152 @@
<template> <template>
<div> <div>
<ms-container v-if="renderComponent"> <ms-container v-if="renderComponent">
<ms-aside-container> <ms-aside-container>
<ms-api-module <ms-api-module
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
@protocolChange="handleProtocolChange" @protocolChange="handleProtocolChange"
@refreshTable="refresh" @refreshTable="refresh"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@debug="debug" @debug="debug"
@saveAsEdit="editApi" @saveAsEdit="editApi"
@setModuleOptions="setModuleOptions" @setModuleOptions="setModuleOptions"
@setNodeTree="setNodeTree" @setNodeTree="setNodeTree"
@enableTrash="enableTrash" @enableTrash="enableTrash"
:type="'edit'" :type="'edit'"
ref="nodeTree"/> ref="nodeTree"/>
</ms-aside-container> </ms-aside-container>
<ms-main-container> <ms-main-container>
<!-- 主框架列表 --> <!-- 主框架列表 -->
<el-tabs v-model="apiDefaultTab" @edit="handleTabRemove" @tab-click="addTab"> <el-tabs v-model="apiDefaultTab" @edit="handleTabRemove" @tab-click="addTab">
<el-tab-pane v-for="(item) in apiTabs" <el-tab-pane v-for="(item) in apiTabs"
:key="item.name" :key="item.name"
:label="item.title" :label="item.title"
:closable="item.closable" :closable="item.closable"
:name="item.name"> :name="item.name">
<ms-tab-button <ms-tab-button
v-if="item.type === 'list'" v-if="item.type === 'list'"
:active-dom.sync="activeDom" :active-dom.sync="activeDom"
:left-tip="$t('api_test.definition.api_title')" :left-tip="$t('api_test.definition.api_title')"
:right-tip="$t('api_test.definition.doc_title')" :right-tip="$t('api_test.definition.doc_title')"
:middle-tip="$t('api_test.definition.case_title')" :middle-tip="$t('api_test.definition.case_title')"
left-content="API" left-content="API"
middle-content="CASE" middle-content="CASE"
:right-content="$t('api_test.definition.doc_title')"> :right-content="$t('api_test.definition.doc_title')">
<!-- 列表集合 --> <!-- 列表集合 -->
<ms-api-list <ms-api-list
v-if="activeDom==='left'" v-if="activeDom==='left'"
@runTest="runTest" @runTest="runTest"
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:queryDataType="queryDataType" :queryDataType="queryDataType"
:selectDataRange="selectDataRange" :selectDataRange="selectDataRange"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi" @editApi="editApi"
@handleCase="handleCase" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
ref="apiList"/> ref="apiList"/>
<!--测试用例列表--> <!--测试用例列表-->
<api-case-simple-list <api-case-simple-list
v-if="activeDom==='middle'" v-if="activeDom==='middle'"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:queryDataType="queryDataType" :queryDataType="queryDataType"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
ref="apiList"/> ref="apiList"/>
<api-documents-page class="api-doc-page" <api-documents-page class="api-doc-page"
v-if="activeDom==='right'" v-if="activeDom==='right'"
:project-id="projectId" :project-id="projectId"
:module-ids="selectNodeIds"/> :module-ids="selectNodeIds"/>
</ms-tab-button> </ms-tab-button>
<!-- 添加/编辑测试窗口--> <!-- 添加/编辑测试窗口-->
<div v-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" <ms-api-config :syncTabs="syncTabs" @runTest="runTest" @saveApi="saveApi" @createRootModel="createRootModel" ref="apiConfig"
:current-api="item.api" :current-api="item.api"
:project-id="projectId" :project-id="projectId"
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:moduleOptions="moduleOptions"/> :moduleOptions="moduleOptions"/>
</div> </div>
<!-- 快捷调试 --> <!-- 快捷调试 -->
<div v-else-if="item.type=== 'debug'" class="ms-api-div"> <div v-else-if="item.type=== 'debug'" class="ms-api-div">
<ms-debug-http-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" <ms-debug-http-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
v-if="currentProtocol==='HTTP'"/> v-if="currentProtocol==='HTTP'"/>
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" <ms-debug-jdbc-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
v-if="currentProtocol==='SQL'"/> v-if="currentProtocol==='SQL'"/>
<ms-debug-tcp-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" <ms-debug-tcp-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
v-if="currentProtocol==='TCP'"/> v-if="currentProtocol==='TCP'"/>
<ms-debug-dubbo-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" <ms-debug-dubbo-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi"
v-if="currentProtocol==='DUBBO'"/> v-if="currentProtocol==='DUBBO'"/>
</div> </div>
<!-- 测试--> <!-- 测试-->
<div v-else-if="item.type=== 'TEST'" class="ms-api-div"> <div v-else-if="item.type=== 'TEST'" class="ms-api-div">
<ms-run-test-http-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId" <ms-run-test-http-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId"
@saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='HTTP'"/> @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='HTTP'"/>
<ms-run-test-tcp-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId" <ms-run-test-tcp-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId"
@saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='TCP'"/> @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='TCP'"/>
<ms-run-test-sql-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId" <ms-run-test-sql-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId"
@saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='SQL'"/> @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='SQL'"/>
<ms-run-test-dubbo-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId" <ms-run-test-dubbo-page :syncTabs="syncTabs" :currentProtocol="currentProtocol" :api-data="item.api" :project-id="projectId"
@saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='DUBBO'"/> @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='DUBBO'"/>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="add"> <el-tab-pane name="add">
<template v-slot:label> <template v-slot:label>
<el-dropdown @command="handleCommand" v-tester> <el-dropdown @command="handleCommand" v-tester>
<el-button type="primary" plain icon="el-icon-plus" size="mini" v-tester/> <el-button type="primary" plain icon="el-icon-plus" size="mini" v-tester/>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="debug">{{ $t('api_test.definition.request.fast_debug') }}</el-dropdown-item> <el-dropdown-item command="debug">{{ $t('api_test.definition.request.fast_debug') }}</el-dropdown-item>
<el-dropdown-item command="ADD">{{ $t('api_test.definition.request.title') }}</el-dropdown-item> <el-dropdown-item command="ADD">{{ $t('api_test.definition.request.title') }}</el-dropdown-item>
<el-dropdown-item command="CLOSE_ALL">{{ $t('api_test.definition.request.close_all_label') }} <el-dropdown-item command="CLOSE_ALL">{{ $t('api_test.definition.request.close_all_label') }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</ms-main-container> </ms-main-container>
</ms-container> </ms-container>
</div> </div>
</template> </template>
<script> <script>
import MsApiList from './components/list/ApiList'; import MsApiList from './components/list/ApiList';
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsApiConfig from "./components/ApiConfig"; import MsApiConfig from "./components/ApiConfig";
import MsDebugHttpPage from "./components/debug/DebugHttpPage"; import MsDebugHttpPage from "./components/debug/DebugHttpPage";
import MsDebugJdbcPage from "./components/debug/DebugJdbcPage"; import MsDebugJdbcPage from "./components/debug/DebugJdbcPage";
import MsDebugTcpPage from "./components/debug/DebugTcpPage"; import MsDebugTcpPage from "./components/debug/DebugTcpPage";
import MsDebugDubboPage from "./components/debug/DebugDubboPage"; import MsDebugDubboPage from "./components/debug/DebugDubboPage";
import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage"; import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage"; import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage"; import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage"; import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
import {checkoutTestManagerOrTestUser, getCurrentUser, getUUID} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser, getCurrentUser, getUUID} from "@/common/js/utils";
import MsApiModule from "./components/module/ApiModule"; import MsApiModule from "./components/module/ApiModule";
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList"; import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
import ApiDocumentsPage from "@/business/components/api/definition/components/list/ApiDocumentsPage"; import ApiDocumentsPage from "@/business/components/api/definition/components/list/ApiDocumentsPage";
import MsTableButton from "@/business/components/common/components/MsTableButton"; import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
export default { export default {
name: "ApiDefinition", name: "ApiDefinition",
@ -157,7 +157,7 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
this.changeRedirectParam(redirectIDParam); this.changeRedirectParam(redirectIDParam);
return routeParam; return routeParam;
}, },
isReadOnly(){ isReadOnly() {
return !checkoutTestManagerOrTestUser(); return !checkoutTestManagerOrTestUser();
}, },
projectId() { projectId() {
@ -221,6 +221,9 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
currentProtocol() { currentProtocol() {
this.handleCommand("CLOSE_ALL"); this.handleCommand("CLOSE_ALL");
}, },
selectNodeIds() {
this.apiDefaultTab = "default";
},
redirectID() { redirectID() {
this.renderComponent = false; this.renderComponent = false;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -18,6 +18,7 @@
{{ assertion.desc }} {{ assertion.desc }}
</div> </div>
<div class="assertion-item btn circle"> <div class="assertion-item btn circle">
<i class="el-icon-view el-button el-button--primary el-button--mini is-circle" circle @click="showPage"/>
<el-button :disabled="isReadOnly" type="success" size="mini" icon="el-icon-edit" circle @click="detail"/> <el-button :disabled="isReadOnly" type="success" size="mini" icon="el-icon-edit" circle @click="detail"/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"/> <el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"/>
</div> </div>
@ -27,23 +28,23 @@
<el-row type="flex" justify="space-between" align="middle" class="quick-script-block"> <el-row type="flex" justify="space-between" align="middle" class="quick-script-block">
<div class="assertion-item input"> <div class="assertion-item input">
<el-input size="small" v-model="assertion.variable" <el-input size="small" v-model="assertion.variable"
:placeholder="$t('api_test.request.assertions.variable_name')" @change="quickScript"/> :placeholder="$t('api_test.request.assertions.variable_name')" @change="quickScript" :disabled="disabled"/>
</div> </div>
<div class="assertion-item select"> <div class="assertion-item select">
<el-select v-model="assertion.operator" :placeholder="$t('commons.please_select')" size="small" <el-select v-model="assertion.operator" :placeholder="$t('commons.please_select')" size="small"
@change="changeOperator"> @change="changeOperator" :disabled="disabled">
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/> <el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
</el-select> </el-select>
</div> </div>
<div class="assertion-item input"> <div class="assertion-item input">
<el-input size="small" v-model="assertion.value" :placeholder="$t('api_test.value')" <el-input size="small" v-model="assertion.value" :placeholder="$t('api_test.value')"
@change="quickScript" v-if="!hasEmptyOperator"/> @change="quickScript" v-if="!hasEmptyOperator" :disabled="disabled"/>
</div> </div>
</el-row> </el-row>
<el-input size="small" v-model="assertion.desc" :placeholder="$t('api_test.request.assertions.script_name')" <el-input size="small" v-model="assertion.desc" :placeholder="$t('api_test.request.assertions.script_name')"
class="quick-script-block"/> class="quick-script-block" :disabled="disabled"/>
<ms-jsr233-processor ref="jsr233" :is-read-only="isReadOnly" :jsr223-processor="assertion" :templates="templates" <ms-jsr233-processor ref="jsr233" :is-read-only="disabled" :jsr223-processor="assertion" :templates="templates"
:height="300" @languageChange="quickScript"/> :height="300" @languageChange="quickScript"/>
<template v-slot:footer v-if="!edit"> <template v-slot:footer v-if="!edit">
<ms-dialog-footer <ms-dialog-footer
@ -84,6 +85,7 @@
data() { data() {
return { return {
visible: false, visible: false,
disabled: false,
operators: { operators: {
EQ: { EQ: {
label: "commons.adv_search.operators.equals", label: "commons.adv_search.operators.equals",
@ -260,6 +262,11 @@
} }
}, },
detail() { detail() {
this.disabled = false;
this.visible = true;
},
showPage() {
this.disabled = true;
this.visible = true; this.visible = true;
}, },
close() { close() {

View File

@ -42,7 +42,7 @@
</div> </div>
<div class="ms-body" v-if="body.type == 'XML'"> <div class="ms-body" v-if="body.type == 'XML'">
<ms-code-edit :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" :mode="'xml'" ref="codeEdit"/> <ms-code-edit :read-only="isReadOnly" :data.sync="body.raw" :modes="modes" :mode="'text'" ref="codeEdit"/>
</div> </div>
<div class="ms-body" v-if="body.type == 'Raw'"> <div class="ms-body" v-if="body.type == 'Raw'">

View File

@ -41,7 +41,6 @@
</template> </template>
<script> <script>
import {getCurrentProjectID} from "@/common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
export default { export default {
@ -58,10 +57,14 @@ export default {
loading: false loading: false
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
search() { search() {
let projectID = getCurrentProjectID(); let projectID = this.projectId;
this.result = this.$get("/api/faliureCaseAboutTestPlan/"+projectID+"/10", response => { this.result = this.$get("/api/faliureCaseAboutTestPlan/"+projectID+"/10", response => {
this.tableData = response.data; this.tableData = response.data;
}); });

View File

@ -57,7 +57,7 @@
</template> </template>
<script> <script>
import {checkoutTestManagerOrTestUser, getCurrentProjectID} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
export default { export default {
name: "MsRunningTaskList", name: "MsRunningTaskList",
@ -80,12 +80,15 @@ export default {
computed:{ computed:{
isReadOnly(){ isReadOnly(){
return !checkoutTestManagerOrTestUser(); return !checkoutTestManagerOrTestUser();
} },
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
search() { search() {
let projectID = getCurrentProjectID(); let projectID = this.projectId;
this.result = this.$get("/api/runningTask/"+projectID+"/"+this.callFrom, response => { this.result = this.$get("/api/runningTask/"+projectID+"/"+this.callFrom, response => {
this.tableData = response.data; this.tableData = response.data;
}); });

View File

@ -201,7 +201,7 @@ export default {
}); });
}, },
async beforeUploadFile(file) { beforeUploadFile(file) {
if (!this.fileValidator(file)) { if (!this.fileValidator(file)) {
/// todo: /// todo:
return false; return false;
@ -211,14 +211,14 @@ export default {
this.$error(this.$t('load_test.delete_file')); this.$error(this.$t('load_test.delete_file'));
return false; return false;
} }
let valid = false; },
checkFileExist(file, callback) {
// //
async function f() { async function f() {
return await axios.post('/performance/file/' + getCurrentProjectID() + '/getMetadataByName', {name: file.name}) return await axios.post('/performance/file/' + getCurrentProjectID() + '/getMetadataByName', {name: file.name})
} }
await f().then(res => { f().then(res => {
let response = res.data; let response = res.data;
if (response.data.length === 0) { if (response.data.length === 0) {
let type = file.name.substring(file.name.lastIndexOf(".") + 1); let type = file.name.substring(file.name.lastIndexOf(".") + 1);
@ -229,33 +229,34 @@ export default {
type: type.toUpperCase(), type: type.toUpperCase(),
updateTime: file.lastModified, updateTime: file.lastModified,
}); });
valid = true;
callback();
} else { } else {
this.$error(this.$t('load_test.project_file_exist')); this.$error(this.$t('load_test.project_file_exist'));
} }
}); });
return valid;
}, },
handleUpload(uploadResources) { handleUpload(uploadResources) {
let self = this; let self = this;
let file = uploadResources.file; let file = uploadResources.file;
self.uploadList.push(file); this.checkFileExist(file, () => {
let type = file.name.substring(file.name.lastIndexOf(".") + 1); self.uploadList.push(file);
if (type.toLowerCase() !== 'jmx') { let type = file.name.substring(file.name.lastIndexOf(".") + 1);
return; if (type.toLowerCase() !== 'jmx') {
} return;
let jmxReader = new FileReader(); }
jmxReader.onload = (event) => { let jmxReader = new FileReader();
let threadGroups = findThreadGroup(event.target.result, file.name); jmxReader.onload = (event) => {
threadGroups.forEach(tg => { let threadGroups = findThreadGroup(event.target.result, file.name);
tg.options = {}; threadGroups.forEach(tg => {
this.scenarios.push(tg); tg.options = {};
}); self.scenarios.push(tg);
self.$emit('fileChange', self.scenarios); });
}; self.$emit('fileChange', self.scenarios);
jmxReader.readAsText(file); };
jmxReader.readAsText(file);
})
}, },
handleExceed() { handleExceed() {
this.$error(this.$t('load_test.file_size_limit')); this.$error(this.$t('load_test.file_size_limit'));

View File

@ -99,7 +99,7 @@ import SelectMenu from "../common/SelectMenu";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getUUID} from "../../../../common/js/utils"; import {checkoutTestManagerOrTestUser, getUUID} from "../../../../common/js/utils";
import TestCaseNodeTree from "../common/TestCaseNodeTree"; import TestCaseNodeTree from "../common/TestCaseNodeTree";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
@ -132,12 +132,10 @@ export default {
loading: false, loading: false,
type:'', type:'',
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
mounted() { mounted() {
this.init(this.$route); this.init(this.$route);
this.projectId = getCurrentProjectID();
}, },
watch: { watch: {
redirectID() { redirectID() {
@ -151,7 +149,6 @@ export default {
this.init(to); this.init(to);
if (to.path.indexOf('/track/case/all') == -1) { if (to.path.indexOf('/track/case/all') == -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();*/
}); });
@ -168,7 +165,10 @@ export default {
isRedirectEdit: function () { isRedirectEdit: function () {
let redirectParam = this.$route.params.dataSelectRange; let redirectParam = this.$route.params.dataSelectRange;
return redirectParam; return redirectParam;
} },
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
handleCommand(e) { handleCommand(e) {
@ -197,7 +197,6 @@ export default {
} }
}, },
addTab(tab) { addTab(tab) {
this.projectId=getCurrentProjectID();
if (!this.projectId) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
@ -238,6 +237,10 @@ export default {
} }
}, },
exportTestCase(){ exportTestCase(){
if (this.activeDom !== 'left') {
this.$warning('请切换成接口列表导出!');
return;
}
this.$refs.testCaseList.exportTestCase() this.$refs.testCaseList.exportTestCase()
}, },
addListener() { addListener() {
@ -258,7 +261,6 @@ export default {
this.testCaseReadOnly = true; this.testCaseReadOnly = true;
} }
let caseId = this.$route.params.caseId; let caseId = this.$route.params.caseId;
this.projectId=getCurrentProjectID();
if (!this.projectId) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;

View File

@ -58,7 +58,7 @@
</template> </template>
<script> <script>
import {getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils"; import {getCurrentUser} from "@/common/js/utils";
import {WORKSPACE_ID} from "@/common/js/constants"; import {WORKSPACE_ID} from "@/common/js/constants";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter"; import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree"; import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
@ -97,15 +97,20 @@ export default {
this.getModuleOptions(); this.getModuleOptions();
}, },
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
saveTestCase(saveAs) { saveTestCase(saveAs) {
this.$refs['testCaseForm'].validate((valid) => { this.$refs['testCaseForm'].validate((valid) => {
if (valid) { if (valid) {
let path = "/test/case/save"; let path = "/test/case/save";
this.testCaseForm.projectId = getCurrentProjectID(); this.testCaseForm.projectId = this.projectId;
this.testCaseForm.type = ""; this.testCaseForm.type = "";
this.testCaseForm.priority = "P0"; this.testCaseForm.priority = "P0";
if (this.currentModule !== undefined || this.currentModule !== null || this.currentModule !== 0 || this.currentModule !== "") { if (this.currentModule && this.currentModule !== 0 && this.currentModule.path && this.currentModule.path !== 0) {
this.testCaseForm.nodePath = this.currentModule.path; this.testCaseForm.nodePath = this.currentModule.path;
this.testCaseForm.nodeId = this.currentModule.id; this.testCaseForm.nodeId = this.currentModule.id;
} else { } else {
@ -113,7 +118,7 @@ export default {
this.testCaseForm.nodeId = "root" this.testCaseForm.nodeId = "root"
} }
this.result = this.$post(path, this.testCaseForm, response => { this.result = this.$post(path, this.testCaseForm, response => {
this.testCaseForm.id=response.data.id this.testCaseForm.id = response.data.id
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.visible = false; this.visible = false;
if (saveAs) { if (saveAs) {

View File

@ -287,10 +287,8 @@
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants'; import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter' import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
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 {getCurrentProjectID} from "../../../../../common/js/utils";
import {buildNodePath} from "../../../api/definition/model/NodeTree"; import {buildNodePath} 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";
@ -324,11 +322,9 @@ export default {
resolve(nodes) resolve(nodes)
} }
if(node.level==1){ if(node.level==1){
this.projectId = getCurrentProjectID()
this.testOptions = []; this.testOptions = [];
let url = ''; let url = '';
this.form.type=node.data.value this.form.type=node.data.value
console.log(this.form.type)
if (this.form.type === 'testcase' || this.form.type === 'automation') { if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') { } else if (this.form.type === 'performance' || this.form.type === 'api') {
@ -354,7 +350,6 @@ export default {
statuOptions:API_STATUS, statuOptions:API_STATUS,
comments: [], comments: [],
result: {}, result: {},
projectId: "",
dialogFormVisible: false, dialogFormVisible: false,
form: { form: {
name: '', name: '',
@ -434,6 +429,11 @@ export default {
}, },
type: String type: String
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
this.getSelectOptions(); this.getSelectOptions();
if (this.type === 'edit' || this.type === 'copy') { if (this.type === 'edit' || this.type === 'copy') {
@ -499,9 +499,6 @@ export default {
this.$nextTick(() => (this.isStepTableAlive = true)); this.$nextTick(() => (this.isStepTableAlive = true));
}, },
open(testCase) { open(testCase) {
console.log("测试用例")
console.log(testCase)
this.projectId = getCurrentProjectID();
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close); window.addEventListener('popstate', this.close);
@ -587,7 +584,6 @@ export default {
/* /*
this.form.testId=testCase.selected this.form.testId=testCase.selected
*/ */
console.log(this.form.selected)
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
}, },
setTestCaseExtInfo(testCase) { setTestCaseExtInfo(testCase) {
@ -692,7 +688,6 @@ export default {
buildParam() { buildParam() {
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
console.log(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 => { this.moduleOptions.forEach(item => {
@ -781,7 +776,6 @@ export default {
}); });
}, },
getTestOptions(val) { getTestOptions(val) {
this.projectId = getCurrentProjectID()
this.testOptions = []; this.testOptions = [];
let url = ''; let url = '';
if (this.form.type === 'testcase' || this.form.type === 'automation') { if (this.form.type === 'testcase' || this.form.type === 'automation') {
@ -803,7 +797,6 @@ export default {
}, },
getDemandOptions() { getDemandOptions() {
if (this.demandOptions.length === 0) { if (this.demandOptions.length === 0) {
this.projectId = getCurrentProjectID();
this.result = {loading : true}; this.result = {loading : true};
this.$get("demand/list/" + this.projectId).then(response => { this.$get("demand/list/" + this.projectId).then(response => {
this.demandOptions = response.data.data; this.demandOptions = response.data.data;

View File

@ -210,7 +210,6 @@ import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEve
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem"; import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import TestCaseDetail from "./TestCaseDetail"; import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {downloadFile, getCurrentProjectID, getCurrentUser} from "../../../../../common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import { import {
_filter, _filter,
@ -330,7 +329,6 @@ export default {
maintainer: [], maintainer: [],
}, },
currentCaseId: null, currentCaseId: null,
projectId: "",
selectDataCounts: 0, selectDataCounts: 0,
selectDataRange: "all" selectDataRange: "all"
} }
@ -353,6 +351,11 @@ export default {
default: false, default: false,
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
created: function () { created: function () {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
if (this.trashEnable) { if (this.trashEnable) {
@ -390,7 +393,6 @@ export default {
this.selectDataRange = dataType === 'case' ? dataRange : 'all'; this.selectDataRange = dataType === 'case' ? dataRange : 'all';
}, },
initTableData() { initTableData() {
this.projectId = getCurrentProjectID();
this.condition.planId = ""; this.condition.planId = "";
this.condition.nodeIds = []; this.condition.nodeIds = [];
initCondition(this.condition); initCondition(this.condition);
@ -538,14 +540,14 @@ export default {
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
}, },
importTestCase() { importTestCase() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
this.$refs.testCaseImport.open(); this.$refs.testCaseImport.open();
}, },
exportTestCase() { exportTestCase() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -44,9 +44,7 @@
<script> <script>
import NodeEdit from "./NodeEdit"; import NodeEdit from "./NodeEdit";
import {getCurrentProjectID} from "../../../../common/js/utils";
import MsNodeTree from "./NodeTree"; import MsNodeTree from "./NodeTree";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
import TestCaseCreate from "@/business/components/track/case/components/TestCaseCreate"; import TestCaseCreate from "@/business/components/track/case/components/TestCaseCreate";
import TestCaseImport from "@/business/components/track/case/components/TestCaseImport"; import TestCaseImport from "@/business/components/track/case/components/TestCaseImport";
@ -61,7 +59,6 @@ export default {
}, },
result: {}, result: {},
treeNodes: [], treeNodes: [],
projectId: "",
condition: { condition: {
filterText: "", filterText: "",
trashEnable: false trashEnable: false
@ -83,12 +80,16 @@ export default {
}, },
}, },
mounted() { mounted() {
this.projectId = getCurrentProjectID();
this.list(); this.list();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
addTestCase(){ addTestCase(){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
@ -109,7 +110,7 @@ export default {
this.addTestCase(); this.addTestCase();
break; break;
case "import": case "import":
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -124,7 +124,7 @@ name: "TestCaseMinder",
if (isChange) { if (isChange) {
saveCases.push(testCase); saveCases.push(testCase);
} }
if (testCase.nodeId.length < 15) { if (testCase.nodeId !== 'root' && testCase.nodeId.length < 15) {
let tip = this.$t('test_track.case.create_case') + "'" + testCase.name + "'" + this.$t('test_track.case.minder_create_tip'); let tip = this.$t('test_track.case.create_case') + "'" + testCase.name + "'" + this.$t('test_track.case.minder_create_tip');
this.$error(tip) this.$error(tip)
throw new Error(tip); throw new Error(tip);

View File

@ -1,39 +1,41 @@
export function getTestCaseDataMap(testCase, isDisable, setParamCallback) { export function getTestCaseDataMap(testCase, isDisable, setParamCallback) {
let dataMap = new Map(); let dataMap = new Map();
testCase.forEach(item => { if (testCase) {
item.steps = JSON.parse(item.steps); testCase.forEach(item => {
// if (item.tags && item.tags.length > 0) { item.steps = JSON.parse(item.steps);
// item.tags = JSON.parse(item.tags); // if (item.tags && item.tags.length > 0) {
// } // item.tags = JSON.parse(item.tags);
let mapItem = dataMap.get(item.nodeId); // }
let nodeItem = { let mapItem = dataMap.get(item.nodeId);
data: { let nodeItem = {
id: item.id, data: {
text: item.name, id: item.id,
priority: Number.parseInt(item.priority.substring(item.priority.length - 1 )) + 1, text: item.name,
resource: ["用例"], priority: Number.parseInt(item.priority.substring(item.priority.length - 1 )) + 1,
type: item.type, resource: ["用例"],
method: item.method, type: item.type,
maintainer: item.maintainer method: item.method,
maintainer: item.maintainer
}
} }
} if (setParamCallback) {
if (setParamCallback) { setParamCallback(nodeItem.data, item);
setParamCallback(nodeItem.data, item); }
} if (isDisable) {
if (isDisable) { nodeItem.data.disable = true;
nodeItem.data.disable = true; // 用例节点可以打标签
// 用例节点可以打标签 nodeItem.data.allowDisabledTag = true;
nodeItem.data.allowDisabledTag = true; }
} parseChildren(nodeItem, item, isDisable);
parseChildren(nodeItem, item, isDisable); if (mapItem) {
if (mapItem) { mapItem.push(nodeItem);
mapItem.push(nodeItem); } else {
} else { mapItem = [];
mapItem = []; mapItem.push(nodeItem);
mapItem.push(nodeItem); dataMap.set(item.nodeId, mapItem);
dataMap.set(item.nodeId, mapItem); }
} })
}) }
return dataMap; return dataMap;
} }
@ -41,14 +43,16 @@ function parseChildren(nodeItem, item, isDisable) {
nodeItem.children = []; nodeItem.children = [];
let children = []; let children = [];
_parseChildren(children, item.prerequisite, "前置条件", isDisable); _parseChildren(children, item.prerequisite, "前置条件", isDisable);
item.steps.forEach((step) => { if (item.steps) {
let descNode = _parseChildren(children, step.desc, undefined, isDisable); item.steps.forEach((step) => {
if (descNode) { let descNode = _parseChildren(children, step.desc, undefined, isDisable);
descNode.data.num = step.num; if (descNode) {
descNode.children = []; descNode.data.num = step.num;
_parseChildren(descNode.children, step.result, undefined, isDisable); descNode.children = [];
} _parseChildren(descNode.children, step.result, undefined, isDisable);
}); }
});
}
_parseChildren(children, item.remark, "备注", isDisable); _parseChildren(children, item.remark, "备注", isDisable);
nodeItem.children = children; nodeItem.children = children;
} }

View File

@ -34,7 +34,8 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<div class="square"> <div class="square">
<relevance-case-card :relevance-count-data="relevanceCountData" class="track-card" @redirectPage="redirectPage"/> <relevance-case-card :relevance-count-data="relevanceCountData" class="track-card"
@redirectPage="redirectPage"/>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -73,7 +74,6 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import MsContainer from "@/business/components/common/components/MsContainer"; import MsContainer from "@/business/components/common/components/MsContainer";
import CaseCountCard from "@/business/components/track/home/components/CaseCountCard"; import CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard"; import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard";
import {getCurrentProjectID,getUUID} from "@/common/js/utils";
import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance"; import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance";
import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants"; import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
import BugCountCard from "@/business/components/track/home/components/BugCountCard"; import BugCountCard from "@/business/components/track/home/components/BugCountCard";
@ -108,13 +108,18 @@ export default {
this.checkTipsType(); this.checkTipsType();
this.init(); this.init();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
checkTipsType() { checkTipsType() {
let random = Math.floor(Math.random() * (4 - 1 + 1)) + 1; let random = Math.floor(Math.random() * (4 - 1 + 1)) + 1;
this.tipsType = random + ""; this.tipsType = random + "";
}, },
init() { init() {
let selectProjectId = getCurrentProjectID(); let selectProjectId = this.projectId;
this.$get("/track/count/" + selectProjectId, response => { this.$get("/track/count/" + selectProjectId, response => {
this.trackCountData = response.data; this.trackCountData = response.data;
@ -136,8 +141,8 @@ export default {
xAxis.push(d.xAxis); xAxis.push(d.xAxis);
} }
}); });
let yAxis1 = data.filter(d => d.groupName === 'FUNCTIONCASE').map(d => d.yAxis); let yAxis1 = data.filter(d => d.groupName === 'FUNCTIONCASE').map(d => [d.xAxis, d.yAxis]);
let yAxis2 = data.filter(d => d.groupName === 'RELEVANCECASE').map(d => d.yAxis); let yAxis2 = data.filter(d => d.groupName === 'RELEVANCECASE').map(d => [d.xAxis, d.yAxis]);
let option = { let option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@ -186,12 +191,17 @@ export default {
}; };
this.caseOption = option; this.caseOption = option;
}, },
redirectPage(page,dataType,selectType){ redirectPage(page, dataType, selectType) {
//test_plan //test_plan
// this.$router.push('/track/plan/view/'+selectType); // this.$router.push('/track/plan/view/'+selectType);
switch (page){ switch (page) {
case "case": case "case":
this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}}); this.$router.push({
name:'testCase',
params:{
dataType:dataType,dataSelectRange:selectType, projectId: this.projectId
}
});
break; break;
} }
} }

View File

@ -20,7 +20,6 @@
import TestPlanEdit from './components/TestPlanEdit'; import TestPlanEdit from './components/TestPlanEdit';
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestPlan", name: "TestPlan",
@ -29,6 +28,11 @@
return { return {
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
if (this.$route.path.indexOf("/track/plan/create") >= 0){ if (this.$route.path.indexOf("/track/plan/create") >= 0){
this.openTestPlanEditDialog(); this.openTestPlanEditDialog();
@ -38,7 +42,7 @@
watch: { watch: {
'$route'(to, from) { '$route'(to, from) {
if (to.path.indexOf("/track/plan/create") >= 0){ if (to.path.indexOf("/track/plan/create") >= 0){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -125,7 +125,7 @@
import {WORKSPACE_ID} from '@/common/js/constants'; import {WORKSPACE_ID} from '@/common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton"; import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";

View File

@ -220,11 +220,10 @@ import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm"; 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 {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain" import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort, getLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants"; import {TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List, Track_Test_Case} 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";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
@ -282,6 +281,9 @@ export default {
}, },
created() { created() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (!this.projectId) {
this.projectId = this.$store.state.projectId;
}
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
@ -296,7 +298,7 @@ export default {
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
@ -320,7 +322,7 @@ export default {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
testPlanCreate() { testPlanCreate() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -151,7 +151,7 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
import BatchEdit from "@/business/components/track/case/components/BatchEdit"; import BatchEdit from "@/business/components/track/case/components/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData"; import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
import {getCurrentProjectID, strMapToObj} from "@/common/js/utils"; import {strMapToObj} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer"; import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils"; import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
@ -539,7 +539,7 @@ export default {
}, },
getProjectId() { getProjectId() {
if (!this.isRelevanceModel) { if (!this.isRelevanceModel) {
return getCurrentProjectID(); return this.$store.state.projectId;
} else { } else {
return this.currentCaseProjectId; return this.currentCaseProjectId;
} }

View File

@ -103,7 +103,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn"; import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag"; import MsTag from "../../../../../common/components/MsTag";
import {getUUID, getCurrentProjectID, getCurrentUser, strMapToObj} from "@/common/js/utils"; import {getUUID, strMapToObj} from "@/common/js/utils";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail"; import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn"; 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";
@ -162,7 +162,6 @@ export default {
status: 'default', status: 'default',
infoDb: false, infoDb: false,
runVisible: false, runVisible: false,
projectId: "",
runData: [], runData: [],
buttons: [ buttons: [
{ {
@ -182,8 +181,12 @@ export default {
}, },
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
created() { created() {
this.projectId = getCurrentProjectID();
this.search(); this.search();
}, },
watch: { watch: {

View File

@ -94,7 +94,7 @@
this.result = this.$get("/project/listAll", res => { this.result = this.$get("/project/listAll", res => {
let data = res.data; let data = res.data;
if (data) { if (data) {
const index = data.findIndex(d => d.id === getCurrentProjectID()); const index = data.findIndex(d => d.id === this.$store.state.projectId);
this.projects = data; this.projects = data;
if (index !== -1) { if (index !== -1) {
this.projectId = data[index].id; this.projectId = data[index].id;

View File

@ -1,7 +1,5 @@
<template> <template>
<div class="card-container"> <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" <ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_id_name_tag')"> :show-create="false" :tip="$t('commons.search_by_id_name_tag')">
@ -18,14 +16,8 @@
<ms-table-button :is-tester-permission="true" icon="el-icon-connection" <ms-table-button :is-tester-permission="true" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')" :content="$t('test_track.plan_view.relevance_test_case')"
@click="$emit('openTestCaseRelevanceDialog')"/> @click="$emit('openTestCaseRelevanceDialog')"/>
<!-- 删除 取消全部关联 按钮-->
<!-- <ms-table-button :is-tester-permission="true" icon="el-icon-document-remove"-->
<!-- :content="$t('test_track.plan_view.cancel_all_relevance')" @click="handleDeleteBatch"/>-->
</template> </template>
</ms-table-header> </ms-table-header>
<!-- </template>-->
<executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" <executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))"
@refresh="initTableData"/> @refresh="initTableData"/>
@ -712,4 +704,8 @@ export default {
.el-tag { .el-tag {
margin-left: 10px; margin-left: 10px;
} }
.ms-table-header >>> .table-title {
height: 0px;
}
</style> </style>

View File

@ -51,7 +51,6 @@
import FunctionalTestCaseList from "./FunctionalTestCaseList"; import FunctionalTestCaseList from "./FunctionalTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder"; import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "TestPlanFunctional", name: "TestPlanFunctional",
@ -71,7 +70,6 @@
selectParentNodes: [], selectParentNodes: [],
treeNodes: [], treeNodes: [],
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
props: [ props: [
@ -80,9 +78,13 @@
'clickType' 'clickType'
], ],
mounted() { mounted() {
this.projectId = getCurrentProjectID();
this.initData(); this.initData();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
activated(){ activated(){
this.initData(); this.initData();
this.openTestCaseEdit(this.$route.path); this.openTestCaseEdit(this.$route.path);

View File

@ -13,7 +13,6 @@
import TestPlanReportList from './components/TestPlanReportList'; import TestPlanReportList from './components/TestPlanReportList';
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestPlanReport", name: "TestPlanReport",

View File

@ -66,7 +66,6 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator"; import MsTableOperator from "../../../common/components/MsTableOperator";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {TEST_PLAN_REPORT_CONFIGS} from "../../../common/components/search/search-components"; import {TEST_PLAN_REPORT_CONFIGS} from "../../../common/components/search/search-components";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import TestPlanReportView from "@/business/components/track/report/components/TestPlanReportView"; import TestPlanReportView from "@/business/components/track/report/components/TestPlanReportView";
import ReportTriggerModeItem from "@/business/components/common/tableItem/ReportTriggerModeItem"; import ReportTriggerModeItem from "@/business/components/common/tableItem/ReportTriggerModeItem";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
@ -124,6 +123,9 @@ export default {
}, },
created() { created() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (!this.projectId) {
this.projectId = this.$store.state.projectId;
}
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
@ -139,7 +141,7 @@ export default {
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
@ -214,7 +216,7 @@ export default {
let deleteParam = {}; let deleteParam = {};
let ids = Array.from(this.selectRows).map(row => row.id); let ids = Array.from(this.selectRows).map(row => row.id);
deleteParam.dataIds = ids; deleteParam.dataIds = ids;
deleteParam.projectId = getCurrentProjectID(); deleteParam.projectId = this.projectId;
deleteParam.selectAllDate = this.isSelectAllDate; deleteParam.selectAllDate = this.isSelectAllDate;
deleteParam.unSelectIds = this.unSelection; deleteParam.unSelectIds = this.unSelection;
deleteParam = Object.assign(deleteParam, this.condition); deleteParam = Object.assign(deleteParam, this.condition);

View File

@ -18,7 +18,6 @@ import TestCaseReviewList from "./components/TestCaseReviewList";
import TestCaseReviewEdit from "./components/TestCaseReviewEdit"; import TestCaseReviewEdit from "./components/TestCaseReviewEdit";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestCaseReview", name: "TestCaseReview",
@ -33,6 +32,11 @@ export default {
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
if (this.$route.path.indexOf("/track/review/create") >= 0){ if (this.$route.path.indexOf("/track/review/create") >= 0){
this.openCaseReviewEditDialog(); this.openCaseReviewEditDialog();
@ -42,7 +46,7 @@ export default {
watch: { watch: {
'$route'(to) { '$route'(to) {
if (to.path.indexOf("/track/review/create") >= 0){ if (to.path.indexOf("/track/review/create") >= 0){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -101,7 +101,7 @@
import TestPlanStatusButton from "../../plan/common/TestPlanStatusButton"; import TestPlanStatusButton from "../../plan/common/TestPlanStatusButton";
import {WORKSPACE_ID} from "@/common/js/constants"; import {WORKSPACE_ID} from "@/common/js/constants";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
export default { export default {

View File

@ -120,7 +120,6 @@ import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination"; import MsTablePagination from "../../../common/pagination/TablePagination";
import { import {
checkoutTestManagerOrTestUser, checkoutTestManagerOrTestUser,
getCurrentProjectID, getCurrentUser,
getCurrentWorkspaceId getCurrentWorkspaceId
} from "../../../../../common/js/utils"; } from "../../../../../common/js/utils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
@ -176,6 +175,11 @@ export default {
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
@ -185,10 +189,10 @@ export default {
getLabel(this, TEST_CASE_REVIEW_LIST); getLabel(this, TEST_CASE_REVIEW_LIST);
let lastWorkspaceId = getCurrentWorkspaceId(); let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId; this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.condition.projectId = getCurrentProjectID(); this.condition.projectId = this.projectId;
this.result = this.$post("/test/case/review/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => { this.result = this.$post("/test/case/review/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
@ -219,7 +223,7 @@ export default {
this.$router.push('/track/review/view/' + row.id); this.$router.push('/track/review/view/' + row.id);
}, },
testCaseReviewCreate() { testCaseReviewCreate() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -49,7 +49,6 @@ import TestReviewRelevance from "@/business/components/track/review/view/compone
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList"; import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder"; import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "TestReviewFunction", name: "TestReviewFunction",
@ -69,7 +68,6 @@ export default {
treeNodes: [], treeNodes: [],
isMenuShow: true, isMenuShow: true,
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
props: [ props: [
@ -79,11 +77,14 @@ export default {
], ],
mounted() { mounted() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
this.projectId = getCurrentProjectID();
}, },
activated() { activated() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
},
computed: {
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
refresh() { refresh() {