|
|
@@ -1,55 +1,55 @@
|
|
1
|
1
|
"use strict";
|
|
2
|
2
|
//var useCount="";
|
|
3
|
3
|
angular.module('app.business')
|
|
4
|
|
- //器材信息
|
|
5
|
|
- .controller("deviceRepairCtrl", function($scope, $http,$state,$rootScope,orgService,deviceRepairService,deviceGetService, $stateParams, APP_CONFIG) {
|
|
6
|
|
- // 获取列表数据
|
|
7
|
|
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
|
|
8
|
|
- $scope.search = {repairStatus:""};
|
|
9
|
|
- $scope.orgId = $rootScope.userInfo.orgId;
|
|
10
|
|
- $scope.loadData = function() {
|
|
11
|
|
- orgService.editOrg($scope.orgId).then(function(data) {
|
|
12
|
|
- $scope.orgInfo = data;
|
|
13
|
|
- //$scope.orgName=$scope.orgInfo.orgName;
|
|
14
|
|
- }, function(data) {
|
|
15
|
|
- console.log(data);
|
|
16
|
|
- });
|
|
17
|
|
-
|
|
18
|
|
- deviceRepairService.getPageInfoDevice($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,$scope.search.repairStatus,$scope.orgInfo.orgName).then(function(data){
|
|
19
|
|
- $scope.pageInfo = data;
|
|
20
|
|
- $scope.deviceRepairList = data.list;
|
|
21
|
|
- },function(data){
|
|
22
|
|
- console.log(data);
|
|
23
|
|
- });
|
|
24
|
|
- }
|
|
25
|
|
- $scope.loadData();
|
|
26
|
|
-
|
|
27
|
|
- // 翻页
|
|
28
|
|
- $scope.goPage = function(pageNum) {
|
|
29
|
|
- if ($scope.pageInfo.pageNum != pageNum && pageNum > 0) {
|
|
30
|
|
- $scope.pageInfo.pageNum = pageNum;
|
|
31
|
|
- $scope.loadData();
|
|
|
4
|
+//器材信息
|
|
|
5
|
+ .controller("deviceRepairCtrl", function ($scope, $http, $state, $rootScope, orgService, deviceRepairService, deviceGetService, $stateParams, APP_CONFIG) {
|
|
|
6
|
+ // 获取列表数据
|
|
|
7
|
+ $scope.pageInfo = {pageNum: 1, pageSize: 10};
|
|
|
8
|
+ $scope.search = {repairStatus: ""};
|
|
|
9
|
+ $scope.orgId = $rootScope.userInfo.orgId;
|
|
|
10
|
+ $scope.loadData = function () {
|
|
|
11
|
+ orgService.editOrg($scope.orgId).then(function (data) {
|
|
|
12
|
+ $scope.orgInfo = data;
|
|
|
13
|
+ //$scope.orgName=$scope.orgInfo.orgName;
|
|
|
14
|
+ }, function (data) {
|
|
|
15
|
+ console.log(data);
|
|
|
16
|
+ });
|
|
|
17
|
+
|
|
|
18
|
+ deviceRepairService.getPageInfoDevice($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search.repairStatus, $scope.orgInfo.orgName).then(function (data) {
|
|
|
19
|
+ $scope.pageInfo = data;
|
|
|
20
|
+ $scope.deviceRepairList = data.list;
|
|
|
21
|
+ }, function (data) {
|
|
|
22
|
+ console.log(data);
|
|
|
23
|
+ });
|
|
|
24
|
+ }
|
|
|
25
|
+ $scope.loadData();
|
|
|
26
|
+
|
|
|
27
|
+ // 翻页
|
|
|
28
|
+ $scope.goPage = function (pageNum) {
|
|
|
29
|
+ if ($scope.pageInfo.pageNum != pageNum && pageNum > 0) {
|
|
|
30
|
+ $scope.pageInfo.pageNum = pageNum;
|
|
|
31
|
+ $scope.loadData();
|
|
|
32
|
+ }
|
|
|
33
|
+ }
|
|
|
34
|
+
|
|
|
35
|
+ //添加维护信息页面
|
|
|
36
|
+ $scope.showRepair = function () {
|
|
|
37
|
+ $state.go('app.business.device.manage.devicerepairAdd');
|
|
|
38
|
+ }
|
|
|
39
|
+
|
|
|
40
|
+ //维护信息详情
|
|
|
41
|
+ $scope.showRepairMassage = function (id) {
|
|
|
42
|
+ $state.go('app.business.device.manage.deviceRepairMassage', {id: id, isNotEdit: false});
|
|
32
|
43
|
}
|
|
33
|
|
- }
|
|
34
|
|
-
|
|
35
|
|
- //添加维护信息页面
|
|
36
|
|
- $scope.showRepair = function () {
|
|
37
|
|
- $state.go('app.business.device.manage.devicerepairAdd');
|
|
38
|
|
- }
|
|
39
|
|
-
|
|
40
|
|
- //维护信息详情
|
|
41
|
|
- $scope.showRepairMassage = function (id) {
|
|
42
|
|
- $state.go('app.business.device.manage.deviceRepairMassage',{id:id,isNotEdit:false});
|
|
43
|
|
- }
|
|
44
|
|
-
|
|
45
|
|
-
|
|
46
|
|
- // 结束维修
|
|
47
|
|
- $scope.EndRepair = function (id) {
|
|
|
44
|
+
|
|
|
45
|
+
|
|
|
46
|
+ // 结束维修
|
|
|
47
|
+ $scope.EndRepair = function (id) {
|
|
48
|
48
|
$http({
|
|
49
|
49
|
method: 'POST',
|
|
50
|
50
|
url: APP_CONFIG.deviceUrl + '/deviceRepair/end',
|
|
51
|
51
|
data: {
|
|
52
|
|
- deviceListJson: angular.toJson({"id":id})
|
|
|
52
|
+ deviceListJson: angular.toJson({"id": id})
|
|
53
|
53
|
}
|
|
54
|
54
|
}).then(function successCallback(response) {
|
|
55
|
55
|
if (response.data.status == "success") {
|
|
|
@@ -61,10 +61,10 @@ angular.module('app.business')
|
|
61
|
61
|
}, function errorCallback(response) {
|
|
62
|
62
|
// 请求失败执行代码
|
|
63
|
63
|
});
|
|
64
|
|
- }
|
|
65
|
|
-
|
|
66
|
|
- /*//批量结束维修复选框
|
|
67
|
|
- $scope.selected = [];
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
|
66
|
+ /*//批量结束维修复选框
|
|
|
67
|
+ $scope.selected = [];
|
|
68
|
68
|
|
|
69
|
69
|
var updateSelected = function(action,id,name){
|
|
70
|
70
|
if(action == 'add' && $scope.selected.indexOf(id) == -1){
|
|
|
@@ -82,137 +82,139 @@ angular.module('app.business')
|
|
82
|
82
|
var action = (checkbox.checked?'add':'remove');
|
|
83
|
83
|
updateSelected(action,id,checkbox.name);
|
|
84
|
84
|
}
|
|
85
|
|
-
|
|
|
85
|
+
|
|
86
|
86
|
$scope.isSelected = function(id){
|
|
87
|
|
- return $scope.selected.indexOf(id)>=0;
|
|
|
87
|
+ return $scope.selected.indexOf(id)>=0;
|
|
88
|
88
|
}*/
|
|
89
|
|
-
|
|
90
|
|
- /* // 批量结束维修
|
|
91
|
|
- $scope.moreDelete = function () {
|
|
92
|
|
- var ids = "";
|
|
93
|
|
- for(var i=0; i<$scope.selected.length; i++){
|
|
94
|
|
- ids +=$scope.selected[i]+",";
|
|
95
|
|
- }
|
|
96
|
|
- if(ids!=""){
|
|
97
|
|
- $http({
|
|
98
|
|
- method: 'POST',
|
|
99
|
|
- url: APP_CONFIG.baseUrl + '/deviceRepair/endMore',
|
|
100
|
|
- data: {
|
|
101
|
|
- deviceListJson: angular.toJson({"id":ids})
|
|
102
|
|
- }
|
|
103
|
|
- }).then(function successCallback(response) {
|
|
104
|
|
- if (response.data.status == "success") {
|
|
105
|
|
- alert("结束维修成功!");
|
|
106
|
|
- $scope.loadData();
|
|
107
|
|
- } else {
|
|
108
|
|
- alert("结束维修失败!");
|
|
109
|
|
- }
|
|
110
|
|
- }, function errorCallback(response) {
|
|
111
|
|
- // 请求失败执行代码
|
|
112
|
|
- });
|
|
113
|
|
- }else{
|
|
114
|
|
- alert("请选择要结束维修的器材");
|
|
115
|
|
- }
|
|
116
|
|
- }
|
|
117
|
|
-
|
|
118
|
|
- */
|
|
|
89
|
+
|
|
|
90
|
+ /* // 批量结束维修
|
|
|
91
|
+ $scope.moreDelete = function () {
|
|
|
92
|
+ var ids = "";
|
|
|
93
|
+ for(var i=0; i<$scope.selected.length; i++){
|
|
|
94
|
+ ids +=$scope.selected[i]+",";
|
|
|
95
|
+ }
|
|
|
96
|
+ if(ids!=""){
|
|
|
97
|
+ $http({
|
|
|
98
|
+ method: 'POST',
|
|
|
99
|
+ url: APP_CONFIG.baseUrl + '/deviceRepair/endMore',
|
|
|
100
|
+ data: {
|
|
|
101
|
+ deviceListJson: angular.toJson({"id":ids})
|
|
|
102
|
+ }
|
|
|
103
|
+ }).then(function successCallback(response) {
|
|
|
104
|
+ if (response.data.status == "success") {
|
|
|
105
|
+ alert("结束维修成功!");
|
|
|
106
|
+ $scope.loadData();
|
|
|
107
|
+ } else {
|
|
|
108
|
+ alert("结束维修失败!");
|
|
|
109
|
+ }
|
|
|
110
|
+ }, function errorCallback(response) {
|
|
|
111
|
+ // 请求失败执行代码
|
|
|
112
|
+ });
|
|
|
113
|
+ }else{
|
|
|
114
|
+ alert("请选择要结束维修的器材");
|
|
|
115
|
+ }
|
|
|
116
|
+ }
|
|
|
117
|
+
|
|
|
118
|
+ */
|
|
119
|
119
|
})
|
|
120
|
|
-
|
|
121
|
|
- //器材信息
|
|
122
|
|
- .controller("deviceRepairSaveCtrl", function($scope, $http,$state,$rootScope,deviceRepairService,deviceGetService, $stateParams, APP_CONFIG) {
|
|
123
|
|
- //根据id查询数据
|
|
124
|
|
- $scope.loadDataById = function(id) {
|
|
125
|
|
- deviceRepairService.loadDataById(id).then(function(data){
|
|
126
|
|
- $scope.deviceRepairMassage = data;
|
|
127
|
|
- console.log(data);
|
|
128
|
|
- },function(data){
|
|
129
|
|
- console.log(data);
|
|
130
|
|
- });
|
|
131
|
|
- }
|
|
132
|
|
- var id=$stateParams.id;
|
|
133
|
|
- $scope.loadDataById(id);
|
|
|
120
|
+
|
|
|
121
|
+ //器材信息
|
|
|
122
|
+ .controller("deviceRepairSaveCtrl", function ($scope, $http, $state, $rootScope, deviceRepairService, deviceGetService, $stateParams, APP_CONFIG) {
|
|
|
123
|
+ //根据id查询数据
|
|
|
124
|
+ $scope.loadDataById = function (id) {
|
|
|
125
|
+ deviceRepairService.loadDataById(id).then(function (data) {
|
|
|
126
|
+ $scope.deviceRepairMassage = data;
|
|
|
127
|
+ console.log(data);
|
|
|
128
|
+ }, function (data) {
|
|
|
129
|
+ console.log(data);
|
|
|
130
|
+ });
|
|
|
131
|
+ }
|
|
|
132
|
+ var id = $stateParams.id;
|
|
|
133
|
+ $scope.loadDataById(id);
|
|
134
|
134
|
})
|
|
135
|
|
-
|
|
136
|
|
-
|
|
137
|
|
- .controller("deviceRepairAddCtrl", function($scope, $http,$state,$rootScope,deviceRepairService,deviceKeepService,deviceGetService, $stateParams, APP_CONFIG) {
|
|
138
|
|
-
|
|
139
|
|
- $scope.deviceRepair={};
|
|
140
|
|
-
|
|
141
|
|
- //获取名称
|
|
142
|
|
- $scope.deviceNameChange=function(){
|
|
143
|
|
- deviceKeepService.getDeviceName().then(function(data){
|
|
144
|
|
- $scope.deviceNameList=data;
|
|
145
|
|
- //console.log(data);
|
|
146
|
|
- },function(data){
|
|
147
|
|
- console.log(data);
|
|
148
|
|
- })
|
|
149
|
|
- }
|
|
150
|
|
-
|
|
151
|
|
- $scope.deviceNameChange();
|
|
152
|
|
-
|
|
153
|
|
- //获取规格型号
|
|
154
|
|
- $scope.deviceModelChange=function(){
|
|
155
|
|
- var deviceName = $scope.deviceRepair.deviceName;
|
|
156
|
|
- deviceKeepService.getDeviceModel(deviceName).then(function(data){
|
|
157
|
|
- $scope.deviceInputList=data;
|
|
158
|
|
- console.log(data);
|
|
159
|
|
- },function(data){
|
|
160
|
|
- console.log(data);
|
|
161
|
|
- })
|
|
|
135
|
+
|
|
|
136
|
+
|
|
|
137
|
+ .controller("deviceRepairAddCtrl", function ($scope, $http, $state, $rootScope, deviceRepairService, deviceKeepService, deviceGetService, $stateParams, APP_CONFIG, $filter) {
|
|
|
138
|
+
|
|
|
139
|
+ $scope.deviceRepair = {};
|
|
|
140
|
+
|
|
|
141
|
+ //获取名称
|
|
|
142
|
+ $scope.deviceNameChange = function () {
|
|
|
143
|
+ deviceKeepService.getDeviceName().then(function (data) {
|
|
|
144
|
+ $scope.deviceNameList = data;
|
|
|
145
|
+ //console.log(data);
|
|
|
146
|
+ }, function (data) {
|
|
|
147
|
+ console.log(data);
|
|
|
148
|
+ })
|
|
|
149
|
+ }
|
|
|
150
|
+
|
|
|
151
|
+ $scope.deviceNameChange();
|
|
|
152
|
+
|
|
|
153
|
+ //获取规格型号
|
|
|
154
|
+ $scope.deviceModelChange = function () {
|
|
|
155
|
+ var deviceName = $scope.deviceRepair.deviceName;
|
|
|
156
|
+ deviceKeepService.getDeviceModel(deviceName).then(function (data) {
|
|
|
157
|
+ $scope.deviceInputList = data;
|
|
|
158
|
+ console.log(data);
|
|
|
159
|
+ }, function (data) {
|
|
|
160
|
+ console.log(data);
|
|
|
161
|
+ })
|
|
|
162
|
+ }
|
|
|
163
|
+
|
|
|
164
|
+ //获取设备编码
|
|
|
165
|
+ $scope.deviceSbCodeModelChange = function () {
|
|
|
166
|
+ var deviceName = $scope.deviceRepair.deviceName;
|
|
|
167
|
+ var model = $scope.deviceRepair.model;
|
|
|
168
|
+ deviceKeepService.deviceSbCodeModelChange(deviceName, model).then(function (data) {
|
|
|
169
|
+ $scope.deviceUseCountList = data;
|
|
|
170
|
+
|
|
|
171
|
+ }, function (data) {
|
|
|
172
|
+ console.log(data);
|
|
|
173
|
+ })
|
|
|
174
|
+ }
|
|
|
175
|
+ //获取故障数量
|
|
|
176
|
+ $scope.gzNumberchange = function () {
|
|
|
177
|
+ var number = $scope.deviceRepair.number;
|
|
|
178
|
+ deviceKeepService.deviceBySbCode(number).then(function (data) {
|
|
|
179
|
+ $scope.deviceRepair.repairSumnumber = data;
|
|
|
180
|
+ }, function (data) {
|
|
|
181
|
+ console.log(data);
|
|
|
182
|
+ })
|
|
|
183
|
+ }
|
|
|
184
|
+ //维修数量改变事件
|
|
|
185
|
+ $scope.getCountChange = function () {
|
|
|
186
|
+ var repairNumber = $scope.deviceRepair.repairNumber;
|
|
|
187
|
+ var brokenCount = $scope.deviceRepair.repairSumnumber;
|
|
|
188
|
+ if (brokenCount < repairNumber) {
|
|
|
189
|
+ alert("超过范围");
|
|
|
190
|
+ $scope.deviceRepair.repairNumber = "";
|
|
162
|
191
|
}
|
|
163
|
|
-
|
|
164
|
|
- //获取设备编码
|
|
165
|
|
- $scope.deviceSbCodeModelChange=function(){
|
|
166
|
|
- var deviceName = $scope.deviceRepair.deviceName;
|
|
167
|
|
- var model = $scope.deviceRepair.model;
|
|
168
|
|
- deviceKeepService.deviceSbCodeModelChange(deviceName,model).then(function(data){
|
|
169
|
|
- $scope.deviceUseCountList=data;
|
|
170
|
|
-
|
|
171
|
|
- },function(data){
|
|
172
|
|
- console.log(data);
|
|
173
|
|
- })
|
|
|
192
|
+ }
|
|
|
193
|
+ // 提交表单
|
|
|
194
|
+ $scope.deviceRepair.orgId = $rootScope.userInfo.orgId;
|
|
|
195
|
+ $scope.deviceRepair.commitPeople = $rootScope.userInfo.realName; // 提交人
|
|
|
196
|
+ $scope.deviceRepair.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
|
|
|
197
|
+ var validator = $("#deviceRepair-form").validate();
|
|
|
198
|
+ $scope.saveData = function () {
|
|
|
199
|
+ $scope.deviceRepair.repairStart = $("#disableStart").val();
|
|
|
200
|
+ if (validator.form()) {
|
|
|
201
|
+ $http({
|
|
|
202
|
+ method: 'POST',
|
|
|
203
|
+ url: APP_CONFIG.deviceUrl + '/deviceRepair/save',
|
|
|
204
|
+ data: {
|
|
|
205
|
+ deviceRepairJson: angular.toJson($scope.deviceRepair)
|
|
|
206
|
+ }
|
|
|
207
|
+ }).then(function successCallback(response) {
|
|
|
208
|
+ if (response.data.status == "success") {
|
|
|
209
|
+ alert("保存成功!");
|
|
|
210
|
+ $state.go('app.business.device.manage.deviceRepairList');
|
|
|
211
|
+ } else {
|
|
|
212
|
+ alert("保存失败!");
|
|
|
213
|
+ }
|
|
|
214
|
+ }, function errorCallback(response) {
|
|
|
215
|
+ // 请求失败执行代码
|
|
|
216
|
+ });
|
|
174
|
217
|
}
|
|
175
|
|
- //获取故障数量
|
|
176
|
|
- $scope.gzNumberchange= function() {
|
|
177
|
|
- var number = $scope.deviceRepair.number;
|
|
178
|
|
- deviceKeepService.deviceBySbCode(number).then(function(data){
|
|
179
|
|
- $scope.deviceRepair.repairSumnumber = data;
|
|
180
|
|
- },function(data){
|
|
181
|
|
- console.log(data);
|
|
182
|
|
- })
|
|
183
|
|
- }
|
|
184
|
|
- //维修数量改变事件
|
|
185
|
|
- $scope.getCountChange = function(){
|
|
186
|
|
- var repairNumber=$scope.deviceRepair.repairNumber;
|
|
187
|
|
- var brokenCount=$scope.deviceRepair.repairSumnumber;
|
|
188
|
|
- if(brokenCount<repairNumber){
|
|
189
|
|
- alert("超过范围");
|
|
190
|
|
- $scope.deviceRepair.repairNumber="";
|
|
191
|
|
- }
|
|
192
|
|
- }
|
|
193
|
|
- // 提交表单
|
|
194
|
|
- $scope.deviceRepair.orgId = $rootScope.userInfo.orgId;
|
|
195
|
|
- var validator = $("#deviceRepair-form").validate();
|
|
196
|
|
- $scope.saveData = function () {
|
|
197
|
|
- $scope.deviceRepair.repairStart = $("#disableStart").val();
|
|
198
|
|
- if (validator.form()) {
|
|
199
|
|
- $http({
|
|
200
|
|
- method: 'POST',
|
|
201
|
|
- url: APP_CONFIG.deviceUrl + '/deviceRepair/save',
|
|
202
|
|
- data: {
|
|
203
|
|
- deviceRepairJson: angular.toJson($scope.deviceRepair)
|
|
204
|
|
- }
|
|
205
|
|
- }).then(function successCallback(response) {
|
|
206
|
|
- if (response.data.status == "success") {
|
|
207
|
|
- alert("保存成功!");
|
|
208
|
|
- $state.go('app.business.device.manage.deviceRepairList');
|
|
209
|
|
- } else {
|
|
210
|
|
- alert("保存失败!");
|
|
211
|
|
- }
|
|
212
|
|
- }, function errorCallback(response) {
|
|
213
|
|
- // 请求失败执行代码
|
|
214
|
|
- });
|
|
215
|
|
- }
|
|
216
|
|
- }
|
|
217
|
|
-
|
|
218
|
|
- })
|
|
|
218
|
+ }
|
|
|
219
|
+
|
|
|
220
|
+ })
|