template fixes

This commit is contained in:
VLE2FE
2020-08-27 13:56:55 +02:00
parent 6f95ff4148
commit 04c2ff2678
7 changed files with 60 additions and 16 deletions

View File

@ -41,8 +41,12 @@ export class SampleModel extends BaseModel {
return this;
}
sendFormat() {
const tmp = pick(this.conditionTemplateCheck(), ['color', 'type', 'batch', 'condition', 'material_id', 'notes']);
sendFormat(pickCondition = true) {
const pickFields = ['color', 'type', 'batch', 'material_id', 'notes'];
if (pickCondition) {
pickFields.push('condition');
}
const tmp = pick(this.conditionTemplateCheck(), pickFields);
Object.keys(tmp).forEach(key => {
if (tmp[key] === undefined) {
delete tmp[key];