channelConfigCtrl.js
4.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
(function(angular) {
function channelConfigCtrl($scope, DTOptionsBuilder, DTColumnBuilder, systemService, $uibModal, $filter, $state,Utils) {
$scope.channelTypeList = [];
systemService.getChannelTypeList(function(res){
$scope.channelTypeList = res.data;
});
$scope.dtColumns = [
DTColumnBuilder.newColumn('channelName').withOption('width',80).withTitle('渠道名称'),
DTColumnBuilder.newColumn('channelType').withOption('width',80).withTitle('渠道类型').renderWith(function(e, dt, node, config){
var channelTypeName = "";
angular.forEach($scope.channelTypeList, function(r){
if(r.confValue == node.channelType){
channelTypeName = r.confName;
}
});
return channelTypeName;
}),
DTColumnBuilder.newColumn('channelWebUrl').withOption('width',80).withTitle('渠道网址'),
DTColumnBuilder.newColumn('channelWebName').withOption('width',80).withTitle('渠道网址名称'),
DTColumnBuilder.newColumn('platformGroup').withOption('width',80).withTitle('平台分组'),
DTColumnBuilder.newColumn('platformChannelName').withOption('width',120).withTitle('平台渠道名称'),
DTColumnBuilder.newColumn('platformChannelCode').withOption('width',120).withTitle('平台渠道编号'),
DTColumnBuilder.newColumn('wechatAppid').withOption('width',90).withTitle('微信应用ID'),
DTColumnBuilder.newColumn('channelLogo').withOption('width',80).withTitle('渠道logo').renderWith(function(e, dt, node, config){
if(node.channelLogo){
return '<img src="' + node.channelLogo + '" style="width:100%;height:60px;">';
}
return "";
}),
DTColumnBuilder.newColumn('loginLogo').withOption('width',80).withTitle('登录页logo').renderWith(function(e, dt, node, config){
if(node.loginLogo){
return '<img src="' + node.loginLogo + '" style="width:100%;height:60px;">';
}
return "";
}),
DTColumnBuilder.newColumn('wechatLoginLogo').withOption('width',100).withTitle('微信登录页logo').renderWith(function(e, dt, node, config){
if(node.wechatLoginLogo){
return '<img src="' + node.wechatLoginLogo + '" style="width:100%;height:60px;">';
}
return "";
}),
DTColumnBuilder.newColumn('siteLogo').withOption('width',80).withTitle('网站内logo').renderWith(function(e, dt, node, config){
if(node.siteLogo){
return '<img src="' + node.siteLogo + '" style="width:100%;height:60px;">';
}
return "";
}),
DTColumnBuilder.newColumn('updatedDate').withOption('width',120).withTitle('更新时间').renderWith(function(e, dt, node, config){
return $filter('date')(new Date(node.updatedDate), 'yyyy-MM-dd HH:mm:ss');
}),
DTColumnBuilder.newColumn(null).withTitle(function(){
return '操作';
}).withOption('width', 80).withClass('text-center').renderWith(function(data, type, full, oSettings) {
var str = '<div class="form-inline">'
+'<div class="form-group"><a class="btn btn-link" ng-click="addOrUpdate('+ data.id +')">修改资料</a></div>';
str += '</div>';
return str;
})
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withFixedColumns({
rightColumns: 1
});
$scope.dtInstance = {
serverData : systemService.getChannelConfigPageList
};
$scope.getParams =function(){
var condition = {};
if($scope.channelName){
condition.channelName = $scope.channelName;
}
return {'condition':condition};
}
//查询
$scope.submitForm = function(){
$scope.dtInstance.query($scope.getParams());
}
$scope.addOrUpdate = function (channelId) {
$uibModal.open({
templateUrl: 'biz/system/view/channelConfigAdd.html',
controller: 'channelConfigAddCtrl',
size: 'lg',
resolve: {
params: function () {
return {'channelId':channelId}
}
}
}).result.then(function (data) {
$scope.dtInstance.query($scope.getParams());
},function(){
$scope.dtInstance.query($scope.getParams());
})
};
}
angular.module('system').controller('channelConfigCtrl', channelConfigCtrl)
})(angular);