Authored by linlong

Merge branch 'channel' of git.yoho.cn:yoho30/yohobuy-union into channel

# By LiQZ
# Via LiQZ
* 'channel' of git.yoho.cn:yoho30/yohobuy-union:
  增加选中导出方法
... ... @@ -56,6 +56,7 @@ public class ChannelUserServiceImpl implements IChannelUserService, IBusinessExp
condition.put("endRegisterTime", request.getEndRegisterTime());
condition.put("beginSmsTime", request.getBeginSmsTime());
condition.put("endSmsTime", request.getEndSmsTime());
condition.put("ids", request.getIds());
/** 删除 '' 条件 */
MapUtil.filterStringBlankMap(condition);
... ...
... ... @@ -320,6 +320,9 @@
<if test="condition.endSmsTime != null">
<![CDATA[ AND sms_time <= #{condition.endSmsTime} ]]>
</if>
<if test="condition.ids != null">
and id in (#{condition.ids})
</if>
</trim>
</if>
</sql>
... ...
... ... @@ -92,6 +92,7 @@
</div>
<script type="text/javascript">
var checkedItems = [];
$(function () {
// 列表
var grid = $("#consultTable");
... ... @@ -102,6 +103,13 @@
url: contextPath + "/channel/user_list",
method: 'POST',
queryParams: getParams(),
rownumbers: true,
idField: "id",
view: fileview,
onCheckAll: addcheckItem,
onCheck: addcheckItem,
onUncheckAll: removeAllItem,
onUncheck: removeSingleItem,
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
... ... @@ -109,16 +117,12 @@
},
columns: [[{
title: "全选",
field: "first",
field: "id",
idField:"id",
width: 10,
align: "center",
checkbox: true
}, {
title: "ID",
field: "id",
width: 40,
align: "center"
}, {
title: "手机号",
field: "mobile",
width: 80,
... ... @@ -230,14 +234,76 @@
}
});
$("#exportButton").linkbutton({
onClick : function() {
var ids =[];
$("input[type='checkbox'][name='id']:checked").each(function () {
ids.push($(this).val());
});
console.log(ids);
if (ids.length == 0) {
$.messager.alert('提示','请选择要导出的数据');
return;
}
var params = {"ids": ids.toString() };
window.open(contextPath + "/batch/export.do?type=channelUserServiceImpl&queryConf=" + JSON.stringify(params));
}
});
$("#exportAllButton").linkbutton({
onClick : function() {
window.open(contextPath + "/batch/export.do?type=channelUserServiceImpl&queryConf=" + JSON.stringify(getParams()));
}
});
});
var fileview = $.extend({}, $.fn.datagrid.defaults.view, { onAfterRender: function (target) { isCheckItem(); } });
function isCheckItem() {
for (var i = 0; i < checkedItems.length; i++) {
$("input[type='checkbox'][name='id'][value='"+checkedItems[i]+"']").attr("checked", "checked");
}
}
function findCheckedItem(ID) {
for (var i = 0; i < checkedItems.length; i++) {
if (checkedItems[i] == ID) return i;
}
return -1;
}
function addcheckItem() {
$("input[type='checkbox'][name='id']:checked").each(function () {
var k = findCheckedItem($(this).val());
if (k == -1) {
checkedItems.push($(this).val());
}
});
}
function removeAllItem(rows) {
$("input[type='checkbox'][name='id']").each(function () {
if (!this.checked) {
var k = findCheckedItem($(this).val());
if (k != -1) {
checkedItems.splice(k, 1);
}
}
});
}
function removeSingleItem(rowIndex, rowData) {
var k = findCheckedItem(rowData.id);
if (k != -1) {
checkedItems.splice(k, 1);
}
}
</script>
</body>
... ...