refs #5066 copy project from the other
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
6f2aa0f618
commit
b45b0ff826
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||
VALUES
|
||||
('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee');
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getVehiclesSorted', {
|
||||
description: 'Sort the vehicles by a warehouse',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'warehouseFk',
|
||||
type: 'number'
|
||||
}],
|
||||
returns: {
|
||||
type: ['object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getVehiclesSorted`,
|
||||
verb: `POST`
|
||||
}
|
||||
});
|
||||
|
||||
Self.getVehiclesSorted = async warehouseFk => {
|
||||
const vehicles = await Self.rawSql(`
|
||||
SELECT v.id, v.numberPlate, w.name
|
||||
FROM vehicle v
|
||||
JOIN warehouse w ON w.id = v.warehouseFk
|
||||
ORDER BY v.warehouseFk = ? DESC, v.numberPlate ASC`, [warehouseFk]);
|
||||
|
||||
return vehicles;
|
||||
};
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/vehicle/getVehiclesSorted')(Self);
|
||||
};
|
|
@ -24,10 +24,13 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.route.vehicleFk"
|
||||
url="Vehicles"
|
||||
data="$ctrl.vehicles"
|
||||
show-field="numberPlate"
|
||||
value-field="id"
|
||||
label="Vehicle">
|
||||
<tpl-item>
|
||||
{{numberPlate}} - {{name}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
|
|
@ -7,6 +7,19 @@ class Controller extends Section {
|
|||
this.card.reload()
|
||||
);
|
||||
}
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.$http.get(`UserConfigs/getUserConfig`)
|
||||
.then(res => {
|
||||
if (res && res.data) {
|
||||
this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk})
|
||||
.then(res => {
|
||||
if (res && res.data)
|
||||
this.vehicles = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnRouteBasicData', {
|
||||
|
|
Loading…
Reference in New Issue