@@ -87,10 +77,12 @@ import JsonSchemaShow from '@/business/definition/components/document/components
import tableAdvancedSetting from '@/business/definition/components/document/components/plugin/TableAdvancedSetting';
import { getCurrentUser } from 'metersphere-frontend/src/utils/token';
import { getUUID } from 'metersphere-frontend/src/utils';
+import { getApiParamsConfigFields, getShowFields } from 'metersphere-frontend/src/utils/custom_field';
+import ApiParamsConfig from '@/business/definition/components/request/components/ApiParamsConfig';
export default {
name: 'ApiRequestInfo',
- components: { JsonSchemaShow, tableAdvancedSetting },
+ components: { JsonSchemaShow, tableAdvancedSetting, ApiParamsConfig },
data() {
return {
tableData: [],
@@ -98,8 +90,11 @@ export default {
tableExpandButtonId: 'docTableExpandBtn' + getUUID(),
active: true,
expandAllRow: false,
+ apiParamStorageKey: 'API_PARAMS_SHOW_FIELD',
expandTitle: this.$t('commons.expand_all'),
+ apiParamsConfigFields: getApiParamsConfigFields(this),
formParamTypes: ['form-data', 'x-www-from-urlencoded', 'BINARY'],
+ tableColumnArr: [],
};
},
props: {
@@ -108,38 +103,45 @@ export default {
activated() {
if (this.apiInfo && this.apiInfo.requestBodyFormData) {
this.tableData = this.getJsonArr(this.apiInfo.requestBodyFormData);
+ this.formatTableData();
}
//获取language,用于改变表格的展开、收起文字 zh_CN/zh_TW/en_US
let user = getCurrentUser();
if (user) {
this.language = user.language;
}
+ this.initTableColumn();
},
created: function () {
if (this.apiInfo && this.apiInfo.requestBodyFormData) {
this.tableData = this.getJsonArr(this.apiInfo.requestBodyFormData);
+ this.formatTableData();
}
//获取language,用于改变表格的展开、收起文字 zh_CN/zh_TW/en_US
let user = getCurrentUser();
if (user) {
this.language = user.language;
}
+ this.initTableColumn();
},
mounted() {
if (this.apiInfo && this.apiInfo.requestBodyFormData) {
this.tableData = this.getJsonArr(this.apiInfo.requestBodyFormData);
+ this.formatTableData();
}
//获取language,用于改变表格的展开、收起文字 zh_CN/zh_TW/en_US
let user = getCurrentUser();
if (user) {
this.language = user.language;
}
+ this.initTableColumn();
},
computed: {},
watch: {
'apiInfo.requestBodyFormData': {
handler(v) {
this.tableData = this.getJsonArr(this.apiInfo.requestBodyFormData);
+ this.formatTableData();
},
deep: true,
},
@@ -163,6 +165,79 @@ export default {
},
},
methods: {
+ formatTableData() {
+ if (this.tableData) {
+ this.tableData.forEach((item) => {
+ if (item.urlEncode !== null && item.urlEncode !== undefined) {
+ if (item.urlEncode === true) {
+ item.urlEncode = this.$t('commons.yes');
+ } else {
+ item.urlEncode = this.$t('commons.no');
+ }
+ }
+ if (item.enable !== null && item.enable !== undefined) {
+ if (item.enable === true) {
+ item.enable = this.$t('commons.yes');
+ } else {
+ item.enable = this.$t('commons.no');
+ }
+ }
+ });
+ }
+ },
+ refreshApiParamsField() {
+ this.initTableColumn();
+ this.reloadedApiVariable = false;
+ this.$nextTick(() => {
+ this.reloadedApiVariable = true;
+ });
+ },
+ initTableColumn() {
+ this.tableColumnArr = [
+ { id: 1, prop: 'name', label: this.$t('api_definition.document.name') },
+ { id: 2, prop: 'contentType', label: this.$t('api_definition.document.type') },
+ {
+ id: 3,
+ prop: 'enable',
+ label: this.$t('api_definition.document.is_required'),
+ },
+ {
+ id: 4,
+ prop: 'value',
+ label: this.$t('api_definition.document.value'),
+ },
+ ];
+ if (this.formParamTypes.includes(this.apiInfo.requestBodyParamType)) {
+ let apiParamConfigArr = getShowFields(this.apiParamStorageKey);
+ if (apiParamConfigArr) {
+ apiParamConfigArr.forEach((item) => {
+ let tableColumn = {};
+ if (item === 'MIX_LENGTH') {
+ tableColumn.id = 5;
+ tableColumn.prop = 'min';
+ tableColumn.label = this.$t('schema.minLength');
+ } else if (item === 'MAX_LENGTH') {
+ tableColumn.id = 6;
+ tableColumn.prop = 'max';
+ tableColumn.label = this.$t('schema.maxLength');
+ } else if (item === 'ENCODE') {
+ tableColumn.id = 7;
+ tableColumn.prop = 'urlEncode';
+ tableColumn.label = this.$t('commons.encode');
+ } else if (item === 'DESCRIPTION') {
+ tableColumn.id = 8;
+ tableColumn.prop = 'description';
+ tableColumn.label = this.$t('commons.description');
+ } else {
+ tableColumn = null;
+ }
+ if (tableColumn) {
+ this.tableColumnArr.push(tableColumn);
+ }
+ });
+ }
+ }
+ },
getRowClassName({ row, rowIndex }) {
let classname = 'autofix-table-row ';
// 通过判断给不需要展开行功能的数据设置样式,通过样式去隐藏展开行图标
diff --git a/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaPanel.vue b/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaPanel.vue
index 188e173313..23c2c00a35 100644
--- a/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaPanel.vue
+++ b/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaPanel.vue
@@ -1,7 +1,7 @@
-
-
-
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- {{ getCollapseOption() }}
-
-
-
= 0;
+ },
isNotEmptyValue(value) {
return value && value !== '';
},
diff --git a/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaShow.vue b/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaShow.vue
index 7cbaf6a648..200519671e 100644
--- a/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaShow.vue
+++ b/api-test/frontend/src/business/definition/components/document/components/JsonSchema/JsonSchemaShow.vue
@@ -1,36 +1,49 @@
-
-
+
+
+
{{ expandTitle }}
-
+
+
+
+
+
diff --git a/api-test/frontend/src/business/definition/components/request/http/ApiHttpRequestForm.vue b/api-test/frontend/src/business/definition/components/request/http/ApiHttpRequestForm.vue
index d83a0037f6..71fecc2e6a 100644
--- a/api-test/frontend/src/business/definition/components/request/http/ApiHttpRequestForm.vue
+++ b/api-test/frontend/src/business/definition/components/request/http/ApiHttpRequestForm.vue
@@ -52,10 +52,14 @@
-
-
+
+
{{ $t('commons.batch_add') }}
+
-
-
+
+
{{ $t('commons.batch_add') }}
+
import('@/business/definition/components/step/JmxStep'),
},
props: {
@@ -273,6 +284,8 @@ export default {
};
return {
activeName: this.request.method === 'POST' ? 'body' : 'parameters',
+ queryColumnConfig: false,
+ apiParamsConfigFields: getApiParamsConfigFields(this),
rules: {
name: [
{
@@ -336,6 +349,13 @@ export default {
});
});
},
+ refreshApiParamsField() {
+ let oldActiveName = this.activeName;
+ this.activeName = 'refreshing';
+ this.$nextTick(() => {
+ this.activeName = oldActiveName;
+ });
+ },
changeActiveName() {
if (this.request.headers && this.request.headers.length > 1) {
this.activeName = 'headers';
diff --git a/framework/sdk-parent/frontend/src/components/table/MsTable.vue b/framework/sdk-parent/frontend/src/components/table/MsTable.vue
index 19609c9122..a71f492d69 100644
--- a/framework/sdk-parent/frontend/src/components/table/MsTable.vue
+++ b/framework/sdk-parent/frontend/src/components/table/MsTable.vue
@@ -8,11 +8,14 @@
v-loading="tableIsLoading"
:data="data"
:default-sort="defaultSort"
- :class="{'ms-select-all-fixed': (showSelectAll && !hidePopover), 'row-click': rowClickStyle}"
+ :class="{
+ 'ms-select-all-fixed': showSelectAll && !hidePopover,
+ 'row-click': rowClickStyle,
+ }"
:height="screenHeight"
:row-key="rowKey"
:row-class-name="tableRowClassName"
- :row-style='rowStyle'
+ :row-style="rowStyle"
:cell-class-name="addPaddingColClass"
:highlight-current-row="highlightCurrentRow"
@sort-change="sort"
@@ -22,35 +25,37 @@
@header-dragend="headerDragend"
@cell-mouse-enter="showPopover"
@row-click="handleRowClick"
- ref="table">
+ ref="table"
+ >
+
+
+
-
-
-
-
-
+ v-if="enableSelection && batchOperators && batchOperators.length > 0"
+ width="15"
+ fixed="left"
+ column-key="batchBtnCol"
+ align="center"
+ :resizable="false"
+ >
-
+
@@ -64,11 +69,12 @@
+ column-key="tableRowDropCol"
+ >
-
-
+
+
@@ -79,28 +85,24 @@
v-if="operators && operators.length > 0"
:fixed="operatorFixed"
:min-width="operatorWidth"
- :label="$t('commons.operating')">
+ :label="$t('commons.operating')"
+ >
+ @exec="openCustomHeader"
+ />
-
+
-
-
+
-
-
+ :index="scope.$index"
+ />
+
@@ -111,8 +113,8 @@
:type="fieldKey"
:custom-fields="customFields"
@reload="resetHeader"
- ref="customTableHeader"/>
-
+ ref="customTableHeader"
+ />
@@ -122,15 +124,15 @@ import {
_handleSelect,
_handleSelectAll,
_sort,
- getSelectDataCounts,
- setUnSelectIds,
- toggleAllSelection,
checkTableRowIsSelect,
+ clearShareDragParam,
getCustomTableHeader,
+ getSelectDataCounts,
+ handleRowDrop,
saveCustomTableWidth,
saveLastTableSortField,
- handleRowDrop,
- clearShareDragParam,
+ setUnSelectIds,
+ toggleAllSelection,
} from "../../utils/tableUtils";
import MsTableHeaderSelectPopover from "./MsTableHeaderSelectPopover";
import MsTablePagination from "../pagination/TablePagination";
@@ -140,8 +142,7 @@ import MsTableOperators from "../MsTableOperators";
import HeaderLabelOperate from "../head/HeaderLabelOperate";
import HeaderCustom from "../head/HeaderCustom";
import MsCustomTableHeader from "./MsCustomTableHeader";
-import {lineToHump} from "../../utils";
-import {getUUID} from "../../utils";
+import { getUUID, lineToHump } from "../../utils";
/**
* 参考 ApiList
@@ -160,7 +161,12 @@ export default {
components: {
MsCustomTableHeader,
HeaderLabelOperate,
- MsTableOperators, MsTableColumn, ShowMoreBtn, MsTablePagination, MsTableHeaderSelectPopover, HeaderCustom
+ MsTableOperators,
+ MsTableColumn,
+ ShowMoreBtn,
+ MsTablePagination,
+ MsTableHeaderSelectPopover,
+ HeaderCustom,
},
data() {
return {
@@ -182,91 +188,91 @@ export default {
type: Boolean,
default() {
return false;
- }
+ },
},
selectNodeIds: {
type: Array,
default() {
return [];
- }
+ },
},
data: {
type: Array,
default() {
return [];
- }
+ },
},
condition: {
type: Object,
default() {
return {};
- }
+ },
},
pageSize: {
type: Number,
default() {
return 10;
- }
+ },
},
total: {
type: Number,
default() {
return 10;
- }
+ },
},
// 操作按钮
operators: {
type: Array,
default() {
return [];
- }
+ },
},
//批量操作按钮
batchOperators: {
type: Array,
default() {
return [];
- }
+ },
},
// 操作列的宽度
operatorWidth: {
type: String,
default() {
return "150px";
- }
+ },
},
// 操作列的宽度
operatorFixed: {
type: [String, Boolean],
default() {
return "right";
- }
+ },
},
//开启全选
enableSelection: {
type: Boolean,
default() {
return true;
- }
+ },
}, //开启全选
showSelectAll: {
type: Boolean,
default() {
return true;
- }
+ },
},
// 添加鼠标移入小手样式
rowClickStyle: {
type: Boolean,
default() {
return false;
- }
+ },
},
tableIsLoading: {
type: [Boolean, Promise],
default() {
return false;
- }
+ },
},
disableHeaderConfig: Boolean,
fields: Array,
@@ -279,10 +285,9 @@ export default {
rowKey: [String, Function],
// 自定义排序,需要传资源所属的项目id或者测试计划id,并且传排序的方法
rowOrderGroupId: String,
- rowOrderFunc: Function
- },
- created() {
+ rowOrderFunc: Function,
},
+ created() {},
mounted() {
this.setDefaultOrders();
},
@@ -310,15 +315,16 @@ export default {
},
selectDataCounts(value) {
this.$emit("selectCountChange", value);
- }
+ },
},
methods: {
// 批量操作提示, 第一次勾选提示, 之后不提示
// 先添加 batch-popper 样式, 全选后再移除样式, 只保留可见框内第一条数据的提示
removeBatchPopper() {
- let elements = window.document.getElementsByClassName('batch-popper');
- let tableHeader = window.document.getElementsByClassName('table-column-mark');
- let columns = window.document.getElementsByClassName('table-more-icon');
+ let elements = window.document.getElementsByClassName("batch-popper");
+ let tableHeader =
+ window.document.getElementsByClassName("table-column-mark");
+ let columns = window.document.getElementsByClassName("table-more-icon");
let tableTop = tableHeader[0].getBoundingClientRect().top;
let index = 0;
for (let i = 0; i < columns.length; i++) {
@@ -331,7 +337,7 @@ export default {
if (elements) {
for (let i = 0; i < elements.length; i++) {
if (i == index) {
- elements[i].classList.remove('batch-popper');
+ elements[i].classList.remove("batch-popper");
setTimeout(() => {
this.hasBatchTipShow = true;
}, 1500);
@@ -342,15 +348,20 @@ export default {
// 拖拽排序
listenRowDrop() {
if (this.rowOrderGroupId) {
- handleRowDrop(this.data, (param) => {
- param.groupId = this.rowOrderGroupId;
- if (this.rowOrderFunc) {
- this.rowOrderFunc(param);
- }
- }, this.msTableKey);
+ handleRowDrop(
+ this.data,
+ (param) => {
+ param.groupId = this.rowOrderGroupId;
+ if (this.rowOrderFunc) {
+ this.rowOrderFunc(param);
+ }
+ },
+ this.msTableKey
+ );
}
},
- isScrollShow(column, tableTop) { //判断元素是否因为超过表头
+ isScrollShow(column, tableTop) {
+ //判断元素是否因为超过表头
let columnTop = column.getBoundingClientRect().top;
return columnTop - tableTop > 30;
},
@@ -358,25 +369,35 @@ export default {
setDefaultOrders() {
let orders = this.condition.orders;
if (orders) {
- orders.forEach(item => {
+ orders.forEach((item) => {
this.defaultSort = {
prop: lineToHump(item.name),
- order: 'descending'
+ order: "descending",
};
- if (item.type === 'asc') {
- this.defaultSort.order = 'ascending';
+ if (item.type === "asc") {
+ this.defaultSort.order = "ascending";
}
return;
});
}
},
handleSelectAll(selection) {
- _handleSelectAll(this, selection, this.data, this.selectRows, this.condition);
+ _handleSelectAll(
+ this,
+ selection,
+ this.data,
+ this.selectRows,
+ this.condition
+ );
setUnSelectIds(this.data, this.condition, this.selectRows);
- this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
- this.selectIds = Array.from(this.selectRows).map(o => o.id);
+ this.selectDataCounts = getSelectDataCounts(
+ this.condition,
+ this.total,
+ this.selectRows
+ );
+ this.selectIds = Array.from(this.selectRows).map((o) => o.id);
//有的组件需要回调父组件的函数,做下一步处理
- this.$emit('callBackSelectAll', selection);
+ this.$emit("callBackSelectAll", selection);
this.$nextTick(function () {
setTimeout(this.removeBatchPopper, 1);
});
@@ -384,10 +405,14 @@ export default {
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.data, this.condition, this.selectRows);
- this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
- this.selectIds = Array.from(this.selectRows).map(o => o.id);
+ this.selectDataCounts = getSelectDataCounts(
+ this.condition,
+ this.total,
+ this.selectRows
+ );
+ this.selectIds = Array.from(this.selectRows).map((o) => o.id);
//有的组件需要回调父组件的函数,做下一步处理
- this.$emit('callBackSelect', selection);
+ this.$emit("callBackSelect", selection);
this.$nextTick(function () {
setTimeout(this.removeBatchPopper, 1);
});
@@ -401,8 +426,12 @@ export default {
//设置未选择ID(更新)
this.condition.unSelectIds = [];
//更新统计信息
- this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
- this.selectIds = Array.from(this.selectRows).map(o => o.id);
+ this.selectDataCounts = getSelectDataCounts(
+ this.condition,
+ this.total,
+ this.selectRows
+ );
+ this.selectIds = Array.from(this.selectRows).map((o) => o.id);
},
headerDragend(newWidth, oldWidth, column, event) {
if (column) {
@@ -417,11 +446,6 @@ export default {
// 保存列宽
saveCustomTableWidth(this.fieldKey, column.columnKey, newWidth);
},
- showPopover(row, column, cell) {
- if (column.property === 'name') {
- this.currentCaseId = row.id;
- }
- },
doLayout() {
if (this.$refs.table) {
// 表格错位问题,执行三次
@@ -430,9 +454,14 @@ export default {
}
}
},
+ showPopover(row, column, cell) {
+ if (column.property === "name") {
+ this.currentCaseId = row.id;
+ }
+ },
filter(filters) {
_filter(filters, this.condition);
- this.$emit('filter');
+ this.$emit("filter");
this.handleRefresh();
},
sort(column) {
@@ -442,9 +471,12 @@ export default {
}
_sort(column, this.condition);
if (this.rememberOrder) {
- saveLastTableSortField(this.fieldKey, JSON.stringify(this.condition.orders));
+ saveLastTableSortField(
+ this.fieldKey,
+ JSON.stringify(this.condition.orders)
+ );
}
- this.$emit('order', column);
+ this.$emit("order", column);
this.handleRefresh();
},
handleBatchEdit() {
@@ -452,17 +484,21 @@ export default {
this.$refs.batchEdit.open();
},
handleBatchMove() {
- this.$refs.testBatchMove.open(this.treeNodes, Array.from(this.selectRows).map(row => row.id), this.moduleOptions);
+ this.$refs.testBatchMove.open(
+ this.treeNodes,
+ Array.from(this.selectRows).map((row) => row.id),
+ this.moduleOptions
+ );
},
handleRowClick(row, column) {
this.$emit("handleRowClick", row, column);
},
handleRefresh() {
this.clear();
- this.$emit('refresh');
+ this.$emit("refresh");
},
handlePageChange() {
- this.$emit('pageChange');
+ this.$emit("pageChange");
},
cancelCurrentRow() {
this.$refs.table.setCurrentRow(-1);
@@ -474,7 +510,13 @@ export default {
this.clearSelectRows();
},
checkTableRowIsSelect() {
- checkTableRowIsSelect(this, this.condition, this.data, this.$refs.table, this.selectRows);
+ checkTableRowIsSelect(
+ this,
+ this.condition,
+ this.data,
+ this.$refs.table,
+ this.selectRows
+ );
},
clearSelection() {
this.clearSelectRows();
@@ -494,7 +536,10 @@ export default {
this.$refs.customTableHeader.open(this.fields);
},
resetHeader() {
- this.$emit('update:fields', getCustomTableHeader(this.fieldKey, this.customFields));
+ this.$emit(
+ "update:fields",
+ getCustomTableHeader(this.fieldKey, this.customFields)
+ );
this.tableActive = false;
this.$nextTick(() => {
this.doLayout();
@@ -510,30 +555,32 @@ export default {
this.doLayout();
});
},
- addPaddingColClass({column}) {
- if (column.columnKey === 'tableRowDropCol'
- || column.columnKey === 'selectionCol'
- || column.columnKey === 'batchBtnCol') {
- return 'padding-col';
+ addPaddingColClass({ column }) {
+ if (
+ column.columnKey === "tableRowDropCol" ||
+ column.columnKey === "selectionCol" ||
+ column.columnKey === "batchBtnCol"
+ ) {
+ return "padding-col";
}
},
- rowStyle({row}) {
- return row.hidden ? {"display": "none"} : {};
+ rowStyle({ row }) {
+ return row.hidden ? { display: "none" } : {};
},
tableRowClassName(row) {
if (row.row.hidden) {
- return 'ms-variable-hidden-row';
+ return "ms-variable-hidden-row";
}
- return '';
+ return "";
},
- }
+ },
};