postPosition.js
6.47 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* Created by 王冠伦 on 2018/2/26.
*/
(function () {
"user strict";
var postPositionController = function($scope,$modal,$http,$interval,dialogService,railwayService){
$scope.$emit('navShow', 6);
$scope.settingShow = 6;
$scope.vm = {
pageSize : 10,
totalCount : 0
}
$scope.selectedCategoryList = [];
angular.forEach($scope.allCategory,function(category){
category.name = category.categoryName;
});
$scope.getList = function(){
$scope.vm.categoryIdList = null;
if($scope.selectedCategoryList.length > 0){
$scope.vm.categoryIdList = [];
for(var i in $scope.selectedCategoryList){
$scope.vm.categoryIdList.push($scope.selectedCategoryList[i].id);
}
}
railwayService.findPostPosition($scope.vm).success(function(data){
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors);
}else{
$scope.postPositionList = data.result;
$scope.vm.totalCount = data.totalCount;
$scope.settingShow = 6;
}
})
}
$scope.getList();
$scope.doSearch = function(){
$scope.vm.pageNumber = 1;
$scope.getList();
}
$scope.doCreate = function(){
window.location = "/admin/postPosition/create.vm";
};
$scope.doEdit = function(id){
window.open("/admin/postPosition/edit.htm?id="+id);
};
$scope.doDelete = function(postPositionId){
var dialogDefaults = {
size:"sm"
};
var dialogOptions = {
closeButtonText: "取消",
actionButtonText: "删除",
headerText: "删除",
bodyText: "您确定要删除权限吗?",
callback: function () {
railwayService.deletePostPosition({id:postPositionId}).success(function (data) {
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors, null, null);
} else {
dialogService.tip([{message:"删除权限成功!"}],"/admin/postPosition/index.htm",1000);
}
});
}
};
dialogService.confirm(dialogDefaults, dialogOptions);
};
}
var postPositionCreateController = function($scope,$modal,$http,$interval,dialogService,railwayService){
$scope.$emit('navShow', 6);
$scope.settingShow = 6;
$scope.vm = {
pageSize : 10,
totalCount : 0
}
/**
* Created @ 0519
* @type {Array}
*/
$scope.cancel = function(){
window.location = "/admin/postPosition/index.vm";
};
//查询车站信息
$scope.postPositionSetting = {}
railwayService.railwayLineStationFind($scope.vm).success(function (data) {
if (data.errors === null || data.errors.length > 0) {
dialogService.tip(data.errors, null, null);
} else {
$scope.postPositionSetting.lineList = data.lineList;
}
});
$scope.doSave = function() {
if($scope.postPositionSetting.name == "" || $scope.postPositionSetting.name == null){
dialogService.tip([{"message": "权限名称不能为空,请填写后再保存!"}]);
return;
}
railwayService.apiPermissionSave($scope.postPositionSetting).success(function(data){
if (data.errors == null || data.errors.length > 0){
dialogService.tip(data.errors);
}
else {
dialogService.tip([{message:"创建成功!"}],"/admin/postPosition/index.htm",1000);
//关闭
//$modalInstance.close($scope.postPositionSetting);
//清空数据
$scope.postPositionSetting={};
}
})
}
}
var postPositionEditController = function($scope,$modal,$http,$interval,$location,dialogService,toolsService,railwayService){
$scope.$emit('navShow', 6);
$scope.settingShow = 6;
$scope.id = toolsService.parameter("id", $location.absUrl());
$scope.vm = {
id: $scope.id,
pageSize : 10,
totalCount : 0
}
$scope.cancel = function(){
window.location = "/admin/postPosition/index.vm";
};
//查询车站信息
$scope.postPositionSetting = {}
railwayService.railwayPermissionFind($scope.vm).success(function (data) {
if (data.errors === null || data.errors.length > 0) {
dialogService.tip(data.errors, null, null);
} else {
$scope.postPositionSetting = data;
}
});
$scope.doEditSave = function() {
if($scope.postPositionSetting.name == "" || $scope.postPositionSetting.name == null){
dialogService.tip([{"message": "权限名称不能为空,请填写后再保存!"}]);
return;
}
railwayService.apiPermissionEditSave($scope.postPositionSetting).success(function(data){
if (data.errors == null || data.errors.length > 0){
dialogService.tip(data.errors);
}
else {
dialogService.tip([{message:"编辑成功!"}],"/admin/postPosition/index.htm",1000);
//关闭
//$modalInstance.close($scope.postPositionSetting);
//清空数据
$scope.postPositionSetting={};
}
})
}
}
angular.module("xn.page", ["xn.directive.form"])
.controller("PostPositionController",["$scope","$modal","$http","$interval","dialogService","RailwayService",postPositionController])
.controller("PostPositionCreateController",["$scope","$modal","$http","$interval","dialogService","RailwayService",postPositionCreateController])
.controller("PostPositionEditController",["$scope","$modal","$http","$interval","$location","dialogService","toolsService","RailwayService",postPositionEditController])
})();