refact list production

This commit is contained in:
Daniel Herrero 2017-11-08 14:59:46 +01:00
parent 1d109f2371
commit f71dfa53ef
4 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,7 @@
<paging
page="$ctrl.currentPage"
page-size="$ctrl.numPerPage"
page-size="$ctrl.numPerPage"
ng-if="$ctrl.numPages>1"
total="$ctrl.numItems"
show-prev-next="true"
show-first-last="false"

View File

@ -138,7 +138,6 @@ export default class ProductionIndex {
this.hourItems.push({id: i, name: hour});
}
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
// this.searchTickets(this.filter);
}
}

View File

@ -4,7 +4,7 @@ export class ProductionTable {
constructor($filter) {
this.$filter = $filter;
this._tickets = [];
this.itemsDisplayedInList = 14;
this.itemsDisplayedInList = 16;
this._checkAll = 0;
this.pageTable = {
filter: {

View File

@ -28,6 +28,13 @@ module.exports = function(Self) {
onFinish(err);
}
reBuildFilter();
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
}
function reBuildFilter() {
if (filter.where && filter.where.q) {
let regexQ = new RegExp(filter.where.q);
delete filter.where.q;
@ -53,14 +60,10 @@ module.exports = function(Self) {
}
filter.where = newFilter;
}
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM FakeProduction_tmp ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
}
function onFinish(err, results) {
conn.query('DROP TEMPORARY TABLE IF EXISTS FakeProduction_tmp');
conn.query('DROP TEMPORARY TABLE IF EXISTS tmp.production');
conn.release();
if (err)
callback(err);