@yorha2b-lab/autodev 1.0.33 → 1.0.34
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/package.json
CHANGED
|
@@ -59,6 +59,10 @@ const watchApi = () => {
|
|
|
59
59
|
`🤖 Pod 153: [警告] 骇入 [${fileName}] 失败。接口数据遭遇强力防火墙:${error}`,
|
|
60
60
|
`🤖 Pod 153: [Warning] Hacking into [${fileName}] failed. Encountered a powerful firewall in API data: ${error}`
|
|
61
61
|
)))
|
|
62
|
+
} finally {
|
|
63
|
+
if (fs.existsSync(filePath)) {
|
|
64
|
+
fs.unlinkSync(filePath)
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
})
|
|
64
68
|
}
|
|
@@ -122,6 +122,9 @@ const watchPage = options => {
|
|
|
122
122
|
`🤖 Pod 042: [报告] 模块 [${fileName}] 物理装配完成!耗时 ${(endTime - startTime) / 1000} 秒`,
|
|
123
123
|
`🤖 Pod 042: [Report] Module [${fileName}] assembly complete! Elapsed time: ${(endTime - startTime) / 1000}s`
|
|
124
124
|
)))
|
|
125
|
+
if (fs.existsSync(filePath)) {
|
|
126
|
+
fs.unlinkSync(filePath)
|
|
127
|
+
}
|
|
125
128
|
} catch (error) {
|
|
126
129
|
spinner.fail(chalk.red(language(
|
|
127
130
|
`🤖 Pod 042: [警告] 模块 [${fileName}] 构筑失败。原因:${error}`,
|
|
@@ -21,8 +21,9 @@ export const useTableQuery = (api, formatResponse, initialParams = {}) => {
|
|
|
21
21
|
try {
|
|
22
22
|
const response = await apiRef.current(search)
|
|
23
23
|
if (currentFetchId !== fetchIdRef.current) return
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const { data, total } = formatResponse(response ?? {})
|
|
25
|
+
setDataSource(data)
|
|
26
|
+
setTotal(total ?? 0)
|
|
26
27
|
} catch (error) {
|
|
27
28
|
console.error('查询失败', error)
|
|
28
29
|
} finally {
|
|
@@ -18,7 +18,7 @@ export default props => {
|
|
|
18
18
|
|
|
19
19
|
const { total, loading, dataSource, search, setSearch, refresh } = useTableQuery(
|
|
20
20
|
async params => await request('/api/{{fileName}}', { method: 'POST', body: params }),
|
|
21
|
-
response => response?.data ?? [],
|
|
21
|
+
response => ({ data: response?.data ?? [], total: response?.total ?? 0 }),
|
|
22
22
|
{...initParams, ...query},
|
|
23
23
|
)
|
|
24
24
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import dayjs from 'dayjs'
|
|
2
2
|
import { request } from './request'
|
|
3
3
|
|
|
4
|
+
//常用工具函数,使用前确保已安装对应模块
|
|
5
|
+
|
|
4
6
|
export const initOSS = async (url, options) => {
|
|
5
|
-
const OSS = require('ali-oss')
|
|
7
|
+
/* const OSS = require('ali-oss')
|
|
6
8
|
const crypto = require('crypto-js')
|
|
7
9
|
const response = await request(url, options)
|
|
8
10
|
const { bucket, endpoint, stsToken, expiration, accessKeyId, accessKeySecret } = response?.data || {}
|
|
@@ -14,7 +16,7 @@ export const initOSS = async (url, options) => {
|
|
|
14
16
|
],
|
|
15
17
|
}))
|
|
16
18
|
const signature = crypto.enc.Base64.stringify(crypto.HmacSHA1(policy, accessKeySecret))
|
|
17
|
-
return { client, policy, signature, ...response?.data }
|
|
19
|
+
return { client, policy, signature, ...response?.data } */
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export const formatQuery = (params, formItems) => {
|
|
@@ -54,7 +56,7 @@ export const moneyRender = (value, { decimals = 2, showSymbol = true } = {}) =>
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export const exportDataToExcel = async (url, options, columns, fileName, resultKey = 'data') => {
|
|
57
|
-
const response = await request(url, options)
|
|
59
|
+
/* const response = await request(url, options)
|
|
58
60
|
if (response?.[resultKey]?.length > 0) {
|
|
59
61
|
const XLSX = require('xlsx')
|
|
60
62
|
const datas = response?.[resultKey]?.map(item => Object.fromEntries(columns.map(col => {
|
|
@@ -74,7 +76,7 @@ export const exportDataToExcel = async (url, options, columns, fileName, resultK
|
|
|
74
76
|
worksheet['!cols'] = Array.from(new Array(header.length)).fill({ wpx: 120 })
|
|
75
77
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
|
|
76
78
|
XLSX.writeFile(workbook, `${fileName}.xlsx`)
|
|
77
|
-
}
|
|
79
|
+
} */
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
export const formatUnit = (value, { k = 1024, units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'], decimals = 2 } = {}) => {
|