refs #5669 refactor: simplificado front
This commit is contained in:
parent
f388415ba3
commit
87311261ca
|
@ -9,31 +9,17 @@ module.exports = Self => {
|
||||||
description: 'ticket id',
|
description: 'ticket id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
}],
|
}],
|
||||||
returns: [{
|
returns: {
|
||||||
arg: 'saleVolume',
|
type: 'object',
|
||||||
type: ['object']
|
root: true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
arg: 'packingTypeVolume',
|
|
||||||
type: ['object']
|
|
||||||
}],
|
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/getVolume`,
|
path: `/:id/getVolume`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getVolume = async(ticketFk, options) => {
|
Self.getVolume = async ticketFk => {
|
||||||
const myOptions = {};
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
const saleVolume = await Self.rawSql(`
|
|
||||||
SELECT saleFk, volume
|
|
||||||
FROM vn.saleVolume
|
|
||||||
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
|
||||||
|
|
||||||
const packingTypeVolume = await Self.rawSql(`
|
const packingTypeVolume = await Self.rawSql(`
|
||||||
SELECT s.itemPackingTypeFk code,
|
SELECT s.itemPackingTypeFk code,
|
||||||
i.description,
|
i.description,
|
||||||
|
@ -42,8 +28,8 @@ module.exports = Self => {
|
||||||
LEFT JOIN vn.itemPackingType i
|
LEFT JOIN vn.itemPackingType i
|
||||||
ON i.code = s.itemPackingTypeFk
|
ON i.code = s.itemPackingTypeFk
|
||||||
WHERE s.ticketFk = ?
|
WHERE s.ticketFk = ?
|
||||||
GROUP BY s.itemPackingTypeFk`, [ticketFk], myOptions);
|
GROUP BY s.itemPackingTypeFk`, [ticketFk]);
|
||||||
|
|
||||||
return [saleVolume, packingTypeVolume];
|
return packingTypeVolume;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,9 +42,11 @@ module.exports = Self => {
|
||||||
i.value7,
|
i.value7,
|
||||||
i.value8,
|
i.value8,
|
||||||
i.value9,
|
i.value9,
|
||||||
i.value10
|
i.value10,
|
||||||
|
sv.volume
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN vn.saleVolume sv ON sv.saleFk = s.id
|
||||||
WHERE s.ticketFk = ?`
|
WHERE s.ticketFk = ?`
|
||||||
, [id]
|
, [id]
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>{{::sale.item.itemPackingTypeFk}}</vn-td>
|
<vn-td number>{{::sale.item.itemPackingTypeFk}}</vn-td>
|
||||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
<vn-td number>{{::sale.quantity}}</vn-td>
|
||||||
<vn-td number>{{::sale.saleVolume.volume | number:3}}</vn-td>
|
<vn-td number>{{::sale.volume | number:3}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
|
|
|
@ -19,17 +19,9 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
applyVolumes() {
|
applyVolumes() {
|
||||||
this.$http.get(`Tickets/${this.$params.id}/getVolume`).then(res => {
|
this.$http.get(`Tickets/${this.$params.id}/getVolume`)
|
||||||
const saleVolume = res.data.saleVolume;
|
.then(res => {
|
||||||
|
this.packingTypeVolume = res.data;
|
||||||
const volumes = new Map();
|
|
||||||
for (const volume of saleVolume)
|
|
||||||
volumes.set(volume.saleFk, volume);
|
|
||||||
|
|
||||||
for (const sale of this.sales)
|
|
||||||
sale.saleVolume = volumes.get(sale.id);
|
|
||||||
|
|
||||||
this.packingTypeVolume = res.data.packingTypeVolume;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue