@tplc/business 0.3.93 → 0.3.94

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,25 @@
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.3.94](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.71...v0.3.94) (2025-03-21)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.1.72 ([400430d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/400430db387cf82e0c0e6f216c1ccd995b137f82))
11
+ * **release:** 0.3.91 ([5802f24](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5802f24980a6fb4cfebf7a048e5d19e0dba8baf0))
12
+ * **release:** 0.3.92 ([07fa5e8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/07fa5e82f05b7d5c2d2d53c9bd4a500f00c3fa6a))
13
+ * **release:** 0.3.93 ([7561a9b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7561a9be483cda4c50ef7ae4fabd8df5fe7729d7))
14
+
15
+
16
+ ### ✨ Features | 新功能
17
+
18
+ * search ([44a5a00](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/44a5a00c99e269fe73650afb3428f1fb799b215b))
19
+ * 搜索支持输入 ([345275a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/345275a417f3399739c512d628796d163862f0cc))
20
+ * 支持搜索输入 ([048387b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/048387bde999bec89539232dfc4bdff9fd68b54e))
21
+ * 新增字段 ([efedb08](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/efedb08a1c3a01b4f2a61ad1a5a5b15168e59119))
22
+ * 背景颜色 ([422624c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/422624c66c8ed859dcbe228541b777d7aa4edcc1))
23
+
5
24
  ### [0.3.93](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.92...v0.3.93) (2025-03-20)
6
25
 
7
26
 
@@ -5,7 +5,7 @@
5
5
  <wd-popup closable position="center" custom-class="!bg-transparent" v-model="show">
6
6
  <view class="agreement-popup">
7
7
  <view class="title">{{ data?.name }}</view>
8
- <view class="max-h-60vh overflow-y-auto">
8
+ <view class="max-h-60vh overflow-y-auto w-full">
9
9
  <mpHtml :content="data?.content" />
10
10
  </view>
11
11
  </view>
@@ -45,18 +45,22 @@
45
45
  "
46
46
  v-bind="field.props"
47
47
  />
48
- <wd-calendar
48
+ <wd-datetime-picker
49
49
  v-else-if="field.frontInputType === 'date'"
50
50
  :label="field.fieldCustomName"
51
51
  v-model="form[field.field]"
52
52
  :required="field.requiredFlag"
53
53
  :prop="field.field"
54
+ :type="getDateType(field.frontInputTypeValue)"
54
55
  :rules="
55
56
  field.requiredFlag
56
57
  ? [{ required: true, message: t('请选择') + field.fieldCustomName }]
57
58
  : []
58
59
  "
59
- v-bind="field.props"
60
+ v-bind="{
61
+ ...field.props,
62
+ ...getDateOptions(field.frontInputContent),
63
+ }"
60
64
  />
61
65
  <!-- radio -->
62
66
  <wd-cell
@@ -95,18 +99,48 @@
95
99
  {{ item }}
96
100
  </wd-radio>
97
101
  </wd-radio-group>
102
+ <!-- checkbox -->
103
+ <wd-checkbox-group
104
+ v-else-if="field.frontInputType === 'checkbox'"
105
+ v-model="form[field.field]"
106
+ v-bind="field.props"
107
+ >
108
+ <wd-checkbox
109
+ v-for="item in getColumns(field.frontInputContent)"
110
+ :key="item"
111
+ :modelValue="item"
112
+ >
113
+ {{ item }}
114
+ </wd-checkbox>
115
+ </wd-checkbox-group>
116
+ <!-- checkboxTag -->
117
+ <wd-checkbox-group
118
+ v-else-if="field.frontInputType === 'checkboxTag'"
119
+ v-model="form[field.field]"
120
+ v-bind="field.props"
121
+ shape="button"
122
+ >
123
+ <wd-checkbox
124
+ v-for="item in getColumns(field.frontInputContent)"
125
+ :key="item"
126
+ :modelValue="item"
127
+ >
128
+ {{ item }}
129
+ </wd-checkbox>
130
+ </wd-checkbox-group>
98
131
  <wd-upload
99
132
  v-else-if="field.frontInputType === 'img'"
100
133
  :label="field.fieldCustomName"
101
134
  accept="image"
