|
|
/**
|
|
|
* Created by jiangmin on 2016/5/9.
|
|
|
* 反馈管理
|
|
|
*/
|
|
|
var $ = require('jquery');
|
|
|
common = require('../common/common');
|
|
|
datepicker = require('../util/datepicker');
|
|
|
|
|
|
var ENUM = {
|
|
|
//发送状态
|
|
|
StatusEnum1: {
|
|
|
'0': '未发送',
|
|
|
'1': '未发送',
|
|
|
'2': '已发送'
|
|
|
},
|
|
|
//状态
|
|
|
StatusEnum2: {
|
|
|
'0': '未回复',
|
|
|
'1': '已回复',
|
|
|
'2': '已回复'
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
* 下拉框
|
|
|
*/
|
|
|
new common.dropDown({
|
|
|
el: "#isHot-filter"
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#status-filter"
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#clientType-filter"
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#appVersion-filter",
|
|
|
ajax: "appVersions"
|
|
|
});
|
|
|
/**
|
|
|
* 日期插件
|
|
|
*/
|
|
|
$('.hasDatepicker').fdatepicker({
|
|
|
format: 'yyyy-mm-dd'
|
|
|
});
|
|
|
/**
|
|
|
* 列表
|
|
|
* @type {common.grid}
|
|
|
*/
|
|
|
var g = new common.grid({
|
|
|
el: '#content-list',
|
|
|
parms: function () {
|
|
|
return {
|
|
|
uid: common.util.__input('uid-filter'),
|
|
|
startTime: common.util.__input('startTime'),
|
|
|
endTime: common.util.__input('endTime'),
|
|
|
isHot: common.util.__input('isHot-filter'),
|
|
|
status: common.util.__input('status-filter'),
|
|
|
clientType: common.util.__input('clientType-filter'),
|
|
|
appVersion: common.util.__input('appVersion-filter'),
|
|
|
//todo 回复人
|
|
|
replyer: common.util.__input('replyer-filter')
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
|
display: '',
|
|
|
type: 'checkbox'
|
|
|
}, {
|
|
|
display: "UID",
|
|
|
name: "uid"
|
|
|
}, {
|
|
|
display: "来源",
|
|
|
name: "clientType"
|
|
|
}, {
|
|
|
display: '版本号',
|
|
|
name: "appVersion"
|
|
|
}, {
|
|
|
display: '图片',
|
|
|
render: function (item) {
|
|
|
return '<a href="' + item.imageUrl + '" target="_blank"><img src="' + item.imageUrl + '"></a>'
|
|
|
}
|
|
|
}, {
|
|
|
display: '反馈内容',
|
|
|
name: "content"
|
|
|
}, {
|
|
|
display: '回复内容',
|
|
|
name: "replyContent"
|
|
|
}, {
|
|
|
display: '回复人',
|
|
|
render: function (item) {
|
|
|
if (item.status == '0') {
|
|
|
return "";
|
|
|
}
|
|
|
else {
|
|
|
//todo
|
|
|
return "test"
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
display: '时间',
|
|
|
name: "createTime"
|
|
|
}, {
|
|
|
display: "发送状态",
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum1[item.status] + "</p>";
|
|
|
}
|
|
|
}, {
|
|
|
display: "状态",
|
|
|
name: 'status',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum2[item.status] + "</p>";
|
|
|
}
|
|
|
}, {
|
|
|
display: '操作',
|
|
|
render: function (item) {
|
|
|
var HtmArr = [];
|
|
|
//已发送,已回复,则不可再“回”
|
|
|
if (item.status == 2) {
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-info btn-xs reply" disabled="true">回</a>');
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs publish" disabled="true">发</a>');
|
|
|
}
|
|
|
else {
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-info btn-xs reply">回</a>');
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs publish">发</a>');
|
|
|
}
|
|
|
if (item.isHot == 1) {
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs setHot" disabled="false">热</a>');
|
|
|
}
|
|
|
else {
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs setHot">热</a>');
|
|
|
}
|
|
|
|
|
|
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs delete">删</a>');
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
g.init('/suggest/suggest/getSuggestList1');
|
|
|
|
|
|
var Bll = {
|
|
|
toast: function (url, item, content) {
|
|
|
common.dialog.confirm("",
|
|
|
content,
|
|
|
function () {
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: item
|
|
|
}, function () {
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
toastBatch: function (url, item, content) {
|
|
|
common.dialog.confirm("", content,
|
|
|
function () {
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: item
|
|
|
}, function (res) {
|
|
|
console.log(res);
|
|
|
//g.reload(1);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
* 查询按钮点击时间
|
|
|
*/
|
|
|
$("#filter-btn").click(function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
/**
|
|
|
* 回
|
|
|
*/
|
|
|
$(document).on('click', '.reply', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
common.dialog({
|
|
|
title: "回答反馈内容",
|
|
|
content: common.util.__template2($("#replyTemplate").html(), item),
|
|
|
button: [
|
|
|
{
|
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
common.util.__ajax({
|
|
|
url: "/suggest/suggest/replySuggest",
|
|
|
data: {
|
|
|
id: item.id,
|
|
|
replyContent: $("#replyContent").val()
|
|
|
}
|
|
|
}, function (res) {
|
|
|
if (res.code == '200') {
|
|
|
g.reload();
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
css: "btn btn-info"
|
|
|
}, {
|
|
|
value: "取消"
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
});
|
|
|
/**
|
|
|
* 发
|
|
|
*/
|
|
|
$(document).on('click', '.publish', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
item = {
|
|
|
id: item.id
|
|
|
};
|
|
|
Bll.toast('/suggest/suggest/publishSuggest', item, "是否确认发送?");
|
|
|
});
|
|
|
/**
|
|
|
* 热
|
|
|
*/
|
|
|
$(document).on('click', '.setHot', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
item = {
|
|
|
id: item.id,
|
|
|
isHot: 1
|
|
|
};
|
|
|
Bll.toast('/suggest/suggest/setHotSuggest', item, "是否确认设置热门?");
|
|
|
});
|
|
|
/**
|
|
|
* 删除
|
|
|
*/
|
|
|
$(document).on('click', '.delete', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
Bll.toast('/suggest/suggest/deleteSuggest', item, "是否确认删除?");
|
|
|
});
|
|
|
|
|
|
//批量发送
|
|
|
$(document).on('click', '#batchPublish', function () {
|
|
|
var selectedArr = g.selected,
|
|
|
len = selectedArr.length,
|
|
|
idList = [];
|
|
|
if (len <= 0) {
|
|
|
common.util.__tip('请选择反馈', 'warning');
|
|
|
return;
|
|
|
}
|
|
|
$.each(selectedArr, function (i, value) {
|
|
|
idList.push(value['id']);
|
|
|
});
|
|
|
var ids=idList.join(",");
|
|
|
console.log(ids);
|
|
|
Bll.toastBatch("/suggest/suggest/batchPublishSuggest",ids,"确定批量发送吗?");
|
|
|
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|