|
|
@@ -163,13 +163,52 @@
|
|
|
reader.readAsArrayBuffer(file); // 以 ArrayBuffer 读取
|
|
|
}
|
|
|
function print_label() {
|
|
|
- console.log(excel_data)
|
|
|
$.post("/whlabelfz/bqpladd", { data: JSON.stringify(excel_data) }, function(res) {
|
|
|
+ layx.destroy('loadId');
|
|
|
+ console.log(res)
|
|
|
+ if(res.code == 1){
|
|
|
+ errora({ success: true, msg: res.msg });
|
|
|
+ }else{
|
|
|
+
|
|
|
+ layx.confirm('错误提示',res.msg,null,{
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ label:'确定',
|
|
|
+ callback:function(id, button, event){
|
|
|
+ download_excel(res.error);
|
|
|
+ layx.destroy(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],dialogIcon:'warn',shadable:0.6
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
},'json');
|
|
|
|
|
|
}
|
|
|
+ function download_excel(data){
|
|
|
+ let sheet = XLSX.utils.json_to_sheet(data)
|
|
|
+
|
|
|
+
|
|
|
+ sheet['!cols'] = [
|
|
|
+ //订单号
|
|
|
+ {
|
|
|
+ wch:60,
|
|
|
+ },
|
|
|
+ //订单编码
|
|
|
+ {
|
|
|
+ wch:120,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ let workbook = XLSX.utils.book_new();
|
|
|
|
|
|
+ XLSX.utils.book_append_sheet(workbook, sheet, "Sheet1");
|
|
|
+ XLSX.writeFile(workbook, "错误数据.xlsx");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
</script>
|