forked from github/dataease
fix(数据源): 校验 API 数据源字段重复
This commit is contained in:
parent
59b393f506
commit
052bf58292
@ -1036,6 +1036,14 @@ export default {
|
|||||||
handleFiledChange2(jsonFields){
|
handleFiledChange2(jsonFields){
|
||||||
for (var i = 0; i < jsonFields.length; i++) {
|
for (var i = 0; i < jsonFields.length; i++) {
|
||||||
if (jsonFields[i].checked && jsonFields[i].children === undefined) {
|
if (jsonFields[i].checked && jsonFields[i].children === undefined) {
|
||||||
|
|
||||||
|
for (var j = 0; j < this.apiItem.fields.length; j++) {
|
||||||
|
if(this.apiItem.fields[j].name === jsonFields[i].name){
|
||||||
|
this.$refs.apiItemTable.toggleRowSelection(jsonFields[i]);
|
||||||
|
this.$message.error(jsonFields[i].name + ', ' + i18n.t('datasource.has_repeat_field_name'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
this.apiItem.fields.push(jsonFields[i]);
|
this.apiItem.fields.push(jsonFields[i]);
|
||||||
}
|
}
|
||||||
if (jsonFields[i].children !== undefined) {
|
if (jsonFields[i].children !== undefined) {
|
||||||
@ -1047,10 +1055,7 @@ export default {
|
|||||||
let datas = [];
|
let datas = [];
|
||||||
let maxPreviewNum = 0;
|
let maxPreviewNum = 0;
|
||||||
for (let j = 0; j < this.apiItem.fields.length; j++) {
|
for (let j = 0; j < this.apiItem.fields.length; j++) {
|
||||||
if (
|
if (this.apiItem.fields[j].value && this.apiItem.fields[j].value.length > maxPreviewNum) {
|
||||||
this.apiItem.fields[j].value &&
|
|
||||||
this.apiItem.fields[j].value.length > maxPreviewNum
|
|
||||||
) {
|
|
||||||
maxPreviewNum = this.apiItem.fields[j].value.length;
|
maxPreviewNum = this.apiItem.fields[j].value.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1059,11 +1064,7 @@ export default {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < this.apiItem.fields.length; i++) {
|
for (let i = 0; i < this.apiItem.fields.length; i++) {
|
||||||
for (let j = 0; j < this.apiItem.fields[i].value.length; j++) {
|
for (let j = 0; j < this.apiItem.fields[i].value.length; j++) {
|
||||||
this.$set(
|
this.$set(datas[j], this.apiItem.fields[i].name, this.apiItem.fields[i].value[j]);
|
||||||
datas[j],
|
|
||||||
this.apiItem.fields[i].name,
|
|
||||||
this.apiItem.fields[i].value[j]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
this.$refs.plxTable.reloadData(datas);
|
this.$refs.plxTable.reloadData(datas);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user