Commit f59bca27 authored by “lixuyan”'s avatar “lixuyan”

前端导入

parent b7c16042
......@@ -19,6 +19,7 @@ import _get from 'lodash.get'
import _set from 'lodash.set'
import router from '../router'
import { downFileByFileId } from '../api/file'
import { export_json_to_excel } from '@/Excel/Export2Excel'
// 限制promise并发数量
export function promiseLimit(func, funcParams, limit = 5) {
let i = 0
......@@ -1593,6 +1594,21 @@ export function getTargetJobResponses(item, responseName) {
}
}
function formatJson(filterVal, jsonData) {
return jsonData.map(row => filterVal.map(j => _get(row, j)))
}
export function export_excel(columns, tableData, title) {
const tHeader = []
const filterVal = []
columns.forEach(col => {
tHeader.push(col.title)
filterVal.push(col.key)
})
// tHeader.push('id')
// filterVal.push('id')
const data = formatJson(filterVal, tableData)
export_json_to_excel(tHeader, data, title)
}
export default {
treeFindBackArray,
throttle,
......@@ -1678,5 +1694,6 @@ export default {
findForm,
sumArray,
subNum,
getTargetJobResponses
getTargetJobResponses,
export_excel
}
Markdown is supported
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