/* * @Author: 疯狂秀才(Lucas Huang) * @Date: 2019-04-08 16:51:39 * @LastEditors: 疯狂秀才(Lucas Huang) * @LastEditTime: 2019-10-17 13:44:33 * @QQ: 1055818239 * @Version: v0.0.1 */ import { cloneDeep } from 'lodash-es'; /** * 转换列的顺序 * @param columns-所有列数据 * @param direction-left|right 左固定或者右固定 */ export const convertColumns = (columns, direction) => { const tempFixedColumns = []; const tempNotFixedColumns = []; columns.forEach(ele => { if (ele.fixed && (ele.fixed === direction || ele.fixed.type === direction)) { tempFixedColumns.push(ele); } else { tempNotFixedColumns.push(ele); } }); return tempFixedColumns.concat(tempNotFixedColumns); }; /** * 对象或者数组深拷贝 * @param data 源数据 */ export const deepCopy = (data) => { return cloneDeep(data); }; export const toUpper = (source: string) => { const jsonObj = JSON.parse(source.replace(/\\/g, '')); return this.deepCopy(jsonObj); };