1、首先引入相关js;
<script type="text/javascript" src="${ctx}/ncplatui/js/common/common_utils.js"></script>
2、在相应的js导出方法里面写导出方法;
//导出
$("#OUTPUT1").on("click", function () {
var info = new EiInfo();
info.setByNode("inqu_status")
EiCommunicator.send("AQKH1001", "exportWt", info, {
onSuccess: function (ei) {
var needColumns = ["checkPerson", "checkDate", "checkYear", "quarter", "dangerDescibe", "dutyDeptCname", "dutyAreaCname", "dutyStationCname", "by2", "by3"];
var colInit = [{width: 150}, {width: 100}, {width: 60}, {width: 60},{width: 300}, {width: 120}, {width: 120},{width: 120}, {width: 300}, {width: 60}];
var dataItems = ei.getBlock("result1").getMappedRows();
var needColumnsCN = ["检查人", "检查日期", "年份", "季度", "问题描述", "责任部门/中心","责任车间/区域", "责任班组/车站", "季度安全考核依据", "扣分"];
var data = _beforeInit(dataItems, needColumns, needColumnsCN);
_exportData(data, colInit, "安全问题检查记录.xlsx");
},
onFail: function () {
NotificationUtil({msg: "导出数据异常"}, "error");
}
});
});
3、在相应的service方法里面写出查询方法;
/**
*【安全问题导出】
* @param inInfo
* @return
*/
public EiInfo exportWt(EiInfo inInfo) {
Map map = inInfo.getRow("inqu_status",0);
List list = dao.query("AQWT01.query", map, 0, -99999);
inInfo.addRows("result1", list);
return inInfo;
}