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

@ -73,7 +73,7 @@
{
"url": "/note",
"state": "claim.card.note",
"component": "ui-view",
"component": "ui-view",
"abstract": true,
"acl": ["salesPerson"]
},
@ -105,7 +105,7 @@
"acl": ["claimManager"]
},
{
"url": "/action",
"url": "/action?q",
"state": "claim.card.action",
"component": "vn-claim-action",
"description": "Action",
@ -131,4 +131,4 @@
"acl": ["claimManager"]
}
]
}
}

View File

@ -20,7 +20,7 @@
{"state": "client.card.credit.index", "icon": "credit_card"},
{"state": "client.card.greuge.index", "icon": "work"},
{"state": "client.card.balance.index", "icon": "icon-invoice"},
{"state": "client.card.recovery.index", "icon": "icon-recovery"},
{"state": "client.card.recovery.index", "icon": "icon-recovery"},
{"state": "client.card.webAccess", "icon": "cloud"},
{"state": "client.card.log", "icon": "history"},
{
@ -37,7 +37,7 @@
{"state": "client.card.unpaid", "icon": "icon-defaulter"}
]
}
]
]
},
"keybindings": [
{"key": "c", "state": "client.index"}
@ -147,7 +147,7 @@
{
"url": "/note",
"state": "client.card.note",
"component": "ui-view",
"component": "ui-view",
"abstract": true
},
{
@ -236,7 +236,7 @@
"client": "$ctrl.client"
}
},
{
{
"url": "/create?payed&companyFk&bankFk&payedAmount",
"state": "client.card.balance.create",
"component": "vn-client-balance-create",
@ -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

@ -23,9 +23,9 @@
</vn-portal>
<div class="vn-w-xl">
<vn-card>
<smart-table
<smart-table
model="model"
options="$ctrl.smartTableOptions"
options="$ctrl.smartTableOptions"
expr-builder="$ctrl.exprBuilder(param, value)">
<slot-table>
<table>
@ -34,18 +34,18 @@
<th field="itemFk">
<span translate>Item ID</span>
</th>
<th field="itemName">
<th field="name">
<span translate>Description</span>
</th>
<th field="warehouseFk">
<span translate>Warehouse</span>
</th>
<th
<th
field="rate2"
vn-tooltip="Price By Unit">
<span translate>P.P.U.</span>
</th>
<th
<th
field="rate3"
vn-tooltip="Price By Package">
<span translate>P.P.P.</span>
@ -170,7 +170,7 @@
</vn-icon-button>
</div>
</slot-table>
</smart-table>
</smart-table>
</vn-card>
</div>
<vn-item-descriptor-popover
@ -182,4 +182,4 @@
on-accept="$ctrl.removePrice($data.$index)"
question="Are you sure you want to continue?"
message="This row will be removed">
</vn-confirm>
</vn-confirm>

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

@ -19,22 +19,24 @@
</vn-none>
</vn-horizontal>
<vn-card vn-id="card">
<smart-table
model="model"
options="$ctrl.smartTableOptions"
<smart-table
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>
<vn-date-picker
class="vn-pa-xs"
label="From"
label="From"
ng-model="$ctrl.dateFrom"
on-change="$ctrl.addFilterDate()">
</vn-date-picker>
<vn-date-picker
class="vn-pa-xs"
label="To"
label="To"
ng-model="$ctrl.dateTo"
on-change="$ctrl.addFilterDate()">
</vn-date-picker>
@ -100,9 +102,9 @@
</slot-pagination>
</smart-table>
</vn-card>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>
</vn-client-descriptor-popover>

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"
@ -49,12 +49,12 @@
"component": "vn-agency-term-index",
"description": "Autonomous",
"acl": ["administrative"]
},{
},{
"url": "/createInvoiceIn?q",
"state": "route.agencyTerm.createInvoiceIn",
"component": "vn-agency-term-create-invoice-in",
"description": "File management",
"params": {
"params": {
"route": "$ctrl.route"
},
"acl": ["administrative"]
@ -92,4 +92,4 @@
"acl": ["delivery"]
}
]
}
}