Unverified Commit ce310d9c authored by zwsznb's avatar zwsznb Committed by GitHub
Browse files

fix: 管理后台订单列表请求失败 (#532)



* fix: 管理后台订单列表请求失败

* fix: 管理后台xlsx导出

---------
Co-authored-by: default avatarlinlinjava <linlinjavaer@gmail.com>
parent 60afecfd
...@@ -6,8 +6,8 @@ export function listOrder(query) { ...@@ -6,8 +6,8 @@ export function listOrder(query) {
url: '/order/list', url: '/order/list',
method: 'get', method: 'get',
params: query, params: query,
paramsSerializer: function(params) { paramsSerializer: {
return Qs.stringify(params, { arrayFormat: 'repeat' }) serialize: (params) => Qs.stringify(params, { arrayFormat: 'repeat' })
} }
}) })
} }
......
/* eslint-disable */ /* eslint-disable */
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import XLSX from 'xlsx' import { utils, SSF, write } from 'xlsx'
function generateArray(table) { function generateArray(table) {
var out = []; var out = [];
...@@ -18,7 +18,7 @@ function generateArray(table) { ...@@ -18,7 +18,7 @@ function generateArray(table) {
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue; if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges //Skip ranges
ranges.forEach(function (range) { ranges.forEach(function(range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) { if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null); for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
} }
...@@ -80,7 +80,7 @@ function sheet_from_array_of_arrays(data, opts) { ...@@ -80,7 +80,7 @@ function sheet_from_array_of_arrays(data, opts) {
v: data[R][C] v: data[R][C]
}; };
if (cell.v == null) continue; if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({ var cell_ref = utils.encode_cell({
c: C, c: C,
r: R r: R
}); });
...@@ -89,14 +89,14 @@ function sheet_from_array_of_arrays(data, opts) { ...@@ -89,14 +89,14 @@ function sheet_from_array_of_arrays(data, opts) {
else if (typeof cell.v === 'boolean') cell.t = 'b'; else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) { else if (cell.v instanceof Date) {
cell.t = 'n'; cell.t = 'n';
cell.z = XLSX.SSF._table[14]; cell.z = SSF._table[14];
cell.v = datenum(cell.v); cell.v = datenum(cell.v);
} else cell.t = 's'; } else cell.t = 's';
ws[cell_ref] = cell; ws[cell_ref] = cell;
} }
} }
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); if (range.s.c < 10000000) ws['!ref'] = utils.encode_range(range);
return ws; return ws;
} }
...@@ -133,7 +133,7 @@ export function export_table_to_excel(id) { ...@@ -133,7 +133,7 @@ export function export_table_to_excel(id) {
wb.SheetNames.push(ws_name); wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws; wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, { var wbout = write(wb, {
bookType: 'xlsx', bookType: 'xlsx',
bookSST: false, bookSST: false,
type: 'binary' type: 'binary'
...@@ -169,7 +169,7 @@ export function export_json_to_excel({ ...@@ -169,7 +169,7 @@ export function export_json_to_excel({
if (merges.length > 0) { if (merges.length > 0) {
if (!ws['!merges']) ws['!merges'] = []; if (!ws['!merges']) ws['!merges'] = [];
merges.forEach(item => { merges.forEach(item => {
ws['!merges'].push(XLSX.utils.decode_range(item)) ws['!merges'].push(utils.decode_range(item))
}) })
} }
...@@ -209,7 +209,7 @@ export function export_json_to_excel({ ...@@ -209,7 +209,7 @@ export function export_json_to_excel({
wb.SheetNames.push(ws_name); wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws; wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, { var wbout = write(wb, {
bookType: bookType, bookType: bookType,
bookSST: false, bookSST: false,
type: 'binary' type: 'binary'
...@@ -227,5 +227,5 @@ function formatJson(jsonSource, jsonFillter) { ...@@ -227,5 +227,5 @@ function formatJson(jsonSource, jsonFillter) {
export function export_json_to_excel2(th, jsonSource, jsonFillter, name) { export function export_json_to_excel2(th, jsonSource, jsonFillter, name) {
const data = formatJson(jsonSource, jsonFillter) const data = formatJson(jsonSource, jsonFillter)
export_json_to_excel({header: th, data, filename: name}) export_json_to_excel({ header: th, data, filename: name })
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment