let ary1 = [
{
fieldNameCh: "名称",
fieldName: "name",
fieldType: "varchar(100)"
},
{
fieldNameCh: "年龄",
fieldName: "age",
fieldType: "int(11)"
},
{
fieldNameCh: "性别",
fieldName: "sex",
fieldType: "varchar(100)"
},
{
fieldNameCh: "id",
fieldName: "id",
fieldType: "integer"
},
{
fieldNameCh: "公司",
fieldName: "cmy",
fieldType: "varchar(100)"
}
];
let ary2 = [
{
columnId: 14,
columnName: "id",
columnType: "integer"
},
{
columnId: 15,
columnName: "name",
columnType: "varchar(100)"
}
];
处理这两个数组得到如下数据
[
{
fieldNameCh: "名称",
fieldName: "name",
fieldType: "varchar(100)",
columnId: 15,
columnName: "name",
columnType: "varchar(100)"
},
{
fieldNameCh: "年龄",
fieldName: "age",
fieldType: "int(11)",
columnId: 0,
columnName: "",
columnType: ""
},
{
fieldNameCh: "性别",
fieldName: "sex",
fieldType: "varchar(100)",
columnId: 0,
columnName: "",
columnType: ""
},
{
fieldNameCh: "id",
fieldName: "id",
fieldType: "integer",
columnId: 14,
columnName: "id",
columnType: "integer"
},
{
fieldNameCh: "公司",
fieldName: "cmy",
fieldType: "varchar(100)",
columnId: 0,
columnName: "",
columnType: ""
}
];
或者这样
let ary3 = [
{
fieldNameCh: "名称",
fieldName: "name",
fieldType: "varchar(100)"
},
{
fieldNameCh: "年龄",
fieldName: "age",
fieldType: "int(11)"
}
];
let ary4 = [
{
columnId: 14,
columnName: "id",
columnType: "integer"
},
{
columnId: 15,
columnName: "name",
columnType: "varchar(100)"
},
{
columnId: 16,
columnName: "age",
columnType: "varchar(100)"
},
{
columnId: 17,
columnName: "sex",
columnType: "varchar(100)"
},
{
columnId: 18,
columnName: "year",
columnType: "varchar(100)"
},
];
得到
[
{
fieldNameCh: "",
fieldName: "",
fieldType: "",
columnId: 14,
columnName: "id",
columnType: "integer"
},
{
fieldNameCh: "名称",
fieldName: "name",
fieldType: "varchar(100)",
columnId: 15,
columnName: "name",
columnType: "varchar(100)"
},
{
fieldNameCh: "年龄",
fieldName: "age",
fieldType: "int(11)",
columnId: 16,
columnName: "age",
columnType: "varchar(100)"
},
{
fieldNameCh: "",
fieldName: "",
fieldType: "",
columnId: 17,
columnName: "sex",
columnType: "varchar(100)"
},
{
fieldNameCh: "",
fieldName: "",
fieldType: "",
columnId: 18,
columnName: "year",
columnType: "varchar(100)"
},
];