normalAppSuggest.js
7.11 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**
* Created by ty on 2016/3/28.
* APP意见反馈管理
*/
var $ = require('jquery'),
common = require('../common/common'),
util = require('../common/util');
new common.edit("#filter").init();
new common.dropDown({el: "#isHot-filter"});
new common.dropDown({el: "#status-filter"});
new common.dropDown({el: "#source-filter"});
new common.dropDown({el: "#clientType-filter"});
common.util.__ajax({
url: '/suggest/getAllAppVersions',
data: {}
},function(res) {
$("#version-search").html(common.util.__template2($("#version-template").html(), res));
new common.dropDown({el: "#appVersion-filter"});
},true);
var g = new common.grid({
el: "#basicTable",
parms: function () {
return {
uid: common.util.__input('uid-filter'),
status: common.util.__input('status-filter'),
clientType: common.util.__input('clientType-filter'),
startTime: common.util.__input('startTime'),
endTime: common.util.__input('endTime'),
isHot: common.util.__input('isHot-filter'),
appVersion: common.util.__input('appVersion-filter'),
//status:t.active
};
},
columns: [
{display: " ", type:"checkbox"},
{display: "UID", name: "uid"},
{display: "来源", name: "clientType", width: "56px", render: function(item) {
if(item.clientType) return item.clientType;
return "未知";
}},
{display: "版本号", name: "appVersion", style:"min-width: 56px;"},
{display: "图片", name: "", render: function(item) {
var url = item.imageUrl ? item.imageUrl.substring(0, item.imageUrl.indexOf("?")) : "";
if(item.imageUrl) {
return '<a href="'+ url +'" target="_blank"><img src="' + item.imageUrl + '" height="60px" width="60px" /></a>';
}
}},
{display: "反馈内容", name: "content", width:"20%"},
{display: "回复内容", name: "replyContent", width:"20%"},
{display: "时间", name: "createTime", width:"88px;"},
{display: "发送状态", name: "", width:"70px;",render: function(item) {
if (item.status == "0") {
return "未发送";
} else if (item.status == "1") {
return "未发送";
} else if (item.status == "2") {
return "已发送";
}
}},
{display: "状态",name: "", width:"70px;",render: function(item) {
if (item.status == "0") {
return "未回复";
} else if (item.status == "1") {
return "已回复";
} else if (item.status == "2") {
return "已回复";
}
}},
{
display: "操作",name: "", width:"156px;", render: function (item) {
var replyDisabled = item.status < 2 ? "" : "disabled";
var sendDisabled = item.status == 1 ? "" : "disabled";
var isHotDisabled = item.isHot == 0 ? "" : "disabled";
var arr = [];
arr.push('<button '+ replyDisabled + ' class="btn btn-primary btn-xs replyBtn" data-index="'+ item.__index +'">回</button>');
arr.push('<button '+ sendDisabled + ' class="btn btn-success btn-xs sendBtn" data-index="'+ item.__index +'">发</button>');
if(isHotDisabled) {
arr.push('<button ' + isHotDisabled + ' class="btn btn-warning btn-xs hotBtn" data-index="' + item.__index + '">热</button>');
} else {
arr.push('<button ' + isHotDisabled + ' class="btn btn-danger btn-xs hotBtn" data-index="' + item.__index + '">热</button>');
}
arr.push('<button class="btn btn-inverse btn-xs delBtn" data-index="'+ item.__index +'">删</button>');
return arr.join("");
}
}
]
});
g.init("/suggest/getSuggestList");
//console.log(g);
var Bll = {
toast:function(url, item, hint) {
var e = new common.edit("#base-form");
common.dialog.confirm(hint,
common.util.__template2($("#reply-template").html(), item),
function() {
e.submit(url, function (option) {
option.success=function(res) {
if(res.data.code == 200) {
util.__tip(res.data.message, "success");
} else {
util.__tip(res.data.message);
}
g.reload();
};
option.error=function(res){
util.__tip(res.data.message);
};
});
});
e.init();
},
batch:function(url, hint) {
var ids = [];
$.each(g.selected,function (i, value) {
ids.push(value.id);
});
if(ids.length) {
if(url.indexOf("Publish") != -1) {
common.dialog.confirm("发送确认", "是否确认发送?", function () {
common.util.__ajax({
url: url,
data: {
id: ids.join(",")
}
}, function () {
g.reload();
});
});
} else {
window.open("/ajax/down?queryConf=" + JSON.stringify({"id":ids.join(",")}) + "&type=suggestExport");
}
} else {
util.__tip(hint,"warning");
}
}
};
//设置回复
$(document).on('click', '.replyBtn', function() {
var item = g.rows[$(this).data("index")];
Bll.toast("/suggest/replySuggest", item, "回答反馈内容");
});
//设置热门
$(document).on('click', '.hotBtn', function() {
var item = g.rows[$(this).data("index")];
common.util.__ajax({
url: '/suggest/setHotSuggest',
data: {
id: item.id,
isHot: 1//只能设置热门
}
},function() {
g.reload();
},true);
});
//发送回复
$(document).on('click', '.sendBtn',function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("发送确认","是否确认发送?",function() {
common.util.__ajax({
url: '/suggest/publishSuggest',
data: {
id: item.id
}
},function() {
g.reload();
});
});
});
//删除一条记录
$(document).on('click', '.delBtn',function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("删除确认","是否确认删除?",function() {
common.util.__ajax({
url: '/suggest/deleteSuggest',
data: {
id: item.id
}
},function() {
g.reload();
});
});
});
$(document).on('click', '#batchSend', function() {//批量发送
Bll.batch("/suggest/batchPublishSuggest", "请选择要发送的回复!");
});
$(document).on('click', '#batchExport', function() {//批量导出
Bll.batch("/suggest/batchExportSuggest", "请选择要导出的数据!");
});
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});