fix(smart-table): monitor only ticketFilter use url and add ?q in routes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-11-02 09:40:09 +01:00
parent f8f44aaae7
commit 9891f7060d
8 changed files with 45 additions and 47 deletions

View File

@ -290,7 +290,7 @@ export default class Searchbar extends Component {
}
let where = null;
let params = null;
let params = {};
if (this.exprBuilder) {
where = buildFilter(filter,

View File

@ -19,9 +19,11 @@ export default class SmartTable extends Component {
this.transclude();
}
$onInit() {
if (this.model)
$onChanges() {
if (this.model) {
this.defaultFilter();
this.defaultOrder();
}
}
$onDestroy() {
@ -53,11 +55,8 @@ export default class SmartTable extends Component {
set model(value) {
this._model = value;
if (value) {
if (value)
this.$.model = value;
this.defaultFilter();
this.defaultOrder();
}
}
getDefaultViewConfig() {
@ -168,7 +167,8 @@ export default class SmartTable extends Component {
}
defaultFilter() {
if (!this.$params.q) return;
if (this.disabledTableFilter || !this.$params.q) return;
const stateFilter = JSON.parse(this.$params.q).tableQ;
if (!stateFilter || !this.exprBuilder) return;
@ -188,6 +188,8 @@ export default class SmartTable extends Component {
}
defaultOrder() {
if (this.disabledTableOrder) return;
let stateOrder;
if (this.$params.q)
stateOrder = JSON.parse(this.$params.q).tableOrder;
@ -607,6 +609,8 @@ ngModule.vnComponent('smartTable', {
autoSave: '<?',
exprBuilder: '&?',
defaultNewData: '&?',
options: '<?'
options: '<?',
disabledTableFilter: '<?',
disabledTableOrder: '<?',
}
});

View File

@ -105,7 +105,7 @@
"acl": ["claimManager"]
},
{
"url": "/action",
"url": "/action?q",
"state": "claim.card.action",
"component": "vn-claim-action",
"description": "Action",

View File

@ -406,13 +406,13 @@
}
},
{
"url": "/defaulter",
"url": "/defaulter?q",
"state": "client.defaulter",
"component": "vn-client-defaulter",
"description": "Defaulter"
},
{
"url" : "/notification",
"url" : "/notification?q",
"state": "client.notification",
"component": "vn-client-notification",
"description": "Notifications"
@ -424,7 +424,7 @@
"description": "Unpaid"
},
{
"url": "/extended-list",
"url": "/extended-list?q",
"state": "client.extendedList",
"component": "vn-client-extended-list",
"description": "Extended list"

View File

@ -34,7 +34,7 @@
<th field="itemFk">
<span translate>Item ID</span>
</th>
<th field="itemName">
<th field="name">
<span translate>Description</span>
</th>
<th field="warehouseFk">

View File

@ -12,14 +12,6 @@ export default class Controller extends Section {
},
defaultSearch: true,
columns: [
{
field: 'itemName',
autocomplete: {
url: 'Items',
showField: 'name',
valueField: 'id'
}
},
{
field: 'warehouseFk',
autocomplete: {
@ -105,8 +97,8 @@ export default class Controller extends Section {
exprBuilder(param, value) {
switch (param) {
case 'itemName':
return {'i.id': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'itemFk':
case 'warehouseFk':
case 'rate2':

View File

@ -23,6 +23,8 @@
model="model"
options="$ctrl.smartTableOptions"
expr-builder="$ctrl.exprBuilder(param, value)"
disabled-table-filter="true"
disabled-table-order="true"
class="scrollable sm">
<slot-actions>
<vn-horizontal>

View File

@ -39,7 +39,7 @@
"abstract": true,
"component": "vn-route-card"
}, {
"url": "/agency-term",
"url": "/agency-term?q",
"abstract": true,
"state": "route.agencyTerm",
"component": "ui-view"