This commit is contained in:
@@ -114,26 +114,32 @@ export default {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
dat = res.data;
|
dat = res.data;
|
||||||
}
|
}
|
||||||
console.log("Done parseCSVFile");
|
//console.log("Done parseCSVFile");
|
||||||
} else {
|
} else {
|
||||||
dat = await parseJSONFile(this.uploadFile);
|
dat = await parseJSONFile(this.uploadFile);
|
||||||
console.log("Done parse json");
|
//console.log("Done parse json");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"The processed data before cleaning is ",
|
// "The processed data before cleaning is ",
|
||||||
JSON.stringify(dat)
|
// JSON.stringify(dat)
|
||||||
);
|
// );
|
||||||
|
|
||||||
//strip out any unsupported fields before transmission
|
//strip out any unsupported fields before transmission
|
||||||
cleanData(dat, this.ayaType);
|
cleanData(dat, this.ayaType);
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"The processed data AFTER cleaning is ",
|
// "The processed data AFTER cleaning is ",
|
||||||
JSON.stringify(dat)
|
// JSON.stringify(dat)
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "if it was csv it should look like this:",
|
||||||
|
// Papa.unparse(dat)
|
||||||
|
// );
|
||||||
|
|
||||||
//upload the data
|
//upload the data
|
||||||
//await this.upload(dat);
|
await this.upload(dat);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
window.$gz.errorHandler.handleFormError(error);
|
window.$gz.errorHandler.handleFormError(error);
|
||||||
}
|
}
|
||||||
@@ -283,41 +289,43 @@ function cleanData(dat, atype) {
|
|||||||
//at front end it will attempt to match up but not create if not existing
|
//at front end it will attempt to match up but not create if not existing
|
||||||
switch (atype) {
|
switch (atype) {
|
||||||
case 8: //CUSTOMER
|
case 8: //CUSTOMER
|
||||||
allowedProps.concat([
|
allowedProps.push(
|
||||||
"Name",
|
...[
|
||||||
"Active",
|
"Name",
|
||||||
"Notes",
|
"Active",
|
||||||
"Wiki",
|
"Notes",
|
||||||
"CustomFields",
|
"Wiki",
|
||||||
"Tags",
|
"CustomFields",
|
||||||
"WebAddress",
|
"Tags",
|
||||||
"AlertNotes",
|
"WebAddress",
|
||||||
"BillHeadOffice",
|
"AlertNotes",
|
||||||
"HeadOfficeName",
|
"BillHeadOffice",
|
||||||
"HeadOfficeViz",
|
"HeadOfficeName",
|
||||||
"TechNotes",
|
"HeadOfficeViz",
|
||||||
"AccountNumber",
|
"TechNotes",
|
||||||
"ContractName",
|
"AccountNumber",
|
||||||
"ContractViz",
|
"ContractName",
|
||||||
"ContractExpires",
|
"ContractViz",
|
||||||
"Phone1",
|
"ContractExpires",
|
||||||
"Phone2",
|
"Phone1",
|
||||||
"Phone3",
|
"Phone2",
|
||||||
"Phone4",
|
"Phone3",
|
||||||
"Phone5",
|
"Phone4",
|
||||||
"EmailAddress",
|
"Phone5",
|
||||||
"PostAddress",
|
"EmailAddress",
|
||||||
"PostCity",
|
"PostAddress",
|
||||||
"PostRegion",
|
"PostCity",
|
||||||
"PostCountry",
|
"PostRegion",
|
||||||
"PostCode",
|
"PostCountry",
|
||||||
"Address",
|
"PostCode",
|
||||||
"City",
|
"Address",
|
||||||
"Region",
|
"City",
|
||||||
"Country",
|
"Region",
|
||||||
"Latitude",
|
"Country",
|
||||||
"Longitude"
|
"Latitude",
|
||||||
]);
|
"Longitude"
|
||||||
|
]
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,12 +333,8 @@ function cleanData(dat, atype) {
|
|||||||
dat.forEach(z => {
|
dat.forEach(z => {
|
||||||
for (const prop in z) {
|
for (const prop in z) {
|
||||||
if (allowedProps.includes(prop) == false) {
|
if (allowedProps.includes(prop) == false) {
|
||||||
console.log(`removing unknown property z.${prop}`);
|
|
||||||
delete z[prop];
|
delete z[prop];
|
||||||
} else {
|
|
||||||
console.log(`Keeping known property z.${prop}`);
|
|
||||||
}
|
}
|
||||||
//console.log(`z.${prop} = ${z[prop]}`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -413,5 +417,14 @@ Assign it in code to a variable:
|
|||||||
"Latitude",
|
"Latitude",
|
||||||
"Longitude"
|
"Longitude"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if it was csv it should look like this:
|
||||||
|
Name,Active,Notes,Wiki,CustomFields,Tags,WebAddress,AlertNotes,BillHeadOffice,HeadOfficeViz,TechNotes,AccountNumber,ContractViz,ContractExpires,Phone1,Phone2,Phone3,Phone4,Phone5,EmailAddress,PostAddress,PostCity,PostRegion,PostCountry,PostCode,Address,City,Region,Country,Latitude,Longitude
|
||||||
|
"ACopyOf Altenwerth, Willms and Krajcik",true,Advanced web-enabled productivity,,,"black,white",https://example.info,,true,"Gerlach, Howe and Crist",,40810165,,,(868) 464-5253,1-788-655-8853 x08455,536.824.7646,,,Maximo_Ziemann10@example.net,00060 Davion Mission,East Kevonstad,Washington,Iraq,68361-2305,75163 Heller Plains,East Kevonstad,Washington,Iraq,33.3014,-157.7912
|
||||||
|
"ACopyOf Adams, Macejkovic and Stoltenberg",true,Multi-layered multi-tasking infrastructure,,,zone9,https://example.biz,,false,,,21491466,,,830-720-4993 x86044,1-306-960-6200 x0811,1-269-482-1221 x97391,,,Leanne99@example.com,4399 Hegmann Pass,South Velva,Georgia,Chile,44636-1335,6036 Reggie Pine,South Velva,Georgia,Chile,41.1883,-152.6866
|
||||||
|
|
||||||
*/
|
*/
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user