refactor(接口测试): 文档断言增加全选框

--story=1011686 --user=王孝刚 接口自动化文档结构断言增加复选框
https://www.tapd.cn/55049933/s/1360753
This commit is contained in:
wxg0103 2023-04-10 14:06:44 +08:00 committed by fit2-zhao
parent 4e0b56abfe
commit 4829d18400
5 changed files with 67 additions and 15 deletions

View File

@ -240,7 +240,7 @@ export function mergeDocumentData(originalData, childMap, rootData) {
item.include = rootData.include;
item.conditions = rootData.conditions;
}
if (childMap && childMap.size !== 0 && childMap.has(item.id)) {
if (childMap && childMap.size !== 0 && childMap instanceof Map && childMap.has(item.id)) {
let sourceData = JSON.parse(JSON.stringify(item.children));
item.children = JSON.parse(JSON.stringify(childMap.get(item.id)));
item.children.forEach((target) => {

View File

@ -50,9 +50,9 @@
<el-table-column
prop="include"
width="78"
width="85"
:label="$t('api_test.request.assertions.must_contain')"
:scoped-slot="renderHeader">
:render-header="renderHeader">
<template slot-scope="scope">
<el-checkbox
v-model="scope.row.include"
@ -63,9 +63,9 @@
<el-table-column
prop="typeVerification"
width="100"
width="115"
:label="$t('api_test.request.assertions.type_verification')"
:scoped-slot="renderHeaderType">
:render-header="renderHeaderType">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.typeVerification" @change="handleCheckOneChange" :disabled="checked" />
</template>
@ -445,30 +445,61 @@ export default {
});
return value;
},
renderHeader(h, { column }) {
return h('span', [
renderHeader(h, {column}) {
return h('div', [
h('span', column.label),
h('el-checkbox', {
style: 'margin-right:5px;',
style: 'margin-left:5px;',
disabled: this.checked,
on: {
change: this.handleCheckAllChange,
},
}),
h('span', column.label),
h(
'el-tooltip',
{
props: {
content: this.$t('api_definition.document_tooltip'),
placement: 'top' //
}
},
[
h('i', {
class: 'el-icon-question',
style: 'margin-left:2px;'
})
]
)
]);
},
renderHeaderType(h, { column }) {
return h('span', [
renderHeaderType(h, {column}) {
return h('div', [
h('span', column.label),
h('el-checkbox', {
style: 'margin-right:5px;',
style: 'margin-left:5px;',
disabled: this.checked,
on: {
change: this.handleType,
},
}),
h('span', column.label),
h(
'el-tooltip',
{
props: {
content: this.$t('api_definition.document_tooltip'),
placement: 'top' //
}
},
[
h('i', {
class: 'el-icon-question',
style: 'margin-left:2px;'
})
]
)
]);
},
renderHeaderArray(h, { column }) {
return h('span', [
h('el-checkbox', {
@ -513,16 +544,34 @@ export default {
}
this.childrenChecked(item.children, 1, val);
});
this.mapData.forEach((value, key) => {
if (value && value.length > 0) {
value.forEach((item) => {
item.include = val;
if (item.type === 'array') {
item.include = false;
} else {
item.include = val;
}
});
}
});
},
handleType(val) {
if (this.checked) {
return;
}
this.originalData.forEach((item) => {
this.tableData.forEach((item) => {
item.typeVerification = val;
this.childrenChecked(item.children, 2, val);
});
this.tableDataList(this.originalData);
this.mapData.forEach((value, key) => {
if (value && value.length > 0) {
value.forEach((item) => {
item.typeVerification = val;
});
}
});
},
handleArray(val) {
if (this.checked) {

View File

@ -37,6 +37,7 @@ const message = {
request: {
auto_redirects: 'Auto redirects',
},
document_tooltip: 'Only valid for displayed parameters',
},
home: {
dashboard: {

View File

@ -35,6 +35,7 @@ const message = {
request: {
auto_redirects: '自动重定向',
},
document_tooltip: '仅对已展示的参数生效',
},
home: {
dashboard: {

View File

@ -35,6 +35,7 @@ const message = {
request: {
auto_redirects: '自動重定向',
},
document_tooltip: '僅對已顯示的參與數據生成效率',
},
home: {
dashboard: {