@indfnd/utils 0.1.35 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/ind-utils.es.js +19905 -1465
- package/dist/ind-utils.umd.cjs +82 -22
- package/package.json +1 -1
- package/src/api/com.ts +5 -2
- package/src/api/item.ts +9 -4
- package/src/api/platform/oss.ts +78 -77
- package/src/utils/excel.js +157 -0
- package/types/api/com.d.ts +2 -2
- package/types/api/com.d.ts.map +1 -1
- package/types/api/index-desc.d.ts +2 -2
- package/types/api/index.d.ts +7 -7
- package/types/api/item.d.ts +4 -4
- package/types/api/item.d.ts.map +1 -1
- package/types/api/permission.d.ts +2 -2
- package/types/api/platform/base64.d.ts +5 -5
- package/types/api/platform/config.d.ts +2 -2
- package/types/api/platform/dict.d.ts +4 -4
- package/types/api/platform/index.d.ts +6 -6
- package/types/api/platform/menu.d.ts +17 -11
- package/types/api/platform/oss.d.ts +16 -8
- package/types/api/platform/oss.d.ts.map +1 -1
- package/types/api/platform/user.d.ts +17 -12
- package/types/api/user.d.ts +2 -2
- package/types/config/base.config.d.ts +33 -33
- package/types/config/dev.config.d.ts +3 -3
- package/types/config/index.d.ts +6 -6
- package/types/config/prod.config.d.ts +3 -3
- package/types/index.d.ts +4 -4
- package/types/utils/base64.d.ts +22 -22
- package/types/utils/blob.d.ts +3 -3
- package/types/utils/cache/dict-cache.d.ts +3 -3
- package/types/utils/cache/index-desc.d.ts +4 -4
- package/types/utils/cache/index.d.ts +4 -4
- package/types/utils/cache/permission-cache.d.ts +4 -4
- package/types/utils/cache/user-cache.d.ts +4 -4
- package/types/utils/date.d.ts +4 -4
- package/types/utils/enum.d.ts +43 -39
- package/types/utils/event.d.ts +13 -5
- package/types/utils/excel.d.ts +5 -4
- package/types/utils/excel.d.ts.map +1 -1
- package/types/utils/half-year.d.ts +6 -6
- package/types/utils/index.d.ts +20 -20
- package/types/utils/is-type.d.ts +33 -33
- package/types/utils/mime-type.d.ts +67 -67
- package/types/utils/number.d.ts +8 -8
- package/types/utils/quarter.d.ts +7 -7
- package/types/utils/request/axios.extends.d.ts +18 -6
- package/types/utils/request/cache-rules.d.ts +3 -3
- package/types/utils/request/content-type.d.ts +9 -9
- package/types/utils/request/index.d.ts +16 -13
- package/types/utils/request/interceptors.d.ts +4 -4
- package/types/utils/request/url-params.d.ts +6 -6
- package/types/utils/sm3/index.d.ts +6 -6
- package/types/utils/sm3/sm3.d.ts +3 -3
- package/types/utils/storage.d.ts +8 -8
- package/types/utils/table.d.ts +40 -31
- package/types/utils/token.d.ts +3 -3
- package/types/utils/uuid.d.ts +4 -4
- package/types/utils/validate.d.ts +5 -5
package/package.json
CHANGED
package/src/api/com.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { axios } from '@/utils'
|
|
2
2
|
import { config } from '@/config'
|
|
3
|
-
|
|
3
|
+
const isHb = location.pathname.includes('scyxweb')
|
|
4
4
|
const CONTEXT = config.ismAmServerContext
|
|
5
5
|
|
|
6
6
|
export function listComTreeApi(params) {
|
|
7
7
|
if (config.useDddComItemTree) {
|
|
8
|
-
return axios.get(
|
|
8
|
+
return axios.get(
|
|
9
|
+
`${isHb ? '/scyxgateway' : ''}${config.ucExtServerContext}/manage/tree/getBusiComTree`,
|
|
10
|
+
{ params },
|
|
11
|
+
)
|
|
9
12
|
}
|
|
10
13
|
return axios.get(`${CONTEXT}/tree/com/listComTree`, { params })
|
|
11
14
|
}
|
package/src/api/item.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { axios } from '@/utils'
|
|
2
2
|
import { config } from '@/config'
|
|
3
|
-
|
|
3
|
+
const isHb = location.pathname.includes('scyxweb')
|
|
4
4
|
const CONTEXT = config.ismAmServerContext
|
|
5
5
|
|
|
6
6
|
export function listItemTreeApi(params) {
|
|
7
7
|
if (config.useDddComItemTree) {
|
|
8
|
-
return axios.get(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return axios.get(
|
|
9
|
+
`${isHb ? '/scyxgateway' : ''}${
|
|
10
|
+
config.ucExtServerContext
|
|
11
|
+
}/manage/tree/getProductInfoAsTreeData`,
|
|
12
|
+
{
|
|
13
|
+
params,
|
|
14
|
+
},
|
|
15
|
+
)
|
|
11
16
|
}
|
|
12
17
|
return axios.get(`${CONTEXT}/tree/item/listItemTree`, { params })
|
|
13
18
|
}
|
package/src/api/platform/oss.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CONTENT_TYPE, axios, getToken, MIME_TYPE } from '@/utils'
|
|
|
2
2
|
import { config } from '@/config'
|
|
3
3
|
import { AxiosRequestConfig, ResponseType } from 'axios'
|
|
4
4
|
|
|
5
|
+
const isHb = location.pathname.includes('scyxweb')
|
|
5
6
|
const CONTEXT = config.ossServerContext
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -11,7 +12,7 @@ const CONTEXT = config.ossServerContext
|
|
|
11
12
|
* @returns url
|
|
12
13
|
*/
|
|
13
14
|
export function getOssFileUrl(fileId = '') {
|
|
14
|
-
return `${CONTEXT}/oss/file/get/${fileId}`
|
|
15
|
+
return `${isHb ? '/scyxgateway/ind-uc-ext-server' : CONTEXT}/oss/file/get/${fileId}`
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -20,7 +21,7 @@ export function getOssFileUrl(fileId = '') {
|
|
|
20
21
|
* @returns url
|
|
21
22
|
*/
|
|
22
23
|
export function putOssFileUrl() {
|
|
23
|
-
return `${CONTEXT}/oss/file/put`
|
|
24
|
+
return `${isHb ? '/scyxgateway/ind-uc-ext-server' : CONTEXT}/oss/file/put`
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -146,63 +147,63 @@ export async function downLoadScDcApi(fileId: string, fileName: string) {
|
|
|
146
147
|
* @returns {string|null} 解析出的文件名
|
|
147
148
|
*/
|
|
148
149
|
function parseContentDisposition(contentDisposition) {
|
|
149
|
-
if (!contentDisposition) return null
|
|
150
|
-
|
|
151
|
-
console.log('原始 Content-Disposition:', contentDisposition)
|
|
152
|
-
|
|
150
|
+
if (!contentDisposition) return null
|
|
151
|
+
|
|
152
|
+
console.log('原始 Content-Disposition:', contentDisposition) // 调试用
|
|
153
|
+
|
|
153
154
|
// 1. 首先尝试解析 filename* (RFC 5987 格式)
|
|
154
155
|
// 格式: filename*=UTF-8''encoded-filename
|
|
155
|
-
const utf8FilenameMatch = contentDisposition.match(/filename\*=(?:UTF-8''|UTF-8\s*'')([^;]+)/i)
|
|
156
|
-
|
|
156
|
+
const utf8FilenameMatch = contentDisposition.match(/filename\*=(?:UTF-8''|UTF-8\s*'')([^;]+)/i)
|
|
157
|
+
|
|
157
158
|
if (utf8FilenameMatch && utf8FilenameMatch[1]) {
|
|
158
159
|
try {
|
|
159
160
|
// 解码 RFC 5987 编码的文件名
|
|
160
|
-
const decoded = decodeURIComponent(utf8FilenameMatch[1].trim())
|
|
161
|
-
console.log('解析 RFC 5987 文件名:', decoded)
|
|
162
|
-
return decoded
|
|
161
|
+
const decoded = decodeURIComponent(utf8FilenameMatch[1].trim())
|
|
162
|
+
console.log('解析 RFC 5987 文件名:', decoded)
|
|
163
|
+
return decoded
|
|
163
164
|
} catch (e) {
|
|
164
|
-
console.warn('RFC 5987 解码失败:', e)
|
|
165
|
+
console.warn('RFC 5987 解码失败:', e)
|
|
165
166
|
// 继续尝试其他格式
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
|
|
169
170
|
// 2. 尝试解析 filename* 的其他编码格式
|
|
170
|
-
const filenameStarMatch = contentDisposition.match(/filename\*=([^;]+)/i)
|
|
171
|
+
const filenameStarMatch = contentDisposition.match(/filename\*=([^;]+)/i)
|
|
171
172
|
if (filenameStarMatch && filenameStarMatch[1]) {
|
|
172
|
-
const encoded = filenameStarMatch[1].trim()
|
|
173
|
-
|
|
173
|
+
const encoded = filenameStarMatch[1].trim()
|
|
174
|
+
|
|
174
175
|
// 检查是否包含编码信息(如 ISO-8859-1, UTF-8 等)
|
|
175
176
|
if (encoded.includes("''")) {
|
|
176
|
-
const parts = encoded.split("''")
|
|
177
|
+
const parts = encoded.split("''")
|
|
177
178
|
if (parts.length === 2) {
|
|
178
179
|
try {
|
|
179
|
-
const decoded = decodeURIComponent(parts[1])
|
|
180
|
-
console.log('解析 filename* 文件名:', decoded)
|
|
181
|
-
return decoded
|
|
180
|
+
const decoded = decodeURIComponent(parts[1])
|
|
181
|
+
console.log('解析 filename* 文件名:', decoded)
|
|
182
|
+
return decoded
|
|
182
183
|
} catch (e) {
|
|
183
|
-
console.warn('filename* 解码失败:', e)
|
|
184
|
+
console.warn('filename* 解码失败:', e)
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
|
|
189
190
|
// 3. 尝试解析普通的 filename(引号内的)
|
|
190
|
-
const quotedFilenameMatch = contentDisposition.match(/filename="([^"]+)"/i)
|
|
191
|
+
const quotedFilenameMatch = contentDisposition.match(/filename="([^"]+)"/i)
|
|
191
192
|
if (quotedFilenameMatch && quotedFilenameMatch[1]) {
|
|
192
|
-
console.log('解析引号内文件名:', quotedFilenameMatch[1])
|
|
193
|
-
return quotedFilenameMatch[1]
|
|
193
|
+
console.log('解析引号内文件名:', quotedFilenameMatch[1])
|
|
194
|
+
return quotedFilenameMatch[1]
|
|
194
195
|
}
|
|
195
|
-
|
|
196
|
+
|
|
196
197
|
// 4. 尝试解析不带引号的 filename
|
|
197
|
-
const unquotedFilenameMatch = contentDisposition.match(/filename=([^;]+)/i)
|
|
198
|
+
const unquotedFilenameMatch = contentDisposition.match(/filename=([^;]+)/i)
|
|
198
199
|
if (unquotedFilenameMatch && unquotedFilenameMatch[1]) {
|
|
199
|
-
const filename = unquotedFilenameMatch[1].trim()
|
|
200
|
-
console.log('解析无引号文件名:', filename)
|
|
201
|
-
return filename
|
|
200
|
+
const filename = unquotedFilenameMatch[1].trim()
|
|
201
|
+
console.log('解析无引号文件名:', filename)
|
|
202
|
+
return filename
|
|
202
203
|
}
|
|
203
|
-
|
|
204
|
-
console.log('未找到有效的文件名')
|
|
205
|
-
return null
|
|
204
|
+
|
|
205
|
+
console.log('未找到有效的文件名')
|
|
206
|
+
return null
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
/**
|
|
@@ -211,40 +212,40 @@ function parseContentDisposition(contentDisposition) {
|
|
|
211
212
|
* @returns {Promise<string>} 文件名
|
|
212
213
|
*/
|
|
213
214
|
function getFilenameFromResponse(response) {
|
|
214
|
-
const contentDisposition = response.headers.get('Content-Disposition')
|
|
215
|
-
console.log('Content-Disposition 头:', contentDisposition)
|
|
216
|
-
|
|
217
|
-
let filename = null
|
|
218
|
-
|
|
215
|
+
const contentDisposition = response.headers.get('Content-Disposition')
|
|
216
|
+
console.log('Content-Disposition 头:', contentDisposition)
|
|
217
|
+
|
|
218
|
+
let filename = null
|
|
219
|
+
|
|
219
220
|
if (contentDisposition) {
|
|
220
|
-
filename = parseContentDisposition(contentDisposition)
|
|
221
|
-
console.log('解析到的文件名:', filename)
|
|
221
|
+
filename = parseContentDisposition(contentDisposition)
|
|
222
|
+
console.log('解析到的文件名:', filename)
|
|
222
223
|
}
|
|
223
|
-
|
|
224
|
+
|
|
224
225
|
// 如果从 Content-Disposition 中没获取到,从 URL 获取
|
|
225
226
|
if (!filename && response.url) {
|
|
226
|
-
filename = extractFilenameFromUrl(response.url)
|
|
227
|
-
console.log('从 URL 提取的文件名:', filename)
|
|
227
|
+
filename = extractFilenameFromUrl(response.url)
|
|
228
|
+
console.log('从 URL 提取的文件名:', filename)
|
|
228
229
|
}
|
|
229
|
-
|
|
230
|
+
|
|
230
231
|
// 如果还是没有,使用默认文件名
|
|
231
232
|
if (!filename) {
|
|
232
|
-
filename = 'download'
|
|
233
|
-
console.log('使用默认文件名:', filename)
|
|
233
|
+
filename = 'download'
|
|
234
|
+
console.log('使用默认文件名:', filename)
|
|
234
235
|
}
|
|
235
|
-
|
|
236
|
+
|
|
236
237
|
// 确保文件名有扩展名
|
|
237
|
-
filename = ensureFileExtension(filename, response.headers.get('Content-Type'))
|
|
238
|
-
|
|
239
|
-
return filename
|
|
238
|
+
filename = ensureFileExtension(filename, response.headers.get('Content-Type'))
|
|
239
|
+
|
|
240
|
+
return filename
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
/**
|
|
243
244
|
* 根据内容类型获取文件扩展名
|
|
244
245
|
*/
|
|
245
246
|
function getExtensionFromContentType(contentType) {
|
|
246
|
-
if (!contentType) return ''
|
|
247
|
-
|
|
247
|
+
if (!contentType) return ''
|
|
248
|
+
|
|
248
249
|
const contentTypeToExtension = {
|
|
249
250
|
// 图片
|
|
250
251
|
'image/jpeg': '.jpg',
|
|
@@ -254,7 +255,7 @@ function getExtensionFromContentType(contentType) {
|
|
|
254
255
|
'image/webp': '.webp',
|
|
255
256
|
'image/svg+xml': '.svg',
|
|
256
257
|
'image/bmp': '.bmp',
|
|
257
|
-
|
|
258
|
+
|
|
258
259
|
// 文档
|
|
259
260
|
'application/pdf': '.pdf',
|
|
260
261
|
'application/msword': '.doc',
|
|
@@ -263,7 +264,7 @@ function getExtensionFromContentType(contentType) {
|
|
|
263
264
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': '.xlsx',
|
|
264
265
|
'application/vnd.ms-powerpoint': '.ppt',
|
|
265
266
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation': '.pptx',
|
|
266
|
-
|
|
267
|
+
|
|
267
268
|
// 文本
|
|
268
269
|
'text/plain': '.txt',
|
|
269
270
|
'text/html': '.html',
|
|
@@ -272,20 +273,20 @@ function getExtensionFromContentType(contentType) {
|
|
|
272
273
|
'application/json': '.json',
|
|
273
274
|
'text/csv': '.csv',
|
|
274
275
|
'text/xml': '.xml',
|
|
275
|
-
|
|
276
|
+
|
|
276
277
|
// 压缩文件
|
|
277
278
|
'application/zip': '.zip',
|
|
278
279
|
'application/x-rar-compressed': '.rar',
|
|
279
280
|
'application/x-7z-compressed': '.7z',
|
|
280
281
|
'application/gzip': '.gz',
|
|
281
|
-
|
|
282
|
+
|
|
282
283
|
// 其他
|
|
283
284
|
'application/octet-stream': '.bin',
|
|
284
|
-
}
|
|
285
|
-
|
|
285
|
+
}
|
|
286
|
+
|
|
286
287
|
// 提取主类型(去除字符集等)
|
|
287
|
-
const mainType = contentType.split(';')[0].trim()
|
|
288
|
-
return contentTypeToExtension[mainType] || ''
|
|
288
|
+
const mainType = contentType.split(';')[0].trim()
|
|
289
|
+
return contentTypeToExtension[mainType] || ''
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
/**
|
|
@@ -294,16 +295,16 @@ function getExtensionFromContentType(contentType) {
|
|
|
294
295
|
function ensureFileExtension(filename, contentType) {
|
|
295
296
|
// 如果文件名已经有扩展名,直接返回
|
|
296
297
|
if (filename.includes('.')) {
|
|
297
|
-
return filename
|
|
298
|
+
return filename
|
|
298
299
|
}
|
|
299
|
-
|
|
300
|
+
|
|
300
301
|
// 根据 Content-Type 添加扩展名
|
|
301
|
-
const extension = getExtensionFromContentType(contentType)
|
|
302
|
+
const extension = getExtensionFromContentType(contentType)
|
|
302
303
|
if (extension) {
|
|
303
|
-
return filename + extension
|
|
304
|
+
return filename + extension
|
|
304
305
|
}
|
|
305
|
-
|
|
306
|
-
return filename
|
|
306
|
+
|
|
307
|
+
return filename
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
/**
|
|
@@ -311,18 +312,18 @@ function ensureFileExtension(filename, contentType) {
|
|
|
311
312
|
*/
|
|
312
313
|
function extractFilenameFromUrl(url) {
|
|
313
314
|
try {
|
|
314
|
-
const urlObj = new URL(url)
|
|
315
|
-
const pathname = urlObj.pathname
|
|
316
|
-
|
|
315
|
+
const urlObj = new URL(url)
|
|
316
|
+
const pathname = urlObj.pathname
|
|
317
|
+
|
|
317
318
|
// 获取路径的最后一部分
|
|
318
|
-
const lastSegment = pathname.split('/').pop()
|
|
319
|
-
|
|
319
|
+
const lastSegment = pathname.split('/').pop()
|
|
320
|
+
|
|
320
321
|
// 移除查询参数和哈希
|
|
321
|
-
const filename = lastSegment.split('?')[0].split('#')[0]
|
|
322
|
-
|
|
323
|
-
return filename || null
|
|
322
|
+
const filename = lastSegment.split('?')[0].split('#')[0]
|
|
323
|
+
|
|
324
|
+
return filename || null
|
|
324
325
|
} catch (e) {
|
|
325
|
-
console.warn('从 URL 提取文件名失败:', e)
|
|
326
|
-
return null
|
|
326
|
+
console.warn('从 URL 提取文件名失败:', e)
|
|
327
|
+
return null
|
|
327
328
|
}
|
|
328
|
-
}
|
|
329
|
+
}
|
package/src/utils/excel.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// const XlsxPopulate = require('xlsx-populate/browser/xlsx-populate')
|
|
4
4
|
import _ from 'lodash'
|
|
5
|
+
import { putOssFileApi } from '@indfnd/utils'
|
|
5
6
|
|
|
6
7
|
const titleStyle = {
|
|
7
8
|
// title style
|
|
@@ -645,3 +646,159 @@ export function getExcelColumnIdx(number) {
|
|
|
645
646
|
}
|
|
646
647
|
return rlt
|
|
647
648
|
}
|
|
649
|
+
|
|
650
|
+
export function previewJsonToExcel(excelData) {
|
|
651
|
+
return new Promise((resolve, reject) => {
|
|
652
|
+
var calcExportDatas = getAgColumnTitleAndData(excelData)
|
|
653
|
+
var fileId = ''
|
|
654
|
+
|
|
655
|
+
console.log('calcExportDatas', calcExportDatas)
|
|
656
|
+
|
|
657
|
+
var title = excelData.title
|
|
658
|
+
|
|
659
|
+
var titleDeepth = calcExportDatas.deepth
|
|
660
|
+
var columnAlign = excelData.columnAlign || calcExportDatas.columnAlign
|
|
661
|
+
var columnType = excelData.columnType || calcExportDatas.columnType
|
|
662
|
+
|
|
663
|
+
var columnTitle = calcExportDatas.columnTitle
|
|
664
|
+
|
|
665
|
+
var columnWidth = excelData.columnWidth || calcExportDatas.columnWidth
|
|
666
|
+
|
|
667
|
+
var columnCount = columnAlign.length
|
|
668
|
+
|
|
669
|
+
var paramLeft = excelData.paramLeft
|
|
670
|
+
|
|
671
|
+
var paramRight = excelData.paramRight
|
|
672
|
+
|
|
673
|
+
var jsonData = calcExportDatas.exportData
|
|
674
|
+
|
|
675
|
+
var numberFormat = excelData.numberFormat || calcExportDatas.numberFormat
|
|
676
|
+
|
|
677
|
+
XlsxPopulate.fromBlankAsync()
|
|
678
|
+
.then((workbook) => {
|
|
679
|
+
// Modify the workbook.
|
|
680
|
+
var sheet = workbook.sheet('Sheet1') // 初始化的时候不能传中文进去
|
|
681
|
+
// sheet.name(title)
|
|
682
|
+
// 设置列宽
|
|
683
|
+
for (var i = 0; i < columnCount; i++) {
|
|
684
|
+
sheet.column(i + 1).width(columnWidth[i] == 0 ? 10 : columnWidth[i])
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
var titleRange = sheet.range(1, 1, 1, columnCount)
|
|
688
|
+
titleRange.merged(true)
|
|
689
|
+
titleRange.style(titleStyle)
|
|
690
|
+
titleRange.cell(0, 0).value(title)
|
|
691
|
+
sheet.row(1).height(titleHeight)
|
|
692
|
+
|
|
693
|
+
var rowsNow = 2
|
|
694
|
+
|
|
695
|
+
if (!!excelData.paramLeft || !!excelData.paramRight) {
|
|
696
|
+
var paramLeftRange = sheet.range(2, 1, 2, Math.round(columnCount / 2))
|
|
697
|
+
paramLeftRange.cell(0, 0).value(paramLeft || '')
|
|
698
|
+
paramLeftRange.merged(true)
|
|
699
|
+
paramLeftRange.style(paramLeftStyle)
|
|
700
|
+
var paramRightRange = sheet.range(2, Math.round(columnCount / 2) + 1, 2, columnCount)
|
|
701
|
+
paramRightRange.cell(0, 0).value(paramRight || '')
|
|
702
|
+
paramRightRange.merged(true)
|
|
703
|
+
paramRightRange.style(paramRightStyle)
|
|
704
|
+
sheet.row(2).height(paramHeight)
|
|
705
|
+
rowsNow += 1
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
columnTitle.forEach((d) => {
|
|
709
|
+
var columnTitleRange = sheet.range(
|
|
710
|
+
d.srow + rowsNow - 1,
|
|
711
|
+
d.scol,
|
|
712
|
+
d.erow + rowsNow - 1,
|
|
713
|
+
d.ecol,
|
|
714
|
+
)
|
|
715
|
+
columnTitleRange.merged(true)
|
|
716
|
+
columnTitleRange.style(columnTitleStyle)
|
|
717
|
+
columnTitleRange.cell(0, 0).value(d.text?.replace(/<br\/>/g, ''))
|
|
718
|
+
})
|
|
719
|
+
for (let i = 0; i < titleDeepth; i++) {
|
|
720
|
+
sheet.row(rowsNow + i).height(columnTitleHeight)
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// 处理表格里的数据,挨家挨户搜一下
|
|
724
|
+
rowsNow += titleDeepth
|
|
725
|
+
|
|
726
|
+
for (var i = 0; i < jsonData.length; i++) {
|
|
727
|
+
var lineData = jsonData[i]
|
|
728
|
+
for (var j = 0; j < lineData.length; j++) {
|
|
729
|
+
if (columnType[j] === 'p' && lineData[j]) {
|
|
730
|
+
// 百分比,当前数值除以100来转换成百分比
|
|
731
|
+
sheet.cell(rowsNow + i, j + 1).value(parseFloat(lineData[j].value / 100))
|
|
732
|
+
dataCellStyle.numberFormat = numberFormat[j]
|
|
733
|
+
} else if (columnType[j] === 'n' && lineData[j]) {
|
|
734
|
+
// 数字保留精度
|
|
735
|
+
sheet.cell(rowsNow + i, j + 1).value(parseFloat(lineData[j].value))
|
|
736
|
+
dataCellStyle.numberFormat = numberFormat[j]
|
|
737
|
+
} else if (columnType[j] === 's' && lineData[j]) {
|
|
738
|
+
// 字符串
|
|
739
|
+
sheet.cell(rowsNow + i, j + 1).value(lineData[j].value)
|
|
740
|
+
dataCellStyle.numberFormat = ''
|
|
741
|
+
} else {
|
|
742
|
+
if (columnType[j] === 'p' || columnType[j] === 'n') {
|
|
743
|
+
// 解决导出excel空串无法计算
|
|
744
|
+
dataCellStyle.numberFormat = numberFormat[j]
|
|
745
|
+
} else {
|
|
746
|
+
// 预留一下,将来可能加别的样式
|
|
747
|
+
sheet.cell(rowsNow + i, j + 1).value('')
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
dataCellStyle.horizontalAlignment = columnAlign[j]
|
|
751
|
+
sheet.cell(rowsNow + i, j + 1).style(dataCellStyle)
|
|
752
|
+
}
|
|
753
|
+
if (excelData.rowColor && i % 2 != 0) {
|
|
754
|
+
var row = sheet.range(rowsNow + i, 1, rowsNow + i, columnCount)
|
|
755
|
+
row.style({ fill: 'f8f8f9' })
|
|
756
|
+
}
|
|
757
|
+
sheet.row(rowsNow + i).height(dataRowHeight)
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (!!excelData.rowSpanDefs) {
|
|
761
|
+
initRowSpanInfosNew({ ...excelData, columns: calcExportDatas.columnsCalc })
|
|
762
|
+
_.forEach(rowSpanExcelInfos, function (rowSpanInfo) {
|
|
763
|
+
var columnTitleRange = sheet.range(
|
|
764
|
+
rowSpanInfo.mergeRowS + rowsNow,
|
|
765
|
+
rowSpanInfo.megerColS + 1,
|
|
766
|
+
rowSpanInfo.mergeRowE + rowsNow,
|
|
767
|
+
rowSpanInfo.megerColE + 1,
|
|
768
|
+
)
|
|
769
|
+
columnTitleRange.merged(true)
|
|
770
|
+
})
|
|
771
|
+
} else if (!!excelData.rowSpanColumns) {
|
|
772
|
+
initRowSpanInfos({ ...excelData, columns: calcExportDatas.columnsCalc })
|
|
773
|
+
_.forEach(rowSpanExcelInfos, function (rowSpanInfo) {
|
|
774
|
+
var columnTitleRange = sheet.range(
|
|
775
|
+
rowSpanInfo.mergeRowS + rowsNow,
|
|
776
|
+
rowSpanInfo.megerColS + 1,
|
|
777
|
+
rowSpanInfo.mergeRowE + rowsNow,
|
|
778
|
+
rowSpanInfo.megerColE + 1,
|
|
779
|
+
)
|
|
780
|
+
columnTitleRange.merged(true)
|
|
781
|
+
})
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (excelData.leftColumns || excelData.topRows) {
|
|
785
|
+
sheet.freezePanes(excelData.leftColumns || 0, (excelData.topRows || 0) + rowsNow - 1)
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// Write to file.
|
|
789
|
+
workbook.outputAsync().then(async function (blob) {
|
|
790
|
+
const timestamp = new Date().getTime()
|
|
791
|
+
const filename = `${timestamp}.xlsx`
|
|
792
|
+
let { data } = await putOssFileApi(filename, blob)
|
|
793
|
+
// data = data.data // lambo-design多了一层,由于axios拦截器的原因
|
|
794
|
+
console.log('data is --111111', data)
|
|
795
|
+
fileId = data?.[0].fileId || ''
|
|
796
|
+
resolve(fileId)
|
|
797
|
+
})
|
|
798
|
+
})
|
|
799
|
+
.catch((err) => {
|
|
800
|
+
console.log(err)
|
|
801
|
+
reject(err)
|
|
802
|
+
})
|
|
803
|
+
})
|
|
804
|
+
}
|
package/types/api/com.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function listComTreeApi(params: any): Promise<import(
|
|
2
|
-
//# sourceMappingURL=com.d.ts.map
|
|
1
|
+
export declare function listComTreeApi(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
2
|
+
//# sourceMappingURL=com.d.ts.map
|
package/types/api/com.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"com.d.ts","sourceRoot":"","sources":["../../src/api/com.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,MAAM,KAAA,+
|
|
1
|
+
{"version":3,"file":"com.d.ts","sourceRoot":"","sources":["../../src/api/com.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,MAAM,KAAA,+CAQpC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function listIndexDescApi(params: any): Promise<import(
|
|
2
|
-
//# sourceMappingURL=index-desc.d.ts.map
|
|
1
|
+
export declare function listIndexDescApi(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
2
|
+
//# sourceMappingURL=index-desc.d.ts.map
|
package/types/api/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './platform'
|
|
2
|
-
export * from './com'
|
|
3
|
-
export * from './index-desc'
|
|
4
|
-
export * from './item'
|
|
5
|
-
export * from './permission'
|
|
6
|
-
export * from './user'
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './platform'
|
|
2
|
+
export * from './com'
|
|
3
|
+
export * from './index-desc'
|
|
4
|
+
export * from './item'
|
|
5
|
+
export * from './permission'
|
|
6
|
+
export * from './user'
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/types/api/item.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function listItemTreeApi(params: any): Promise<import(
|
|
2
|
-
export declare function getPriceInfo(): Promise<import(
|
|
3
|
-
export declare function getItem(params: any): Promise<import(
|
|
4
|
-
//# sourceMappingURL=item.d.ts.map
|
|
1
|
+
export declare function listItemTreeApi(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
2
|
+
export declare function getPriceInfo(): Promise<import('axios').AxiosResponse<any>>
|
|
3
|
+
export declare function getItem(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
4
|
+
//# sourceMappingURL=item.d.ts.map
|
package/types/api/item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/api/item.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,MAAM,KAAA,+
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../src/api/item.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,MAAM,KAAA,+CAYrC;AACD,wBAAgB,YAAY,gDAE3B;AACD,wBAAgB,OAAO,CAAC,MAAM,KAAA,+CAE7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getApplicationTreeApi(params: any): Promise<any
|
|
2
|
-
//# sourceMappingURL=permission.d.ts.map
|
|
1
|
+
export declare function getApplicationTreeApi(params: any): Promise<any>
|
|
2
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export namespace Base64 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
let Base64Chars: string
|
|
3
|
+
function encode(s: any): any
|
|
4
|
+
function ucs2_utf8(s: any): any[]
|
|
5
|
+
function utf8_ucs2(s: any): string
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=base64.d.ts.map
|
|
7
|
+
//# sourceMappingURL=base64.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getGlobalConfig(): Promise<any
|
|
2
|
-
//# sourceMappingURL=config.d.ts.map
|
|
1
|
+
export function getGlobalConfig(): Promise<any>
|
|
2
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getDictsMapApi(dictId: string): Promise<import(
|
|
2
|
-
export declare function getDictApi(dictId: string): Promise<any
|
|
3
|
-
export declare function getDictMapApi(dictIdArr: string[]): Promise<{}
|
|
4
|
-
//# sourceMappingURL=dict.d.ts.map
|
|
1
|
+
export declare function getDictsMapApi(dictId: string): Promise<import('axios').AxiosResponse<any>>
|
|
2
|
+
export declare function getDictApi(dictId: string): Promise<any>
|
|
3
|
+
export declare function getDictMapApi(dictIdArr: string[]): Promise<{}>
|
|
4
|
+
//# sourceMappingURL=dict.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './dict'
|
|
2
|
-
export * from './menu'
|
|
3
|
-
export * from './oss'
|
|
4
|
-
export * from './user'
|
|
5
|
-
export * from './config.js'
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './dict'
|
|
2
|
+
export * from './menu'
|
|
3
|
+
export * from './oss'
|
|
4
|
+
export * from './user'
|
|
5
|
+
export * from './config.js'
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
export declare function getPermissionApi(): Promise<import(
|
|
2
|
-
export declare function getMenuHistoryApi(): Promise<import(
|
|
3
|
-
export declare function menuHistoryApi(params: any): Promise<import(
|
|
4
|
-
export declare function deleteMenuHistoryApi(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export declare function getPermissionApi(): Promise<import('axios').AxiosResponse<any>>
|
|
2
|
+
export declare function getMenuHistoryApi(): Promise<import('axios').AxiosResponse<any>>
|
|
3
|
+
export declare function menuHistoryApi(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
4
|
+
export declare function deleteMenuHistoryApi(
|
|
5
|
+
historyId: any,
|
|
6
|
+
): Promise<import('axios').AxiosResponse<any>>
|
|
7
|
+
export declare function getMenuCollectApi(): Promise<import('axios').AxiosResponse<any>>
|
|
8
|
+
export declare function addMenuCollectApi(params: any): Promise<import('axios').AxiosResponse<any>>
|
|
9
|
+
export declare function deleteMenuCollectApi(
|
|
10
|
+
collectId: any,
|
|
11
|
+
): Promise<import('axios').AxiosResponse<any>>
|
|
12
|
+
export declare function removeMenuCollectApi(
|
|
13
|
+
params: any,
|
|
14
|
+
): Promise<import('axios').AxiosResponse<any>>
|
|
15
|
+
export declare function getAppListApi(): Promise<import('axios').AxiosResponse<any>>
|
|
16
|
+
export declare function getMaxTabNumValueApi(): Promise<import('axios').AxiosResponse<any>>
|
|
17
|
+
//# sourceMappingURL=menu.d.ts.map
|