未验证 提交 e6a9556e 编写于 作者: B BugKing 提交者: GitHub

Merge pull request #2445 from metersphere/dev

合并dev
......@@ -14,13 +14,14 @@ import io.metersphere.commons.utils.JsonPathUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import org.apache.commons.lang3.StringUtils;
import org.json.XML;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
......@@ -410,10 +411,39 @@ public class MockConfigService {
e.printStackTrace();
}
return object;
} else {
Enumeration<String> paramNameItor = request.getParameterNames();
} else if (StringUtils.equalsIgnoreCase("text/xml", request.getContentType())) {
String xmlString = this.readXml(request);
System.out.println(xmlString);
org.json.JSONObject xmlJSONObj = XML.toJSONObject(xmlString);
String jsonStr = xmlJSONObj.toString();
JSONObject object = null;
try {
object = JSONObject.parseObject(jsonStr);
} catch (Exception e) {
}
return object;
} else if (StringUtils.equalsIgnoreCase("application/x-www-form-urlencoded", request.getContentType())) {
JSONObject object = new JSONObject();
Enumeration<String> paramNameItor = request.getParameterNames();
while (paramNameItor.hasMoreElements()) {
String key = paramNameItor.nextElement();
String value = request.getParameter(key);
object.put(key, value);
}
return object;
} else {
JSONObject object = new JSONObject();
String bodyParam = this.readBody(request);
if (!StringUtils.isEmpty(bodyParam)) {
try {
object = JSONObject.parseObject(bodyParam);
} catch (Exception e) {
e.printStackTrace();
}
}
Enumeration<String> paramNameItor = request.getParameterNames();
while (paramNameItor.hasMoreElements()) {
String key = paramNameItor.nextElement();
String value = request.getParameter(key);
......@@ -423,40 +453,103 @@ public class MockConfigService {
}
}
private String readXml(HttpServletRequest request) {
{
String inputLine = null;
// 接收到的数据
StringBuffer recieveData = new StringBuffer();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
request.getInputStream(), "UTF-8"));
while ((inputLine = in.readLine()) != null) {
recieveData.append(inputLine);
}
} catch (IOException e) {
} finally {
try {
if (null != in) {
in.close();
}
} catch (IOException e) {
}
}
return recieveData.toString();
}
}
private String readBody(HttpServletRequest request) {
String result = "";
try {
InputStream inputStream = request.getInputStream();
ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while ((len = inputStream.read(buffer)) != -1) {
outSteam.write(buffer, 0, len);
}
outSteam.close();
inputStream.close();
result = new String(outSteam.toByteArray(), "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public JSONObject getSendRestParamMapByIdAndUrl(ApiDefinitionWithBLOBs api, String urlParams) {
// ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId);
JSONObject returnJson = new JSONObject();
if (api != null) {
String path = api.getPath();
if (path.startsWith("/")) {
path = path.substring(1);
}
String[] pathArr = path.split("/");
List<String> sendParams = new ArrayList<>();
for (String param : pathArr) {
String[] sendParamArr = urlParams.split("/");
//获取 url的<参数名-参数值>,通过匹配api的接口设置和实际发送的url
for (int i = 0; i < pathArr.length; i++) {
String param = pathArr[i];
if (param.startsWith("{") && param.endsWith("}")) {
param = param.substring(1, param.length() - 1);
sendParams.add(param);
}
}
try {
JSONObject requestJson = JSONObject.parseObject(api.getRequest());
if (requestJson.containsKey("rest")) {
JSONArray jsonArray = requestJson.getJSONArray("rest");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
if (object.containsKey("name") && object.containsKey("enable") && object.getBoolean("enable")) {
String name = object.getString("name");
if (sendParams.contains(name)) {
String value = "";
if (object.containsKey("value")) {
value = object.getString("value");
}
returnJson.put(name, value);
}
}
String value = "";
if (sendParamArr.length > i) {
value = sendParamArr[i];
}
returnJson.put(param, value);
}
} catch (Exception e) {
e.printStackTrace();
}
// List<String> sendParams = new ArrayList<>();
// for (String param : pathArr) {
// if (param.startsWith("{") && param.endsWith("}")) {
// param = param.substring(1, param.length() - 1);
// sendParams.add(param);
// }
// }
// try {
// JSONObject requestJson = JSONObject.parseObject(api.getRequest());
// if (requestJson.containsKey("rest")) {
// JSONArray jsonArray = requestJson.getJSONArray("rest");
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject object = jsonArray.getJSONObject(i);
// if (object.containsKey("name") && object.containsKey("enable") && object.getBoolean("enable")) {
// String name = object.getString("name");
// if (sendParams.contains(name)) {
// String value = "";
// if (object.containsKey("value")) {
// value = object.getString("value");
// }
// returnJson.put(name, value);
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
return returnJson;
}
......@@ -577,7 +670,8 @@ public class MockConfigService {
return this.assemblyMockConfingResponse(configList);
}
public String checkReturnWithMockExpectByBodyParam(String method, String projectId, HttpServletRequest request, HttpServletResponse response) {
public String checkReturnWithMockExpectByBodyParam(String method, String projectId, HttpServletRequest
request, HttpServletResponse response) {
String returnStr = "";
String urlSuffix = this.getUrlSuffix(projectId, request);
List<ApiDefinitionWithBLOBs> aualifiedApiList = apiDefinitionService.preparedUrl(projectId, method, urlSuffix, urlSuffix);
......@@ -599,7 +693,8 @@ public class MockConfigService {
return returnStr;
}
public String checkReturnWithMockExpectByUrlParam(String get, String projectId, HttpServletRequest request, HttpServletResponse response) {
public String checkReturnWithMockExpectByUrlParam(String get, String projectId, HttpServletRequest
request, HttpServletResponse response) {
String returnStr = "";
String urlSuffix = this.getUrlSuffix(projectId, request);
List<ApiDefinitionWithBLOBs> aualifiedApiList = apiDefinitionService.preparedUrl(projectId, "GET", null, urlSuffix);
......
......@@ -67,7 +67,7 @@
show-overflow-tooltip
width="120px"
:key="index">
<template v-slot:default="scope" class="request-method">
<template v-slot:default="scope">
<el-tag size="mini"
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
class="api-el-tag">
......@@ -144,68 +144,7 @@
show-overflow-tooltip
:key="index"/>
</template>
</ms-table>
<!-- <el-table v-loading="result.loading"-->
<!-- border-->
<!-- :data="tableData" row-key="id" class="test-content adjust-table"-->
<!-- @select-all="handleSelectAll"-->
<!-- @select="handleSelect" ref="table">-->
<!-- <el-table-column reserve-selection type="selection"/>-->
<!-- <el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>-->
<!-- <el-table-column-->
<!-- prop="status"-->
<!-- column-key="api_status"-->
<!-- :label="$t('api_test.definition.api_status')"-->
<!-- show-overflow-tooltip>-->
<!-- <template v-slot:default="scope">-->
<!-- <ms-tag v-if="scope.row.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>-->
<!-- <ms-tag v-if="scope.row.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>-->
<!-- <ms-tag v-if="scope.row.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>-->
<!-- <ms-tag v-if="scope.row.status == 'Trash'" type="danger" effect="plain" :content="$t('test_track.plan.plan_status_trash')"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="method"-->
<!-- :label="$t('api_test.definition.api_type')"-->
<!-- show-overflow-tooltip>-->
<!-- <template v-slot:default="scope" class="request-method">-->
<!-- <el-tag size="mini" :style="{'background-color': getColor(scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">-->
<!-- {{ scope.row.method }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="path"-->
<!-- :label="$t('api_test.definition.api_path')"-->
<!-- show-overflow-tooltip/>-->
<!-- <el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">-->
<!-- <template v-slot:default="scope">-->
<!-- <span>{{ scope.row.updateTime | timestampFormatDate }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="caseTotal"-->
<!-- :label="$t('api_test.definition.api_case_number')"-->
<!-- show-overflow-tooltip/>-->
<!-- <el-table-column-->
<!-- prop="caseStatus"-->
<!-- :label="$t('api_test.definition.api_case_status')"-->
<!-- show-overflow-tooltip/>-->
<!-- <el-table-column-->
<!-- prop="casePassingRate"-->
<!-- :label="$t('api_test.definition.api_case_passing_rate')"-->
<!-- show-overflow-tooltip/>-->
<!-- </el-table>-->
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</api-list-container>
......@@ -216,236 +155,69 @@
<script>
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/Ms-table-column";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _handleSelect, _handleSelectAll, _sort, buildBatchParam, getLabel,} from "@/common/js/tableUtils";
import {API_LIST, WORKSPACE_ID} from "@/common/js/constants";
export default {
name: "RelevanceApiList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsBottomContainer,
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn
},
data() {
return {
condition: {},
selectCase: {},
tableLabel: [],
result: {},
moduleId: "",
deletePath: "/test/case/delete",
screenHeight: document.documentElement.clientHeight - 500,//屏幕高度,
typeArr: [
{id: 'priority', name: this.$t('test_track.case.priority')},
],
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
valueArr: {
priority: CASE_PRIORITY,
},
methodColorMap: new Map(API_METHOD_COLOUR),
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
environmentId: "",
methodFilters: [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
{text: 'PATCH', value: 'PATCH'},
{text: 'DELETE', value: 'DELETE'},
{text: 'OPTIONS', value: 'OPTIONS'},
{text: 'HEAD', value: 'HEAD'},
{text: 'CONNECT', value: 'CONNECT'},
{text: 'DUBBO', value: 'DUBBO'},
{text: 'dubbo://', value: 'dubbo://'},
{text: 'SQL', value: 'SQL'},
{text: 'TCP', value: 'TCP'},
],
userFilters: [],
}
},
props: {
currentProtocol: String,
selectNodeIds: Array,
visible: {
type: Boolean,
default: false,
},
isApiListEnable: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false
},
isCaseRelevance: {
type: Boolean,
default: false,
},
projectId: String,
planId: String,
isTestPlan: Boolean
},
created: function () {
if (this.$refs.apitable) {
this.$refs.apitable.clearSelectRows();
}
this.initTable();
this.getMaintainerOptions();
},
watch: {
selectNodeIds() {
this.initTable();
},
currentProtocol() {
this.initTable();
},
projectId() {
this.initTable();
}
},
computed: {
selectRows() {
if (this.$refs.apitable) {
return this.$refs.apitable.getSelectRows();
} else {
return new Set();
}
}
},
methods: {
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable(projectId) {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId != null && typeof projectId === 'string') {
this.condition.projectId = projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}else{
this.condition.protocol = "HTTP";
}
let url = '/api/definition/list/';
if (this.isTestPlan) {
url = '/api/definition/list/relevance/';
this.condition.planId = this.planId;
}
this.result = this.$post(url + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.genProtocalFilter(this.condition.protocol);
this.$nextTick(function () {
if (this.$refs.apitable) {
this.$refs.apitable.doLayout();
this.$refs.apitable.checkTableRowIsSelect();
}
});
});
//添加自定义列的查询
getLabel(this, API_LIST);
},
showExecResult(row) {
this.visible = false;
this.$emit('showExecResult', row);
},
filter(filters) {
_filter(filters, this.condition);
this.initTable();
},
sort(column) {
// 每次只对一个字段排序
if (this.condition.orders) {
this.condition.orders = [];
}
_sort(column, this.condition);
this.initTable();
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getColor(method) {
return this.methodColorMap.get(method);
},
setEnvironment(data) {
this.environmentId = data.id;
},
clearSelection() {
if (this.$refs.apitable) {
this.$refs.apitable.clearSelectRows();
this.$refs.apitable.clearSelection();
}
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/Ms-table-column";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _handleSelect, _handleSelectAll, _sort, buildBatchParam, getLabel,} from "@/common/js/tableUtils";
import {API_LIST, WORKSPACE_ID} from "@/common/js/constants";
export default {
name: "RelevanceApiList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsBottomContainer,
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
this.methodFilters = [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
{text: 'PATCH', value: 'PATCH'},
{text: 'DELETE', value: 'DELETE'},
{text: 'OPTIONS', value: 'OPTIONS'},
{text: 'HEAD', value: 'HEAD'},
{text: 'CONNECT', value: 'CONNECT'},
];
} else if (protocalType === "TCP") {
this.methodFilters = [
{text: 'TCP', value: 'TCP'},
];
} else if (protocalType === "SQL") {
this.methodFilters = [
{text: 'SQL', value: 'SQL'},
];
} else if (protocalType === "DUBBO") {
this.methodFilters = [
{text: 'DUBBO', value: 'DUBBO'},
{text: 'dubbo://', value: 'dubbo://'},
];
} else {
this.methodFilters = [
data() {
return {
condition: {},
selectCase: {},
tableLabel: [],
result: {},
moduleId: "",
deletePath: "/test/case/delete",
screenHeight: document.documentElement.clientHeight - 500,//屏幕高度,
typeArr: [
{id: 'priority', name: this.$t('test_track.case.priority')},
],
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
valueArr: {
priority: CASE_PRIORITY,
},
methodColorMap: new Map(API_METHOD_COLOUR),
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
environmentId: "",
methodFilters: [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
......@@ -458,48 +230,215 @@ export default {
{text: 'dubbo://', value: 'dubbo://'},
{text: 'SQL', value: 'SQL'},
{text: 'TCP', value: 'TCP'},
];
],
userFilters: [],
}
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id};
props: {
currentProtocol: String,
selectNodeIds: Array,
visible: {
type: Boolean,
default: false,
},
isApiListEnable: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false
},
isCaseRelevance: {
type: Boolean,
default: false,
},
projectId: String,
planId: String,
isTestPlan: Boolean
},
created: function () {
if (this.$refs.apitable) {
this.$refs.apitable.clearSelectRows();
}
this.initTable();
this.getMaintainerOptions();
},
watch: {
selectNodeIds() {
this.initTable();
},
currentProtocol() {
this.initTable();
},
projectId() {
this.initTable();
}
},
computed: {
selectRows() {
if (this.$refs.apitable) {
return this.$refs.apitable.getSelectRows();
} else {
return new Set();
}
}
},
methods: {
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable(projectId) {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId != null && typeof projectId === 'string') {
this.condition.projectId = projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
} else {
this.condition.protocol = "HTTP";
}
let url = '/api/definition/list/';
if (this.isTestPlan) {
url = '/api/definition/list/relevance/';
this.condition.planId = this.planId;
}
this.result = this.$post(url + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.genProtocalFilter(this.condition.protocol);
this.$nextTick(function () {
if (this.$refs.apitable) {
this.$refs.apitable.doLayout();
this.$refs.apitable.checkTableRowIsSelect();
}
});
});
//添加自定义列的查询
getLabel(this, API_LIST);
},
showExecResult(row) {
this.visible = false;
this.$emit('showExecResult', row);
},
filter(filters) {
_filter(filters, this.condition);
this.initTable();
},
sort(column) {
// 每次只对一个字段排序
if (this.condition.orders) {
this.condition.orders = [];
}
_sort(column, this.condition);
this.initTable();
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getColor(flag, method) {
return this.methodColorMap.get(method);
},
setEnvironment(data) {
this.environmentId = data.id;
},
clearSelection() {
if (this.$refs.apitable) {
this.$refs.apitable.clearSelectRows();
this.$refs.apitable.clearSelection();
}
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
this.methodFilters = [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
{text: 'PATCH', value: 'PATCH'},
{text: 'DELETE', value: 'DELETE'},
{text: 'OPTIONS', value: 'OPTIONS'},
{text: 'HEAD', value: 'HEAD'},
{text: 'CONNECT', value: 'CONNECT'},
];
} else if (protocalType === "TCP") {
this.methodFilters = [
{text: 'TCP', value: 'TCP'},
];
} else if (protocalType === "SQL") {
this.methodFilters = [
{text: 'SQL', value: 'SQL'},
];
} else if (protocalType === "DUBBO") {
this.methodFilters = [
{text: 'DUBBO', value: 'DUBBO'},
{text: 'dubbo://', value: 'dubbo://'},
];
} else {
this.methodFilters = [
{text: 'GET', value: 'GET'},
{text: 'POST', value: 'POST'},
{text: 'PUT', value: 'PUT'},
{text: 'PATCH', value: 'PATCH'},
{text: 'DELETE', value: 'DELETE'},
{text: 'OPTIONS', value: 'OPTIONS'},
{text: 'HEAD', value: 'HEAD'},
{text: 'CONNECT', value: 'CONNECT'},
{text: 'DUBBO', value: 'DUBBO'},
{text: 'dubbo://', value: 'dubbo://'},
{text: 'SQL', value: 'SQL'},
{text: 'TCP', value: 'TCP'},
];
}
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
});
},
getConditions() {
let sampleSelectRows = this.$refs.apitable.getSelectRows();
let param = buildBatchParam(this);
param.ids = Array.from(sampleSelectRows).map(row => row.id);
return param;
}
},
getConditions() {
let sampleSelectRows = this.$refs.apitable.getSelectRows();
let param = buildBatchParam(this);
param.ids = Array.from(sampleSelectRows).map(row => row.id);
return param;
}
},
}
}
</script>
<style scoped>
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.api-el-tag {
color: white;
}
.search-input {
float: right;
width: 30%;
margin-bottom: 20px;
margin-right: 20px;
}
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.api-el-tag {
color: white;
}
.search-input {
float: right;
width: 30%;
margin-bottom: 20px;
margin-right: 20px;
}
</style>
......@@ -32,7 +32,7 @@
</template>
</ms-table-column>
<field-custom-data-table-item :scene="scene"/>
<!-- <field-custom-data-table-item :scene="scene"/>-->
<ms-table-column
:label="$t('api_test.definition.document.table_coloum.is_required')"
......
......@@ -30,7 +30,7 @@
return {
editor: ClassicEditor,
editorConfig: {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ,'insertTable', 'imageUpload', '|','undo', 'redo'],
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ,'insertTable', '|','undo', 'redo'],
// ckfinder: {
// uploadUrl: `/image/uploadCkEditor?imgPath=${JSON.stringify(this.imagePath)}`
// },
......
......@@ -7,11 +7,11 @@
<el-dropdown-menu>
<el-dropdown-item command="STEP">
<div>{{ $t('test_track.case.step_describe') }}</div>
<div>{{ $t('test_track.case.text_describe_tip') }}</div>
<div>{{ $t('test_track.case.step_describe_tip') }}</div>
</el-dropdown-item>
<el-dropdown-item command="TEXT">
<div>{{ $t('test_track.case.text_describe') }}</div>
<div>{{ $t('test_track.case.change_type_tip') }}</div>
<div>{{ $t('test_track.case.text_describe_tip') }}</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
......
......@@ -63,6 +63,7 @@
</el-row>
<el-form ref="customFieldForm"
v-if="isCustomFiledActive"
class="case-form">
<el-row>
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index">
......@@ -181,6 +182,7 @@ export default {
comments: [],
testCaseTemplate: {},
formLabelWidth: "100px",
isCustomFiledActive: false
};
},
props: {
......@@ -352,6 +354,7 @@ export default {
}
this.testCase = item;
parseCustomField(this.testCase, this.testCaseTemplate, null, null, buildTestCaseOldFields(this.testCase));
this.isCustomFiledActive = true;
if (!this.testCase.actualResult) {
// 如果没值,使用模板的默认值
this.testCase.actualResult = this.testCaseTemplate.actualResult;
......
......@@ -78,6 +78,7 @@
</el-row>
<el-form ref="customFieldForm"
v-if="isCustomFiledActive"
class="case-form">
<el-row>
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index">
......@@ -187,7 +188,8 @@ export default {
testCaseTemplate: {},
hasTapdId: false,
hasZentaoId: false,
formLabelWidth: '100px'
formLabelWidth: '100px',
isCustomFiledActive: false
};
},
props: {
......@@ -302,6 +304,7 @@ export default {
item.stepModel = 'STEP';
}
parseCustomField(item, this.testCaseTemplate, null, null, buildTestCaseOldFields(item));
this.isCustomFiledActive = true;
this.testCase = item;
if (!this.testCase.actualResult) {
// 如果没值,使用模板的默认值
......
......@@ -1250,10 +1250,10 @@ export default {
step_info: "Step Info",
other_info: "Other Info",
step_describe: "Step Describe",
step_describe_tip: "Applicable to every step of the test scenario, there are clear test steps, expected results",
text_describe: "Text Describe",
text_describe_tip: "For simple test scenarios, there are no clear test steps",
change_type: "Change Type",
change_type_tip: "Applicable to every step of the test scenario, there are clear test steps, expected results",
minder_create_tip: "failed, unable to create its parent module in minder",
check_select: "Please check the case",
export_all_cases: 'Are you sure you want to export all use cases?',
......
......@@ -1255,10 +1255,10 @@ export default {
step_info: "步骤信息",
other_info: "其他信息",
step_describe: "步骤描述",
step_describe_tip: "适用于需要每一个步骤进行测试的场景,有明确的测试步骤、预期结果",
text_describe: "文本描述",
text_describe_tip: "使用于简单的测试场景,没有明确的测试步骤",
change_type: "更改类型",
change_type_tip: "适用于需要每一个步骤进行测试的场景,有明确的测试步骤、预期结果",
minder_create_tip: "失败, 无法在脑图创建其父模块",
check_select: "请勾选用例",
export_all_cases: '确定要导出全部用例吗?',
......
......@@ -1255,10 +1255,10 @@ export default {
step_info: "步驟信息",
other_info: "其他信息",
step_describe: "步驟描述",
step_describe_tip: "適用於需要每一個步驟進行測試的場景,有明確的測試步驟、預期結果",
text_describe: "文本描述",
text_describe_tip: "使用於簡單的測試場景,沒有明確的測試步驟",
change_type: "更改類型",
change_type_tip: "適用於需要每一個步驟進行測試的場景,有明確的測試步驟、預期結果",
minder_create_tip: "失敗, 無法在腦圖創建其父模塊",
check_select: "請勾選用例",
export_all_cases: '確定要導出全部用例嗎?',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册