@tplc/business 0.4.145 → 0.4.147

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.4.147](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.91...v0.4.147) (2025-06-28)
6
+
7
+ ### [0.4.146](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.88...v0.4.146) (2025-06-27)
8
+
5
9
  ### [0.4.145](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.137...v0.4.145) (2025-06-26)
6
10
 
7
11
 
@@ -1,58 +1,15 @@
1
1
  <template>
2
2
  <lcb-block v-bind="$props">
3
- <wd-form custom-class="lcb-form" ref="formRef" :model="form">
3
+ <wd-form :custom-class="`lcb-form ${vertical ? 'vertical' : ''}`" ref="formRef" :model="form">
4
4
  <wd-cell-group border>
5
5
  <block v-for="field in fields" :key="field.entryFormFieldConfigId">
6
- <wd-input
7
- v-if="field.frontInputType === 'input'"
8
- :placeholder="field.frontPlaceholder || t('请输入') + field.fieldCustomName"
9
- v-model="form[field.field]"
10
- :label="field.fieldCustomName"
11
- :required="field.requiredFlag"
12
- :prop="field.field"
13
- :rules="field.requiredFlag ? [{ required: true, message: t('内容不能为空') }] : []"
14
- v-bind="field.props"
15
- />
16
- <wd-textarea
17
- v-else-if="field.frontInputType === 'inputArea'"
18
- :placeholder="field.frontPlaceholder || t('请输入') + field.fieldCustomName"
19
- v-model="form[field.field]"
20
- :label="field.fieldCustomName"
21
- :required="field.requiredFlag"
22
- :prop="field.field"
23
- :rules="field.requiredFlag ? [{ required: true, message: t('内容不能为空') }] : []"
24
- v-bind="field.props"
25
- />
26
- <wd-picker
27
- v-else-if="field.frontInputType === 'selector'"
28
- :columns="getColumns(field.frontInputContent)"
29
- :label="field.fieldCustomName"
30
- v-model="form[field.field]"
31
- :required="field.requiredFlag"
32
- :prop="field.field"
33
- :rules="field.requiredFlag ? [{ required: true, message: t('内容不能为空') }] : []"
34
- v-bind="field.props"
35
- />
36
- <wd-datetime-picker
37
- v-else-if="field.frontInputType === 'date'"
38
- :label="field.fieldCustomName"
39
- v-model="form[field.field]"
40
- :required="field.requiredFlag"
41
- :prop="field.field"
42
- :type="getDateType(field.frontInputTypeValue)"
43
- :rules="field.requiredFlag ? [{ required: true, message: t('内容不能为空') }] : []"
44
- v-bind="{
45
- ...field.props,
46
- ...getDateOptions(field.frontInputContent),
47
- }"
48
- />
49
6
  <!-- radio -->
50
7
  <wd-cell
51
- v-else
52
8
  :title="field.fieldCustomName"
53
9
  :required="field.requiredFlag"
54
10
  :prop="field.field"
55
- title-width="230rpx"
11
+ :title-width="!vertical ? '230rpx' : '100%'"
12
+ :vertical="vertical"
56
13
  :rules="
57
14
  field.requiredFlag
58
15
  ? [
@@ -64,11 +21,40 @@
64
21
  : []
65
22
  "
66
23
  >
24
+ <wd-input
25
+ v-if="field.frontInputType === 'input'"
26
+ :placeholder="field.frontPlaceholder || t('请输入') + field.fieldCustomName"
27
+ v-model="form[field.field]"
28
+ v-bind="field.props"
29
+ no-border
30
+ />
31
+ <wd-textarea
32
+ v-else-if="field.frontInputType === 'inputArea'"
33
+ :placeholder="field.frontPlaceholder || t('请输入') + field.fieldCustomName"
34
+ v-model="form[field.field]"
35
+ v-bind="field.props"
36
+ />
37
+
38
+ <wd-picker
39
+ v-else-if="field.frontInputType === 'selector'"
40
+ :columns="getColumns(field.frontInputContent)"
41
+ v-model="form[field.field]"
42
+ v-bind="field.props"
43
+ />
44
+ <wd-datetime-picker
45
+ v-else-if="field.frontInputType === 'date'"
46
+ v-model="form[field.field]"
47
+ :type="getDateType(field.frontInputTypeValue)"
48
+ v-bind="{
49
+ ...field.props,
50
+ ...getDateOptions(field.frontInputContent),
51
+ }"
52
+ />
67
53
  <wd-radio-group
68
- v-if="field.frontInputType === 'radio'"
54
+ v-else-if="field.frontInputType === 'radio'"
69
55
  v-model="form[field.field]"
70
56
  v-bind="field.props"
71
- inline
57
+ :inline="!vertical"
72
58
  shape="dot"
73
59
  >
74
60
  <wd-radio
@@ -78,6 +64,17 @@
78
64
  >
79
65
  {{ item }}
80
66
  </wd-radio>
67
+ <template v-if="field.frontInputTypeValue === '1'">
68
+ <wd-radio :value="customField" key="custom">其他</wd-radio>
69
+ <view class="custom-input" v-if="form[field.field] === customField">
70
+ <wd-input
71
+ :placeholder="`请输入自定义内容`"
72
+ v-model="customInputs[field.field]"
73
+ size="small"
74
+ :no-border="true"
75
+ />
76
+ </view>
77
+ </template>
81
78
  </wd-radio-group>
82
79
  <wd-radio-group
83
80
  v-else-if="field.frontInputType === 'radioTag'"
@@ -92,6 +89,17 @@
92
89
  >
93
90
  {{ item }}
94
91
  </wd-radio>
92
+ <template v-if="field.frontInputTypeValue === '1'">
93
+ <wd-radio :value="customField" key="custom">其他</wd-radio>
94
+ <view class="custom-input" v-if="form[field.field] === customField">
95
+ <wd-input
96
+ :placeholder="`请输入自定义内容`"
97
+ v-model="customInputs[field.field]"
98
+ size="small"
99
+ :no-border="true"
100
+ />
101
+ </view>
102
+ </template>
95
103
  </wd-radio-group>
96
104
  <!-- checkbox -->
97
105
  <wd-checkbox-group
@@ -103,9 +111,23 @@
103
111
  v-for="item in getColumns(field.frontInputContent)"
104
112
  :key="item"
105
113
  :modelValue="item"
114
+ shape="square"
106
115
  >
107
116
  {{ item }}
108
117
  </wd-checkbox>
118
+ <template v-if="field.frontInputTypeValue === '1'">
119
+ <wd-checkbox :modelValue="customField" key="custom" shape="square">
120
+ 其他
121
+ </wd-checkbox>
122
+ <view class="custom-input" v-if="form[field.field]?.includes(customField)">
123
+ <wd-input
124
+ :placeholder="`请输入自定义内容`"
125
+ v-model="customInputs[field.field]"
126
+ size="small"
127
+ :no-border="true"
128
+ />
129
+ </view>
130
+ </template>
109
131
  </wd-checkbox-group>
110
132
  <!-- checkboxTag -->
111
133
  <wd-checkbox-group
@@ -113,6 +135,7 @@
113
135
  v-model="form[field.field]"
114
136
  v-bind="field.props"
115
137
  shape="button"
138
+ custom-class="checkbox-group-button"
116
139
  >
117
140
  <wd-checkbox
118
141
  v-for="item in getColumns(field.frontInputContent)"
@@ -121,6 +144,19 @@
121
144
  >
122
145
  {{ item }}
123
146
  </wd-checkbox>
147
+ <template v-if="field.frontInputTypeValue === '1'">
148
+ <wd-checkbox :modelValue="customField" key="custom" shape="square">
149
+ 其他
150
+ </wd-checkbox>
151
+ <view class="custom-input" v-if="form[field.field]?.includes(customField)">
152
+ <wd-input
153
+ :placeholder="`请输入自定义内容`"
154
+ v-model="customInputs[field.field]"
155
+ size="small"
156
+ :no-border="true"
157
+ />
158
+ </view>
159
+ </template>
124
160
  </wd-checkbox-group>
