vue2-client 1.16.13 → 1.16.15

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": "vue2-client",
3
- "version": "1.16.13",
3
+ "version": "1.16.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -174,8 +174,12 @@ export default {
174
174
  this.getOptions(item, formDataContext)
175
175
  }
176
176
  },
177
- // 批量设置所有表单值
177
+ // 批量设置所有表单值
178
178
  setAllFormsData (dataList) {
179
+ // 确保有足够多的表单实例来容纳所有数据
180
+ while (this.formInstances.length < dataList.length) {
181
+ this.addFormInstance()
182
+ }
179
183
  dataList.forEach((data, index) => {
180
184
  if (this.formInstances[index]) {
181
185
  Object.assign(this.formInstances[index].formData, data)
@@ -328,13 +332,13 @@ export default {
328
332
  </a-col>
329
333
  </a-row>
330
334
  </a-form-model>
331
- <a-divider v-if="config.manyForm && formIndex < formInstances.length - 1" />
335
+ <a-divider style="margin: 10px" v-if="config.manyForm && formIndex < formInstances.length - 1" />
332
336
  </div>
333
337
 
334
338
  <!-- 全局添加/删除按钮,只在所有表单实例之后显示 -->
335
339
  <a-row v-if="config.manyForm" type="flex" justify="start" style="margin-top: 20px; gap: 10px;">
336
340
  <a-button v-if="config.showAddButton" class="form-action-button" icon="plus" @click="addFormInstance"></a-button>
337
- <a-button v-if="config.showDeleteButton && formInstances.length > 1" class="form-action-button" icon="minus" @click="deleteFormInstance(formInstances[formInstances.length - 1].id)"></a-button>
341
+ <a-button v-if="config.showDeleteButton && formInstances.length > 1" class="form-action-button" style="margin-left: 0px" icon="minus" @click="deleteFormInstance(formInstances[formInstances.length - 1].id)"></a-button>
338
342
  </a-row>
339
343
 
340
344
  <a-row v-if="config.showSubmitBtn" type="flex" justify="start" style="margin-top: 20px;">
@@ -351,13 +355,13 @@ export default {
351
355
  // 基础样式,对应 defaultForm
352
356
  &.h-add-native-form-defaultForm {
353
357
  padding: 0px;
354
- background-color: #fff;
358
+ // background-color: #fff;
355
359
  border-radius: 8px;
356
360
  }
357
361
  }
358
362
 
359
363
  .form-instance-wrapper {
360
- margin-bottom: 20px;
364
+ margin-bottom: 0px;
361
365
  /* 移除边框和背景色,使其看起来像一个整体 */
362
366
  /* border: 1px solid #e8e8e8;
363
367
  border-radius: 4px;
@@ -382,6 +386,7 @@ export default {
382
386
  display: flex;
383
387
  justify-content: center;
384
388
  align-items: center;
389
+ margin-left: 95px;
385
390
 
386
391
  &:hover {
387
392
  border-color: #40a9ff; /* 鼠标悬停时边框颜色 */
@@ -408,10 +413,10 @@ export default {
408
413
  }
409
414
 
410
415
  :deep(.ant-form-item) {
411
- margin-bottom: 16px; // 增加表单项间距
416
+ margin-bottom: 5px; // 增加表单项间距
412
417
  display: flex;
413
418
  flex-direction: column;
414
- margin-left: 120px;
419
+ margin-left: 95px;
415
420
  }
416
421
 
417
422
  :deep(.ant-form-item-label) {
@@ -35,7 +35,8 @@ const isCustomPagination = computed(() => props.tableStyle === 'custom-paginatio
35
35
 
36
36
  <template>
37
37
  <div
38
- class="h-form-table-wrapper" :class="[
38
+ class="h-form-table-wrapper"
39
+ :class="[
39
40
  `h-form-table-${tableStyle}`,
40
41
  {
41
42
  [`h-form-table-${topStyle}`]: ['top-hidden'].includes(topStyle),
@@ -182,6 +182,10 @@ defineExpose({
182
182
  position: relative;
183
183
  padding-left: 18px !important;
184
184
  margin-right: 20px !important;
185
+ display: inline-flex !important; // 使用inline-flex保持水平布局
186
+ align-items: center !important; // 确保内容垂直居中
187
+ line-height: normal !important; // 重置line-height避免冲突
188
+ vertical-align: top !important; // 确保垂直对齐
185
189
  }
186
190
  :deep(.ant-tabs-tab::before) {
187
191
  content: "" !important;
@@ -194,8 +198,14 @@ defineExpose({
194
198
  background: #0057FE !important;
195
199
  border-radius: 50% !important;
196
200
  display: block !important;
201
+ z-index: 1 !important; // 确保圆点在最上层
202
+ }
203
+ :deep(.ant-tabs-nav) {
204
+ display: flex !important;
205
+ flex-direction: row !important; // 明确指定水平方向
206
+ flex-wrap: nowrap !important;
207
+ align-items: center !important; // 确保导航栏垂直居中
197
208
  }
198
- :deep(.ant-tabs-nav) { display: flex !important; flex-wrap: nowrap !important; }
199
209
  }
200
210
  }
201
211
  // 用户词条使用样式
@@ -0,0 +1,275 @@
1
+ # XCharge 支付组件使用文档
2
+
3
+ ## 概述
4
+
5
+ `XCharge` 用于门诊/收费等场景的支付方式选择与金额录入:
6
+ - 支持单选支付与混合支付(多选)。
7
+ - 支付详情仅展示“金额”输入框;每种方式的字段名可通过配置映射。
8
+ - 自动汇总总支付金额并通过事件抛出。
9
+
10
+ ## 组件引入
11
+
12
+ ```vue
13
+ <x-charge
14
+ :queryParamsName="'chargeConfig'"
15
+ :parameter="{ registerId: 'xxx' }"
16
+ @method="onMethod"
17
+ @methods="onMethods"
18
+ @totalPaymentAmount="onTotal"
19
+ @action="onAction"
20
+ />
21
+ ```
22
+
23
+ ### Props
24
+ - `queryParamsName: string`:后端/配置平台上的配置名。
25
+ - `parameter: object`:拉取数据源逻辑时传入的参数(可选)。
26
+
27
+ ## 配置结构(Schema)
28
+
29
+ ```ts
30
+ interface ChargeConfig {
31
+ amountFields: Array<{ field: string; label: string; disabled?: boolean }>
32
+ paymentMethods: Array<{ key: string; label: string; amountLabel?: string }>
33
+ bottomFields: Array<{ field: string; label: string; disabled?: boolean }>
34
+ actionButtons: Array<{ key: string; label: string; icon?: string }>
35
+ enableMixedPayment: boolean
36
+ // 新增:金额字段名称映射(优先级最高)
37
+ paymentAmountLabels?: Record<string, string> // e.g. { '现金': '现金金额' }
38
+ // 可选:事件名覆写
39
+ eventNames?: {
40
+ method?: string
41
+ methods?: string
42
+ totalPaymentAmount?: string
43
+ action?: string
44
+ }
45
+ // 可选:数据源逻辑名(通过 runLogic 拉取初始数据)
46
+ dataSourceConfig?: string
47
+ }
48
+ ```
49
+
50
+ ### 字段含义
51
+ - `amountFields`:顶部金额信息区(展示型/输入型混合,按配置 `disabled` 控制)。
52
+ - `paymentMethods`:支付方式列表,展示在方式选择区。可为每项配置 `amountLabel` 作为金额输入框的名称。
53
+ - 金额字段名称:优先使用 `paymentMethods[].amountLabel`;未配置时回退为“{支付方式}金额”。(已移除 `paymentAmountLabels` 配置)
54
+ - `bottomFields`:底部金额与辅助字段区(如账户余额、实收、找零)。
55
+ - `actionButtons`:底部操作按钮(收费/退费/打印等)。
56
+ - `enableMixedPayment`:是否启用混合支付(true=多选;false=单选)。
57
+ - `eventNames`:对外抛出事件名的自定义(默认见下)。
58
+ - `dataSourceConfig`:用于通过 `runLogic` 拉取初始数据的逻辑名。
59
+
60
+ ### 最小配置示例
61
+ ```js
62
+ {
63
+ enableMixedPayment: true,
64
+ paymentMethods: [
65
+ { key: '医保卡', label: '医保卡' },
66
+ { key: '微信/支付宝', label: '微信/支付宝' },
67
+ { key: '银行卡', label: '银行卡' },
68
+ { key: '现金', label: '现金' }
69
+ ],
70
+ paymentAmountLabels: {
71
+ '现金': '现金金额',
72
+ '医保卡': '医保支付金额'
73
+ },
74
+ amountFields: [
75
+ { field: 'f_amount', label: '费用总额' }
76
+ ],
77
+ bottomFields: [
78
+ { field: 'received', label: '实收' },
79
+ { field: 'change', label: '找零' }
80
+ ],
81
+ actionButtons: [
82
+ { key: 'charge', label: '收费', icon: 'check' }
83
+ ]
84
+ }
85
+ ```
86
+
87
+ ## 关键事件
88
+
89
+ - `@method(value: string)`:单选/主方式变更(向后兼容)。
90
+ - `@methods(values: string[])`:混合支付方式列表变更。
91
+ - `@totalPaymentAmount(total: number)`:支付金额合计变更。
92
+ - `@paymentAmountChange(payload: { method: string; amount: number })`:任意单个支付方式金额变更。
93
+ - `@action(payload: ActionPayload)`:点击底部操作按钮时触发。
94
+
95
+ ```ts
96
+ interface ActionPayload {
97
+ key: string // 按钮 key
98
+ data: Record<string, any> // 页面顶部/底部的数据对象
99
+ method: string // 当前主方式(兼容字段)
100
+ mixedPayment: {
101
+ selectedMethods: string[]
102
+ paymentAmounts: Record<string, number>
103
+ totalPaymentAmount: number
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## 交互与展示规则
109
+
110
+ - 支付详情区只显示金额输入框;每种方式的标签来自:
111
+ 1) `paymentMethods[].amountLabel`
112
+ 2) 回退为“{支付方式}金额”。
113
+ - 混合支付:已选方式的金额输入框横向同一行展示,超出可横向滚动。
114
+ - 单一支付:同一行展示一个金额输入。
115
+ - 边框与卡片背景均已移除,样式与底部区域保持一致、简洁。
116
+
117
+ ## 使用代码示例
118
+
119
+ ```vue
120
+ <template>
121
+ <x-charge
122
+ :queryParamsName="'testChargeConfig'"
123
+ :parameter="{ visitId: '123' }"
124
+ @method="onMethod"
125
+ @methods="onMethods"
126
+ @totalPaymentAmount="onTotal"
127
+ @action="onAction"
128
+ />
129
+ </template>
130
+
131
+ <script>
132
+ export default {
133
+ methods: {
134
+ onMethod(value) { console.log('主方式:', value) },
135
+ onMethods(values) { console.log('已选方式:', values) },
136
+ onTotal(total) { console.log('合计金额:', total) },
137
+ onAction(payload) { console.log('动作数据:', payload) }
138
+ }
139
+ }
140
+ </script>
141
+ ```
142
+
143
+ ## 内置数据/计算
144
+
145
+ - `paymentAmounts: Record<string, number>`:各支付方式金额,输入变更自动更新。
146
+ - 自动计算 `data.totalPaymentAmount` 并通过事件抛出。
147
+
148
+ ## 注意事项
149
+
150
+ - 若使用混合支付,请确保 `paymentMethods` 的 `key` 唯一且与 `paymentAmountLabels` 中的键一致。
151
+ - 仅金额字段参与总额计算;备注、状态等已从 UI 中移除(如需扩展,可在底部区域或外层表单自行补充)。
152
+ - 配置缺失或数据源异常时组件会启用默认数据以保障可用性。
153
+ # XCharge 混合支付组件
154
+
155
+ ## 功能特性
156
+
157
+ ### 1. 配置控制混合支付
158
+ - 通过 `enableMixedPayment` 配置项控制是否启用混合支付
159
+ - 支持单选模式(传统)和混合支付模式(多选)
160
+
161
+ ### 2. 混合支付模式
162
+ - 支持多种支付方式同时选择
163
+ - 每种支付方式可单独设置金额、备注、状态
164
+ - 自动计算总支付金额
165
+ - 支持动态添加/移除支付方式
166
+
167
+ ### 3. 单选模式(向后兼容)
168
+ - 保持原有的单选支付方式
169
+ - 完全兼容现有配置和代码
170
+
171
+ ## 配置示例
172
+
173
+ ### 启用混合支付
174
+ ```javascript
175
+ {
176
+ enableMixedPayment: true,
177
+ paymentMethods: [
178
+ { key: "医保卡", label: "医保卡" },
179
+ { key: "微信/支付宝", label: "微信/支付宝" },
180
+ { key: "银行卡", label: "银行卡" },
181
+ { key: "现金", label: "现金" }
182
+ ],
183
+ // ... 其他配置
184
+ }
185
+ ```
186
+
187
+ ### 禁用混合支付(单选模式)
188
+ ```javascript
189
+ {
190
+ enableMixedPayment: false,
191
+ paymentMethods: [
192
+ { key: "医保卡", label: "医保卡" },
193
+ { key: "现金", label: "现金" }
194
+ ],
195
+ // ... 其他配置
196
+ }
197
+ ```
198
+
199
+ ## 事件
200
+
201
+ ### 单选模式事件
202
+ - `@method`: 支付方式选择事件
203
+ - `@action`: 操作按钮点击事件
204
+
205
+ ### 混合支付模式事件
206
+ - `@method`: 主要支付方式选择事件(向后兼容)
207
+ - `@methods`: 多选支付方式变化事件
208
+ - `@totalPaymentAmount`: 总支付金额变化事件
209
+ - `@action`: 操作按钮点击事件(包含混合支付数据)
210
+
211
+ ## 数据结构
212
+
213
+ ### 混合支付数据结构
214
+ ```javascript
215
+ {
216
+ selectedMethods: ['医保卡', '微信/支付宝'],
217
+ paymentAmounts: { '医保卡': 50, '微信/支付宝': 30 },
218
+ paymentNotes: { '医保卡': '医保支付', '微信/支付宝': '扫码支付' },
219
+ paymentStatus: { '医保卡': 'paid', '微信/支付宝': 'pending' },
220
+ totalPaymentAmount: 80
221
+ }
222
+ ```
223
+
224
+ ## 使用示例
225
+
226
+ ```vue
227
+ <template>
228
+ <x-charge
229
+ :queryParamsName="'chargeConfig'"
230
+ :data="chargeData"
231
+ @method="handleMethod"
232
+ @methods="handleMethods"
233
+ @totalPaymentAmount="handleTotalAmount"
234
+ @action="handleAction"
235
+ />
236
+ </template>
237
+
238
+ <script>
239
+ export default {
240
+ methods: {
241
+ handleMethod(value) {
242
+ console.log('单选支付方式:', value)
243
+ },
244
+ handleMethods(methods) {
245
+ console.log('多选支付方式:', methods)
246
+ },
247
+ handleTotalAmount(amount) {
248
+ console.log('总支付金额:', amount)
249
+ },
250
+ handleAction(actionData) {
251
+ if (actionData.mixedPayment) {
252
+ console.log('混合支付数据:', actionData.mixedPayment)
253
+ } else {
254
+ console.log('单选支付数据:', actionData.method)
255
+ }
256
+ }
257
+ }
258
+ }
259
+ </script>
260
+ ```
261
+
262
+ ## 修复的问题
263
+
264
+ 1. **方法名冲突**: 修复了XChargeDemo中`totalPaymentAmount`方法名与数据属性冲突
265
+ 2. **配置访问安全**: 添加了计算属性`isMixedPaymentEnabled`来安全访问配置
266
+ 3. **空值检查**: 所有配置访问都添加了空值检查,避免运行时错误
267
+ 4. **事件处理**: 改进了事件处理逻辑,支持单选和混合支付两种模式
268
+ 5. **向后兼容**: 确保所有原有功能完全兼容
269
+
270
+ ## 测试建议
271
+
272
+ 1. 测试单选模式下的正常功能
273
+ 2. 测试混合支付模式下的多选功能
274
+ 3. 测试配置切换时的状态清理
275
+ 4. 测试各种边界情况(空配置、无效数据等)