viewMerchantDetailCtrl.js
4.92 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
(function (angular) {
function viewMerchantDetailCtrl($scope,respondentsService,questionItemService,param,DTColumnBuilder,DTOptionsBuilder,Utils) {
$scope.mark = param.mark;
$scope.qnId = param.id;
$scope.qnCode = param.code;
$scope.qnName = param.qnName;
$scope.condition = {
condition:{
qnCode: $scope.qnCode
}
};
$scope.condition1 = {
condition:{
qnId: $scope.qnId
}
};
$scope.statusList = [
{value : 0, text : '待完善'},
{value : 1, text : '待发送'},
{value : 2, text : '已发送'},
{value : 3, text : '已撤回'}];
$scope.tabs = [
{text: '调查商户明细', active: true, value: 1},
{text: '被调查商户明细', active: false, value: 2}
];
$scope.statusList = [
{ id: '', name: '全部' },
{ id: 1, name: '待提交' },
{ id: 2, name: '已提交' }
];
$scope.dtColumns = [
DTColumnBuilder.newColumn('userName').withOption('width',60).withTitle('调查商户名称'),
DTColumnBuilder.newColumn('accountName').withOption('width',60).withTitle('调查商户账号'),
DTColumnBuilder.newColumn('answerStatus').withOption('width',60).withTitle('当前状态').renderWith(function(data, type, full, oSettings) {
for(var i in $scope.statusList){
if(data === $scope.statusList[i].id){
return $scope.statusList[i].name;
}
}
}),
DTColumnBuilder.newColumn('updatedDate').withOption('width',60).withTitle('更新时间')
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withFixedColumns({
leftColumns: 1,
rightColumns: 0
})
.withOption('num', true);
$scope.dtInstance = {
serverData : respondentsService.list
};
$scope.dtColumns1 = [
DTColumnBuilder.newColumn('name').withOption('width',600).withTitle('被调查商户名称')
];
$scope.dtOptions1 = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withFixedColumns({
leftColumns: 1,
rightColumns: 0
})
.withOption('num', true);
$scope.dtInstance1 = {
serverData : questionItemService.list
};
$scope.changeTabs = function (index) {
$scope.tabs.forEach(e =>e.active = false);
$scope.tabs[index].active = true;
};
$scope.getParam = function () {
var obj = {
condition:{
qnCode: $scope.qnCode
}
};
if($scope.fieldName && $scope.fieldText){
obj.condition[$scope.fieldName] = $scope.fieldText;
}
if($scope.status){
obj.condition.answerStatus = $scope.status.id;
}
return obj;
};
$scope.select = function () {
var obj = $scope.getParam();
$scope.dtInstance.query(obj);
};
$scope.export = function () {
var options = $scope.getParam().condition;
Utils.exportExcel2('inquiryUser/exportRespondents',options,$scope.qnCode +'-'+$scope.qnName+ '-'+ '调查商户明细列表');
};
$scope.export1 = function () {
var options = $scope.getParam1().condition;
Utils.exportExcel2('questionItems/exportQuestionItems',options,$scope.qnCode +'-'+$scope.qnName+'-'+ '被调查商户明细列表');
};
$scope.getParam1 = function () {
var obj = {
condition:{
qnId: $scope.qnId
}
};
if($scope.name){
obj.condition.name = $scope.name;
}
return obj;
};
$scope.select1 = function () {
var obj = {
condition:{
qnId: $scope.qnId
}
};
if($scope.name){
obj.condition.name = $scope.name;
}
$scope.dtInstance1.query(obj);
};
$scope.init = function () {
$scope.fieldName = 'userName';
if($scope.mark){
$scope.tabs.forEach(e =>e.active = false);
for(var i in $scope.tabs){
if($scope.tabs[i].value === $scope.mark){
$scope.tabs[i].active = true;
break;
}
}
}
};
$scope.init();
}
angular.module('questionnaire')
.controller('viewMerchantDetailCtrl', viewMerchantDetailCtrl);
})(angular);