@ -20,13 +20,38 @@
< body class = "gray-bg" >
< div class = "container-div" >
< div class = "row" >
< div class = "col-sm-12 search-collapse" >
< form id = "formId" >
< div class = "select-list" >
< ul >
< li class = "select-time" >
< label > 入库时间:< / label >
< input type = "text" class = "time-input" id = "startTime" placeholder = "开始时间"
name="params[beginCheckTime]"/>
< span > -< / span >
< input type = "text" class = "time-input" id = "endTime" placeholder = "结束时间"
name="params[endCheckTime]"/>
< / li >
< li >
< label > 批次码:< / label >
< input type = "text" name = "batchCode" / >
< / li >
< li >
< a class = "btn btn-primary btn-rounded btn-sm" onclick = "$.table.search()" > < i class = "fa fa-search" > < / i > 搜索< / a >
<!-- <a class="btn btn - primary btn - rounded btn - sm" id="btnSearch"><i class="fa fa - search"></i> 搜索</a> -->
< a class = "btn btn-warning btn-rounded btn-sm" onclick = "$.form.reset()" > < i class = "fa fa-refresh" > < / i > 重置< / a >
< / li >
< / ul >
< / div >
< / form >
< / div >
< div class = "col-sm-12 select-table table-striped" >
<!-- 点击事件的方式打开使用 detailViewIcon: false and detailViewByClick: true
data-detail-view-icon="false"
data-detail-view-by-click="true" -->
< table id = "bootstrap-table" > < / table >
< / div >
< div class = "btn-group-sm" id = "toolbar" role = "group" > `
< div class = "btn-group-sm" id = "toolbar" role = "group" >
< i class = "fa fa-info-circle" style = "color: red;" > < / i > 勾选数据导出指定列,否则为全部
< a class = "btn btn-warning" onclick = "exportSelected()" >
< i class = "fa fa-download" > < / i > 导出
@ -61,7 +86,10 @@
var prefix = ctx + "manage/record_in";
var datas = [{"createBy":"admin","createTime":"2024-06-06 02:06:39","updateBy":null,"updateTime":null,"remark":"\u6B63\u5E38\u72B6\u6001","dictCode":6,"dictSort":1,"dictLabel":"\u6B63\u5E38","dictValue":"0","dictType":"sys_normal_disable","cssClass":"","listClass":"primary","isDefault":"Y","status":"0","default":true},{"createBy":"admin","createTime":"2024-06-06 02:06:39","updateBy":null,"updateTime":null,"remark":"\u505C\u7528\u72B6\u6001","dictCode":7,"dictSort":2,"dictLabel":"\u505C\u7528","dictValue":"1","dictType":"sys_normal_disable","cssClass":"","listClass":"danger","isDefault":"N","status":"0","default":false}];
$(function() {
var options = {
url: prefix + "/sort_list",
showSearch: false,
@ -74,6 +102,9 @@
initChildTable(index, row, $detail);
},
columns: [
{
checkbox: true
},
{
field: 'createTime',
title: '入库时间',
@ -120,6 +151,7 @@
// }
}]
};
$.table.init(options);
});
@ -149,9 +181,6 @@
};
},
columns: [
{
checkbox: true
},
{
title: '序号',
formatter: function (value, row, index) {
@ -206,64 +235,28 @@
}*/]
});
};
// 导出数据
// function exportSelected() {
// var $table =$('#bootstrap-table');
// var selections = $table.bootstrapTable('getSelections');
// var userIds = $.map(selections, function (row) {
// return row.objid; // 假设objid是子表每行的唯一标识
// });
//
// if(userIds.length === 0){
// $.modal.alertWarning("请至少选择一条记录");
// return;
// }
//
// var dataParam = {
// userIds: userIds.join(',')
// };
// if($.common.isNotEmpty(userIds)){
// tipMsg = "确定导出勾选" + userIds.length + "条数据吗?";
// dataParam.push({ "name": "userIds", "value": userIds });
// }
// $.modal.confirm(tipMsg, function() {
// $.post(prefix + "/export", dataParam, function(result) {
// if (result.code == web_status.SUCCESS) {
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "& delete=" + true;
// } else {
// $.modal.alertError(result.msg);
// }
// });
// });
// }
// 导出子表数据
function exportSelected() {
var childTables = $('.detail-view table'); // 获取所有子表的引用
var userIds = [];
// 遍历每个子表
childTables.each(function() {
var selections = $(this).bootstrapTable('getSelections'); // 获取子表中的选中行
// 将子表中选中行的objid添加到userIds数组中
userIds = userIds.concat($.map(selections, function (row) {
return row.objid; // 假设objid是子表每行的唯一标识
}));
function exportSelected() {
var $table =$('#bootstrap-table');
var selections = $table.bootstrapTable('getSelections');
var objIds = $.map(selections, function (row) {
return row.batchCode; // 假设objid是父表每行的唯一标识
});
if(userIds.length === 0) {
// var objIds = row.batchCode;
if (objIds.length === 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var dataParam = {
userIds: user Ids.join(',')
objIds: objIds.join(',')
};
$.modal.confirm("确定导出选中的" + user Ids.length + "条数据吗?", function() {
$.modal.confirm("确定导出勾选的" + objIds.length + "条数据吗?", function() {
$.ajax({
url: prefix + "/export", // 修改为你 的导出接口URL
url: prefix + "/export_sort", // 修改为您的导出接口URL
method: 'POST',
data: dataParam,
// data: dataParam,
success: function(result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "& delete=" + true;
@ -278,6 +271,7 @@
});
}
< / script >
< / body >
< / html >