repairConfig.js
3.22 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
(function (angular) {
function repairConfig($scope, aiNicheService, Utils, $uibModal, DTOptionsBuilder, DTColumnBuilder, $q, common, $resource) {
$scope.searchForm = {}
$scope.selcetList = [{
label: '请选择',
value: ''
}, {
label: '商户名称',
value: 'merchantName'
}, {
label: '商户号',
value: 'merchantId'
}, {
label: '登录账号',
value: 'remark'
}]
$scope.select = {
type: '',
value: ''
}
$scope.markLastSelect = ''
// 表格
$scope.dtColumns = [
DTColumnBuilder.newColumn('merchantName').withOption('width', 150).withTitle('商户名称'),
DTColumnBuilder.newColumn('merchantId').withOption('width', 150).withTitle('商户号'),
DTColumnBuilder.newColumn('remark').withOption('width').withTitle('登陆账号'),
DTColumnBuilder.newColumn('counselorName').withTitle('送修顾问名字'),
DTColumnBuilder.newColumn('collisionPhone').withTitle('送修顾问联系电话'),
DTColumnBuilder.newColumn('sparePhones').withTitle('备用联系电话'),
]
$scope.dtOptions = DTOptionsBuilder.newOptions().withOption('num', false)
$scope.dtInstance = {
serverData: function (param) {
return aiNicheService.getConfigList(param);
}
}
function getParams() {
$scope.markLastSelect && (delete $scope.searchForm[$scope.markLastSelect])
var regNum = /^[0-9]*$/
if ($scope.select.type) {
$scope.markLastSelect = $scope.select.type
if ($scope.select.type == 'merchantId' && !regNum.test($scope.select.value)) {
$scope.searchForm[$scope.select.type] = -1
} else {
$scope.searchForm[$scope.select.type] = $scope.select.value
}
}
};
$scope.handleSearch = function () {
getParams()
$scope.dtInstance.query({
condition: $scope.searchForm
})
};
$scope.handleReset = function () {
$scope.searchForm = {}
$scope.select = {
type: '',
value: ''
}
$scope.markLastSelect = ''
$scope.dtInstance.query()
};
$scope.handleExport = function () {
var maintainTitle = '送修配置列表'
// // url, params, filename, method
getParams()
Utils.exportExcel2('collisionNoticeConfig/export', $scope.searchForm, maintainTitle, 'GET')
};
$scope.handleImport = function () {
$uibModal.open({
templateUrl: 'biz/AIniche/view/aiImportModal.html',
controller: 'aiImportModalCtrl',
size: 'md',
resolve: {
importConfig: function () {
return {
pageTitle: '批量导入', //弹框标题
ajaxUrl: 'collisionNoticeConfig/importCollisionConfig', //导入服务地址
downloadType: '21', //下载导入模板类型
importTemplate: '送修配置管理模板', //下载导入模板文件名
errorDown: '送修配置管理报错下载.xlsx'
}
}
}
}).result.then(function () {}, function () {
$scope.dtInstance.query({
condition: $scope.searchForm
})
});
};
}
angular.module('AIniche').controller('repairConfig', repairConfig);
})(angular);