|
@@ -1,203 +0,0 @@
|
1
|
|
-"use strict";
|
2
|
|
-//器材信息
|
3
|
|
-angular.module('app.business')
|
4
|
|
- .controller("facilityScrapListCtrl", function($scope, $http,$state,$rootScope,facilityListService,enumService,orgService,$stateParams, APP_CONFIG) {
|
5
|
|
-
|
6
|
|
- // 获取列表数据
|
7
|
|
-
|
8
|
|
- //分页、查询条件
|
9
|
|
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
|
10
|
|
- $scope.device = {deviceType:"",deviceName:""};
|
11
|
|
-
|
12
|
|
-
|
13
|
|
-
|
14
|
|
- $scope.loadData = function() {
|
15
|
|
-
|
16
|
|
- if($scope.device.deviceName != undefined && $scope.device.deviceName != ""){
|
17
|
|
-
|
18
|
|
- if($scope.pageInfo.pageNum!=1||$scope.pageInfo.pageSize!=10){
|
19
|
|
- $scope.device.deviceName=$scope.device.deviceName;
|
20
|
|
- }else{
|
21
|
|
- $scope.device.deviceName = $scope.device.deviceName[0].id;
|
22
|
|
- }
|
23
|
|
- }
|
24
|
|
-
|
25
|
|
- facilityListService.getPageInfoFacility($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,$scope.device.deviceName,$scope.device.deviceType,$rootScope.orgInfo.orgName).then(function(data){
|
26
|
|
- $scope.pageInfo = data;
|
27
|
|
- },function(data){
|
28
|
|
- console.log(data);
|
29
|
|
- });
|
30
|
|
-
|
31
|
|
- }
|
32
|
|
- $scope.loadData();
|
33
|
|
- //新增
|
34
|
|
- $scope.showAddInput = function () {
|
35
|
|
- $state.go('app.business.facility.addFacilityScrap',{id:0,isNotEdit:false});
|
36
|
|
- }
|
37
|
|
-
|
38
|
|
-
|
39
|
|
- // 翻页
|
40
|
|
- $scope.goPage = function(pageNum) {
|
41
|
|
- $scope.pageInfo.pageNum = pageNum;
|
42
|
|
- $scope.loadData();
|
43
|
|
- }
|
44
|
|
-
|
45
|
|
- // 根据id删除信息
|
46
|
|
- $scope.remove = function(id) {
|
47
|
|
- deviceInputService.removeById(id).then(function (data) {
|
48
|
|
- if(data.msg == "success"){
|
49
|
|
- alert("删除成功");
|
50
|
|
- $scope.loadData();
|
51
|
|
- }else{
|
52
|
|
- alert("删除失败");
|
53
|
|
- }
|
54
|
|
- });
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
-
|
58
|
|
- // 查看页面
|
59
|
|
- $scope.showViewInput = function(id) {
|
60
|
|
- $state.go('app.business.device.inputEdit',{id:id,isNotEdit:true});
|
61
|
|
- }
|
62
|
|
-
|
63
|
|
- //修改页面
|
64
|
|
- $scope.showEditInput = function(id) {
|
65
|
|
- $state.go('app.business.device.inputEdit',{id:id,isNotEdit:false});
|
66
|
|
- }
|
67
|
|
-
|
68
|
|
- //树形下拉框获取器材设备名称
|
69
|
|
- $scope.getDeviceName = function() {
|
70
|
|
- $scope.deviceType=angular.fromJson($scope.device.deviceType);
|
71
|
|
- enumService.getTreeListByTypeId($scope.device.deviceName,$scope.deviceType).then(function(data) {
|
72
|
|
- $scope.deviceNameTreeData = data;
|
73
|
|
- },function(data) {
|
74
|
|
- console.log(data);
|
75
|
|
- })
|
76
|
|
- };
|
77
|
|
-
|
78
|
|
-
|
79
|
|
-
|
80
|
|
-})
|
81
|
|
-
|
82
|
|
- .controller("addFacilityScrapCtrl", function($scope, $filter,$http,$state,$rootScope, facilityListService,equipmentEquipmentPoolService,enumService,$stateParams, APP_CONFIG) {
|
83
|
|
- //根据id获取数据
|
84
|
|
- /*$scope.loadDataById = function(id) {
|
85
|
|
- deviceInputService.loadDataById(id).then(function(data){
|
86
|
|
- $scope.device = data;
|
87
|
|
- $scope.device.inputTime = $filter('date')($scope.device.inputTime, "yyyy-MM-dd");
|
88
|
|
- $scope.device.produceTime = $filter('date')($scope.device.produceTime, "yyyy-MM-dd");
|
89
|
|
- $scope.device.position=parseInt(data.position);
|
90
|
|
- $scope.device.storageRack=parseInt(data.storageRack);
|
91
|
|
- $scope.device.storageRackCell=parseInt(data.storageRackCell);
|
92
|
|
- $scope.device.deviceManager = parseInt($scope.device.deviceManager);
|
93
|
|
-
|
94
|
|
- $scope.getDeviceName();
|
95
|
|
- },function(data){
|
96
|
|
- // console.log(data);
|
97
|
|
- });
|
98
|
|
- };
|
99
|
|
-
|
100
|
|
- //查看修改调用此方法
|
101
|
|
- if ($stateParams.id != 0) {
|
102
|
|
- $scope.loadDataById($stateParams.id);
|
103
|
|
- }*/
|
104
|
|
-
|
105
|
|
- //树形下拉框获取器材设备名称
|
106
|
|
- $scope.getDeviceName = function(deviceType,deviceName) {
|
107
|
|
- //$scope.deviceType=angular.fromJson($scope.device.deviceType);
|
108
|
|
- //$scope.device.deviceName=angular.fromJson($scope.device.deviceName);
|
109
|
|
- if(deviceType==undefined ){
|
110
|
|
- deviceType=angular.fromJson($scope.device.deviceType);
|
111
|
|
- }
|
112
|
|
- enumService.getTreeListByTypeId(deviceName,deviceType).then(function(data) {
|
113
|
|
- $scope.deviceNameTreeData = data;
|
114
|
|
- },function(data) {
|
115
|
|
- console.log(data);
|
116
|
|
- })
|
117
|
|
- };
|
118
|
|
-
|
119
|
|
- $scope.loadDataByParam = function(deviceType,deviceName,model) {
|
120
|
|
- $scope.device = {deviceType:null,deviceName:null,model:null};
|
121
|
|
- $scope.device.deviceType = parseInt(deviceType);
|
122
|
|
- //$scope.device.deviceName = deviceName;
|
123
|
|
- $scope.device.model = model;
|
124
|
|
- $scope.getDeviceName($scope.device.deviceType,deviceName);
|
125
|
|
- };
|
126
|
|
- if($stateParams.deviceType!=null,$stateParams.deviceName!=null,$stateParams.model!=null){
|
127
|
|
- $scope.loadDataByParam($stateParams.deviceType,$stateParams.deviceName,$stateParams.model);
|
128
|
|
- }
|
129
|
|
- //判断可否修改
|
130
|
|
- var disabled = false;
|
131
|
|
- $("#deviceInput-form input").attr("disabled",disabled);
|
132
|
|
- $("#deviceInput-form select").attr("disabled",disabled);
|
133
|
|
-
|
134
|
|
- if($stateParams.isNotEdit != null){
|
135
|
|
- if ($stateParams.isNotEdit == "false") {
|
136
|
|
- $scope.isNotEdit = false;
|
137
|
|
- } else if ($stateParams.isNotEdit == "true") {
|
138
|
|
- $scope.isNotEdit = true;
|
139
|
|
- }
|
140
|
|
- }else{
|
141
|
|
- $scope.isNotEdit = false;
|
142
|
|
- }
|
143
|
|
-
|
144
|
|
-
|
145
|
|
-
|
146
|
|
- // 存放位置
|
147
|
|
- $scope.loadData = function() {
|
148
|
|
- equipmentEquipmentPoolService.getPageInfo(null, null,null).then(function(data){
|
149
|
|
- $scope.equipmentEquipmentPool = data.list;
|
150
|
|
- },function(data){
|
151
|
|
- console.log(data);
|
152
|
|
- });
|
153
|
|
- }
|
154
|
|
- $scope.loadData();
|
155
|
|
-
|
156
|
|
- // 提交表单
|
157
|
|
- var validator = $("#deviceInput-form").validate();
|
158
|
|
- $scope.saveData = function() {
|
159
|
|
- if (validator.form()) {
|
160
|
|
- //粮库名称
|
161
|
|
- //$scope.device.storehouse=$rootScope.depotInfo.orgName;
|
162
|
|
-
|
163
|
|
- $scope.deviceName=angular.fromJson($scope.device.deviceName);
|
164
|
|
- $scope.device.deviceName=$scope.deviceName[0].id;
|
165
|
|
- //入库的原始数量
|
166
|
|
- //$scope.device.deviceManager = $scope.device.useCount+"";
|
167
|
|
- $scope.device.useCount = parseInt($scope.device.deviceManager);
|
168
|
|
- if ($scope.device.deviceName == '' || $scope.device.deviceName == null) {
|
169
|
|
- $("#devicename-error").text("必须填写");
|
170
|
|
- } else {
|
171
|
|
- $("#devicename-error").text("");
|
172
|
|
- }
|
173
|
|
-
|
174
|
|
- $scope.device.orgId=$rootScope.userInfo.orgId;
|
175
|
|
-
|
176
|
|
- $http({
|
177
|
|
- method: 'POST',
|
178
|
|
- url: APP_CONFIG.deviceUrl + '/deviceInput/save',
|
179
|
|
- data: {
|
180
|
|
- deviceInputJson : angular.toJson($scope.device)
|
181
|
|
- }
|
182
|
|
- }).then(function successCallback(response) {
|
183
|
|
- if(response.data.status == "success"){
|
184
|
|
- alert("保存成功!");
|
185
|
|
- $state.go('app.business.device.deviceInputList');
|
186
|
|
- }else{
|
187
|
|
- alert(response.data.msg);
|
188
|
|
- $scope.saveFlag = false;
|
189
|
|
- }
|
190
|
|
-
|
191
|
|
- }, function errorCallback(response) {
|
192
|
|
- // 请求失败执行代码
|
193
|
|
- });
|
194
|
|
-
|
195
|
|
-
|
196
|
|
-
|
197
|
|
-
|
198
|
|
- }
|
199
|
|
- }
|
200
|
|
-
|
201
|
|
-
|
202
|
|
-
|
203
|
|
- })
|