提交 a5b400d0 authored 作者: 钟是志's avatar 钟是志

增加公共函数

上级 bfa4224f
...@@ -187,18 +187,12 @@ export function getColumns(columns) { ...@@ -187,18 +187,12 @@ export function getColumns(columns) {
return sum; return sum;
} }
let columnsHandle = getColumnsData(columns) let columnsHandle = getColumnsData(columns).filter((v, i) => {
.filter((v, i) => {
return (v.level < columnsHeight && v.isLast) || v.width > 1; return (v.level < columnsHeight && v.isLast) || v.width > 1;
}); });
let columnsMerges = []; let columnsMerges = [];
columnsHandle.forEach((v, i) => { columnsHandle.forEach((v, i) => {
let { let { isLast, width, col, level } = v;
isLast,
width,
col,
level
} = v;
let nowCol = col - 1; let nowCol = col - 1;
let nowLevel = level - 1; let nowLevel = level - 1;
if (isLast && width === 1) { if (isLast && width === 1) {
...@@ -234,12 +228,8 @@ export function getColumnsSqlKeyRealize({ ...@@ -234,12 +228,8 @@ export function getColumnsSqlKeyRealize({
styles, styles,
fileName = '导出文件', fileName = '导出文件',
ext = 'xlsx', ext = 'xlsx',
}) { }) {
let { let { columnsList, columnsMerges, columnsKey } = getColumns(columns);
columnsList,
columnsMerges,
columnsKey
} = getColumns(columns);
let content = { let content = {
sheets: [ sheets: [
{ {
...@@ -317,17 +307,9 @@ export function getColumnsDataRealize({ ...@@ -317,17 +307,9 @@ export function getColumnsDataRealize({
fileName = '导出文件', fileName = '导出文件',
ext = 'xlsx', ext = 'xlsx',
eliminateStr = [], eliminateStr = [],
}) { }) {
let { let { columnsList, columnsMerges, columnsKey, columnsHeight } = getColumns(columns);
columnsList, let { colSpanData, rowSpanData } = getSpanJson(mergeKey, data, eliminateStr);
columnsMerges,
columnsKey,
columnsHeight
} = getColumns(columns);
let {
colSpanData,
rowSpanData
} = getSpanJson(mergeKey, data, eliminateStr);
// 处理数据 // 处理数据
let bodyData = []; let bodyData = [];
const uj = { const uj = {
...@@ -435,8 +417,7 @@ export function getWord({ ...@@ -435,8 +417,7 @@ export function getWord({
allValues = {}, allValues = {},
listConfig = {}, listConfig = {},
ext = 'docx', ext = 'docx',
} }) {
) {
//可更新的 //可更新的
let getFileData = giveFilePostDataInfoForTrue( let getFileData = giveFilePostDataInfoForTrue(
{ {
...@@ -495,13 +476,12 @@ function makeArrayKey(key) { ...@@ -495,13 +476,12 @@ function makeArrayKey(key) {
function FormdataWrapper(obj, fd, pre) { function FormdataWrapper(obj, fd, pre) {
fd = fd || new FormData(); fd = fd || new FormData();
Object.keys(obj) Object.keys(obj).forEach(function(prop) {
.forEach(function (prop) {
var key = pre ? pre + '[' + prop + ']' : prop; var key = pre ? pre + '[' + prop + ']' : prop;
if (isObject(obj[prop]) && !isArray(obj[prop]) && !isFile(obj[prop])) { if (isObject(obj[prop]) && !isArray(obj[prop]) && !isFile(obj[prop])) {
FormdataWrapper(obj[prop], fd, key); FormdataWrapper(obj[prop], fd, key);
} else if (isArray(obj[prop])) { } else if (isArray(obj[prop])) {
obj[prop].forEach(function (value) { obj[prop].forEach(function(value) {
var arrayKey = makeArrayKey(key); var arrayKey = makeArrayKey(key);
if (isObject(value) && !isFile(value)) { if (isObject(value) && !isFile(value)) {
FormdataWrapper(value, fd, arrayKey); FormdataWrapper(value, fd, arrayKey);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论