viewQuestionnaireCtrl.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
(function (angular) {
function viewQuestionnaireCtrl($scope,questionnaireService,param,DTColumnBuilder,DTOptionsBuilder,$uibModal,SweetAlertX) {
$scope.importQuestionItem = {};
$scope.importRespondents = {};
$scope.qnId = param;
$scope.condition = {
condition:{
qnId: $scope.qnId
}
};
$scope.statusList = [
{value : 0, text : '待完善'},
{value : 1, text : '待发送'},
{value : 2, text : '已发送'},
{value : 3, text : '已撤回'}];
$scope.getAllInfoById = function () {
questionnaireService.getAllInfoById({id:$scope.qnId},function (res) {
if(res && res.data){
$scope.questionnaire = res.data;
if($scope.questionnaire.questionItemList && $scope.questionnaire.questionItemList.length > 0){
$scope.importQuestionItem.execlName = '被调查商户表.xlsx';
$scope.importQuestionItem.list = $scope.questionnaire.questionItemList;
}
if($scope.questionnaire.respondentsList && $scope.questionnaire.respondentsList.length > 0){
$scope.importRespondents.execlName = '调查商户表.xlsx';
$scope.importRespondents.list = $scope.questionnaire.respondentsList;
}
}
})
};
$scope.getAllInfoById();
$scope.dtColumns = [
DTColumnBuilder.newColumn('name').withOption('width',60).withTitle('公司名称')
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withFixedColumns({
leftColumns: 1,
rightColumns: 0
})
.withOption('num', true);
// $scope.dtInstance = {
// serverData : questionItemService.list
// };
$scope.select = function () {
var obj = {
condition:{
qnId: $scope.qnId
}
};
if($scope.name){
obj.condition.name = $scope.name;
}
$scope.dtInstance.query(obj);
};
$scope.changeStatus = function (ids,status,name) {
SweetAlertX.confirm({
text: "是否确认"+ name +"问卷?",
confirmButtonText: "确认",
cancelButtonText: "取消"
}, function () {
questionnaireService.changeStatus({ids:ids,status:status},function (res) {
if(res && res.data){
$scope.getAllInfoById();
SweetAlertX.alert('',name + '问卷成功','success');
}else {
SweetAlertX.alert('',name + '问卷失败','success');
}
});
})
};
$scope.viewMerchant = function (mark) {
$uibModal.open({
templateUrl : 'biz/questionnaire/view/viewMerchantDetail.html',
controller : 'viewMerchantDetailCtrl',
size : 'lg',
scope:$scope,
resolve : {
param: function () {
return {
id:$scope.questionnaire.id,
qnName:$scope.questionnaire.name,
code:$scope.questionnaire.code,
mark:mark
};
}
}
}).result.then(function(){
//关闭弹框后执行方法
},function () {
$scope.select();
});
};
$scope.edit = function () {
$uibModal.open({
templateUrl : 'biz/questionnaire/view/addQuestionnaire.html',
controller : 'editQuestionnaireCtrl',
size : 'lg',
scope:$scope,
resolve : {
param: function () {
return $scope.qnId
}
}
}).result.then(function(){
//关闭弹框后执行方法
},function () {
$scope.getAllInfoById();
$scope.select();
});
}
}
angular.module('questionnaire')
.controller('viewQuestionnaireCtrl', viewQuestionnaireCtrl);
})(angular);