Zone.getLeaves() refactor
gitea/salix/master This commit looks good
Details
gitea/salix/master This commit looks good
Details
This commit is contained in:
parent
05fec10cf2
commit
40c555702d
|
@ -4,9 +4,10 @@ module.exports = Self => {
|
||||||
description: 'Returns the nodes for a zone',
|
description: 'Returns the nodes for a zone',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'zoneFk',
|
arg: 'id',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
required: true,
|
http: {source: 'path'},
|
||||||
|
required: true
|
||||||
}, {
|
}, {
|
||||||
arg: 'parentFk',
|
arg: 'parentFk',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
|
@ -22,15 +23,15 @@ module.exports = Self => {
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/getLeaves`,
|
path: `/:id/getLeaves`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getLeaves = async(zoneFk, parentFk = null, search) => {
|
Self.getLeaves = async(id, parentFk = null, search) => {
|
||||||
let [res] = await Self.rawSql(
|
let [res] = await Self.rawSql(
|
||||||
`CALL zone_getLeaves(?, ?, ?)`,
|
`CALL zone_getLeaves(?, ?, ?)`,
|
||||||
[zoneFk, parentFk, search]
|
[id, parentFk, search]
|
||||||
);
|
);
|
||||||
|
|
||||||
let map = new Map();
|
let map = new Map();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="/agency/api/Zones/getLeaves"
|
url="/api/Zones/{{$ctrl.$stateParams.id}}/getLeaves"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
params="{zoneFk: $ctrl.$stateParams.id}"
|
|
||||||
auto-load="false">
|
auto-load="false">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<div class="main-with-right-menu">
|
<div class="main-with-right-menu">
|
||||||
|
|
|
@ -2,11 +2,9 @@ import ngModule from '../module';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($, $http, $stateParams) {
|
constructor($, $http, $stateParams) {
|
||||||
this.$stateParams = $stateParams;
|
|
||||||
this.$ = $;
|
this.$ = $;
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.searchValue = '';
|
this.$stateParams = $stateParams;
|
||||||
this.filter = {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(params) {
|
onSearch(params) {
|
||||||
|
|
Loading…
Reference in New Issue