From 4e703e5c6117f9502043cf659dbc03e8da9254c4 Mon Sep 17 00:00:00 2001
From: 李天宇 <876263681@qq.com>
Date: 星期六, 09 十一月 2024 10:24:07 +0800
Subject: [PATCH] #update 新增日出入库明细汇总
---
src/main/webapp/static/js/mat/mat.js | 38 ++++++++++++++++++++++++++++----------
1 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/src/main/webapp/static/js/mat/mat.js b/src/main/webapp/static/js/mat/mat.js
index f1e0dc5..3d47663 100644
--- a/src/main/webapp/static/js/mat/mat.js
+++ b/src/main/webapp/static/js/mat/mat.js
@@ -9,7 +9,7 @@
cols.push.apply(cols, matCols);
cols.push(
{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
- )
+ )
return cols;
}
@@ -167,18 +167,35 @@
url: baseUrl+"/mat/export/auth",
headers: {'token': localStorage.getItem('token')},
data: JSON.stringify(param),
- dataType:'json',
+ // dataType:'json',
contentType:'application/json;charset=UTF-8',
method: 'POST',
+ xhrFields: {
+ responseType: "blob" // 璁剧疆鍝嶅簲绫诲瀷涓轰簩杩涘埗鏁版嵁
+ },
success: function (res) {
+ // 鍒涘缓涓�涓复鏃剁殑涓嬭浇閾炬帴
+ const url = window.URL.createObjectURL(res);
+ // 鍒涘缓涓�涓殣钘忕殑 <a> 鍏冪礌骞惰缃笅杞介摼鎺�
+ const a = document.createElement("a");
+ a.style.display = "none";
+ a.href = url;
+ a.download = "export.xlsx"; // 鎸囧畾涓嬭浇鐨勬枃浠跺悕
+ document.body.appendChild(a);
+
+ // 瑙﹀彂鐐瑰嚮浜嬩欢浠ュ紑濮嬩笅杞�
+ a.click();
+
+ // 娓呯悊涓存椂璧勬簮
+ setTimeout(function () {
+ window.URL.revokeObjectURL(url);
+ document.body.removeChild(a);
+ layer.closeAll();
+ }, 100);
+ },
+ fail: function (){
+ layer.msg('瀵煎嚭澶辫触', {icon: 2})
layer.closeAll();
- if (res.code === 200) {
- table.exportFile(titles,res.data,'xls');
- } else if (res.code === 403) {
- top.location.href = baseUrl+"/";
- } else {
- layer.msg(res.msg)
- }
}
});
});
@@ -247,7 +264,7 @@
success: function (layero, dIndex) {
// 鍥炴樉琛ㄥ崟鏁版嵁
form.val('detail', mData);
- // 鏂板鑷姩鐢熸垚鍟嗗搧缂栧彿
+ // 鏂板鑷姩鐢熸垚鍝佸彿
if (!mData) {
http.get(baseUrl + "/mat/auto/matnr/auth", null, function (res) {
$('#matnr').val(res.data);
@@ -255,6 +272,7 @@
}
// 琛ㄥ崟鎻愪氦浜嬩欢
form.on('submit(editSubmit)', function (data) {
+ console.log(data)
data.field.tagId = insXmSel.getValue('valueStr');
if (isEmpty(data.field.tagId)) {
layer.msg('鍒嗙被涓嶈兘涓虹┖', {icon: 2});
--
Gitblit v1.9.1