102
135
  :limit="1"
136
+ v-model:file-list="imgList[field.field]"
103
137
  :upload-method="customUpload"
104
138
  v-bind="field.props"
105
139
  />
106
140
  </wd-cell>
107
141
  </block>
108
142
  </wd-cell-group>
109
- <view class="text-center text-3 mt-6" v-if="agreementType">
143
+ <view class="text-center text-3 mt-6" v-if="agreementType && fields">
110
144
  <wd-checkbox v-model="form.agreement">
111
145
  <view class="flex">
112
146
  <text>{{ t('同意') }}</text>
@@ -118,7 +152,14 @@
118
152
  </view>
119
153
  </wd-checkbox>
120
154
  </view>
121
- <wd-button type="primary" @click="submit" block size="large" class="!w-90% my-3">
155
+ <wd-button
156
+ type="primary"
157
+ @click="submit"
158
+ block
159
+ size="large"
160
+ custom-class="!w-90% my-3"
161
+ v-if="fields"
162
+ >
122
163
  {{ t(submitText) }}
123
164
  </wd-button>
124
165
  </wd-form>
@@ -130,6 +171,7 @@ import { ref, watch } from 'vue'
130
171
  import { LcbFormField, LcbFormProps } from './types'
131
172
  import { customUpload } from '../../utils/utils'
132
173
  import { useTranslate } from '@tplc/wot'
