diff --git a/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html b/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html
index 7d82de79..3870a2aa 100644
--- a/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html
+++ b/ruoyi-admin/src/main/resources/templates/manage/delivery/import.html
@@ -4,18 +4,34 @@
-
-
+
@@ -30,7 +46,7 @@ url: prefix + "/list",
showToggle:false,
showPageGo:true,
params:{
- deliveryId:''
+ deliveryId:$('#bootstrap-table').attr('deliveryid')
},
columns: [{
checkbox: false,
@@ -74,22 +90,40 @@ $.table.init(options);
}
function importList(){
-
+ $('#uploadInput').click()
}
- // layui.use('upload',function(){
- // var upload = layui.upload;
- // // 渲染
- // upload.render({
- // elem: '#uploadInput',
- // url:prefix+'/importData', // 此处配置你自己的上传接口即可
- // auto: true,
- // // multiple: true,',
- // done: function(res){
- // layer.msg('上传成功');
- // console.log(res)
- // }
- // });
- // });
+
+ document.getElementById('uploadInput').addEventListener('change', function(event) {
+ const file = event.target.files[0];
+ let data=new FormData()
+ data.append('file',file)
+ data.append('deliveryId',$('#bootstrap-table').attr('deliveryid'))
+ var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
+ xhr.open('POST',prefix+'/importData', true); // 设置请求类型和URL
+ // 当请求完成时执行的回调函数
+ xhr.onload = function (res) {
+ let data=JSON.parse(res.currentTarget.response)
+ if (data.code === 0) {
+ $.modal.msgSuccess('上传成功');
+ } else {
+ $.modal.msgError(data.msg);
+
+ }
+ $('#uploadInput').val('')
+ $.table.refresh();
+
+ };
+
+ // 当请求发生错误时执行的回调函数
+ xhr.onerror = function () {
+ console.log('上传过程中发生错误');
+ };
+ //
+ // // 发送数据到服务器
+ xhr.send(data);
+
+
+ });