@tplc/business 0.4.29 → 0.4.31

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,38 @@
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.31](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.30...v0.4.31) (2025-03-28)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 字段解析 ([38461f0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/38461f09e19042e31dbd52e3a49810f239ebb255))
11
+
12
+ ### [0.4.30](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.27...v0.4.30) (2025-03-28)
13
+
14
+
15
+ ### 🚀 Chore | 构建/工程依赖/工具
16
+
17
+ * **release:** 0.1.74 ([49a4e72](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/49a4e720a3744603630bbe7e042a5bb3ba2e4033))
18
+ * **release:** 0.1.75 ([282ba19](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/282ba19d36ce4949929c105fb276d74ad1ca1986))
19
+ * **release:** 0.4.28 ([ba26479](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ba264791fe2027308ab17cc27d6e9731d9773ba9))
20
+ * **release:** 0.4.29 ([ac8affb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ac8affb6c17cdd9dcdfa8bc0a585e7ff40322509))
21
+
22
+
23
+ ### ✨ Features | 新功能
24
+
25
+ * backup ([5934345](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/59343452497456c698c7c6e0d9cafb4cc18ea842))
26
+ * lcb-city-select 自动清空额外字段 ([229b530](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/229b530f93fe237a9674a48c1248cae955fa9006))
27
+ * search 焦点 ([76a175f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/76a175ff3fc3f91c66bedf39af6780f11d0cb686))
28
+ * 初始化字段 ([2bb232b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2bb232bcf514bb880e92ebe2e1c78c424f5a22b6))
29
+ * 同步city ([155266f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/155266f0e8dd302b5e974968552146e6d8448f5d))
30
+ * 字段同步 ([5395b64](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5395b6415bbb5d7ef7396fbc949940ce0ccab2a5))
31
+ * 支持img ([508b7f9](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/508b7f97b40f3c473e8a4528814db54b74e8b919))
32
+ * 暂时完善数据同步 ([66af8a1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/66af8a18e04913c407ccae7e1463a19b6aa584c3))
33
+ * 暂时完成数据 ([0e97d09](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0e97d09182421a21a90659a785e10ae5489d9e61))
34
+ * 样式 ([5e4039c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5e4039ca29a673da67790e424cf2e7fc35fa1d1d))
35
+ * 调整组件 ([6b4ce6c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6b4ce6c95ee380e143df93b6de16e6c8af0116d7))
36
+
5
37
  ### [0.4.29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.28...v0.4.29) (2025-03-27)
6
38
 
7
39
 
@@ -168,6 +168,7 @@ import { LcbFormField, LcbFormProps } from './types'
168
168
  import { customUpload } from '../../utils/utils'
169
169
  import { useTranslate } from '@tplc/wot'
170
170
  import { DateTimeType } from '@tplc/wot/types/components/wd-datetime-picker-view/types'
