customerDeviceFsyncCountCtrl.js
4 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
(function (angular) {
function customerDeviceFsyncCountCtrl($scope, customerService, DTColumnBuilder, DTOptionsBuilder, $http, $state, $uibModal, Utils) {
$scope.fieldName = 'merchantId';
$scope.dtColumns = [
DTColumnBuilder.newColumn('merchantName').withOption('width', 60).withTitle('商户名称'),
DTColumnBuilder.newColumn('merchantId').withOption('width', 60).withTitle('商户号'),
DTColumnBuilder.newColumn('count').withOption('width', 60).withTitle('预录设备量'),
DTColumnBuilder.newColumn('activeSum').withOption('width', 60).withTitle('激活设备量'),
DTColumnBuilder.newColumn('salesSum').withOption('width', 60).withTitle('系统撤销量'),
DTColumnBuilder.newColumn('createdDate').withOption('width', 60).withTitle('操作时间'),
DTColumnBuilder.newColumn(null).withTitle('操作').withOption('width', 100).renderWith((data, type, full, oSettings) => {
let str = `<a class="btn-link" style="padding:0 5px;" ng-click='delete(${data.merchantId})' >删除</a>`
return str;
})
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id', 'id')
.withFixedColumns({
leftColumns: 1,
rightColumns: 1
})
.withOption('lengthMenu', [10, 20, 40, 60, 100])
.withOption('num', true);
$scope.dtInstance = {
serverData: customerService.listCustomerDeviceFsyncPage
};
$scope.delete = function (merchantId) {
swal({
title: "确定删除吗?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnConfirm: false
}, function () {
deleteByMerchantId(merchantId);
});
}
/**
* 删除已退单服务订单
*/
function deleteByMerchantId(merchantId) {
//swal({title: '删除中', text: "请稍候...", showConfirmButton: false});
customerService.deleteByMerchantId( merchantId, function (result) {
if (result.returnCode == '0') {
swal({
type: 'success',
title: '',
html: true,
text: '删除成功',
showConfirmButton: false,
timer: 1000
});
$scope.select()
} else {
swal({
type: 'error',
title: '',
html: true,
text: '删除失败 ' + (result.errId || ''),
confirmButtonText: "确定"
});
}
});
}
$scope.importExcel = function () {
$uibModal.open({
templateUrl: 'biz/customer/view/customerImportModal.html',
controller: 'customerImportModalCtrl',
size: 'md',
scope: $scope,
resolve: {
importConfig: function () {
return {
pageTitle: '同步商户导入', //弹框标题
ajaxUrl: 'customer/customerDeviceFsyncCount/import', //导入服务地址
downloadType: '25', //下载导入模板类型
importTemplate: '同步商户导入-模版', //下载导入模板文件名
errorDown: '同步商户导入报错下载.xlsx'
};
}
}
}).result.then(function () {
//关闭弹框后执行方法
}, function () {
$scope.select();
});
};
$scope.getParam = function () {
var param = {};
if ($scope.fieldName && $scope.fieldValue) {
param[$scope.fieldName] = $scope.fieldValue;
}
var obj = {
condition: param
};
return obj;
}
$scope.select = function () {
var param = $scope.getParam();
$scope.dtInstance.query(param);
}
$scope.exportExcel = function () {
var options = $scope.getParam().condition;
Utils.exportExcel2('customer/customerDeviceFsyncCount/exportFsyncCount', options, '预录商户');
};
}
angular.module('customer').controller('customerDeviceFsyncCountCtrl', customerDeviceFsyncCountCtrl);
})(angular);