fix(接口测试): 修复key-value参数中当建值对全部为空时不会主动删除当前数据行的问题

--bug=1012000 --user=宋天阳 rest 参数删除后保存,标签那里数字没有清空
https://www.tapd.cn/55049933/s/1133353
This commit is contained in:
song-tianyang 2022-04-12 18:05:06 +08:00 committed by TIanyang
parent 82884face5
commit 541b01a1d1
1 changed files with 14 additions and 1 deletions

View File

@ -192,9 +192,21 @@ export default {
},
change: function () {
let isNeedCreate = true;
let removeIndexArr = [];
this.parameters.forEach((item, index) => {
if ((!item.name || item.name === '' ) && (!item.value || item.value === '') && (!item.files || item.files.length === 0)) {
//
removeIndexArr.push(index);
}
});
if(removeIndexArr.length > 0){
for(let i = removeIndexArr.length-1; i>=0; i--){
this.remove(removeIndexArr[i]);
}
}
let removeIndex = -1;
this.parameters.forEach((item, index) => {
if (!item.name && !item.value) {
if ((!item.name || item.name === '' ) && (!item.value || item.value === '') && (!item.files || item.files.length === 0)) {
//
if (index !== this.parameters.length - 1) {
removeIndex = index;
@ -203,6 +215,7 @@ export default {
isNeedCreate = false;
}
});
if (isNeedCreate) {
this.parameters.push(new KeyValue({
type: 'text',