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) {
url: '/order/list',
method: 'get',
params: query,
paramsSerializer: function(params) {
return Qs.stringify(params, { arrayFormat: 'repeat' })
paramsSerializer: {
serialize: (params) => Qs.stringify(params, { arrayFormat: 'repeat' })
}
})
}
......
/* eslint-disable */
import { saveAs } from 'file-saver'
import XLSX from 'xlsx'
import { utils, SSF, write } from 'xlsx'
function generateArray(table) {
var out = [];
......@@ -18,7 +18,7 @@ function generateArray(table) {
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//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) {
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) {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
var cell_ref = utils.encode_cell({
c: C,
r: R
});
......@@ -89,14 +89,14 @@ function sheet_from_array_of_arrays(data, opts) {
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.z = SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
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;
}
......@@ -133,7 +133,7 @@ export function export_table_to_excel(id) {
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
var wbout = write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
......@@ -169,7 +169,7 @@ export function export_json_to_excel({
if (merges.length > 0) {
if (!ws['!merges']) ws['!merges'] = [];
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({
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
var wbout = write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
......@@ -227,5 +227,5 @@ function formatJson(jsonSource, jsonFillter) {
export function export_json_to_excel2(th, jsonSource, jsonFillter, name) {
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