af-mobile-client-vue3 1.3.36 → 1.3.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/.cursorrules +60 -60
- package/.editorconfig +9 -9
- package/.env +10 -10
- package/.env.development +1 -1
- package/.env.production +1 -1
- package/.node-version +1 -1
- package/.vscode/extensions.json +12 -12
- package/.vscode/settings.json +68 -68
- package/CLAUDE.md +218 -218
- package/README.md +182 -182
- package/af-example-mobile-vue-web.iml +9 -9
- package/build/vite/index.ts +98 -98
- package/build/vite/optimize.ts +34 -34
- package/build/vite/vconsole.ts +47 -47
- package/commitlint.config.ts +32 -32
- package/compress.js +36 -36
- package/eslint.config.ts +31 -31
- package/index.html +23 -23
- package/mock/data.ts +20 -20
- package/mock/index.ts +7 -7
- package/mock/modules/prose.mock.ts +13 -13
- package/mock/modules/user.mock.ts +95 -95
- package/mock/util.ts +19 -19
- package/netlify.toml +12 -12
- package/package.json +114 -114
- package/postcss.config.ts +27 -27
- package/public/favicon.svg +4 -4
- package/public/safari-pinned-tab.svg +4 -4
- package/scripts/verifyCommit.js +19 -19
- package/src/App.vue +79 -79
- package/src/api/auth/index.ts +77 -77
- package/src/api/auth/types.ts +200 -200
- package/src/api/mock/index.ts +30 -30
- package/src/api/user/index.ts +40 -40
- package/src/assets/img/user/login/background-shadow-1.svg +20 -20
- package/src/assets/img/user/login/logo-background.svg +20 -20
- package/src/bootstrap.ts +26 -26
- package/src/components/core/BeautifulLoading/index.vue +52 -52
- package/src/components/core/ImageUploader/index.vue +251 -251
- package/src/components/core/NavBar/index.vue +53 -53
- package/src/components/core/Tabbar/index.vue +32 -32
- package/src/components/core/Uploader/index.vue +124 -124
- package/src/components/core/XGridDropOption/index.vue +154 -154
- package/src/components/core/XMultiSelect/index.vue +183 -183
- package/src/components/core/XSelect/index.vue +149 -149
- package/src/components/data/CardContainer/CardContainer.vue +118 -118
- package/src/components/data/CardContainer/CardHeader.vue +99 -99
- package/src/components/data/InfoDisplay/index.vue +132 -132
- package/src/components/data/UserDetail/api.ts +24 -24
- package/src/components/data/UserDetail/index.vue +620 -620
- package/src/components/data/UserDetail/recordEntries.ts +159 -159
- package/src/components/data/UserDetail/types.ts +26 -26
- package/src/components/data/XBadge/index.vue +82 -82
- package/src/components/data/XCellDetail/index.vue +105 -105
- package/src/components/data/XCellList/XCellList.md +432 -432
- package/src/components/data/XCellList/index.vue +1436 -1436
- package/src/components/data/XCellListFilter/QrScanner/index.vue +207 -207
- package/src/components/data/XCellListFilter/QrScanner/startScanAnimation.ts +53 -53
- package/src/components/data/XCellListFilter/VpnRecognition/index.vue +119 -119
- package/src/components/data/XCellListFilter/index.vue +705 -705
- package/src/components/data/XForm/index.vue +659 -659
- package/src/components/data/XFormGroup/doc/DeviceForm.vue +122 -122
- package/src/components/data/XFormGroup/doc/FormGroupDemo.vue +56 -56
- package/src/components/data/XFormGroup/doc/README.md +286 -286
- package/src/components/data/XFormGroup/doc/UserForm.vue +102 -102
- package/src/components/data/XFormGroup/index.vue +240 -240
- package/src/components/data/XFormItem/index.vue +1311 -1311
- package/src/components/data/XOlMap/README.md +227 -227
- package/src/components/data/XOlMap/XLocationPicker/index.vue +226 -226
- package/src/components/data/XOlMap/index.vue +1490 -1490
- package/src/components/data/XOlMap/types.ts +149 -149
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.ts +171 -171
- package/src/components/data/XReportForm/DateTimeSecondsPicker.vue +208 -208
- package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
- package/src/components/data/XReportForm/index.vue +1393 -1393
- package/src/components/data/XReportGrid/XAddReport/XAddReport.vue +198 -198
- package/src/components/data/XReportGrid/XAddReport/index.js +3 -3
- package/src/components/data/XReportGrid/XAddReport/index.md +53 -53
- package/src/components/data/XReportGrid/XAddReport/index.ts +10 -10
- package/src/components/data/XReportGrid/XReport.vue +960 -960
- package/src/components/data/XReportGrid/XReportDemo.vue +33 -33
- package/src/components/data/XReportGrid/XReportDesign.vue +597 -597
- package/src/components/data/XReportGrid/XReportDrawer/XReportDrawer.vue +148 -148
- package/src/components/data/XReportGrid/XReportDrawer/index.js +3 -3
- package/src/components/data/XReportGrid/XReportDrawer/index.ts +10 -10
- package/src/components/data/XReportGrid/XReportJsonRender.vue +399 -399
- package/src/components/data/XReportGrid/XReportTrGroup.vue +592 -592
- package/src/components/data/XReportGrid/index.md +46 -46
- package/src/components/data/XReportGrid/print.js +184 -184
- package/src/components/data/XSignature/index.vue +284 -284
- package/src/components/data/XTag/index.vue +10 -10
- package/src/components/layout/NormalDataLayout/index.vue +69 -69
- package/src/components/layout/TabBarLayout/index.vue +40 -40
- package/src/composables/dark.ts +5 -5
- package/src/config/routes.ts +9 -9
- package/src/constants/index.ts +2 -2
- package/src/enums/requestEnum.ts +25 -25
- package/src/expression/ExpressionRunner.ts +28 -28
- package/src/expression/TestExpression.ts +510 -510
- package/src/expression/core/Delegate.ts +116 -116
- package/src/expression/core/Expression.ts +1359 -1359
- package/src/expression/core/Program.ts +985 -985
- package/src/expression/core/Token.ts +29 -29
- package/src/expression/enums/ExpressionType.ts +81 -81
- package/src/expression/enums/TokenType.ts +11 -11
- package/src/expression/exception/BreakWayException.ts +2 -2
- package/src/expression/exception/ContinueWayException.ts +2 -2
- package/src/expression/exception/ExpressionException.ts +29 -29
- package/src/expression/exception/ReturnWayException.ts +14 -14
- package/src/expression/exception/ServiceException.ts +22 -22
- package/src/expression/instances/JSONArray.ts +52 -52
- package/src/expression/instances/JSONObject.ts +118 -118
- package/src/expression/instances/LogicConsole.ts +31 -31
- package/src/font-style/font.css +4 -4
- package/src/hooks/useBoolean.ts +26 -26
- package/src/hooks/useCommon.ts +9 -9
- package/src/hooks/useLoading.ts +16 -16
- package/src/hooks/useLogin.ts +97 -97
- package/src/icons/svg/check-in.svg +32 -32
- package/src/icons/svg/dark.svg +4 -4
- package/src/icons/svg/github.svg +4 -4
- package/src/icons/svg/light.svg +4 -4
- package/src/icons/svg/link.svg +4 -4
- package/src/icons/svgo.yml +22 -22
- package/src/layout/GridView/index.vue +16 -16
- package/src/layout/PageLayout.vue +9 -9
- package/src/layout/SingleLayout.vue +9 -9
- package/src/locales/en-US.json +128 -128
- package/src/locales/zh-CN.json +128 -128
- package/src/logic/LogicRunner.ts +67 -67
- package/src/logic/TestLogic.ts +13 -13
- package/src/logic/plugins/common/DateTools.ts +35 -35
- package/src/logic/plugins/common/VueTools.ts +30 -30
- package/src/logic/plugins/index.ts +7 -7
- package/src/main.ts +44 -44
- package/src/plugins/AppData.ts +38 -38
- package/src/plugins/GetLoginInfoService.ts +10 -10
- package/src/plugins/collectIcons.ts +10 -10
- package/src/plugins/index.ts +11 -11
- package/src/router/README.md +8 -8
- package/src/router/external-routes.ts +60 -60
- package/src/router/guards.ts +131 -131
- package/src/router/index.ts +35 -35
- package/src/router/invoiceRoutes.ts +33 -33
- package/src/router/routes.ts +421 -421
- package/src/services/api/Login.ts +6 -6
- package/src/services/api/common.ts +109 -109
- package/src/services/api/index.ts +7 -7
- package/src/services/api/manage.ts +8 -8
- package/src/services/api/search.ts +16 -16
- package/src/services/api/user.ts +17 -17
- package/src/services/restTools.ts +56 -56
- package/src/services/v3Api.ts +147 -147
- package/src/stores/index.ts +13 -13
- package/src/stores/modules/counter.ts +19 -19
- package/src/stores/modules/homeApp.ts +55 -55
- package/src/stores/modules/routeCache.ts +22 -22
- package/src/stores/modules/setting.ts +87 -87
- package/src/stores/modules/user.ts +326 -326
- package/src/stores/mutation-type.ts +12 -12
- package/src/styles/app.less +36 -36
- package/src/styles/login.less +109 -109
- package/src/styles/var.less +25 -25
- package/src/types/auth.ts +89 -89
- package/src/types/env.d.ts +16 -16
- package/src/types/platform.ts +194 -194
- package/src/types/settings.ts +1 -1
- package/src/types/vue-router.d.ts +13 -13
- package/src/utils/Storage.ts +124 -124
- package/src/utils/authority-utils.ts +84 -84
- package/src/utils/common.ts +41 -41
- package/src/utils/crypto.ts +39 -39
- package/src/utils/dataUtil.ts +42 -42
- package/src/utils/dictUtil.ts +52 -52
- package/src/utils/http/index.ts +201 -201
- package/src/utils/i18n.ts +72 -72
- package/src/utils/indexedDB.ts +195 -195
- package/src/utils/inline-px-to-vw.ts +28 -28
- package/src/utils/mobileUtil.ts +33 -33
- package/src/utils/platform-auth.ts +135 -135
- package/src/utils/progress.ts +19 -19
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/utils/routerUtil.ts +271 -271
- package/src/utils/runEvalFunction.ts +13 -13
- package/src/utils/secureStorage.ts +70 -70
- package/src/utils/set-page-title.ts +5 -5
- package/src/utils/validate.ts +6 -6
- package/src/views/chat/index.vue +153 -153
- package/src/views/common/Forbidden.vue +97 -97
- package/src/views/common/LoadError.vue +63 -63
- package/src/views/common/NotFound.vue +67 -67
- package/src/views/component/EvaluateRecordView/index.vue +40 -40
- package/src/views/component/IconifyView/index.vue +504 -504
- package/src/views/component/UserDetailView/UserDetailPage.vue +77 -77
- package/src/views/component/UserDetailView/index.vue +234 -234
- package/src/views/component/XCellDetailView/index.vue +217 -217
- package/src/views/component/XCellListView/index.vue +108 -108
- package/src/views/component/XFormAppraiseView/index.vue +174 -174
- package/src/views/component/XFormGroupView/index.vue +78 -78
- package/src/views/component/XFormView/index.vue +27 -27
- package/src/views/component/XOlMapView/index.vue +434 -434
- package/src/views/component/XOlMapView/testData.ts +64 -64
- package/src/views/component/XReportFormIframeView/index.vue +47 -47
- package/src/views/component/XReportFormView/index.vue +13 -13
- package/src/views/component/XReportGridView/index.vue +17 -17
- package/src/views/component/XRequestView/index.vue +234 -234
- package/src/views/component/XSignatureView/index.vue +50 -50
- package/src/views/component/index.vue +181 -181
- package/src/views/component/menu.vue +117 -117
- package/src/views/component/notice.vue +46 -46
- package/src/views/component/topNav.vue +36 -36
- package/src/views/external/index.vue +152 -152
- package/src/views/invoiceShow/index.vue +61 -61
- package/src/views/loading/AuthLoading.vue +345 -345
- package/src/views/user/login/ForgetPasswordForm.vue +94 -94
- package/src/views/user/login/LoginForm.vue +350 -350
- package/src/views/user/login/LoginTitle.vue +76 -76
- package/src/views/user/login/LoginWave.vue +109 -109
- package/src/views/user/login/index.vue +22 -22
- package/src/views/user/my/comm/ModifyPassword.vue +346 -346
- package/src/views/user/my/index.vue +507 -507
- package/src/views/user/register/index.vue +952 -952
- package/src/views/userRecords/AbnormalAlarmRecords.vue +21 -21
- package/src/views/userRecords/CardReplacementRecords.vue +21 -21
- package/src/views/userRecords/ChangeRecords.vue +19 -19
- package/src/views/userRecords/CommandViewRecords.vue +20 -20
- package/src/views/userRecords/GasCompensationRecords.vue +20 -20
- package/src/views/userRecords/InstrumentCollectionRecords.vue +21 -21
- package/src/views/userRecords/MeterRecords.vue +20 -20
- package/src/views/userRecords/OperateRecords.vue +51 -51
- package/src/views/userRecords/OtherChargeRecords.vue +19 -19
- package/src/views/userRecords/PaymentRecords.vue +28 -28
- package/src/views/userRecords/PriceAdjustmentRecords.vue +19 -19
- package/src/views/userRecords/ReplacementRecords.vue +19 -19
- package/src/views/userRecords/SafetyRecords.vue +19 -19
- package/src/views/userRecords/TransactionRecords.vue +21 -21
- package/src/views/userRecords/TransferRecords.vue +19 -19
- package/src/views/userRecords/operateRecordDetail/index.vue +316 -316
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AddUserDetail.vue +124 -124
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AdvanceDeliveryDetail.vue +88 -88
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AutoAccountsCancelDetail.vue +205 -205
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/AutoAccountsDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BankDkDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BankPayDetail.vue +192 -192
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/BlacklistDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CancellationDetail.vue +101 -101
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardMeterCenterCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardMeterCenterDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/CardOverUserDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ChangeMeterCancelDetail.vue +166 -166
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ChangeMeterDetail.vue +205 -205
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/DisableManageDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/EnableManageDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/FaZheChangeDetail.vue +124 -124
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/FeeDeductionDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/GasPriceChangeDetail.vue +126 -126
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/InputtorChangeDetail.vue +126 -126
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotMeterCenterCancelDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotMeterCenterDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/IotOpenDetail.vue +88 -88
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineCardDetail.vue +101 -101
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineMeterCenterCancelDetail.vue +218 -218
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/MachineMeterCenterDetail.vue +153 -153
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OffGasAddGasDetail.vue +140 -140
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OtherChargeCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OtherChargeDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/OverUserChangeDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReBillDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/RefundDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReplaceCardManageCancelDetail.vue +127 -127
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/ReplaceCardManageDetail.vue +114 -114
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/SaleCardGasDetail.vue +140 -140
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/TransferManageCancelDetail.vue +152 -152
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/TransferManageDetail.vue +178 -178
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/UserChangeDetail.vue +123 -123
- package/src/views/userRecords/operateRecordDetail/operateRecordDetails/WechatPayDetail.vue +192 -192
- package/src/views/userRecords/types.ts +66 -66
- package/tsconfig.json +39 -39
- package/uno.config.ts +82 -82
- package/vite.config.ts +114 -114
- package/.claude/settings.local.json +0 -14
|
@@ -1,432 +1,432 @@
|
|
|
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
|
-
|
|
39
|
-
### 功能概述
|
|
40
|
-
|
|
41
|
-
XCellList 组件新增了强大的长按多选功能,支持以下特性:
|
|
42
|
-
|
|
43
|
-
- **长按触发**:长按卡片 500ms 进入多选模式
|
|
44
|
-
- **精确选择**:点击标题切换选中状态,点击卡片其他区域不触发选择
|
|
45
|
-
- **视觉反馈**:选中项目有高亮边框和背景色变化
|
|
46
|
-
- **操作面板**:底部 ActionSheet 显示自定义操作按钮
|
|
47
|
-
- **智能提示**:启用多选功能时显示操作提示
|
|
48
|
-
- **按钮禁用**:多选模式下自动禁用其他操作按钮
|
|
49
|
-
|
|
50
|
-
### 使用方法
|
|
51
|
-
|
|
52
|
-
#### 基础多选
|
|
53
|
-
|
|
54
|
-
```vue
|
|
55
|
-
<script setup lang="ts">
|
|
56
|
-
const multiSelectActions = ref([
|
|
57
|
-
{ name: '批量操作', key: 'batchOperation', color: '#000000', icon: 'records-o' }
|
|
58
|
-
])
|
|
59
|
-
|
|
60
|
-
function handleMultiSelectAction(action, selectedIds, selectedItems) {
|
|
61
|
-
console.log('多选操作:', action, selectedIds, selectedItems)
|
|
62
|
-
// 处理批量操作逻辑
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function handleSelectionChange(selectedItems) {
|
|
66
|
-
console.log('选择变化:', selectedItems)
|
|
67
|
-
}
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<template>
|
|
71
|
-
<XCellList
|
|
72
|
-
config-name="listConfig"
|
|
73
|
-
:service-name="serviceName"
|
|
74
|
-
:enable-multi-select="true"
|
|
75
|
-
id-key="rr_id"
|
|
76
|
-
:multi-select-actions="multiSelectActions"
|
|
77
|
-
@multi-select-action="handleMultiSelectAction"
|
|
78
|
-
@selection-change="handleSelectionChange"
|
|
79
|
-
/>
|
|
80
|
-
</template>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### 自定义多选操作
|
|
84
|
-
|
|
85
|
-
```vue
|
|
86
|
-
<script setup lang="ts">
|
|
87
|
-
const multiSelectActions = ref([
|
|
88
|
-
{ name: '标记已读', key: 'markRead', color: '#1989fa', icon: 'eye-o' },
|
|
89
|
-
{ name: '移动到文件夹', key: 'moveToFolder', color: '#07c160', icon: 'folder-o' },
|
|
90
|
-
{ name: '标记重要', key: 'markImportant', color: '#ff976a', icon: 'star-o' }
|
|
91
|
-
])
|
|
92
|
-
|
|
93
|
-
function handleMultiSelectAction(action, selectedIds, selectedItems) {
|
|
94
|
-
switch (action) {
|
|
95
|
-
case 'markRead':
|
|
96
|
-
// 标记已读逻辑
|
|
97
|
-
break
|
|
98
|
-
case 'moveToFolder':
|
|
99
|
-
// 移动到文件夹逻辑
|
|
100
|
-
break
|
|
101
|
-
case 'markImportant':
|
|
102
|
-
// 标记重要逻辑
|
|
103
|
-
break
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
</script>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 多选功能提示
|
|
110
|
-
|
|
111
|
-
当启用多选功能(`enableMultiSelect: true`)但未进入多选模式时,会在筛选条件下方显示一个提示条:
|
|
112
|
-
|
|
113
|
-
- 提示内容:"长按卡片可进入多选模式"
|
|
114
|
-
- 样式:浅灰色背景,信息图标,友好的提示文字
|
|
115
|
-
- 进入多选模式后,此提示自动消失,显示多选模式提示条
|
|
116
|
-
|
|
117
|
-
### 多选模式下的按钮禁用
|
|
118
|
-
|
|
119
|
-
在多选模式下,以下按钮会被自动禁用:
|
|
120
|
-
|
|
121
|
-
- 新增按钮(add-action-btn)
|
|
122
|
-
- 卡片内的操作按钮(action-button)
|
|
123
|
-
- 卡片底部的操作按钮(action-btn)
|
|
124
|
-
- 更多按钮(⋯)
|
|
125
|
-
|
|
126
|
-
这样可以避免在多选过程中误触发其他操作。
|
|
127
|
-
|
|
128
|
-
## 使用示例
|
|
129
|
-
|
|
130
|
-
### 基础列表
|
|
131
|
-
|
|
132
|
-
```vue
|
|
133
|
-
<script setup lang="ts">
|
|
134
|
-
const serviceName = 'userService'
|
|
135
|
-
|
|
136
|
-
function handleDetail(item) {
|
|
137
|
-
// 处理详情点击
|
|
138
|
-
}
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<template>
|
|
142
|
-
<XCellList
|
|
143
|
-
config-name="listConfig"
|
|
144
|
-
:service-name="serviceName"
|
|
145
|
-
@to-detail="handleDetail"
|
|
146
|
-
/>
|
|
147
|
-
</template>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### 带筛选的表单
|
|
151
|
-
|
|
152
|
-
```vue
|
|
153
|
-
<script setup lang="ts">
|
|
154
|
-
const configName = 'searchForm'
|
|
155
|
-
const serviceName = 'userService'
|
|
156
|
-
const formData = ref({})
|
|
157
|
-
|
|
158
|
-
function handleSubmit(data) {
|
|
159
|
-
console.log('表单提交:', data)
|
|
160
|
-
}
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<template>
|
|
164
|
-
<XFormGroup
|
|
165
|
-
:config-name="configName"
|
|
166
|
-
:service-name="serviceName"
|
|
167
|
-
:group-form-data="formData"
|
|
168
|
-
mode="查询"
|
|
169
|
-
@submit="handleSubmit"
|
|
170
|
-
/>
|
|
171
|
-
</template>
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### 表单功能(琉璃配置中的需要勾选的新增和修改)
|
|
175
|
-
|
|
176
|
-
```vue
|
|
177
|
-
<script setup lang="ts">
|
|
178
|
-
const configName = 'searchForm'
|
|
179
|
-
const serviceName = 'userService'
|
|
180
|
-
|
|
181
|
-
function addOption() {
|
|
182
|
-
console.log('新增表单')
|
|
183
|
-
}
|
|
184
|
-
function updateRow(item) {
|
|
185
|
-
console.log('修改表单:', item)
|
|
186
|
-
}
|
|
187
|
-
</script>
|
|
188
|
-
|
|
189
|
-
<template>
|
|
190
|
-
<XCellList
|
|
191
|
-
:config-name="configName"
|
|
192
|
-
:service-name="serviceName"
|
|
193
|
-
:custom-add="true"
|
|
194
|
-
:custom-edit="true"
|
|
195
|
-
@update="updateRow"
|
|
196
|
-
@add="addOption"
|
|
197
|
-
/>
|
|
198
|
-
</template>
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## API 文档
|
|
202
|
-
|
|
203
|
-
### XCellList Props
|
|
204
|
-
|
|
205
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
206
|
-
| ---------------------- | ---------------------- | ----------- | --------- |
|
|
207
|
-
| configName | 配置名称 | string | - |
|
|
208
|
-
| serviceName | 服务名称 | string | - |
|
|
209
|
-
| fixQueryForm | 固定查询参数 | object | null |
|
|
210
|
-
| idKey | 主键字段 | string | 'o_id' |
|
|
211
|
-
| customAdd | 是否采用自定义新增按钮 | boolean | false |
|
|
212
|
-
| customEdit | 是否采用自定义修改按钮 | boolean | false |
|
|
213
|
-
| **enableMultiSelect** | **是否启用多选功能** | **boolean** | **false** |
|
|
214
|
-
| **multiSelectActions** | **多选操作按钮配置** | **Array** | **[]** |
|
|
215
|
-
|
|
216
|
-
### XCellList Events
|
|
217
|
-
|
|
218
|
-
| 事件名 | 说明 | 回调参数 |
|
|
219
|
-
| --------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- |
|
|
220
|
-
| toDetail | 点击详情时触发 | item: 当前项数据 |
|
|
221
|
-
| add | 点击新增按钮时触发(customAdd为true才会触发) | - |
|
|
222
|
-
| update | 点击修改按钮时触发(customEdit为true才会触发) | item: 当前项数据 |
|
|
223
|
-
| **multiSelectAction** | **多选操作时触发** | **action: 操作key, selectedIds: 选中ID数组, selectedItems: 选中项目数组** |
|
|
224
|
-
| **selectionChange** | **选择状态变化时触发** | **selectedItems: 选中项目数组** |
|
|
225
|
-
|
|
226
|
-
### 多选操作按钮配置
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
interface MultiSelectAction {
|
|
230
|
-
name: string // 按钮显示名称
|
|
231
|
-
key?: string // 操作标识(可选,默认使用name)
|
|
232
|
-
color?: string // 按钮颜色(可选,默认黑色)
|
|
233
|
-
icon?: string // 按钮图标(可选,默认records-o)
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### XFormGroup Props
|
|
238
|
-
|
|
239
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
240
|
-
| ------------- | -------- | -------------------------- | ------ |
|
|
241
|
-
| configName | 配置名称 | string | '' |
|
|
242
|
-
| serviceName | 服务名称 | string | - |
|
|
243
|
-
| groupFormData | 表单数据 | object | {} |
|
|
244
|
-
| mode | 表单模式 | '查询' \| '新增' \| '修改' | '查询' |
|
|
245
|
-
|
|
246
|
-
### XFormItem Props
|
|
247
|
-
|
|
248
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
249
|
-
| --------- | ------------ | ------------ | ------ |
|
|
250
|
-
| attr | 表单项配置 | FormItemAttr | - |
|
|
251
|
-
| form | 表单数据对象 | object | - |
|
|
252
|
-
| mode | 表单模式 | string | '查询' |
|
|
253
|
-
| showLabel | 是否显示标签 | boolean | true |
|
|
254
|
-
|
|
255
|
-
## 配置说明
|
|
256
|
-
|
|
257
|
-
### 列表配置
|
|
258
|
-
|
|
259
|
-
```typescript
|
|
260
|
-
interface ListConfig {
|
|
261
|
-
// 列配置
|
|
262
|
-
columnJson: {
|
|
263
|
-
// 列类型: mobile_header_column | mobile_subtitle_column | mobile_details_column | mobile_footer_column
|
|
264
|
-
mobileColumnType: string
|
|
265
|
-
// 数据字段
|
|
266
|
-
dataIndex: string
|
|
267
|
-
// 标题
|
|
268
|
-
title: string
|
|
269
|
-
// 展示类型
|
|
270
|
-
slotType?: 'badge' | 'action'
|
|
271
|
-
// 操作按钮配置
|
|
272
|
-
actionArr?: Array<{
|
|
273
|
-
text: string
|
|
274
|
-
func: string
|
|
275
|
-
}>
|
|
276
|
-
}[]
|
|
277
|
-
|
|
278
|
-
// 按钮状态
|
|
279
|
-
buttonState: {
|
|
280
|
-
add?: boolean
|
|
281
|
-
edit?: boolean
|
|
282
|
-
delete?: boolean
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// 是否显示排序
|
|
286
|
-
showSortIcon?: boolean
|
|
287
|
-
|
|
288
|
-
// 查询表单配置
|
|
289
|
-
formJson: FormItem[]
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### 表单配置
|
|
294
|
-
|
|
295
|
-
```typescript
|
|
296
|
-
interface FormItem {
|
|
297
|
-
// 表单项类型
|
|
298
|
-
type: 'input' | 'select' | 'date' | 'checkbox' | 'radio' | 'switch' | 'textarea' | 'uploader'
|
|
299
|
-
|
|
300
|
-
// 字段名
|
|
301
|
-
model: string
|
|
302
|
-
|
|
303
|
-
// 标签名
|
|
304
|
-
name: string
|
|
305
|
-
|
|
306
|
-
// 校验规则
|
|
307
|
-
rule?: {
|
|
308
|
-
required: string
|
|
309
|
-
type: 'string' | 'number' | 'integer' | 'float'
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// 占位提示
|
|
313
|
-
placeholder?: string
|
|
314
|
-
|
|
315
|
-
// 数据源配置
|
|
316
|
-
keyName?: string
|
|
317
|
-
|
|
318
|
-
// 是否只读
|
|
319
|
-
readonly?: boolean
|
|
320
|
-
|
|
321
|
-
// 是否禁用
|
|
322
|
-
disabled?: boolean
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
## 高级功能
|
|
327
|
-
|
|
328
|
-
### 表单联动
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
// 配置联动显示函数
|
|
332
|
-
const showFormItemFunc = `function(form, attr, data, mode) {
|
|
333
|
-
return form.type === '1'
|
|
334
|
-
}`
|
|
335
|
-
|
|
336
|
-
// 配置值变化函数
|
|
337
|
-
const dataChangeFunc = `function(form, attr, data, mode) {
|
|
338
|
-
if(form.type === '1') {
|
|
339
|
-
form.name = 'test'
|
|
340
|
-
}
|
|
341
|
-
}`
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
### 自定义样式
|
|
345
|
-
|
|
346
|
-
```typescript
|
|
347
|
-
// 配置样式函数
|
|
348
|
-
const styleFunctionForValue = `function(value) {
|
|
349
|
-
return {
|
|
350
|
-
color: value > 100 ? 'red' : 'green'
|
|
351
|
-
}
|
|
352
|
-
}`
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## 注意事项
|
|
356
|
-
|
|
357
|
-
1. 配置名称必须与后端配置一致
|
|
358
|
-
2. 表单验证规则需要按照规范配置
|
|
359
|
-
3. 自定义函数需要使用字符串形式
|
|
360
|
-
4. 数据源配置支持多种方式:
|
|
361
|
-
|
|
362
|
-
- logic@: 逻辑处理
|
|
363
|
-
- config@: 配置数据
|
|
364
|
-
- search@: 搜索数据5.对于默认的新增和修改功能,单表已经实现(也可以自定义),多表关联及自定义sql请使用自定义按钮实现
|
|
365
|
-
- 配置按钮状态(customAdd、customEdit)为 true
|
|
366
|
-
- 监听 add 和 update 事件
|
|
367
|
-
- 实现自定义逻辑
|
|
368
|
-
|
|
369
|
-
## 最佳实践
|
|
370
|
-
|
|
371
|
-
1. 合理使用表单分组
|
|
372
|
-
2. 适当配置表单联动
|
|
373
|
-
3. 统一管理配置文件
|
|
374
|
-
4. 做好错误处理
|
|
375
|
-
5. 优化列表性能
|
|
376
|
-
|
|
377
|
-
## 常见问题
|
|
378
|
-
|
|
379
|
-
1. Q: 如何配置自定义校验规则?
|
|
380
|
-
A: 在 rule 中配置 validator 函数
|
|
381
|
-
|
|
382
|
-
2. Q: 如何实现表单联动?
|
|
383
|
-
A: 使用 showFormItemFunc 和 dataChangeFunc 配置联动逻辑
|
|
384
|
-
|
|
385
|
-
3. Q: 如何自定义列表样式?
|
|
386
|
-
A: 使用 styleFunctionForValue 配置样式函数
|
|
387
|
-
|
|
388
|
-
4. **Q: 多选功能如何触发?**
|
|
389
|
-
**A: 长按卡片 500ms 即可进入多选模式**
|
|
390
|
-
|
|
391
|
-
5. **Q: 如何自定义多选操作按钮?**
|
|
392
|
-
**A: 通过 `multiSelectActions` 属性配置,支持自定义名称、颜色和图标**
|
|
393
|
-
|
|
394
|
-
6. **Q: 多选模式下如何选择项目?**
|
|
395
|
-
**A: 点击项目标题可以切换选中状态,点击卡片其他区域不会触发选择**
|
|
396
|
-
|
|
397
|
-
7. **Q: 如何获取选中的项目数据?**
|
|
398
|
-
**A: 监听 `selectionChange` 事件,或通过 `multiSelectAction` 事件获取**
|
|
399
|
-
|
|
400
|
-
## 更新日志
|
|
401
|
-
|
|
402
|
-
### v1.0.0
|
|
403
|
-
|
|
404
|
-
- 初始版本发布
|
|
405
|
-
- 支持基础列表功能
|
|
406
|
-
- 支持表单配置
|
|
407
|
-
|
|
408
|
-
### v1.1.0
|
|
409
|
-
|
|
410
|
-
- 添加表单联动
|
|
411
|
-
- 优化列表性能
|
|
412
|
-
- 修复已知问题
|
|
413
|
-
|
|
414
|
-
## 后续规划
|
|
415
|
-
|
|
416
|
-
1. [ ] 支持更多表单类型
|
|
417
|
-
2. [ ] 添加表单预览功能
|
|
418
|
-
3. [ ] 优化列表性能
|
|
419
|
-
4. [ ] 完善错误处理
|
|
420
|
-
5. [ ] 添加单元测试
|
|
421
|
-
|
|
422
|
-
## 贡献指南
|
|
423
|
-
|
|
424
|
-
欢迎提交 Issue 和 PR,请遵循以下规范:
|
|
425
|
-
|
|
426
|
-
1. 遵循代码规范
|
|
427
|
-
2. 添加必要的测试
|
|
428
|
-
3. 更新相关文档
|
|
429
|
-
|
|
430
|
-
## 许可证
|
|
431
|
-
|
|
432
|
-
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
|
+
|
|
39
|
+
### 功能概述
|
|
40
|
+
|
|
41
|
+
XCellList 组件新增了强大的长按多选功能,支持以下特性:
|
|
42
|
+
|
|
43
|
+
- **长按触发**:长按卡片 500ms 进入多选模式
|
|
44
|
+
- **精确选择**:点击标题切换选中状态,点击卡片其他区域不触发选择
|
|
45
|
+
- **视觉反馈**:选中项目有高亮边框和背景色变化
|
|
46
|
+
- **操作面板**:底部 ActionSheet 显示自定义操作按钮
|
|
47
|
+
- **智能提示**:启用多选功能时显示操作提示
|
|
48
|
+
- **按钮禁用**:多选模式下自动禁用其他操作按钮
|
|
49
|
+
|
|
50
|
+
### 使用方法
|
|
51
|
+
|
|
52
|
+
#### 基础多选
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<script setup lang="ts">
|
|
56
|
+
const multiSelectActions = ref([
|
|
57
|
+
{ name: '批量操作', key: 'batchOperation', color: '#000000', icon: 'records-o' }
|
|
58
|
+
])
|
|
59
|
+
|
|
60
|
+
function handleMultiSelectAction(action, selectedIds, selectedItems) {
|
|
61
|
+
console.log('多选操作:', action, selectedIds, selectedItems)
|
|
62
|
+
// 处理批量操作逻辑
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function handleSelectionChange(selectedItems) {
|
|
66
|
+
console.log('选择变化:', selectedItems)
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<XCellList
|
|
72
|
+
config-name="listConfig"
|
|
73
|
+
:service-name="serviceName"
|
|
74
|
+
:enable-multi-select="true"
|
|
75
|
+
id-key="rr_id"
|
|
76
|
+
:multi-select-actions="multiSelectActions"
|
|
77
|
+
@multi-select-action="handleMultiSelectAction"
|
|
78
|
+
@selection-change="handleSelectionChange"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### 自定义多选操作
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
const multiSelectActions = ref([
|
|
88
|
+
{ name: '标记已读', key: 'markRead', color: '#1989fa', icon: 'eye-o' },
|
|
89
|
+
{ name: '移动到文件夹', key: 'moveToFolder', color: '#07c160', icon: 'folder-o' },
|
|
90
|
+
{ name: '标记重要', key: 'markImportant', color: '#ff976a', icon: 'star-o' }
|
|
91
|
+
])
|
|
92
|
+
|
|
93
|
+
function handleMultiSelectAction(action, selectedIds, selectedItems) {
|
|
94
|
+
switch (action) {
|
|
95
|
+
case 'markRead':
|
|
96
|
+
// 标记已读逻辑
|
|
97
|
+
break
|
|
98
|
+
case 'moveToFolder':
|
|
99
|
+
// 移动到文件夹逻辑
|
|
100
|
+
break
|
|
101
|
+
case 'markImportant':
|
|
102
|
+
// 标记重要逻辑
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 多选功能提示
|
|
110
|
+
|
|
111
|
+
当启用多选功能(`enableMultiSelect: true`)但未进入多选模式时,会在筛选条件下方显示一个提示条:
|
|
112
|
+
|
|
113
|
+
- 提示内容:"长按卡片可进入多选模式"
|
|
114
|
+
- 样式:浅灰色背景,信息图标,友好的提示文字
|
|
115
|
+
- 进入多选模式后,此提示自动消失,显示多选模式提示条
|
|
116
|
+
|
|
117
|
+
### 多选模式下的按钮禁用
|
|
118
|
+
|
|
119
|
+
在多选模式下,以下按钮会被自动禁用:
|
|
120
|
+
|
|
121
|
+
- 新增按钮(add-action-btn)
|
|
122
|
+
- 卡片内的操作按钮(action-button)
|
|
123
|
+
- 卡片底部的操作按钮(action-btn)
|
|
124
|
+
- 更多按钮(⋯)
|
|
125
|
+
|
|
126
|
+
这样可以避免在多选过程中误触发其他操作。
|
|
127
|
+
|
|
128
|
+
## 使用示例
|
|
129
|
+
|
|
130
|
+
### 基础列表
|
|
131
|
+
|
|
132
|
+
```vue
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
const serviceName = 'userService'
|
|
135
|
+
|
|
136
|
+
function handleDetail(item) {
|
|
137
|
+
// 处理详情点击
|
|
138
|
+
}
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<template>
|
|
142
|
+
<XCellList
|
|
143
|
+
config-name="listConfig"
|
|
144
|
+
:service-name="serviceName"
|
|
145
|
+
@to-detail="handleDetail"
|
|
146
|
+
/>
|
|
147
|
+
</template>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 带筛选的表单
|
|
151
|
+
|
|
152
|
+
```vue
|
|
153
|
+
<script setup lang="ts">
|
|
154
|
+
const configName = 'searchForm'
|
|
155
|
+
const serviceName = 'userService'
|
|
156
|
+
const formData = ref({})
|
|
157
|
+
|
|
158
|
+
function handleSubmit(data) {
|
|
159
|
+
console.log('表单提交:', data)
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<template>
|
|
164
|
+
<XFormGroup
|
|
165
|
+
:config-name="configName"
|
|
166
|
+
:service-name="serviceName"
|
|
167
|
+
:group-form-data="formData"
|
|
168
|
+
mode="查询"
|
|
169
|
+
@submit="handleSubmit"
|
|
170
|
+
/>
|
|
171
|
+
</template>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 表单功能(琉璃配置中的需要勾选的新增和修改)
|
|
175
|
+
|
|
176
|
+
```vue
|
|
177
|
+
<script setup lang="ts">
|
|
178
|
+
const configName = 'searchForm'
|
|
179
|
+
const serviceName = 'userService'
|
|
180
|
+
|
|
181
|
+
function addOption() {
|
|
182
|
+
console.log('新增表单')
|
|
183
|
+
}
|
|
184
|
+
function updateRow(item) {
|
|
185
|
+
console.log('修改表单:', item)
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<template>
|
|
190
|
+
<XCellList
|
|
191
|
+
:config-name="configName"
|
|
192
|
+
:service-name="serviceName"
|
|
193
|
+
:custom-add="true"
|
|
194
|
+
:custom-edit="true"
|
|
195
|
+
@update="updateRow"
|
|
196
|
+
@add="addOption"
|
|
197
|
+
/>
|
|
198
|
+
</template>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## API 文档
|
|
202
|
+
|
|
203
|
+
### XCellList Props
|
|
204
|
+
|
|
205
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
206
|
+
| ---------------------- | ---------------------- | ----------- | --------- |
|
|
207
|
+
| configName | 配置名称 | string | - |
|
|
208
|
+
| serviceName | 服务名称 | string | - |
|
|
209
|
+
| fixQueryForm | 固定查询参数 | object | null |
|
|
210
|
+
| idKey | 主键字段 | string | 'o_id' |
|
|
211
|
+
| customAdd | 是否采用自定义新增按钮 | boolean | false |
|
|
212
|
+
| customEdit | 是否采用自定义修改按钮 | boolean | false |
|
|
213
|
+
| **enableMultiSelect** | **是否启用多选功能** | **boolean** | **false** |
|
|
214
|
+
| **multiSelectActions** | **多选操作按钮配置** | **Array** | **[]** |
|
|
215
|
+
|
|
216
|
+
### XCellList Events
|
|
217
|
+
|
|
218
|
+
| 事件名 | 说明 | 回调参数 |
|
|
219
|
+
| --------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- |
|
|
220
|
+
| toDetail | 点击详情时触发 | item: 当前项数据 |
|
|
221
|
+
| add | 点击新增按钮时触发(customAdd为true才会触发) | - |
|
|
222
|
+
| update | 点击修改按钮时触发(customEdit为true才会触发) | item: 当前项数据 |
|
|
223
|
+
| **multiSelectAction** | **多选操作时触发** | **action: 操作key, selectedIds: 选中ID数组, selectedItems: 选中项目数组** |
|
|
224
|
+
| **selectionChange** | **选择状态变化时触发** | **selectedItems: 选中项目数组** |
|
|
225
|
+
|
|
226
|
+
### 多选操作按钮配置
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
interface MultiSelectAction {
|
|
230
|
+
name: string // 按钮显示名称
|
|
231
|
+
key?: string // 操作标识(可选,默认使用name)
|
|
232
|
+
color?: string // 按钮颜色(可选,默认黑色)
|
|
233
|
+
icon?: string // 按钮图标(可选,默认records-o)
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### XFormGroup Props
|
|
238
|
+
|
|
239
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
240
|
+
| ------------- | -------- | -------------------------- | ------ |
|
|
241
|
+
| configName | 配置名称 | string | '' |
|
|
242
|
+
| serviceName | 服务名称 | string | - |
|
|
243
|
+
| groupFormData | 表单数据 | object | {} |
|
|
244
|
+
| mode | 表单模式 | '查询' \| '新增' \| '修改' | '查询' |
|
|
245
|
+
|
|
246
|
+
### XFormItem Props
|
|
247
|
+
|
|
248
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
249
|
+
| --------- | ------------ | ------------ | ------ |
|
|
250
|
+
| attr | 表单项配置 | FormItemAttr | - |
|
|
251
|
+
| form | 表单数据对象 | object | - |
|
|
252
|
+
| mode | 表单模式 | string | '查询' |
|
|
253
|
+
| showLabel | 是否显示标签 | boolean | true |
|
|
254
|
+
|
|
255
|
+
## 配置说明
|
|
256
|
+
|
|
257
|
+
### 列表配置
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
interface ListConfig {
|
|
261
|
+
// 列配置
|
|
262
|
+
columnJson: {
|
|
263
|
+
// 列类型: mobile_header_column | mobile_subtitle_column | mobile_details_column | mobile_footer_column
|
|
264
|
+
mobileColumnType: string
|
|
265
|
+
// 数据字段
|
|
266
|
+
dataIndex: string
|
|
267
|
+
// 标题
|
|
268
|
+
title: string
|
|
269
|
+
// 展示类型
|
|
270
|
+
slotType?: 'badge' | 'action'
|
|
271
|
+
// 操作按钮配置
|
|
272
|
+
actionArr?: Array<{
|
|
273
|
+
text: string
|
|
274
|
+
func: string
|
|
275
|
+
}>
|
|
276
|
+
}[]
|
|
277
|
+
|
|
278
|
+
// 按钮状态
|
|
279
|
+
buttonState: {
|
|
280
|
+
add?: boolean
|
|
281
|
+
edit?: boolean
|
|
282
|
+
delete?: boolean
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// 是否显示排序
|
|
286
|
+
showSortIcon?: boolean
|
|
287
|
+
|
|
288
|
+
// 查询表单配置
|
|
289
|
+
formJson: FormItem[]
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### 表单配置
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
interface FormItem {
|
|
297
|
+
// 表单项类型
|
|
298
|
+
type: 'input' | 'select' | 'date' | 'checkbox' | 'radio' | 'switch' | 'textarea' | 'uploader'
|
|
299
|
+
|
|
300
|
+
// 字段名
|
|
301
|
+
model: string
|
|
302
|
+
|
|
303
|
+
// 标签名
|
|
304
|
+
name: string
|
|
305
|
+
|
|
306
|
+
// 校验规则
|
|
307
|
+
rule?: {
|
|
308
|
+
required: string
|
|
309
|
+
type: 'string' | 'number' | 'integer' | 'float'
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// 占位提示
|
|
313
|
+
placeholder?: string
|
|
314
|
+
|
|
315
|
+
// 数据源配置
|
|
316
|
+
keyName?: string
|
|
317
|
+
|
|
318
|
+
// 是否只读
|
|
319
|
+
readonly?: boolean
|
|
320
|
+
|
|
321
|
+
// 是否禁用
|
|
322
|
+
disabled?: boolean
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## 高级功能
|
|
327
|
+
|
|
328
|
+
### 表单联动
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
// 配置联动显示函数
|
|
332
|
+
const showFormItemFunc = `function(form, attr, data, mode) {
|
|
333
|
+
return form.type === '1'
|
|
334
|
+
}`
|
|
335
|
+
|
|
336
|
+
// 配置值变化函数
|
|
337
|
+
const dataChangeFunc = `function(form, attr, data, mode) {
|
|
338
|
+
if(form.type === '1') {
|
|
339
|
+
form.name = 'test'
|
|
340
|
+
}
|
|
341
|
+
}`
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### 自定义样式
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
// 配置样式函数
|
|
348
|
+
const styleFunctionForValue = `function(value) {
|
|
349
|
+
return {
|
|
350
|
+
color: value > 100 ? 'red' : 'green'
|
|
351
|
+
}
|
|
352
|
+
}`
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## 注意事项
|
|
356
|
+
|
|
357
|
+
1. 配置名称必须与后端配置一致
|
|
358
|
+
2. 表单验证规则需要按照规范配置
|
|
359
|
+
3. 自定义函数需要使用字符串形式
|
|
360
|
+
4. 数据源配置支持多种方式:
|
|
361
|
+
|
|
362
|
+
- logic@: 逻辑处理
|
|
363
|
+
- config@: 配置数据
|
|
364
|
+
- search@: 搜索数据5.对于默认的新增和修改功能,单表已经实现(也可以自定义),多表关联及自定义sql请使用自定义按钮实现
|
|
365
|
+
- 配置按钮状态(customAdd、customEdit)为 true
|
|
366
|
+
- 监听 add 和 update 事件
|
|
367
|
+
- 实现自定义逻辑
|
|
368
|
+
|
|
369
|
+
## 最佳实践
|
|
370
|
+
|
|
371
|
+
1. 合理使用表单分组
|
|
372
|
+
2. 适当配置表单联动
|
|
373
|
+
3. 统一管理配置文件
|
|
374
|
+
4. 做好错误处理
|
|
375
|
+
5. 优化列表性能
|
|
376
|
+
|
|
377
|
+
## 常见问题
|
|
378
|
+
|
|
379
|
+
1. Q: 如何配置自定义校验规则?
|
|
380
|
+
A: 在 rule 中配置 validator 函数
|
|
381
|
+
|
|
382
|
+
2. Q: 如何实现表单联动?
|
|
383
|
+
A: 使用 showFormItemFunc 和 dataChangeFunc 配置联动逻辑
|
|
384
|
+
|
|
385
|
+
3. Q: 如何自定义列表样式?
|
|
386
|
+
A: 使用 styleFunctionForValue 配置样式函数
|
|
387
|
+
|
|
388
|
+
4. **Q: 多选功能如何触发?**
|
|
389
|
+
**A: 长按卡片 500ms 即可进入多选模式**
|
|
390
|
+
|
|
391
|
+
5. **Q: 如何自定义多选操作按钮?**
|
|
392
|
+
**A: 通过 `multiSelectActions` 属性配置,支持自定义名称、颜色和图标**
|
|
393
|
+
|
|
394
|
+
6. **Q: 多选模式下如何选择项目?**
|
|
395
|
+
**A: 点击项目标题可以切换选中状态,点击卡片其他区域不会触发选择**
|
|
396
|
+
|
|
397
|
+
7. **Q: 如何获取选中的项目数据?**
|
|
398
|
+
**A: 监听 `selectionChange` 事件,或通过 `multiSelectAction` 事件获取**
|
|
399
|
+
|
|
400
|
+
## 更新日志
|
|
401
|
+
|
|
402
|
+
### v1.0.0
|
|
403
|
+
|
|
404
|
+
- 初始版本发布
|
|
405
|
+
- 支持基础列表功能
|
|
406
|
+
- 支持表单配置
|
|
407
|
+
|
|
408
|
+
### v1.1.0
|
|
409
|
+
|
|
410
|
+
- 添加表单联动
|
|
411
|
+
- 优化列表性能
|
|
412
|
+
- 修复已知问题
|
|
413
|
+
|
|
414
|
+
## 后续规划
|
|
415
|
+
|
|
416
|
+
1. [ ] 支持更多表单类型
|
|
417
|
+
2. [ ] 添加表单预览功能
|
|
418
|
+
3. [ ] 优化列表性能
|
|
419
|
+
4. [ ] 完善错误处理
|
|
420
|
+
5. [ ] 添加单元测试
|
|
421
|
+
|
|
422
|
+
## 贡献指南
|
|
423
|
+
|
|
424
|
+
欢迎提交 Issue 和 PR,请遵循以下规范:
|
|
425
|
+
|
|
426
|
+
1. 遵循代码规范
|
|
427
|
+
2. 添加必要的测试
|
|
428
|
+
3. 更新相关文档
|
|
429
|
+
|
|
430
|
+
## 许可证
|
|
431
|
+
|
|
432
|
+
MIT License
|