addCollisionFollowRecord.js
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(function (angular) {
function AddCollisionFollowRecordInfo($scope, aiNicheService,param,$uibModalInstance, SweetAlertX) {
if(param == null){
$scope.form = {};
$scope.isEdit = false;
}else {
$scope.form = param;
$scope.isEdit = true;
}
// 单选日期配置 跟进时间
$scope.singleDateSettings = {
singleDatePicker: true
};
$scope.form.followTime = {
startDate: moment(),
endDate: moment()
};
$scope.maxDate = moment();
$scope.minDate = moment();
//保养、预约时间
// $scope.singleDateSettings1 = {
// singleDatePicker: true,
// timePicker: true,
// format: 'YYYY-MM-DD HH:mm:ss'
// };
//跟进时间
$scope.singleDateSettings = {
singleDatePicker: true,
timePicker: true,
format: 'YYYY-MM-DD HH:mm:ss'
};
// $scope.form.makeTime = {
// startDate: moment(),
// endDate: moment()
// };
function getFollowInfo () {
aiNicheService.getFollowRecordById({id:param.followId}, function (response) {
if (response.returnCode === '0') {
if (response.data != null) {
var obj = response.data;
$scope.form.followResult = obj.followResult + '';
$scope.form.remarks = obj.remarks;
}
}
})
}
getFollowInfo();
//保存
$scope.ok = function () {
if ($scope.add_followRecord_form.$valid) {
var standNo = param.standNo;
var id = param.followId;
var collision = param.id;
var obj = {
id:id,
collisionId:collision,
standNo: standNo,
source:3,
sign:1,
followTime: $scope.form.followTime.startDate.format('YYYY-MM-DD HH:mm:ss'),
followResult: $scope.form.followResult,
remarks: ($scope.form.remarks ||'--')
};
aiNicheService.addFollowRecord(obj, function (data) {
if (data.returnCode == '0') {
SweetAlertX.alert('', '提交成功', 'success');
$uibModalInstance.close(data);
} else {
SweetAlertX.alert(data.message || '', '提交失败', 'error');
}
});
}else {
$scope.add_followRecord_form.submitted = true;
}
};
//取消
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
}
angular.module('AIniche').controller('AddCollisionFollowRecordInfo', AddCollisionFollowRecordInfo);
})(angular);