fix(entry_latest-buys): fix multi_check
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-05-17 13:50:06 +02:00
parent 576cad16ad
commit 4a9c5742c0
4 changed files with 22 additions and 10 deletions

View File

@ -146,16 +146,17 @@ export default class MultiCheck extends FormInput {
if (!this.model || !this.model.data) return;
const data = this.model.data;
const modelParams = this.model.userParams;
const params = {
filter: {
modelParams: modelParams,
limit: null
}
};
if (this.model.userFilter)
Object.assign(params.filter, this.model.userFilter);
if (this.model.userParams)
Object.assign(params, this.model.userParams);
this.rows = data.length;
this.$http.get(this.model.url, {params})
.then(res => {
this.allRowsCount = res.data.length;

View File

@ -98,9 +98,6 @@ module.exports = Self => {
Self.latestBuysFilter = async(ctx, filter, options) => {
const myOptions = {};
if (filter && filter.modelParams)
ctx.args = filter.modelParams;
if (typeof options == 'object')
Object.assign(myOptions, options);

View File

@ -148,12 +148,12 @@
</td>
<td number>
<vn-chip class="transparent" translate-attr="buy.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': buy.groupingMode == 2}">
<span translate>{{::buy.packing | dashIfEmpty}}</span>
<span>{{::buy.packing | dashIfEmpty}}</span>
</vn-chip>
</td>
<td number>
<vn-chip class="transparent" translate-attr="buy.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': buy.groupingMode == 1}">
<span translate>{{::buy.grouping | dashIfEmpty}}</span>
<span>{{::buy.grouping | dashIfEmpty}}</span>
</vn-chip>
</td>
<td number>{{::buy.quantity}}</td>

View File

@ -159,8 +159,22 @@ export default class Controller extends Section {
lines: rowsToEdit
};
if (this.checkedDummyCount && this.checkedDummyCount > 0)
data.filter = this.$.model.userParams;
if (this.checkedDummyCount && this.checkedDummyCount > 0) {
const params = {};
if (this.$.model.userParams) {
const userParams = this.$.model.userParams;
for (let param in userParams) {
let newParam = this.exprBuilder(param, userParams[param]);
if (!newParam)
newParam = {[param]: userParams[param]};
Object.assign(params, newParam);
}
}
if (this.$.model.userFilter)
Object.assign(params, this.$.model.userFilter.where);
data.filter = params;
}
return this.$http.post('Buys/editLatestBuys', data)
.then(() => {