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