@longhongguo/form-create-ant-design-vue 3.2.80 → 3.2.82

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": "@longhongguo/form-create-ant-design-vue",
3
- "version": "3.2.80",
3
+ "version": "3.2.82",
4
4
  "description": "AntDesignVue版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
5
5
  "main": "./dist/form-create.min.js",
6
6
  "module": "./dist/form-create.esm.js",
package/src/core/alias.js CHANGED
@@ -39,5 +39,7 @@ export default {
39
39
  subForm: 'fcSubForm',
40
40
  object: 'fcSubForm',
41
41
  image: PRE + 'Image',
42
- aImage: PRE + 'Image'
42
+ aImage: PRE + 'Image',
43
+ accTable: PRE + 'Table',
44
+ accTableTable: PRE + 'Table'
43
45
  }
package/src/core/api.js CHANGED
@@ -209,7 +209,10 @@ export default function extendApi(api, h) {
209
209
  // 使用 api.fetch 方法,它内部使用 frame/fetch.js 封装的 asyncFetch
210
210
  return api.fetch(config)
211
211
  },
212
- getStorInfo(storeId) {
212
+ getStoreInfo(storeId) {
213
+ if (!storeId) {
214
+ return Promise.resolve(null)
215
+ }
213
216
  let config = {
214
217
  action: `${MERCHANT_URL}/storeInfo/page`,
215
218
  method: 'post',
@@ -226,7 +229,11 @@ export default function extendApi(api, h) {
226
229
  api
227
230
  .fetch(config)
228
231
  .then((res) => {
229
- resolve(res?.data?.records?.[0] || null)
232
+ if (res?.code === 0) {
233
+ resolve(res?.data?.records?.[0] || null)
234
+ } else {
235
+ resolve(null)
236
+ }
230
237
  })
231
238
  .catch((err) => {
232
239
  reject(err)
@@ -0,0 +1,105 @@
1
+ import { hasProperty } from '@form-create/utils/lib/type'
2
+
3
+ export default {
4
+ name: 'accTable',
5
+ mergeProp(ctx) {
6
+ const props = ctx.prop.props || {}
7
+ const rule = ctx.rule
8
+
9
+ // 初始化列配置
10
+ if (!hasProperty(props, 'columns')) {
11
+ let columns = rule.props?.columns || []
12
+ // 如果 columns 是字符串,尝试解析为 JSON
13
+ if (typeof columns === 'string') {
14
+ try {
15
+ const parsed = JSON.parse(columns)
16
+ if (Array.isArray(parsed)) {
17
+ columns = parsed
18
+ }
19
+ } catch (e) {
20
+ console.warn('accTable columns parse error:', e)
21
+ columns = []
22
+ }
23
+ }
24
+ props.columns = columns
25
+ }
26
+
27
+ // 初始化数据源
28
+ if (!hasProperty(props, 'dataSource')) {
29
+ let dataSource = rule.value || rule.props?.dataSource || []
30
+ // 如果 dataSource 是字符串,尝试解析为 JSON(仅静态数据模式)
31
+ if (typeof dataSource === 'string' && !rule.effect?.fetch) {
32
+ try {
33
+ const parsed = JSON.parse(dataSource)
34
+ if (Array.isArray(parsed)) {
35
+ dataSource = parsed
36
+ }
37
+ } catch (e) {
38
+ console.warn('accTable dataSource parse error:', e)
39
+ dataSource = []
40
+ }
41
+ }
42
+ props.dataSource = dataSource
43
+ }
44
+
45
+ // 检测 loading 状态:从 effectData('fetch') 中获取 loading 状态
46
+ const fetchData = ctx.effectData('fetch')
47
+ const isLoading = fetchData && fetchData.loading === true
48
+
49
+ // 设置 loading 状态
50
+ if (hasProperty(props, 'loading')) {
51
+ props.loading =
52
+ rule.props?.loading !== undefined ? rule.props.loading : isLoading
53
+ } else {
54
+ props.loading = isLoading
55
+ }
56
+
57
+ // 处理分页配置
58
+ if (!hasProperty(props, 'pagination')) {
59
+ const paginationConfig = rule.props?.pagination
60
+ if (paginationConfig === false) {
61
+ props.pagination = false
62
+ } else if (paginationConfig && typeof paginationConfig === 'object') {
63
+ props.pagination = {
64
+ current: paginationConfig.current || 1,
65
+ pageSize: paginationConfig.pageSize || 10,
66
+ total: paginationConfig.total || 0,
67
+ showSizeChanger: paginationConfig.showSizeChanger !== false,
68
+ showQuickJumper: paginationConfig.showQuickJumper || false,
69
+ showTotal: paginationConfig.showTotal,
70
+ ...paginationConfig
71
+ }
72
+ } else {
73
+ // 默认不启用分页
74
+ props.pagination = false
75
+ }
76
+ }
77
+
78
+ // 设置其他常用配置
79
+ if (hasProperty(rule.props, 'bordered')) {
80
+ props.bordered = rule.props.bordered
81
+ }
82
+ if (hasProperty(rule.props, 'size')) {
83
+ props.size = rule.props.size
84
+ }
85
+ if (hasProperty(rule.props, 'scroll')) {
86
+ props.scroll = rule.props.scroll
87
+ }
88
+ if (hasProperty(rule.props, 'rowKey')) {
89
+ props.rowKey = rule.props.rowKey || 'id'
90
+ }
91
+ if (hasProperty(rule.props, 'rowSelection')) {
92
+ props.rowSelection = rule.props.rowSelection
93
+ }
94
+ if (hasProperty(rule.props, 'sticky')) {
95
+ props.sticky = rule.props.sticky
96
+ }
97
+ if (hasProperty(rule.props, 'virtual')) {
98
+ props.virtual = rule.props.virtual
99
+ }
100
+ },
101
+ render(children, ctx) {
102
+ // 使用默认渲染
103
+ return ctx.$render.defaultRender(ctx, children)
104
+ }
105
+ }
@@ -17,6 +17,7 @@ import flex from './flex'
17
17
  import space from './space'
18
18
  import spin from './spin'
19
19
  import div from './div'
20
+ import accTable from './accTable'
20
21
 
21
22
  export default [
22
23
  checkbox,
@@ -37,5 +38,6 @@ export default [
37
38
  flex,
38
39
  space,
39
40
  spin,
40
- div
41
+ div,
42
+ accTable
41
43
  ]