@tplc/business 0.4.12 → 0.4.14
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 +9 -0
- package/components/lcb-calendar-search/lcb-calendar-search.vue +13 -3
- package/components/lcb-list/components/TreeSelect/index.vue +1 -1
- package/components/lcb-list/hooks/useSelect.ts +19 -4
- package/package.json +1 -1
- package/types/components/lcb-list/hooks/useSelect.d.ts +1 -0
- package/types/utils/transform.d.ts +2 -0
- package/utils/transform.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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.14](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.13...v0.4.14) (2025-03-25)
|
|
6
|
+
|
|
7
|
+
### [0.4.13](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.12...v0.4.13) (2025-03-25)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ✨ Features | 新功能
|
|
11
|
+
|
|
12
|
+
* 调整日历 ([89734b6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/89734b6488f7f06e0ce0acc6bb3926c2ff443284))
|
|
13
|
+
|
|
5
14
|
### [0.4.12](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.11...v0.4.12) (2025-03-25)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -59,6 +59,8 @@ import { LcbAddress } from '../lcb-city-select/api'
|
|
|
59
59
|
import { FORM_KEY } from '../../constants'
|
|
60
60
|
import { getHistoryCity } from '../../utils/history'
|
|
61
61
|
import { stringify } from 'qs'
|
|
62
|
+
import { cleanOutSizeKeys } from '../../utils/transform'
|
|
63
|
+
import { getCurrentPage } from '../../utils/utils'
|
|
62
64
|
defineOptions({
|
|
63
65
|
name: 'LcbCalendarSearch',
|
|
64
66
|
options: {
|
|
@@ -90,10 +92,18 @@ watch(
|
|
|
90
92
|
() => addressCity.value,
|
|
91
93
|
(val) => {
|
|
92
94
|
if (val) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
const params: Record<string, any> = {
|
|
96
|
+
cityId: val?.cityId,
|
|
97
|
+
areaId: val?.areaId,
|
|
98
|
+
addressName: val?.addressName,
|
|
99
|
+
}
|
|
95
100
|
if (val.keywords) {
|
|
96
|
-
|
|
101
|
+
params.keywords = val.keywords
|
|
102
|
+
}
|
|
103
|
+
const datas = cleanOutSizeKeys(form.value, Object.keys(getCurrentPage().options))
|
|
104
|
+
form.value = {
|
|
105
|
+
...datas,
|
|
106
|
+
...params,
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</view>
|
|
15
15
|
<view class="scroll-view flex-1 w-0 bg-#FAFAFA pl-4" v-if="mode === 'single'">
|
|
16
16
|
<view
|
|
17
|
-
v-for="item in options[currentCategory]
|
|
17
|
+
v-for="item in options[currentCategory]?.children"
|
|
18
18
|
:key="item.label"
|
|
19
19
|
@click="onItemClick(item, options[currentCategory].valueName)"
|
|
20
20
|
class="filter-select flex justify-between items-center !px-36rpx !py-30rpx"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { onMounted, onUnmounted, ref, Ref } from 'vue'
|
|
1
|
+
import { inject, onMounted, onUnmounted, ref, Ref, watch } from 'vue'
|
|
2
2
|
import { FilterItemProps, Option } from '../types'
|
|
3
|
+
import { FORM_KEY } from '../../../constants'
|
|
3
4
|
const useSelect = (
|
|
4
5
|
props: FilterItemProps,
|
|
5
6
|
{
|
|
@@ -13,6 +14,7 @@ const useSelect = (
|
|
|
13
14
|
},
|
|
14
15
|
) => {
|
|
15
16
|
const options = ref<Option[]>(props.options || [])
|
|
17
|
+
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
16
18
|
const onItemClick = (item: Option, valueName?: string) => {
|
|
17
19
|
let val: string[] | string | undefined
|
|
18
20
|
const currentValue = valueName ? extraModel?.value[valueName] : model.value
|
|
@@ -34,12 +36,18 @@ const useSelect = (
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
const getOptions = async () => {
|
|
38
40
|
if (props.apiPath) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const { data } = await uni.$lcb.http.post<Option[]>(props.apiPath, {
|
|
42
|
+
...props.apiParams,
|
|
43
|
+
...form?.value,
|
|
44
|
+
})
|
|
41
45
|
options.value = data
|
|
42
46
|
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onMounted(async () => {
|
|
50
|
+
getOptions()
|
|
43
51
|
if (onOpen) uni.$on('drop-open', onOpen)
|
|
44
52
|
})
|
|
45
53
|
onUnmounted(() => {
|
|
@@ -53,8 +61,15 @@ const useSelect = (
|
|
|
53
61
|
return Boolean(currentValue && currentValue === item.value)
|
|
54
62
|
}
|
|
55
63
|
}
|
|
64
|
+
watch(
|
|
65
|
+
() => form?.value?.addressName,
|
|
66
|
+
() => {
|
|
67
|
+
getOptions()
|
|
68
|
+
},
|
|
69
|
+
)
|
|
56
70
|
return {
|
|
57
71
|
options,
|
|
72
|
+
getOptions,
|
|
58
73
|
getChecked,
|
|
59
74
|
onItemClick,
|
|
60
75
|
}
|
package/package.json
CHANGED
|
@@ -3,3 +3,5 @@ export declare const transformValueUnit: (value?: number | string, uni?: string)
|
|
|
3
3
|
export declare const getJsonStrFirstUrl: (jsonStr?: string) => any
|
|
4
4
|
/** 获取json字符串列表 */
|
|
5
5
|
export declare const getJsonStrList: (jsonStr?: string) => any
|
|
6
|
+
/** 删除其他外部字段 */
|
|
7
|
+
export declare const cleanOutSizeKeys: (obj: Record<string, any>, keys?: string[]) => {}
|
package/utils/transform.ts
CHANGED
|
@@ -12,3 +12,17 @@ export const getJsonStrFirstUrl = (jsonStr = '[]') => {
|
|
|
12
12
|
export const getJsonStrList = (jsonStr = '[]') => {
|
|
13
13
|
return JSON.parse(jsonStr)
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
/** 删除其他外部字段 */
|
|
17
|
+
export const cleanOutSizeKeys = (
|
|
18
|
+
obj: Record<string, any>,
|
|
19
|
+
/** 保留字段 */
|
|
20
|
+
keys: string[] = [],
|
|
21
|
+
) => {
|
|
22
|
+
return Object.keys(obj).reduce((acc, key) => {
|
|
23
|
+
if ([...keys, ...['endDate', 'startDate', 'keywords']].includes(key)) {
|
|
24
|
+
acc[key] = obj[key]
|
|
25
|
+
}
|
|
26
|
+
return acc
|
|
27
|
+
}, {})
|
|
28
|
+
}
|