| xqd
@@ -160,10 +160,12 @@
|
|
|
}
|
|
|
$scope.load(true);
|
|
|
}]);
|
|
|
- app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', function ($scope, myService, msg, $state, $stateParams, camera, config) {
|
|
|
+ app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', 'camera', 'config', '$timeout', function ($scope, myService, msg, $state, $stateParams, camera, config, $timeout) {
|
|
|
$scope.vm = {};
|
|
|
if ($stateParams.item) {
|
|
|
$scope.vm = $stateParams.item;
|
|
|
+ $scope.vm.begin_use_date = new Date($scope.vm.begin_use_date);
|
|
|
+ $scope.vm.expire_date = new Date($scope.vm.expire_date);
|
|
|
}
|
|
|
$scope.typeOpt = [
|
|
|
{ name: '厢式货车', value: '1' },
|
| xqd
@@ -188,13 +190,24 @@
|
|
|
{ name: '其他', value: '20' }];
|
|
|
$scope.save = function () {
|
|
|
msg.loading('保存中...');
|
|
|
- myService.addTruck($scope.vm).then(function (result) {
|
|
|
- msg.hide();
|
|
|
- $state.go('wl.my_truck');
|
|
|
- }, function (erro) {
|
|
|
- msg.hide();
|
|
|
- msg.error(erro.data.message);
|
|
|
- });
|
|
|
+ if ($scope.vm.id>0) {
|
|
|
+ myService.updateTruck($scope.vm).then(function (result) {
|
|
|
+ msg.hide();
|
|
|
+ $state.go('wl.my_truck');
|
|
|
+ }, function (erro) {
|
|
|
+ msg.hide();
|
|
|
+ msg.error(erro.data.message);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ myService.addTruck($scope.vm).then(function (result) {
|
|
|
+ msg.hide();
|
|
|
+ $state.go('wl.my_truck');
|
|
|
+ }, function (erro) {
|
|
|
+ msg.hide();
|
|
|
+ msg.error(erro.data.message);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//上传图片
|
|
|
$scope.setPhoto = function () {
|