171
+ import dayjs from 'dayjs/esm'
171
172
  defineOptions({
172
173
  name: 'LcbForm',
173
174
  options: {
@@ -202,7 +203,17 @@ watch(
202
203
  } else if (item.frontInputType === 'checkboxTag' || item.frontInputType === 'checkbox') {
203
204
  form.value[item.field] = JSON.parse(item.value)
204
205
  } else if (item.frontInputType === 'date') {
205
- form.value[item.field] = Number(item.value)
206
+ switch (item.frontInputTypeValue) {
207
+ case 'day':
208
+ form.value[item.field] = dayjs(item.value, 'YYYY-MM-DD').valueOf()
209
+ break
210
+ case 'month':
211
+ form.value[item.field] = dayjs(item.value, 'YYYY-MM').valueOf()
212
+ break
213
+ case 'year':
214
+ form.value[item.field] = dayjs(item.value, 'YYYY').valueOf()
215
+ break
216
+ }
206
217
  } else {
207
218
  form.value[item.field] = item.value
208
219
  }
@@ -229,7 +240,21 @@ const submit = () => {
229
240
  if (!valid) return
230
241
  if (props.submitUrl) {
231
242
  const values = fields.value?.reduce((acc, cur) => {
232
- acc[cur.field] = form.value[cur.field]
243
+ if (cur.frontInputType === 'date') {
244
+ switch (cur.frontInputTypeValue) {
245
+ case 'day':
246
+ acc[cur.field] = dayjs(form.value[cur.field]).format('YYYY-MM-DD')
247
+ break
248
+ case 'month':
249
+ acc[cur.field] = dayjs(form.value[cur.field]).format('YYYY-MM')
250
+ break
251
+ case 'year':
252
+ acc[cur.field] = dayjs(form.value[cur.field]).format('YYYY')
253
+ break
254
+ }
255
+ } else {
256
+ acc[cur.field] = form.value[cur.field]
257
+ }
233
258
  return acc
234
259
  }, {})
235
260
  await uni.$lcb.http.post(props.submitUrl, {
@@ -7,6 +7,7 @@
7
7
  <view v-if="child.component === 'slider'" class="!text-26rpx slider-title">
8
8
  {{
9
9
  getSliderTitle(
10
+ translate,
10
11
  innerFilter[child.valueName],
11
12
  child.componentProps.max,
12
13
  child.componentProps.min,
@@ -41,6 +42,7 @@ import FilterSlider from '../FilterSlider/index.vue'
41
42
  import TagSelect from '../TagSelect/index.vue'
42
43
  import ActionView from '../ActionView/index.vue'
43
44
  import { useTranslate } from '@tplc/wot'
45
+ import { getSliderTitle } from '../../../../utils/transform'
44
46
  defineOptions({
45
47
  name: 'ComponentGroup',
46
48
  options: {
@@ -83,22 +85,6 @@ const onCancel = () => {
83
85
  const onSubmit = () => {
84
86
  emits('submit', innerFilter.value)
85
87
  }
86
- const getSliderTitle = (value?: number[], max = 0, min = 0) => {
87
- if (value) {
88
- const [start, end] = value
89
- if (start === min && end === max) {
90
- return translate('不限')
91
- } else if (end === max || end === undefined) {
92
- return `¥${start}` + translate('以上')
93
- } else if (start === min) {
94
- return `¥${end}` + translate('以下')
95
- } else {
96
- return `¥${start}-${end}`
97
- }
98
- } else {
99
- return ''
100
- }
101
- }
102
88
  </script>
103
89
  <style lang="scss" scoped>
104
90
  @import '@tplc/wot/components/common/abstracts/variable';
@@ -36,6 +36,8 @@ import SelectTagView from '../SelectTagView/index.vue'
36
36
  import { onMounted, onUnmounted, ref, watch, inject } from 'vue'
37
37
  import type { SliderInstance } from '@tplc/wot/components/wd-slider/types'
38
38
  import useSyncValues from '../../hooks/useSyncValues'
39
+ import { getSliderTitle } from '../../../../utils/transform'
40
+ import { useTranslate } from '@tplc/wot'
39
41
  defineOptions({
40
42
  name: 'FilterSlider',
41
43
  options: {
@@ -50,6 +52,7 @@ const slider = ref<SliderInstance>()
50
52
  const props = withDefaults(defineProps<FilterSliderProps>(), {
51
53
  step: 100,
52
54
  })
55
+ const { translate } = useTranslate()
53
56
  const model = defineModel<number[]>()
54
57
  const innerValue = ref<number[]>()
55
58
  const { syncValues } = useSyncValues()
@@ -91,7 +94,7 @@ watch(
91
94
  props.valueName,
92
95
  [
93
96
  {
94
- label: `${innerValue.value?.[0]}${props.unit} - ${innerValue.value?.[1]}${props.unit}`,
97
+ label: getSliderTitle(translate, innerValue.value, props.max, props.min),
95
98
  value: `${innerValue.value}`,
96
99
  },
97
100
  ],
@@ -159,33 +159,37 @@ const onCancel = () => {
159
159
  const optionsMap = computed(() => {
160
160
  const map = {} as Record<string, Option>
161
161
  options.value.forEach((v) => {
162
- if (!v.valueName) {
163
- map[v.value] = v
164
- if (v.children) {
165
- v.children.forEach((v) => {
166
- map[v.value] = v
167
- })
168
- }
162
+ if (v.value) {
163
+ map[`${v.valueName || props.valueName}_${v.value}`] = v
164
+ }
165
+
166
+ if (v.children) {
167
+ v.children.forEach((child) => {
168
+ map[`${v.valueName || props.valueName}_${child.value}`] = child
169
+ })
169
170
  }
170
171
  })
171
172
  return map
172
173
  })
173
174
 
174
175
  const setValues = (params: Record<string, any>) => {
176
+ const getOptions = (value: string | string[], valueName: string) => {
177
+ if (Array.isArray(value)) {
178
+ return value.map((v) => optionsMap.value[`${valueName}_${v}`])
179
+ } else {
180
+ return [optionsMap.value[`${valueName}_${value}`]]
181
+ }
182
+ }
175
183
  if (params[props.valueName]) {
176
- syncValues(
177
- props.valueName,
178
- params[props.valueName].map((v) => optionsMap.value[v]),
179
- )
184
+ const options = getOptions(params[props.valueName], props.valueName)
185
+ syncValues(props.valueName, options)
180
186
  }
181
187
  modelKeys.value?.forEach((v: string) => {
182
188
  if (v !== props.valueName && params[v]) {
183
189
  const currentOptions = options.value.find((option) => option.valueName === v)
184
190
  if (currentOptions) {
185
- syncValues(
186
- v,
187
- params[v].map((v) => optionsMap.value[v]),
188
- )
191
+ const options = getOptions(params[v], v)
192
+ syncValues(v, options)
189
193
  }
190
194
  }
191
195
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -5,3 +5,9 @@ export declare const getJsonStrFirstUrl: (jsonStr?: string) => any
5
5
  export declare const getJsonStrList: (jsonStr?: string) => any
6
6
  /** 删除其他外部字段 */
7
7
  export declare const cleanOutSizeKeys: (obj: Record<string, any>, keys?: string[]) => {}
8
+ export declare const getSliderTitle: (
9
+ translate: (v: string) => string,
10
+ value?: number[],
11
+ max?: number,
12
+ min?: number,
13
+ ) => string
@@ -26,3 +26,25 @@ export const cleanOutSizeKeys = (
26
26
  return acc
27
27
  }, {})
28
28
  }
29
+
30
+ export const getSliderTitle = (
31
+ translate: (v: string) => string,
32
+ value?: number[],
33
+ max = 0,
34
+ min = 0,
35
+ ) => {
36
+ if (value) {
37
+ const [start, end] = value
38
+ if (start === min && end === max) {
39
+ return translate('不限')
40
+ } else if (end === max || end === undefined) {
41
+ return `¥${start}` + translate('以上')
42
+ } else if (start === min) {
43
+ return `¥${end}` + translate('以下')
44
+ } else {
45
+ return `¥${start}-${end}`
46
+ }
47
+ } else {
48
+ return ''
49
+ }
50
+ }