174
+ import { DateTimeType } from '@tplc/wot/types/components/wd-datetime-picker-view/types'
133
175
  defineOptions({
134
176
  name: 'LcbForm',
135
177
  options: {
@@ -142,6 +184,7 @@ const { translate: t } = useTranslate()
142
184
  const form = ref({
143
185
  agreement: false,
144
186
  })
187
+ const imgList = ref({})
145
188
  const formRef = ref()
146
189
  const props = withDefaults(defineProps<LcbFormProps>(), {
147
190
  submitText: '提交',
@@ -156,6 +199,19 @@ watch(
156
199
  } = await uni.$lcb.http.post<any>('/entryFormCustom/detail', {
157
200
  entryFormConfigId: newVal,
158
201
  })
202
+ entryFormFieldConfigList.forEach((item) => {
203
+ if (item.value) {
204
+ if (item.frontInputType === 'img') {
205
+ imgList.value[item.field] = [{ url: item.value }]
206
+ } else if (item.frontInputType === 'checkboxTag' || item.frontInputType === 'checkbox') {
207
+ form.value[item.field] = JSON.parse(item.value)
208
+ } else if (item.frontInputType === 'date') {
209
+ form.value[item.field] = Number(item.value)
210
+ } else {
211
+ form.value[item.field] = item.value
212
+ }
213
+ }
214
+ })
159
215
 
160
216
  fields.value = entryFormFieldConfigList
161
217
  }
@@ -173,28 +229,57 @@ const submit = () => {
173
229
  })
174
230
  return
175
231
  }
176
- formRef.value.validate().then(async (res) => {
232
+ formRef.value.validate().then(async ({ valid }) => {
233
+ if (!valid) return
177
234
  if (props.submitUrl) {
235
+ const values = fields.value?.reduce((acc, cur) => {
236
+ if (cur.frontInputType === 'img') {
237
+ const imgInfo = imgList.value[cur.field]?.[0]
238
+ acc[cur.field] = imgInfo?.response || imgInfo?.url
239
+ } else {
240
+ acc[cur.field] = form.value[cur.field]
241
+ }
242
+ return acc
243
+ }, {})
178
244
  await uni.$lcb.http.post(props.submitUrl, {
179
245
  entryFormConfigId: props.formType,
180
- allField: JSON.stringify(res),
181
- })
182
- uni.showToast({
183
- title: t('提交成功'),
184
- icon: 'success',
246
+ allField: JSON.stringify(values),
185
247
  })
186
248
  }
187
249
  })
188
250
  }
251
+ const getDateType = (frontInputTypeValue: string) => {
252
+ return ({
253
+ day: 'date',
254
+ year: 'year',
255
+ month: 'year-month',
256
+ }[frontInputTypeValue] || 'time') as DateTimeType
257
+ }
258
+ const getDateOptions = (frontInputContent: string) => {
259
+ if (frontInputContent.includes('[')) return {}
260
+ return JSON.parse(frontInputContent || '{}')
261
+ }
189
262
  </script>
190
263
 
191
264
  <style lang="scss" scoped>
192
265
  .lcb-form {
193
266
  :deep(.wd-radio) {
194
- line-height: inherit;
267
+ line-height: inherit !important;
195
268
  }
196
269
  :deep(.wd-radio-group) {
197
- text-align: left;
270
+ text-align: left !important;
271
+ display: flex;
272
+ flex-wrap: wrap;
273
+ gap: 8rpx;
274
+ }
275
+ :deep(.wd-checkbox) {
276
+ line-height: inherit !important;
277
+ }
278
+ :deep(.wd-checkbox-group) {
279
+ text-align: left !important;
280
+ display: flex;
281
+ flex-wrap: wrap;
282
+ gap: 8rpx;
198
283
  }
199
284
  }
200
285
  </style>
@@ -57,6 +57,19 @@ export interface LcbFormField {
57
57
  * 组件的props
58
58
  */
59
59
  props: Record<string, any>
60
+ range: string[]
61
+ /**
62
+ * 最小日期
63
+ */
64
+ minDate: number
65
+ /**
66
+ * 最大日期
67
+ */
68
+ maxDate: number
69
+ /**
70
+ * 默认日期
71
+ */
72
+ defaultDate: number
60
73
  }
61
74
  export interface LcbFormProps extends LcbBlockProps {
62
75
  fields: LcbFormField[]
@@ -7,7 +7,9 @@
7
7
  @refresh="$emit('refresh', { item })"
8
8
  @nav="$emit('cancel')"
9
9
  >
10
- <wd-button v-bind="getBtnProps(item)" :size="size">{{ item.buttonName }}</wd-button>
10
+ <wd-button v-bind="getBtnProps(item)" :size="size">
11
+ {{ item.buttonName || item.name }}
12
+ </wd-button>
11
13
  </lcb-action-view>
12
14
  <view class="absolute">
13
15
  <wd-message-box />
@@ -40,8 +42,14 @@ withDefaults(defineProps<LcbOperationActionsProps>(), {
40
42
  const emits = defineEmits(['refresh', 'cancel'])
41
43
  const getBtnProps = (item: IPageBtn) => {
42
44
  return {
43
- type: item.styleContent?.buttonType?.includes?.('theme') ? 'primary' : 'info',
44
- plain: item.styleContent?.buttonType?.includes?.('Hollow'),
45
+ type:
46
+ Number(item.styleContent?.buttonType) === 6 ||
47
+ item.styleContent?.buttonType?.includes?.('theme')
48
+ ? 'primary'
49
+ : 'info',
50
+ plain:
51
+ Number(item.styleContent?.buttonType) === 6 ||
52
+ item.styleContent?.buttonType?.includes?.('Hollow'),
45
53
  size: 'small',
46
54
  ...item.buttonProps,
47
55
  } as ButtonProps
@@ -14,6 +14,7 @@ export interface IconList {
14
14
  export interface IPageBtn {
15
15
  buttonKey: string
16
16
  buttonName: string
17
+ name: string
17
18
  buttonType: number
18
19
  popUpFlag: boolean
19
20
  popUpTip: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.3.93",
3
+ "version": "0.3.94",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -56,6 +56,19 @@ export interface LcbFormField {
56
56
  * 组件的props
57
57
  */
58
58
  props: Record<string, any>
59
+ range: string[]
60
+ /**
61
+ * 最小日期
62
+ */
63
+ minDate: number
64
+ /**
65
+ * 最大日期
66
+ */
67
+ maxDate: number
68
+ /**
69
+ * 默认日期
70
+ */
71
+ defaultDate: number
59
72
  }
60
73
  export interface LcbFormProps extends LcbBlockProps {
61
74
  fields: LcbFormField[]
@@ -12,6 +12,7 @@ export interface IconList {
12
12
  export interface IPageBtn {
13
13
  buttonKey: string
14
14
  buttonName: string
15
+ name: string
15
16
  buttonType: number
16
17
  popUpFlag: boolean
17
18
  popUpTip: string