@yorha2b-lab/autodev 1.0.32 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "基于视觉大模型的前端(Umi+Antd)全自动 CRUD 代码生成器",
5
5
  "bin": {
6
6
  "autodev": "bin/autodev.js"
@@ -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}`,
@@ -54,7 +54,7 @@ export const MyModalForm = ({ width, title, submit, record, visible, setModal, l
54
54
  }
55
55
 
56
56
  return (
57
- <Modal centered title={title} width={width} open={visible} onOk={handleOk} destroyOnHidden onCancel={handleCancel} confirmLoading={pending}>
57
+ <Modal centered title={title} width={width} open={visible} onOk={handleOk} destroyOnClose onCancel={handleCancel} confirmLoading={pending}>
58
58
  <Form form={form} preserve={false} labelCol={labelCol} wrapperCol={wrapperCol} onValuesChange={(changed, all) => onValuesChange?.({ changed, all, form, record })}>
59
59
  <Row gutter={[24, 0]}>
60
60
  {formItems.map((item, index) =>
@@ -20,7 +20,7 @@ export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns
20
20
  }
21
21
 
22
22
  return (
23
- <Modal centered destroyOnHidden title={title} width={width} open={visible} onOk={handleOk} footer={footer} onCancel={() => setModal({ visible: false })}>
23
+ <Modal centered destroyOnClose title={title} width={width} open={visible} onOk={handleOk} footer={footer} onCancel={() => setModal({ visible: false })}>
24
24
  {formItems?.length > 0 && <MySearchForm search={search} formItems={formItems} setSearch={handleSearch} syncUrlParams={false} />}
25
25
  <MyTable
26
26
  loading={loading}
@@ -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
- setDataSource(formatResponse(response))
25
- setTotal(response?.total || 0)
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 } = {}) => {