Sfoglia il codice sorgente

修改boss导入信息

lvhao 1 settimana fa
parent
commit
539a0ba0eb
2 ha cambiato i file con 21 aggiunte e 6 eliminazioni
  1. 2 2
      core/CoreApp/controllers/Boss.php
  2. 19 4
      template/erp/boss_qtcs.html

+ 2 - 2
core/CoreApp/controllers/Boss.php

@@ -1533,9 +1533,9 @@ class Boss extends Start_Controller
 			unset($sp[$k]['warehouse_show']);
 		}
 		$sp = array_values($sp);
-		
+		$title = "商品统计" . date('Y-m-d H-i-s', time());
 
-		echo json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $sp));
+		echo json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $sp,'filename'=>$title));
 		die;
 	}
 

+ 19 - 4
template/erp/boss_qtcs.html

@@ -288,9 +288,25 @@ var f = {}; var i = 0;
                     ],dialogIcon:'error',shadable:0.6
                 });
             }else{
-                const fileName = '员工数据.xlsx' ;
+                const fileName = res.filename+'.xlsx' ;
                 // 将数据转换为工作表
-                const worksheet = XLSX.utils.json_to_sheet(res.data);
+
+                let  list = [];
+                for(let item in res.data){
+                    list.push({
+                        "名称":item.t,
+                        "中文":item.z,
+                        "类型":item.c,
+                        "SKU":item.w,
+                        "用友料号":item.j,
+                        "数量":item.n,
+                        "许昌仓发货量":item.xcc,
+                        "美仓发货量":item.mc,
+                        "定制仓发货量":item.dzc,
+                        "其他仓发货量":item.qtc,
+                    })
+                }
+                const worksheet = XLSX.utils.json_to_sheet(list);
                 // 创建工作簿
                 const workbook = XLSX.utils.book_new();
             
@@ -307,9 +323,8 @@ var f = {}; var i = 0;
                     { wch: 10 },
                     { wch: 10 },
                 ];
-                
                 // 将工作表添加到工作簿
-                XLSX.utils.book_append_sheet(workbook, worksheet, '员工数据');
+                XLSX.utils.book_append_sheet(workbook, worksheet, res.filename);
                 
                 // 导出文件
                 XLSX.writeFile(workbook, fileName);