125
161
  <wd-upload
126
162
  v-else-if="field.frontInputType === 'img'"
@@ -191,23 +227,34 @@ const props = withDefaults(defineProps<LcbFormProps>(), {
191
227
  submitText: '提交',
192
228
  affirmText: '同意',
193
229
  bottomFixed: true,
230
+ vertical: false,
194
231
  })
195
232
  const fields = ref<LcbFormField[]>()
233
+ const customInputs = ref<Record<string, string>>({})
234
+ const customField = 'custom'
196
235
  watch(
197
236
  () => props.formType,
198
237
  async (newVal) => {
199
238
  if (newVal) {
200
239
  const {
201
- data: { entryFormFieldConfigList },
240
+ data: { entryFormFieldConfigList = [], extra = '{}' },
202
241
  } = await uni.$lcb.http.post<any>('/entryFormCustom/detail', {
203
242
  entryFormConfigId: newVal,
204
243
  })
244
+ const extraData = JSON.parse(extra)
245
+ customInputs.value = extraData
246
+
205
247
  entryFormFieldConfigList.forEach((item) => {
206
248
  if (item.value) {
207
249
  if (item.frontInputType === 'img') {
208
250
  imgList.value[item.field] = [{ url: item.value }]
209
251
  } else if (item.frontInputType === 'checkboxTag' || item.frontInputType === 'checkbox') {
210
- form.value[item.field] = JSON.parse(item.value)
252
+ const values = JSON.parse(item.value)
253
+ form.value[item.field] = values.map((val) =>
254
+ val === extraData[item.field] ? customField : val,
255
+ )
256
+ } else if (item.frontInputType === 'radioTag' || item.frontInputType === 'radio') {
257
+ form.value[item.field] = extraData[item.field] === item.value ? customField : item.value
211
258
  } else if (item.frontInputType === 'date') {
212
259
  switch (item.frontInputTypeValue) {
213
260
  case 'day':
@@ -244,7 +291,10 @@ const submit = () => {
244
291
  }
245
292
  formRef.value.validate().then(async ({ valid }) => {
246
293
  if (!valid) return
294
+
247
295
  if (props.submitUrl) {
296
+ // 用户自定义内容集合
297
+ const extra = {}
248
298
  const values = fields.value?.reduce((acc, cur) => {
249
299
  if (cur.frontInputType === 'date') {
250
300
  switch (cur.frontInputTypeValue) {
@@ -259,13 +309,34 @@ const submit = () => {
259
309
  break
260
310
  }
261
311
  } else {
262
- acc[cur.field] = form.value[cur.field]
312
+ const customValue = customInputs.value[cur.field] || ''
313
+ let fieldValue = form.value[cur.field]
314
+
315
+ // 处理自定义输入值
316
+ if (['radio', 'radioTag'].includes(cur.frontInputType) && fieldValue === customField) {
317
+ fieldValue = customValue
318
+ extra[cur.field] = customValue
319
+ } else if (
320
+ ['checkbox', 'checkboxTag'].includes(cur.frontInputType) &&
321
+ Array.isArray(fieldValue)
322
+ ) {
323
+ const haveCustom = fieldValue.includes(customField)
324
+ if (haveCustom) {
325
+ extra[cur.field] = customValue
326
+ }
327
+ fieldValue = [...fieldValue, haveCustom ? customValue : '']
328
+ .map((val) => (val === customField ? '' : val))
329
+ .filter((val) => val !== '')
330
+ }
331
+
332
+ acc[cur.field] = fieldValue
263
333
  }
264
334
  return acc
265
335
  }, {})
266
336
  await uni.$lcb.http.post(props.submitUrl, {
267
337
  entryFormConfigId: props.formType,
268
338
  allField: JSON.stringify(values),
339
+ extra: JSON.stringify(extra),
269
340
  })
270
341
  }
271
342
  })
@@ -302,25 +373,70 @@ watch(
302
373
  line-height: inherit !important;
303
374
  padding: 0px !important;
304
375
  margin: 0px !important;
376
+ .wd-radio__label {
377
+ margin-right: 8rpx;
378
+ max-width: 100% !important;
379
+ height: auto !important;
380
+ text-align: left !important;
381
+ white-space: break-spaces !important;
382
+ }
305
383
  }
306
384
  :deep(.wd-radio-group) {
307
385
  text-align: left !important;
308
386
  display: flex;
309
387
  flex-wrap: wrap;
310
- gap: 8rpx;
388
+ gap: 24rpx;
389
+ // flex-direction: column;
311
390
  }
312
391
  :deep(.wd-checkbox) {
313
392
  line-height: inherit !important;
314
393
  padding: 0px !important;
315
394
  margin: 0px !important;
316
395
  }
396
+ :deep(.wd-checkbox.is-button-box) {
397
+ width: 32%;
398
+ }
317
399
  :deep(.wd-checkbox-group) {
318
400
  text-align: left !important;
319
401
  display: flex;
320
402
  flex-wrap: wrap;
321
403
  gap: 8rpx;
404
+ // flex-direction: column;
405
+ }
406
+ :deep(.wd-picker) {
407
+ .wd-picker__cell {
408
+ padding: 0;
409
+ &:after {
410
+ display: none !important;
411
+ }
412
+ }
413
+ }
414
+ :deep(.wd-textarea) {
415
+ padding: 0;
322
416
  }
323
417
  }
418
+
419
+ .vertical {
420
+ :deep(.wd-checkbox-group) {
421
+ flex-direction: column;
422
+ .wd-checkbox__txt {
423
+ white-space: break-spaces;
424
+ }
425
+ .wd-checkbox {
426
+ display: flex;
427
+ }
428
+ .is-square {
429
+ margin-top: 10rpx;
430
+ }
431
+ .wd-checkbox__label {
432
+ flex: 1;
433
+ }
434
+ }
435
+ :deep(.checkbox-group-button) {
436
+ flex-direction: row;
437
+ }
438
+ }
439
+
324
440
  .bottom-fixed {
325
441
  position: fixed;
326
442
  bottom: 0;
@@ -330,4 +446,12 @@ watch(
330
446
  z-index: 5;
331
447
  box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
332
448
  }
449
+ .custom-input {
450
+ margin-top: 8rpx;
451
+ width: 100%;
452
+ border: 1rpx solid #e5e5e5;
453
+ border-radius: 4rpx;
454
+ padding: 8rpx;
455
+ box-sizing: border-box;
456
+ }
333
457
  </style>
@@ -80,4 +80,5 @@ export interface LcbFormProps extends LcbBlockProps {
80
80
  affirmText?: string
81
81
  // 底部悬浮
82
82
  bottomFixed?: boolean
83
+ vertical?: boolean
83
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.145",
3
+ "version": "0.4.147",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "vue": ">=3.2.47",
14
- "@tplc/wot": "0.1.87"
14
+ "@tplc/wot": "0.1.91"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=18",
@@ -6,6 +6,7 @@ declare const _default: import('vue').DefineComponent<
6
6
  submitText: string
7
7
  affirmText: string
8
8
  bottomFixed: boolean
9
+ vertical: boolean
9
10
  }
10
11
  >,
11
12
  {},
@@ -25,11 +26,13 @@ declare const _default: import('vue').DefineComponent<
25
26
  submitText: string
26
27
  affirmText: string
27
28
  bottomFixed: boolean
29
+ vertical: boolean
28
30
  }
29
31
  >
30
32
  >
31
33
  >,
32
34
  {
35
+ vertical: boolean
33
36
  submitText: string
34
37
  affirmText: string
35
38
  bottomFixed: boolean
@@ -78,4 +78,5 @@ export interface LcbFormProps extends LcbBlockProps {
78
78
  agreementType?: string
79
79
  affirmText?: string
80
80
  bottomFixed?: boolean
81
+ vertical?: boolean
81
82
  }