|
|
@@ -3,13 +3,13 @@
|
|
3
|
3
|
angular.module('app.business')
|
|
4
|
4
|
.controller("reportWeeklyCtrl", function($scope, $state,$rootScope, $stateParams, enumService,reportWeeklyService, APP_CONFIG) {
|
|
5
|
5
|
// 获取列表数据
|
|
6
|
|
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
|
|
|
6
|
+ $scope.pageInfo = {pageNum : 1, pageSize : 25};
|
|
7
|
7
|
$scope.searchCondition = {reportPeriod:'',status:'',filledTime:''};
|
|
8
|
8
|
$scope.search = {id:""};
|
|
9
|
9
|
$scope.loadData = function () {
|
|
10
|
10
|
reportWeeklyService.loadData($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,$scope.searchCondition.reportPeriod,$scope.searchCondition.status,$scope.searchCondition.filledTime)
|
|
11
|
11
|
.then(function(data){
|
|
12
|
|
- console.log(data,'pageInfoData---loadData')
|
|
|
12
|
+ // console.log(data,'pageInfoData---loadData')
|
|
13
|
13
|
|
|
14
|
14
|
$scope.pageInfoData = data;
|
|
15
|
15
|
|
|
|
@@ -34,11 +34,13 @@ angular.module('app.business')
|
|
34
|
34
|
//获取当前时间
|
|
35
|
35
|
var nowTime=new Date();
|
|
36
|
36
|
var date = new Date(nowTime);
|
|
37
|
|
- $scope.year = nowTime.getFullYear()
|
|
38
|
|
- console.log($scope.year,'years')
|
|
39
|
|
- nowTime=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() /* + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() */;
|
|
40
|
|
-
|
|
41
|
|
- $scope.reportWeekly.filledTime= nowTime;
|
|
|
37
|
+ $scope.year = new Date().getFullYear()
|
|
|
38
|
+ // console.log($scope.year,'years')
|
|
|
39
|
+ nowTime=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()/* + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() */;
|
|
|
40
|
+ $scope.reportWeekly.filledTime=new Date()
|
|
|
41
|
+ // console.log($rootScope.now,'now')
|
|
|
42
|
+ // console.log($scope.reportWeekly.filledTime,'现在时间')
|
|
|
43
|
+ // $scope.reportWeekly.filledTime= nowTime;
|
|
42
|
44
|
|
|
43
|
45
|
// 翻页
|
|
44
|
46
|
$scope.goPage = function(pageNum) {
|
|
|
@@ -72,17 +74,18 @@ angular.module('app.business')
|
|
72
|
74
|
|
|
73
|
75
|
// 新增提交
|
|
74
|
76
|
$scope.saveWeeklyData = function () {
|
|
75
|
|
-
|
|
76
|
|
-
|
|
77
|
77
|
if(validator.form()) {
|
|
78
|
|
- console.log('校验成功')
|
|
|
78
|
+ // console.log('校验成功')
|
|
79
|
79
|
var orgId = $rootScope.userInfo.orgId;//当前登录者的库id
|
|
80
|
80
|
$scope.reportWeekly.companyOrgCode=$rootScope.orgInfo.companyOrgCode;//组织机构代码
|
|
81
|
81
|
// $scope.reportWeekly.filledTime = $("input[name='filledTime']").val();
|
|
82
|
|
- $scope.reportWeekly.filledTime = new Date($scope.reportWeekly.filledTime)
|
|
83
|
|
- $scope.reportWeekly.weeklyTimeStart = new Date($('#weeklyTimeStart').val())
|
|
84
|
|
- $scope.reportWeekly.weeklyTimeEnd = new Date($('#weeklyTimeEnd').val())
|
|
85
|
|
- // console.log($scope.reportWeekly,'reportWeekly')
|
|
|
82
|
+ // $scope.reportWeekly.filledTime = new Date($scope.reportWeekly.filledTime)
|
|
|
83
|
+ // 在ie中不支持‘-’格式,需要把日期转为 "/" var date= new Date(Date.parse(a.replace(/-/g,'/' )) )
|
|
|
84
|
+ $scope.reportWeekly.weeklyTimeStart = new Date(Date.parse(( $('#weeklyTimeStart').val()).replace(/-/g,'/' ) ))
|
|
|
85
|
+ $scope.reportWeekly.weeklyTimeEnd = new Date(Date.parse(( $('#weeklyTimeEnd').val()).replace(/-/g,'/' ) ))
|
|
|
86
|
+ // console.log($scope.reportWeekly,'reportWeekly-查看周报表保存数据')
|
|
|
87
|
+ // console.log($scope.reportWeekly.weeklyTimeStart,$scope.reportWeekly.weeklyTimeEnd,'$scope.reportWeekly.weeklyTimeStart,$scope.reportWeekly.weeklyTimeEnd,')
|
|
|
88
|
+
|
|
86
|
89
|
reportWeeklyService.saveData(angular.toJson($scope.reportWeekly),orgId)
|
|
87
|
90
|
.then(function (data) {
|
|
88
|
91
|
// console.log(data,'data')
|
|
|
@@ -113,13 +116,13 @@ angular.module('app.business')
|
|
113
|
116
|
var reportWeeklys = angular.fromJson(angular.toJson(data));
|
|
114
|
117
|
reportWeeklys.orgName= $rootScope.orgInfo.orgName;
|
|
115
|
118
|
reportWeeklys.companyOrgCode= $rootScope.orgInfo.companyOrgCode;//组织机构代码
|
|
116
|
|
- console.log(reportWeeklys,'reportWeeklys---111--22')
|
|
|
119
|
+ // console.log(reportWeeklys,'reportWeeklys---111--22')
|
|
117
|
120
|
reportWeeklyService.reportWeekly(reportWeeklys).then(function(data){
|
|
118
|
|
- console.log(data +"----上报结果");
|
|
|
121
|
+ // console.log(data +"----上报结果");
|
|
119
|
122
|
if(data.status=="success"){
|
|
120
|
123
|
//alert("点击上报后不可再取消,确认上报");
|
|
121
|
124
|
reportWeeklyService.updateStatusw(id).then(function(data){
|
|
122
|
|
- console.log(data,"上报状态修改返回值");
|
|
|
125
|
+ // console.log(data,"上报状态修改返回值");
|
|
123
|
126
|
if(data.status=="success"){
|
|
124
|
127
|
// $scope.reportWeekly.status = 0
|
|
125
|
128
|
$scope.loadData();
|
|
|
@@ -130,9 +133,12 @@ angular.module('app.business')
|
|
130
|
133
|
console.log(data);
|
|
131
|
134
|
});
|
|
132
|
135
|
|
|
133
|
|
- }else{
|
|
134
|
|
- alert("省级平台接收数据有误,尽快与其联系!");
|
|
|
136
|
+ }else if(data.infoCode == 303){
|
|
|
137
|
+ console.log(data.msg,data.status,'重复提交报错信息')
|
|
|
138
|
+ alert("当前机构已提交过该周报表,请勿重复提交!");
|
|
135
|
139
|
$scope.saveFlag = false ;
|
|
|
140
|
+ }else if(data.infoCode == 500){
|
|
|
141
|
+ alert("服务异常")
|
|
136
|
142
|
}
|
|
137
|
143
|
|
|
138
|
144
|
},function(data){
|
|
|
@@ -164,10 +170,11 @@ angular.module('app.business')
|
|
164
|
170
|
$scope.reportWeekly = data;
|
|
165
|
171
|
// reportWeekly.weeklyTimeStart
|
|
166
|
172
|
// console.log(data,'data')
|
|
|
173
|
+ // console.log(data.weeklyTimeStart,'datdata.weeklyTimeStarta')
|
|
167
|
174
|
// endDate.getFullYear() + '-' + (endDate.getMonth() + 1) + '-' + endDate.getDate()
|
|
168
|
175
|
$scope.reportWeekly.weeklyTimeStart = new Date(data.weeklyTimeStart).getFullYear() + '-' + (new Date(data.weeklyTimeStart).getMonth() + 1) + '-' + new Date(data.weeklyTimeStart).getDate()
|
|
169
|
176
|
$scope.reportWeekly.weeklyTimeEnd = new Date(data.weeklyTimeEnd).getFullYear() + '-' + (new Date(data.weeklyTimeEnd).getMonth() + 1) + '-' + new Date(data.weeklyTimeEnd).getDate()
|
|
170
|
|
- console.log($scope.reportWeekly.weeklyTimeStart,'$scope.reportWeekly.weeklyTimeStart')
|
|
|
177
|
+ // console.log($scope.reportWeekly.weeklyTimeStart,'$scope.reportWeekly.weeklyTimeStart')
|
|
171
|
178
|
// console.log($scope.reportWeekly,'$scope.reportWeekly0000000')
|
|
172
|
179
|
// $scope.reportWeekly.monthlyTime = $filter('date')($scope.reportWeekly.monthlyTime, "yyyy-MM-dd");
|
|
173
|
180
|
|
|
|
@@ -226,4 +233,74 @@ angular.module('app.business')
|
|
226
|
233
|
var checkNumber = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,3})?$/;
|
|
227
|
234
|
return this.optional(element)||(checkNumber.test(value));
|
|
228
|
235
|
},"请输入大于0的数字,最多三位小数!");
|
|
|
236
|
+
|
|
|
237
|
+ // 计算汇总(小计)
|
|
|
238
|
+ $scope.subTotal = function(num1,num2,num3,category,level) {
|
|
|
239
|
+ // console.log('小麦:'+num1,'玉米:'+num2,'食用油:'+ num3,'类别:'+category, '级别:'+level)
|
|
|
240
|
+ if(category == 'plan') {
|
|
|
241
|
+ // 计划
|
|
|
242
|
+ if(level == 3) {
|
|
|
243
|
+ // 省级
|
|
|
244
|
+ $scope.reportWeekly.provincePlanTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
245
|
+ }else if(level ==2) {
|
|
|
246
|
+ // 市级
|
|
|
247
|
+ $scope.reportWeekly.municipalPlanTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
248
|
+ }else if(level == 1) {
|
|
|
249
|
+ // 县级
|
|
|
250
|
+ $scope.reportWeekly.countyPlanTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
251
|
+ }
|
|
|
252
|
+ }else if(category == 'out') {
|
|
|
253
|
+ // 本周轮出
|
|
|
254
|
+ if(level == 3) {
|
|
|
255
|
+ // 省级
|
|
|
256
|
+ $scope.reportWeekly.provinceOutTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
257
|
+ }else if(level == 2) {
|
|
|
258
|
+ // 市级
|
|
|
259
|
+ $scope.reportWeekly.municipalOutTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
260
|
+ }else if (level == 1) {
|
|
|
261
|
+ // 县级
|
|
|
262
|
+ $scope.reportWeekly.countyOutTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
263
|
+ }
|
|
|
264
|
+ }else if(category == 'outCumulative') {
|
|
|
265
|
+ // 累计轮出
|
|
|
266
|
+ if(level == 3) {
|
|
|
267
|
+ // 省级
|
|
|
268
|
+ $scope.reportWeekly.provinceOutTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
269
|
+ }else if(level == 2) {
|
|
|
270
|
+ // 市级
|
|
|
271
|
+ $scope.reportWeekly.municipalOutTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
272
|
+ }else if(level == 1 ) {
|
|
|
273
|
+ // 县级
|
|
|
274
|
+ $scope.reportWeekly.countyOutTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
275
|
+ }
|
|
|
276
|
+ }else if(category == 'in') {
|
|
|
277
|
+ // 本周轮入
|
|
|
278
|
+ if(level == 3) {
|
|
|
279
|
+ // 省级
|
|
|
280
|
+ $scope.reportWeekly.provinceInTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
281
|
+ }else if(level == 2) {
|
|
|
282
|
+ // 市级
|
|
|
283
|
+ $scope.reportWeekly.municipalInTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
284
|
+ }else if(level == 1) {
|
|
|
285
|
+ // 县级
|
|
|
286
|
+ $scope.reportWeekly.countyInTotal =Number(num1) +Number(num2) + Number(num3)
|
|
|
287
|
+ }
|
|
|
288
|
+ }else if(category == 'inCumulative') {
|
|
|
289
|
+ // 累计轮入
|
|
|
290
|
+ if(level == 3) {
|
|
|
291
|
+ // 省级
|
|
|
292
|
+ $scope.reportWeekly.provinceInTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
293
|
+ }else if(level == 2) {
|
|
|
294
|
+ // 市级
|
|
|
295
|
+ $scope.reportWeekly.municipalInTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
296
|
+ }else if(level == 1) {
|
|
|
297
|
+ // 县级
|
|
|
298
|
+ $scope.reportWeekly.countyInTotalCumulative =Number(num1) +Number(num2) + Number(num3)
|
|
|
299
|
+ }
|
|
|
300
|
+ }
|
|
|
301
|
+ }
|
|
|
302
|
+
|
|
|
303
|
+
|
|
229
|
304
|
})
|
|
|
305
|
+
|
|
|
306
|
+
|