|
@@ -1,209 +0,0 @@
|
1
|
|
-"use strict";
|
2
|
|
-
|
3
|
|
-//保管总账
|
4
|
|
-angular.module('app.storage').controller("keepVoucherCtrl",
|
5
|
|
- function($scope, $rootScope, $state, $stateParams, $filter, enumService, keepAccountService, StorehouseService, warehouseService, APP_CONFIG) {
|
6
|
|
-
|
7
|
|
- // 获取列表数据
|
8
|
|
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
|
9
|
|
- $scope.search = {lspz:"", lsxz:"", startDate:"", endDate:""};
|
10
|
|
- $scope.loadData = function() {
|
11
|
|
- if($scope.search.lsxz != undefined && $scope.search.lsxz != ""){
|
12
|
|
- $scope.search.lsxz = $scope.search.lsxz[0].id;
|
13
|
|
- }
|
14
|
|
- keepAccountService.getSumAccountPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search).then(function(data){
|
15
|
|
- $scope.pageInfo = data;
|
16
|
|
- $scope.deptName = $rootScope.depotInfo.orgName;
|
17
|
|
- //获取记账人和审核人
|
18
|
|
- //$scope.getAccountRecord($scope.pageInfo.list);
|
19
|
|
- },function(data){
|
20
|
|
- console.log(data);
|
21
|
|
- });
|
22
|
|
- //加载打印区域的数据
|
23
|
|
- keepAccountService.getSumAccountPageInfo(null, null, $scope.search).then(function(data){
|
24
|
|
- $scope.pageInfos = data;
|
25
|
|
- $scope.printList = data.list;
|
26
|
|
- //获取记账人和审核人
|
27
|
|
- //$scope.getAccountRecord($scope.printList);
|
28
|
|
- },function(data){
|
29
|
|
- console.log(data);
|
30
|
|
- });
|
31
|
|
- // 树形下拉框(粮食性质)
|
32
|
|
- enumService.getTreeListByTypeId($scope.search.lsxz, 1032).then(function(data) {
|
33
|
|
- var data_new = $scope.data_add(data);
|
34
|
|
- $scope.grainAttributeTreeData = data_new;
|
35
|
|
- },function(data) {
|
36
|
|
- console.log(data);
|
37
|
|
- });
|
38
|
|
- }
|
39
|
|
- $scope.loadData();
|
40
|
|
-
|
41
|
|
- $scope.data_add = function(data) {
|
42
|
|
- //var data_new = $scope.data_add(data);
|
43
|
|
- var e = [];
|
44
|
|
- if (data.length != 0) {
|
45
|
|
- //要插入的json对象串
|
46
|
|
- var a = {"id":null,"name":"请选择","children":[]};
|
47
|
|
- //将返回的json对象和要插入的json对象串转换为字符串格式
|
48
|
|
- var f = angular.toJson(a);
|
49
|
|
- var b = angular.toJson(data);
|
50
|
|
- //把要插入的json对象串插入返回数据的最前面
|
51
|
|
- var c = b.substring(0,1);
|
52
|
|
- var d = b.substring(1,b.length);
|
53
|
|
- e = c + f + "," + d;
|
54
|
|
- }
|
55
|
|
- //最后在转换为json对象返回去
|
56
|
|
- return angular.fromJson(e);
|
57
|
|
- }
|
58
|
|
-
|
59
|
|
- $scope.getAccountRecord = function (pageInfo) {
|
60
|
|
- if (pageInfo != null || pageInfo.length != 0) {
|
61
|
|
- var obj;
|
62
|
|
- var rq;
|
63
|
|
- for (var i = 0; i < pageInfo.length; i++) {
|
64
|
|
- obj = pageInfo[0];
|
65
|
|
- rq = $filter('date')(obj.rq, "yyyy-MM");
|
66
|
|
- keepAccountService.accountingRecord(obj.ch, obj.hwh, obj.lspz, obj.hwxz, rq, obj.wjh, obj.remark, 1).then(function(data){
|
67
|
|
- $scope.account = data.obj;
|
68
|
|
- obj.accountingPerson = $scope.account.accountingPerson;//记账人
|
69
|
|
- obj.auditor = $scope.account.auditor;//审核人
|
70
|
|
- },function(data){
|
71
|
|
- console.log(data);
|
72
|
|
- });
|
73
|
|
- }
|
74
|
|
- }
|
75
|
|
- }
|
76
|
|
-
|
77
|
|
- // 翻页
|
78
|
|
- $scope.goPage = function(pageNum) {
|
79
|
|
- $scope.pageInfo.pageNum = pageNum;
|
80
|
|
- $scope.loadData();
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
- //页面跳转
|
84
|
|
- $scope.edit = function(account, butType) {
|
85
|
|
- var obj_str = angular.toJson(account);
|
86
|
|
- $scope.fcbgz = angular.fromJson(obj_str);
|
87
|
|
- var rq = $filter('date')($scope.fcbgz.rq, "yyyy-MM");
|
88
|
|
- if (butType != 3) { //记账、审核、查看
|
89
|
|
- keepAccountService.accountingRecord(null, null, $scope.fcbgz.lspz, $scope.fcbgz.hwxz, rq, $scope.fcbgz.wjh, $scope.fcbgz.remark, 1).then(function(data){
|
90
|
|
- $scope.account = data.obj;
|
91
|
|
- if (butType == 0) { //记账
|
92
|
|
- if (data.obj.id != null || data.obj.id != undefined) {
|
93
|
|
- alert("当前记录已记账!");
|
94
|
|
- return;
|
95
|
|
- }
|
96
|
|
- } else if (butType == 1) { //审核
|
97
|
|
- if (data.obj.id == null || data.obj.id == undefined) {
|
98
|
|
- alert("当前记录还尚未记账,请先记账!");
|
99
|
|
- return;
|
100
|
|
- } else {
|
101
|
|
- if (data.obj.auditor != null || data.obj.auditor != undefined) {
|
102
|
|
- alert("当前记录已审核!");
|
103
|
|
- return;
|
104
|
|
- }
|
105
|
|
- }
|
106
|
|
- } else if (butType == 2) { //查看
|
107
|
|
- if (data.obj.id == null || data.obj.id == undefined) {
|
108
|
|
- alert("当前记录还尚未记账,请先记账!");
|
109
|
|
- return;
|
110
|
|
- }
|
111
|
|
- }
|
112
|
|
- $state.go('app.storage.account.keepTotalAccount.keepTotalAccountEdit',{account:angular.toJson(account), butType:butType});
|
113
|
|
- },function(data){
|
114
|
|
- console.log(data);
|
115
|
|
- });
|
116
|
|
- } else { //分仓账
|
117
|
|
- $state.go('app.storage.account.houseKeepAccount',{account:angular.toJson(account), type:butType});
|
118
|
|
- }
|
119
|
|
- }
|
120
|
|
- //打印
|
121
|
|
- $scope.print = function() {
|
122
|
|
- $("#print").printArea();
|
123
|
|
- }
|
124
|
|
-
|
125
|
|
-})
|
126
|
|
-.controller("keepTotalAccountEditCtrl",
|
127
|
|
- function($scope, $rootScope, $state, $stateParams, $filter, keepAccountService, StorehouseService, warehouseService, APP_CONFIG) {
|
128
|
|
-
|
129
|
|
- // 获取列表日数据
|
130
|
|
- $scope.edit = function() {
|
131
|
|
- $scope.fcbgz = angular.fromJson($stateParams.account);
|
132
|
|
- $scope.fcbgz.lcmc = $rootScope.depotInfo.orgName;
|
133
|
|
- var rq = $filter('date')($scope.fcbgz.rq, "yyyy-MM");
|
134
|
|
- keepAccountService.accountingRecord($scope.fcbgz.ch, $scope.fcbgz.hwh, $scope.fcbgz.lspz, $scope.fcbgz.hwxz, rq, $scope.fcbgz.wjh, $scope.fcbgz.remark, 1).then(function(data){
|
135
|
|
- $scope.account = data.obj;
|
136
|
|
-
|
137
|
|
- if ($stateParams.butType == 0) { //记账
|
138
|
|
- //初始化数据记账表对象数据
|
139
|
|
- $scope.account.lspz = $scope.fcbgz.lspz;
|
140
|
|
- $scope.account.hwxz = $scope.fcbgz.hwxz;
|
141
|
|
- $scope.account.rq = rq;
|
142
|
|
- $scope.account.srsl = $scope.fcbgz.srsl;
|
143
|
|
- $scope.account.zcsl = $scope.fcbgz.zcsl;
|
144
|
|
- $scope.account.kcsl = $scope.fcbgz.kcsl;
|
145
|
|
- $scope.account.accountingPerson = $rootScope.userInfo.realName; //记账人
|
146
|
|
- $scope.account.accountingDate = $filter('date')(new Date(), "yyyy-MM-dd"); //记账时间
|
147
|
|
- $scope.account.remark = $scope.fcbgz.remark; //摘要
|
148
|
|
- $scope.account.wjh = $scope.fcbgz.wjh; //文件号
|
149
|
|
- //设置状态为记账
|
150
|
|
- //$scope.accountType = 0;
|
151
|
|
-
|
152
|
|
- //影藏审核信息
|
153
|
|
- $scope.auditor_th = true;
|
154
|
|
- } else if ($stateParams.butType == 1) { //审核
|
155
|
|
- //设置记账时间格式化和不可编辑
|
156
|
|
- $scope.account.accountingDate = $filter('date')($scope.account.accountingDate, "yyyy-MM-dd");
|
157
|
|
- $scope.accounting_isNotEdit = true;
|
158
|
|
- //显示审核信息
|
159
|
|
- $scope.auditor_th = false;
|
160
|
|
- //设置审核人为当前用户,审核时间为当前时间
|
161
|
|
- $scope.account.auditor = $rootScope.userInfo.realName;
|
162
|
|
- $scope.account.auditorDate = $filter('date')(new Date(), "yyyy-MM-dd");
|
163
|
|
- } else if ($stateParams.butType == 2) { //查看
|
164
|
|
- //设置记账时间格式化和不可编辑
|
165
|
|
- $scope.account.accountingDate = $filter('date')($scope.account.accountingDate, "yyyy-MM-dd");
|
166
|
|
- $scope.accounting_isNotEdit = true;
|
167
|
|
- //显示审核信息
|
168
|
|
- $scope.auditor_th = false;
|
169
|
|
- //审核信息设置不可编辑
|
170
|
|
- $scope.account.auditorDate = $filter('date')($scope.account.auditorDate, "yyyy-MM-dd");
|
171
|
|
- $scope.auditor_isNotEdit = true;
|
172
|
|
- //提交按钮影藏
|
173
|
|
- $scope.isNotEdit = true;
|
174
|
|
- }
|
175
|
|
- //初始分仓保管账表对象数据
|
176
|
|
- $scope.fcbgz.hwxz = $rootScope.dicData[$scope.fcbgz.hwxz];
|
177
|
|
- $scope.fcbgz.lspz = $rootScope.dicData[$scope.fcbgz.lspz];
|
178
|
|
- $scope.fcbgz.dj = $rootScope.dicData[$scope.fcbgz.dj];
|
179
|
|
- $scope.fcbgz.rq = rq;
|
180
|
|
- },function(data){
|
181
|
|
- console.log(data);
|
182
|
|
- });
|
183
|
|
-
|
184
|
|
- }
|
185
|
|
- $scope.edit();
|
186
|
|
-
|
187
|
|
- //提交
|
188
|
|
- $scope.submit = function() {
|
189
|
|
- keepAccountService.submit($scope.account, 1, $rootScope.orgInfo.orgId).then(function(data){
|
190
|
|
- if (data.status = 'success') {
|
191
|
|
- alert(data.msg);
|
192
|
|
- } else {
|
193
|
|
- alert("保存失败!");
|
194
|
|
- }
|
195
|
|
- $scope.retList();
|
196
|
|
- },function(data){
|
197
|
|
- alert("保存失败!");
|
198
|
|
- });
|
199
|
|
- }
|
200
|
|
-
|
201
|
|
- //返回
|
202
|
|
- $scope.retList = function () {
|
203
|
|
- if ($rootScope.previousState_name != '') {
|
204
|
|
- $rootScope.back();
|
205
|
|
- } else {
|
206
|
|
- $state.go('app.storage.account.keepTotalAccount');
|
207
|
|
- }
|
208
|
|
- }
|
209
|
|
-});
|