demo.js
2.88 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
(function () {
"user strict";
var demoController = function($scope,$modal,$http,dialogService,railwayService){
$scope.$emit('navShow', 5);
$scope.vm = {
pageSize : 10,
pageNumber : 1,
totalCount : 0,
type : "PARTNER"
}
$scope.getList = function(){
PartnerService.findTag($scope.vm).success(function(data){
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors);
}else{
$scope.tagList = data.result;
$scope.vm.totalCount = data.totalCount;
}
})
}
$scope.getList();
$scope.doAddTag = function(){
var vm = {};
var modalInstance = $modal.open({
templateUrl: "create.html",
controller:createTagController,
size:"md",
resolve: {
items: function () {
return vm;
}
}
});
modalInstance.result.then(function () {
$scope.getList();
});
}
$scope.doEdit = function (id) {
var vm = {
id:id
};
var modalInstance = $modal.open({
templateUrl: "create.html",
controller:editTagController,
size:"md",
resolve: {
items: function () {
return vm;
}
}
});
modalInstance.result.then(function () {
$scope.getList();
});
}
$scope.doSearch = function(){
$scope.vm.pageNumber = 1;
$scope.getList();
}
$scope.doDelete = function(id){
var dialogDefaults = {
size: "sm"
};
var dialogOptions = {
closeButtonText: "取消",
actionButtonText: "确定",
headerText: "提示",
bodyText: "确认删除吗",
callback: function () {
PartnerService.deleteTag({id:id}).success(function(data){
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors);
}else{
dialogService.tip([{"message": "删除成功!" }]);
$scope.getList();
}
})
}
};
dialogService.confirm(dialogDefaults, dialogOptions);
}
}
angular.module("xn.page", ["xn.directive.form"])
.controller("DemoController",["$scope","$modal","$http","dialogService","RailwayService",demoController])
})();