af-mobile-client-vue3 1.0.75 → 1.0.76

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.
@@ -1,275 +1,275 @@
1
- # 移动端配置化表单/列表组件文档
2
-
3
- ## 组件概述
4
-
5
- 这是一个基于 Vue 3 + TypeScript + Vant 4 开发的移动端配置化查询列表组件系统,主要包含以下组件:
6
-
7
- - `XCellList`: 列表容器组件
8
- - `XCellListFilter`: 列表筛选组件
9
- - `XFormItem`: 表单项组件
10
- - `XForm`: 表单容器组件
11
- - `XFormGroup`: 表单分组组件
12
-
13
- ## 功能特性
14
-
15
- ### 列表功能
16
- - ✅ 下拉刷新
17
- - ✅ 上拉加载
18
- - ✅ 搜索过滤
19
- - ✅ 多条件筛选
20
- - ✅ 排序功能
21
- - ✅ 卡片式布局
22
- - ✅ 批量操作
23
- - ✅ 自定义操作按钮
24
-
25
- ### 表单功能
26
- - ✅ 支持多种表单项类型
27
- - ✅ 表单分组
28
- - ✅ 表单验证
29
- - ✅ 动态显示隐藏
30
- - ✅ 表单联动
31
- - ✅ 数据字典
32
- - ✅ 自定义校验规则
33
-
34
- ## 使用示例
35
-
36
- ### 基础列表
37
-
38
- ```vue
39
- <template>
40
- <XCellList
41
- config-name="listConfig"
42
- :service-name="serviceName"
43
- @to-detail="handleDetail"
44
- />
45
- </template>
46
-
47
- <script setup lang="ts">
48
- const serviceName = 'userService'
49
-
50
- const handleDetail = (item) => {
51
- // 处理详情点击
52
- }
53
- </script>
54
- ```
55
-
56
- ### 带筛选的表单
57
-
58
- ```vue
59
- <template>
60
- <XFormGroup
61
- :config-name="configName"
62
- :service-name="serviceName"
63
- :group-form-data="formData"
64
- mode="查询"
65
- @submit="handleSubmit"
66
- />
67
- </template>
68
-
69
- <script setup lang="ts">
70
- const configName = 'searchForm'
71
- const serviceName = 'userService'
72
- const formData = ref({})
73
-
74
- const handleSubmit = (data) => {
75
- console.log('表单提交:', data)
76
- }
77
- </script>
78
- ```
79
-
80
- ## API 文档
81
-
82
- ### XCellList Props
83
-
84
- | 参数 | 说明 | 类型 | 默认值 |
85
- |------|------|------|--------|
86
- | configName | 配置名称 | string | - |
87
- | serviceName | 服务名称 | string | - |
88
- | fixQueryForm | 固定查询参数 | object | null |
89
- | idKey | 主键字段 | string | 'o_id' |
90
-
91
- ### XCellList Events
92
-
93
- | 事件名 | 说明 | 回调参数 |
94
- |------|------|------|
95
- | toDetail | 点击详情时触发 | item: 当前项数据 |
96
- | addOption | 点击新增按钮时触发 | - |
97
-
98
- ### XFormGroup Props
99
-
100
- | 参数 | 说明 | 类型 | 默认值 |
101
- |------|------|------|--------|
102
- | configName | 配置名称 | string | '' |
103
- | serviceName | 服务名称 | string | - |
104
- | groupFormData | 表单数据 | object | {} |
105
- | mode | 表单模式 | '查询' \| '新增' \| '修改' | '查询' |
106
-
107
- ### XFormItem Props
108
-
109
- | 参数 | 说明 | 类型 | 默认值 |
110
- |------|------|------|--------|
111
- | attr | 表单项配置 | FormItemAttr | - |
112
- | form | 表单数据对象 | object | - |
113
- | mode | 表单模式 | string | '查询' |
114
- | showLabel | 是否显示标签 | boolean | true |
115
-
116
- ## 配置说明
117
-
118
- ### 列表配置
119
-
120
- ```typescript
121
- interface ListConfig {
122
- // 列配置
123
- columnJson: {
124
- // 列类型: mobile_header_column | mobile_subtitle_column | mobile_details_column | mobile_footer_column
125
- mobileColumnType: string
126
- // 数据字段
127
- dataIndex: string
128
- // 标题
129
- title: string
130
- // 展示类型
131
- slotType?: 'badge' | 'action'
132
- // 操作按钮配置
133
- actionArr?: Array<{
134
- text: string
135
- func: string
136
- }>
137
- }[]
138
-
139
- // 按钮状态
140
- buttonState: {
141
- add?: boolean
142
- edit?: boolean
143
- delete?: boolean
144
- }
145
-
146
- // 是否显示排序
147
- showSortIcon?: boolean
148
-
149
- // 查询表单配置
150
- formJson: FormItem[]
151
- }
152
- ```
153
-
154
- ### 表单配置
155
-
156
- ```typescript
157
- interface FormItem {
158
- // 表单项类型
159
- type: 'input' | 'select' | 'date' | 'checkbox' | 'radio' | 'switch' | 'textarea' | 'uploader'
160
-
161
- // 字段名
162
- model: string
163
-
164
- // 标签名
165
- name: string
166
-
167
- // 校验规则
168
- rule?: {
169
- required: string
170
- type: 'string' | 'number' | 'integer' | 'float'
171
- }
172
-
173
- // 占位提示
174
- placeholder?: string
175
-
176
- // 数据源配置
177
- keyName?: string
178
-
179
- // 是否只读
180
- readonly?: boolean
181
-
182
- // 是否禁用
183
- disabled?: boolean
184
- }
185
- ```
186
-
187
- ## 高级功能
188
-
189
- ### 表单联动
190
-
191
- ```typescript
192
- // 配置联动显示函数
193
- const showFormItemFunc = `function(form, attr, data, mode) {
194
- return form.type === '1'
195
- }`
196
-
197
- // 配置值变化函数
198
- const dataChangeFunc = `function(form, attr, data, mode) {
199
- if(form.type === '1') {
200
- form.name = 'test'
201
- }
202
- }`
203
- ```
204
-
205
- ### 自定义样式
206
-
207
- ```typescript
208
- // 配置样式函数
209
- const styleFunctionForValue = `function(value) {
210
- return {
211
- color: value > 100 ? 'red' : 'green'
212
- }
213
- }`
214
- ```
215
-
216
- ## 注意事项
217
-
218
- 1. 配置名称必须与后端配置一致
219
- 2. 表单验证规则需要按照规范配置
220
- 3. 自定义函数需要使用字符串形式
221
- 4. 数据源配置支持多种方式:
222
- - logic@: 逻辑处理
223
- - config@: 配置数据
224
- - search@: 搜索数据
225
-
226
- ## 最佳实践
227
-
228
- 1. 合理使用表单分组
229
- 2. 适当配置表单联动
230
- 3. 统一管理配置文件
231
- 4. 做好错误处理
232
- 5. 优化列表性能
233
-
234
- ## 常见问题
235
-
236
- 1. Q: 如何配置自定义校验规则?
237
- A: 在 rule 中配置 validator 函数
238
-
239
- 2. Q: 如何实现表单联动?
240
- A: 使用 showFormItemFunc 和 dataChangeFunc 配置联动逻辑
241
-
242
- 3. Q: 如何自定义列表样式?
243
- A: 使用 styleFunctionForValue 配置样式函数
244
-
245
- ## 更新日志
246
-
247
- ### v1.0.0
248
- - 初始版本发布
249
- - 支持基础列表功能
250
- - 支持表单配置
251
-
252
- ### v1.1.0
253
- - 添加表单联动
254
- - 优化列表性能
255
- - 修复已知问题
256
-
257
- ## 后续规划
258
-
259
- 1. [ ] 支持更多表单类型
260
- 2. [ ] 添加表单预览功能
261
- 3. [ ] 优化列表性能
262
- 4. [ ] 完善错误处理
263
- 5. [ ] 添加单元测试
264
-
265
- ## 贡献指南
266
-
267
- 欢迎提交 Issue 和 PR,请遵循以下规范:
268
-
269
- 1. 遵循代码规范
270
- 2. 添加必要的测试
271
- 3. 更新相关文档
272
-
273
- ## 许可证
274
-
275
- MIT License
1
+ # 移动端配置化表单/列表组件文档
2
+
3
+ ## 组件概述
4
+
5
+ 这是一个基于 Vue 3 + TypeScript + Vant 4 开发的移动端配置化查询列表组件系统,主要包含以下组件:
6
+
7
+ - `XCellList`: 列表容器组件
8
+ - `XCellListFilter`: 列表筛选组件
9
+ - `XFormItem`: 表单项组件
10
+ - `XForm`: 表单容器组件
11
+ - `XFormGroup`: 表单分组组件
12
+
13
+ ## 功能特性
14
+
15
+ ### 列表功能
16
+ - ✅ 下拉刷新
17
+ - ✅ 上拉加载
18
+ - ✅ 搜索过滤
19
+ - ✅ 多条件筛选
20
+ - ✅ 排序功能
21
+ - ✅ 卡片式布局
22
+ - ✅ 批量操作
23
+ - ✅ 自定义操作按钮
24
+
25
+ ### 表单功能
26
+ - ✅ 支持多种表单项类型
27
+ - ✅ 表单分组
28
+ - ✅ 表单验证
29
+ - ✅ 动态显示隐藏
30
+ - ✅ 表单联动
31
+ - ✅ 数据字典
32
+ - ✅ 自定义校验规则
33
+
34
+ ## 使用示例
35
+
36
+ ### 基础列表
37
+
38
+ ```vue
39
+ <template>
40
+ <XCellList
41
+ config-name="listConfig"
42
+ :service-name="serviceName"
43
+ @to-detail="handleDetail"
44
+ />
45
+ </template>
46
+
47
+ <script setup lang="ts">
48
+ const serviceName = 'userService'
49
+
50
+ const handleDetail = (item) => {
51
+ // 处理详情点击
52
+ }
53
+ </script>
54
+ ```
55
+
56
+ ### 带筛选的表单
57
+
58
+ ```vue
59
+ <template>
60
+ <XFormGroup
61
+ :config-name="configName"
62
+ :service-name="serviceName"
63
+ :group-form-data="formData"
64
+ mode="查询"
65
+ @submit="handleSubmit"
66
+ />
67
+ </template>
68
+
69
+ <script setup lang="ts">
70
+ const configName = 'searchForm'
71
+ const serviceName = 'userService'
72
+ const formData = ref({})
73
+
74
+ const handleSubmit = (data) => {
75
+ console.log('表单提交:', data)
76
+ }
77
+ </script>
78
+ ```
79
+
80
+ ## API 文档
81
+
82
+ ### XCellList Props
83
+
84
+ | 参数 | 说明 | 类型 | 默认值 |
85
+ |------|------|------|--------|
86
+ | configName | 配置名称 | string | - |
87
+ | serviceName | 服务名称 | string | - |
88
+ | fixQueryForm | 固定查询参数 | object | null |
89
+ | idKey | 主键字段 | string | 'o_id' |
90
+
91
+ ### XCellList Events
92
+
93
+ | 事件名 | 说明 | 回调参数 |
94
+ |------|------|------|
95
+ | toDetail | 点击详情时触发 | item: 当前项数据 |
96
+ | addOption | 点击新增按钮时触发 | - |
97
+
98
+ ### XFormGroup Props
99
+
100
+ | 参数 | 说明 | 类型 | 默认值 |
101
+ |------|------|------|--------|
102
+ | configName | 配置名称 | string | '' |
103
+ | serviceName | 服务名称 | string | - |
104
+ | groupFormData | 表单数据 | object | {} |
105
+ | mode | 表单模式 | '查询' \| '新增' \| '修改' | '查询' |
106
+
107
+ ### XFormItem Props
108
+
109
+ | 参数 | 说明 | 类型 | 默认值 |
110
+ |------|------|------|--------|
111
+ | attr | 表单项配置 | FormItemAttr | - |
112
+ | form | 表单数据对象 | object | - |
113
+ | mode | 表单模式 | string | '查询' |
114
+ | showLabel | 是否显示标签 | boolean | true |
115
+
116
+ ## 配置说明
117
+
118
+ ### 列表配置
119
+
120
+ ```typescript
121
+ interface ListConfig {
122
+ // 列配置
123
+ columnJson: {
124
+ // 列类型: mobile_header_column | mobile_subtitle_column | mobile_details_column | mobile_footer_column
125
+ mobileColumnType: string
126
+ // 数据字段
127
+ dataIndex: string
128
+ // 标题
129
+ title: string
130
+ // 展示类型
131
+ slotType?: 'badge' | 'action'
132
+ // 操作按钮配置
133
+ actionArr?: Array<{
134
+ text: string
135
+ func: string
136
+ }>
137
+ }[]
138
+
139
+ // 按钮状态
140
+ buttonState: {
141
+ add?: boolean
142
+ edit?: boolean
143
+ delete?: boolean
144
+ }
145
+
146
+ // 是否显示排序
147
+ showSortIcon?: boolean
148
+
149
+ // 查询表单配置
150
+ formJson: FormItem[]
151
+ }
152
+ ```
153
+
154
+ ### 表单配置
155
+
156
+ ```typescript
157
+ interface FormItem {
158
+ // 表单项类型
159
+ type: 'input' | 'select' | 'date' | 'checkbox' | 'radio' | 'switch' | 'textarea' | 'uploader'
160
+
161
+ // 字段名
162
+ model: string
163
+
164
+ // 标签名
165
+ name: string
166
+
167
+ // 校验规则
168
+ rule?: {
169
+ required: string
170
+ type: 'string' | 'number' | 'integer' | 'float'
171
+ }
172
+
173
+ // 占位提示
174
+ placeholder?: string
175
+
176
+ // 数据源配置
177
+ keyName?: string
178
+
179
+ // 是否只读
180
+ readonly?: boolean
181
+
182
+ // 是否禁用
183
+ disabled?: boolean
184
+ }
185
+ ```
186
+
187
+ ## 高级功能
188
+
189
+ ### 表单联动
190
+
191
+ ```typescript
192
+ // 配置联动显示函数
193
+ const showFormItemFunc = `function(form, attr, data, mode) {
194
+ return form.type === '1'
195
+ }`
196
+
197
+ // 配置值变化函数
198
+ const dataChangeFunc = `function(form, attr, data, mode) {
199
+ if(form.type === '1') {
200
+ form.name = 'test'
201
+ }
202
+ }`
203
+ ```
204
+
205
+ ### 自定义样式
206
+
207
+ ```typescript
208
+ // 配置样式函数
209
+ const styleFunctionForValue = `function(value) {
210
+ return {
211
+ color: value > 100 ? 'red' : 'green'
212
+ }
213
+ }`
214
+ ```
215
+
216
+ ## 注意事项
217
+
218
+ 1. 配置名称必须与后端配置一致
219
+ 2. 表单验证规则需要按照规范配置
220
+ 3. 自定义函数需要使用字符串形式
221
+ 4. 数据源配置支持多种方式:
222
+ - logic@: 逻辑处理
223
+ - config@: 配置数据
224
+ - search@: 搜索数据
225
+
226
+ ## 最佳实践
227
+
228
+ 1. 合理使用表单分组
229
+ 2. 适当配置表单联动
230
+ 3. 统一管理配置文件
231
+ 4. 做好错误处理
232
+ 5. 优化列表性能
233
+
234
+ ## 常见问题
235
+
236
+ 1. Q: 如何配置自定义校验规则?
237
+ A: 在 rule 中配置 validator 函数
238
+
239
+ 2. Q: 如何实现表单联动?
240
+ A: 使用 showFormItemFunc 和 dataChangeFunc 配置联动逻辑
241
+
242
+ 3. Q: 如何自定义列表样式?
243
+ A: 使用 styleFunctionForValue 配置样式函数
244
+
245
+ ## 更新日志
246
+
247
+ ### v1.0.0
248
+ - 初始版本发布
249
+ - 支持基础列表功能
250
+ - 支持表单配置
251
+
252
+ ### v1.1.0
253
+ - 添加表单联动
254
+ - 优化列表性能
255
+ - 修复已知问题
256
+
257
+ ## 后续规划
258
+
259
+ 1. [ ] 支持更多表单类型
260
+ 2. [ ] 添加表单预览功能
261
+ 3. [ ] 优化列表性能
262
+ 4. [ ] 完善错误处理
263
+ 5. [ ] 添加单元测试
264
+
265
+ ## 贡献指南
266
+
267
+ 欢迎提交 Issue 和 PR,请遵循以下规范:
268
+
269
+ 1. 遵循代码规范
270
+ 2. 添加必要的测试
271
+ 3. 更新相关文档
272
+
273
+ ## 许可证
274
+
275
+ MIT License
@@ -317,6 +317,7 @@ function addOption() {
317
317
  v-model:order-val="orderVal"
318
318
  v-model:condition-params="conditionParams"
319
319
  :fix-query-form="fixQueryForm"
320
+ :service-name="serviceName"
320
321
  :order-list="orderList"
321
322
  :form-query="formQueryList"
322
323
  :button-state="buttonState"
@@ -353,6 +354,7 @@ function addOption() {
353
354
  <XBadge
354
355
  :style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
355
356
  :dict-name="column.dictName" :dict-value="item[column.dataIndex]"
357
+ :service-name="serviceName"
356
358
  />
357
359
  </p>
358
360
  </VanCol>
@@ -366,6 +368,7 @@ function addOption() {
366
368
  <XBadge
367
369
  :style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
368
370
  :dict-name="column.dictName" :dict-value="item[column.dataIndex]"
371
+ :service-name="serviceName"
369
372
  />
370
373
  </p>
371
374
  </VanCol>
@@ -379,6 +382,7 @@ function addOption() {
379
382
  <XBadge
380
383
  :style="handleFunctionStyle(column.styleFunctionForValue, item[column.dataIndex])"
381
384
  :dict-name="column.dictName" :dict-value="item[column.dataIndex]"
385
+ :service-name="serviceName"
382
386
  />
383
387
  </p>
384
388
  </VanCol>
@@ -14,6 +14,7 @@ import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vu
14
14
 
15
15
  const props = defineProps<{
16
16
  fixQueryForm?: object
17
+ serviceName?: string
17
18
  orderVal?: string
18
19
  sortordVal?: string
19
20
  orderList?: any[]
@@ -140,7 +141,7 @@ onMounted(() => {
140
141
  </div>
141
142
  </VanCol>
142
143
  </VanRow>
143
- <XFormItem v-model="conditionParams[item.model]" :form="conditionParams" :attr="item" :show-label="false" />
144
+ <XFormItem v-model="conditionParams[item.model]" :form="conditionParams" :attr="item" :service-name="props.serviceName" :show-label="false" />
144
145
  </template>
145
146
  </div>
146
147
  <div class="operations-panel">
@@ -63,7 +63,7 @@ async function submit() {
63
63
  <VanTab
64
64
  v-for="(item, index) in groupItems"
65
65
  :key="item.groupName ? (item.groupName + index) : index"
66
- :title="item.describe ? item.describe : null "
66
+ :title="item.describe ? item.describe : item.tableName "
67
67
  >
68
68
  <div class="x-form-group-item">
69
69
  <XForm