|
|
@ -368,55 +368,25 @@ |
|
|
|
|
|
|
|
// 导出 |
|
|
|
function exportExcel(formId) { |
|
|
|
// $.table.set(); |
|
|
|
var supplierCodeData = []; |
|
|
|
var selections = $("#bootstrap-table").bootstrapTable("getSelections"); |
|
|
|
if(selections.length === 0){ |
|
|
|
$.modal.confirm("确定导出所有的客户报价吗?", function() { |
|
|
|
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; |
|
|
|
var params = $("#bootstrap-table").bootstrapTable('getOptions'); |
|
|
|
var dataParam = $("#" + currentId).serializeArray(); |
|
|
|
dataParam.push({ "name": "orderByColumn", "value": params.sortName }); |
|
|
|
dataParam.push({ "name": "isAsc", "value": params.sortOrder }); |
|
|
|
var ids = $.table.selectColumns("supplierCode"); |
|
|
|
var dataParam = $("#formId").serializeArray(); |
|
|
|
|
|
|
|
let tipMsg = "确定导出当前所有数据吗?"; |
|
|
|
if ($.common.isNotEmpty(ids)) { |
|
|
|
tipMsg = `确定导出 ${ids} 数据吗?`; |
|
|
|
dataParam.push({ "name": "ids", "value": ids }); |
|
|
|
} |
|
|
|
$.modal.confirm(tipMsg, function () { |
|
|
|
$.modal.loading("正在导出数据,请稍后..."); |
|
|
|
$.post(prefix + '/exportAll', dataParam, function(result) { |
|
|
|
if (result.code == web_status.SUCCESS) { |
|
|
|
$.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 if (result.code == web_status.WARNING) { |
|
|
|
$.modal.alertWarning(result.msg) |
|
|
|
} else { |
|
|
|
$.modal.alertError(result.msg); |
|
|
|
} |
|
|
|
$.modal.closeLoading(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else { |
|
|
|
$.modal.confirm("确定导出选中的所有客户报价吗?", function () { |
|
|
|
//·拼接单号 |
|
|
|
for(let i=0;i<selections.length;i++){ |
|
|
|
supplierCodeData.push(selections[i].supplierCode); |
|
|
|
} |
|
|
|
var supplierCodes = JSON.stringify(supplierCodeData); |
|
|
|
// console.log(bomNos); |
|
|
|
$.modal.loading("正在导出数据,请稍后..."); |
|
|
|
var config = { |
|
|
|
url: prefix + '/export', |
|
|
|
type: "post", |
|
|
|
dataType: "json", |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
data: supplierCodes, |
|
|
|
success: function(result) { |
|
|
|
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; |
|
|
|
$.modal.alertSuccess("导出成功!") |
|
|
|
$.modal.closeLoading(); |
|
|
|
}, |
|
|
|
error: function (result){ |
|
|
|
$.modal.alertError(result.msg); |
|
|
|
} |
|
|
|
}; |
|
|
|
$.ajax(config) |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|