@tplc/business 0.3.99 → 0.3.101
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-list/components/FilterList/index.vue +0 -1
- package/components/lcb-list/components/FilterView/index.vue +5 -3
- package/components/lcb-list/components/FilterView/type.ts +1 -0
- package/components/lcb-list/components/TreeSelect/index.vue +48 -34
- package/components/lcb-list/components/TreeSelect/type.ts +5 -1
- package/components/lcb-list/hooks/useSelect.ts +28 -12
- package/components/lcb-list/lcb-list.vue +3 -0
- package/components/lcb-list/types.ts +1 -0
- package/components/lcb-operation-actions/BtnViews.vue +0 -1
- package/package.json +1 -1
- package/types/components/lcb-list/components/FilterView/type.d.ts +1 -0
- package/types/components/lcb-list/components/TreeSelect/index.vue.d.ts +3 -6
- package/types/components/lcb-list/components/TreeSelect/type.d.ts +5 -1
- package/types/components/lcb-list/hooks/useSelect.d.ts +7 -2
- package/types/components/lcb-list/types.d.ts +1 -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.3.101](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.100...v0.3.101) (2025-03-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 还差数据统一 ([4f87b06](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4f87b06331726ae4bf505c4ebae62076688ee9dc))
|
|
11
|
+
|
|
12
|
+
### [0.3.100](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.99...v0.3.100) (2025-03-22)
|
|
13
|
+
|
|
5
14
|
### [0.3.99](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.98...v0.3.99) (2025-03-22)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
<TreeSelect
|
|
35
35
|
v-else-if="item.component === 'treeSelect'"
|
|
36
36
|
v-bind="item.componentProps"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
:value="filter[item.valueName]"
|
|
38
|
+
:value-name="item.valueName"
|
|
39
|
+
v-model:count="titleCount[item.valueName]"
|
|
40
|
+
:filter-value="filter"
|
|
41
|
+
@submit="onSubmit(index, $event)"
|
|
40
42
|
/>
|
|
41
43
|
<ComponentGroup
|
|
42
44
|
v-else-if="item.component === 'componentGroup'"
|
|
@@ -16,12 +16,18 @@
|
|
|
16
16
|
<view
|
|
17
17
|
v-for="item in options[currentCategory].children"
|
|
18
18
|
:key="item.label"
|
|
19
|
-
@click="onItemClick(item)"
|
|
19
|
+
@click="onItemClick(item, options[currentCategory].valueName)"
|
|
20
20
|
class="filter-select flex justify-between items-center !px-36rpx !py-30rpx"
|
|
21
|
-
:class="
|
|
21
|
+
:class="
|
|
22
|
+
getChecked(item, options[currentCategory].valueName) ? 'filter-select__choose' : ''
|
|
23
|
+
"
|
|
22
24
|
>
|
|
23
25
|
{{ item.label }}
|
|
24
|
-
<wd-icon
|
|
26
|
+
<wd-icon
|
|
27
|
+
name="check"
|
|
28
|
+
custom-class="choose_icon"
|
|
29
|
+
v-if="getChecked(item, options[currentCategory].valueName)"
|
|
30
|
+
/>
|
|
25
31
|
</view>
|
|
26
32
|
</view>
|
|
27
33
|
<scroll-view
|
|
@@ -42,23 +48,19 @@
|
|
|
42
48
|
v-for="child in item.children"
|
|
43
49
|
:key="child.label"
|
|
44
50
|
:title="child.label"
|
|
45
|
-
:checked="getChecked(child)"
|
|
46
|
-
@click="onItemClick(child)"
|
|
51
|
+
:checked="getChecked(child, item.valueName)"
|
|
52
|
+
@click="onItemClick(child, item.valueName)"
|
|
47
53
|
/>
|
|
48
54
|
</view>
|
|
49
55
|
</view>
|
|
50
56
|
</scroll-view>
|
|
51
57
|
</view>
|
|
52
|
-
<ActionView
|
|
53
|
-
:disabled="!Boolean(innerValue)"
|
|
54
|
-
@cancel="innerValue = undefined"
|
|
55
|
-
@submit="onSubmit"
|
|
56
|
-
/>
|
|
58
|
+
<ActionView :disabled="!Boolean(innerValue)" @cancel="onCancel" @submit="onSubmit" />
|
|
57
59
|
</view>
|
|
58
60
|
</template>
|
|
59
61
|
|
|
60
62
|
<script setup lang="ts">
|
|
61
|
-
import {
|
|
63
|
+
import { getCurrentInstance, nextTick, watch, ref } from 'vue'
|
|
62
64
|
import { TreeSelectProps } from './type'
|
|
63
65
|
import useSelect from '../../hooks/useSelect'
|
|
64
66
|
import SelectTagView from '../SelectTagView/index.vue'
|
|
@@ -72,36 +74,44 @@ defineOptions({
|
|
|
72
74
|
},
|
|
73
75
|
})
|
|
74
76
|
const props = defineProps<TreeSelectProps>()
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const innerValue = ref(model.value)
|
|
77
|
+
const modelCount = defineModel<number>('count')
|
|
78
|
+
const innerValue = ref(props.value)
|
|
78
79
|
const toView = ref('')
|
|
80
|
+
const extraModel = ref({
|
|
81
|
+
...props.filterValue,
|
|
82
|
+
})
|
|
79
83
|
const itemTopPositions = ref<{ top: number; bottom: number }[]>([])
|
|
80
84
|
const emits = defineEmits(['submit'])
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{} as Record<string, string>,
|
|
92
|
-
)
|
|
85
|
+
const onOpen = () => {
|
|
86
|
+
innerValue.value = props.value
|
|
87
|
+
extraModel.value = {
|
|
88
|
+
...props.filterValue,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const { onItemClick, options, getChecked } = useSelect(props, {
|
|
92
|
+
model: innerValue,
|
|
93
|
+
extraModel,
|
|
94
|
+
onOpen,
|
|
93
95
|
})
|
|
96
|
+
const currentCategory = ref(0)
|
|
94
97
|
const onSubmit = () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
let count = 0
|
|
99
|
+
options.value.forEach((item) => {
|
|
100
|
+
if (item.valueName) {
|
|
101
|
+
count += extraModel.value[item.valueName]
|
|
102
|
+
? props.mode !== 'multiple'
|
|
103
|
+
? 1
|
|
104
|
+
: extraModel.value[item.valueName].length
|
|
105
|
+
: 0
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
count += innerValue.value ? (props.mode !== 'multiple' ? 1 : innerValue.value.length) : 0
|
|
109
|
+
modelCount.value = count
|
|
110
|
+
emits('submit', {
|
|
111
|
+
...extraModel.value,
|
|
112
|
+
[props.valueName]: innerValue.value,
|
|
98
113
|
})
|
|
99
114
|
}
|
|
100
|
-
watchEffect(() => {
|
|
101
|
-
if (props.mode !== 'multiple') {
|
|
102
|
-
modelTitle.value = treeObj.value[innerValue.value as string]
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
115
|
const onCategoryClick = (index: number) => {
|
|
106
116
|
currentCategory.value = index
|
|
107
117
|
toView.value = `grid_${index}`
|
|
@@ -134,6 +144,10 @@ const onGridScroll = (e) => {
|
|
|
134
144
|
}
|
|
135
145
|
})
|
|
136
146
|
}
|
|
147
|
+
const onCancel = () => {
|
|
148
|
+
innerValue.value = undefined
|
|
149
|
+
extraModel.value = {}
|
|
150
|
+
}
|
|
137
151
|
</script>
|
|
138
152
|
<style lang="scss" scoped>
|
|
139
153
|
@import '@tplc/wot/components/common/abstracts/variable';
|
|
@@ -1,25 +1,36 @@
|
|
|
1
|
-
import { onMounted, ref, Ref } from 'vue'
|
|
1
|
+
import { onMounted, onUnmounted, ref, Ref } from 'vue'
|
|
2
2
|
import { FilterItemProps, Option } from '../types'
|
|
3
3
|
const useSelect = (
|
|
4
4
|
props: FilterItemProps,
|
|
5
5
|
{
|
|
6
6
|
model,
|
|
7
|
+
extraModel,
|
|
8
|
+
onOpen,
|
|
7
9
|
}: {
|
|
8
10
|
model: Ref<string | string[] | undefined>
|
|
11
|
+
extraModel?: Ref<Record<string, any>>
|
|
12
|
+
onOpen?: () => void
|
|
9
13
|
},
|
|
10
14
|
) => {
|
|
11
15
|
const options = ref<Option[]>(props.options || [])
|
|
12
|
-
const onItemClick = (item: Option) => {
|
|
16
|
+
const onItemClick = (item: Option, valueName?: string) => {
|
|
17
|
+
let val: string[] | string | undefined
|
|
18
|
+
const currentValue = valueName ? extraModel?.value[valueName] : model.value
|
|
13
19
|
if (props.mode === 'multiple') {
|
|
14
|
-
if (typeof
|
|
15
|
-
|
|
20
|
+
if (typeof currentValue === 'object' && currentValue.includes(item.value as string)) {
|
|
21
|
+
val = currentValue.filter((v) => v !== item.value)
|
|
16
22
|
} else {
|
|
17
|
-
|
|
23
|
+
val = [...(currentValue || []), item.value as string]
|
|
18
24
|
}
|
|
19
|
-
} else if (
|
|
20
|
-
|
|
25
|
+
} else if (currentValue === item.value) {
|
|
26
|
+
val = undefined
|
|
21
27
|
} else {
|
|
22
|
-
|
|
28
|
+
val = item.value
|
|
29
|
+
}
|
|
30
|
+
if (valueName && extraModel) {
|
|
31
|
+
extraModel.value[valueName] = val
|
|
32
|
+
} else {
|
|
33
|
+
model.value = val
|
|
23
34
|
}
|
|
24
35
|
}
|
|
25
36
|
|
|
@@ -29,12 +40,17 @@ const useSelect = (
|
|
|
29
40
|
const { data } = await uni.$lcb.http.post<Option[]>(props.apiPath, props.apiParams || {})
|
|
30
41
|
options.value = data
|
|
31
42
|
}
|
|
43
|
+
if (onOpen) uni.$on('drop-opened', onOpen)
|
|
44
|
+
})
|
|
45
|
+
onUnmounted(() => {
|
|
46
|
+
if (onOpen) uni.$off('drop-opened', onOpen)
|
|
32
47
|
})
|
|
33
|
-
const getChecked = (item: Option) => {
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
const getChecked = (item: Option, valueName?: string) => {
|
|
49
|
+
const currentValue = valueName ? extraModel?.value[valueName] : model.value
|
|
50
|
+
if (Array.isArray(currentValue)) {
|
|
51
|
+
return currentValue.includes(`${item.value}`)
|
|
36
52
|
} else {
|
|
37
|
-
return Boolean(
|
|
53
|
+
return Boolean(currentValue && currentValue === item.value)
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
56
|
return {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
:info="info"
|
|
12
12
|
v-model="form"
|
|
13
13
|
:titleObj="titleObj"
|
|
14
|
+
:titleCount="titleCount"
|
|
14
15
|
:sticky="sticky"
|
|
15
16
|
/>
|
|
16
17
|
</wd-sticky>
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
:info="info"
|
|
21
22
|
v-model="form"
|
|
22
23
|
:titleObj="titleObj"
|
|
24
|
+
:titleCount="titleCount"
|
|
23
25
|
:sticky="sticky"
|
|
24
26
|
/>
|
|
25
27
|
</template>
|
|
@@ -79,6 +81,7 @@ defineOptions({
|
|
|
79
81
|
},
|
|
80
82
|
})
|
|
81
83
|
const titleObj = ref<Record<string, any>>({})
|
|
84
|
+
const titleCount = ref<Record<string, number>>({})
|
|
82
85
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
83
86
|
const props = withDefaults(defineProps<LcbListProps>(), {
|
|
84
87
|
borderRadius: 12,
|
|
@@ -126,7 +126,6 @@ async function link({ item }: { item: IPageBtn }) {
|
|
|
126
126
|
const { data: logisticInfo } = await uni.$lcb.http.post<any>(item.requestUrl, {
|
|
127
127
|
...item.requestParam,
|
|
128
128
|
})
|
|
129
|
-
console.log(logisticInfo)
|
|
130
129
|
logistic.data = logisticInfo
|
|
131
130
|
logistic.show = true
|
|
132
131
|
} else {
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { TreeSelectProps } from './type'
|
|
2
2
|
declare let __VLS_typeProps: TreeSelectProps
|
|
3
3
|
type __VLS_PublicProps = {
|
|
4
|
-
|
|
5
|
-
title?: string
|
|
4
|
+
count?: number
|
|
6
5
|
} & typeof __VLS_typeProps
|
|
7
6
|
declare const _default: import('vue').DefineComponent<
|
|
8
7
|
__VLS_TypePropsToOption<__VLS_PublicProps>,
|
|
@@ -13,16 +12,14 @@ declare const _default: import('vue').DefineComponent<
|
|
|
13
12
|
import('vue').ComponentOptionsMixin,
|
|
14
13
|
import('vue').ComponentOptionsMixin,
|
|
15
14
|
{
|
|
16
|
-
'update:
|
|
17
|
-
'update:title': (title: string) => void
|
|
15
|
+
'update:count': (count: number) => void
|
|
18
16
|
submit: (...args: any[]) => void
|
|
19
17
|
},
|
|
20
18
|
string,
|
|
21
19
|
import('vue').PublicProps,
|
|
22
20
|
Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
23
|
-
'onUpdate:modelValue'?: ((modelValue: string | string[]) => any) | undefined
|
|
24
21
|
onSubmit?: ((...args: any[]) => any) | undefined
|
|
25
|
-
'onUpdate:
|
|
22
|
+
'onUpdate:count'?: ((count: number) => any) | undefined
|
|
26
23
|
},
|
|
27
24
|
{},
|
|
28
25
|
{}
|
|
@@ -4,8 +4,12 @@ declare const useSelect: (
|
|
|
4
4
|
props: FilterItemProps,
|
|
5
5
|
{
|
|
6
6
|
model,
|
|
7
|
+
extraModel,
|
|
8
|
+
onOpen,
|
|
7
9
|
}: {
|
|
8
10
|
model: Ref<string | string[] | undefined>
|
|
11
|
+
extraModel?: Ref<Record<string, any>>
|
|
12
|
+
onOpen?: () => void
|
|
9
13
|
},
|
|
10
14
|
) => {
|
|
11
15
|
options: Ref<
|
|
@@ -17,9 +21,10 @@ declare const useSelect: (
|
|
|
17
21
|
min?: number | undefined
|
|
18
22
|
children?: any[] | undefined
|
|
19
23
|
unit?: string | undefined
|
|
24
|
+
valueName?: string | undefined
|
|
20
25
|
}[]
|
|
21
26
|
>
|
|
22
|
-
getChecked: (item: Option) => boolean
|
|
23
|
-
onItemClick: (item: Option) => void
|
|
27
|
+
getChecked: (item: Option, valueName?: string) => boolean
|
|
28
|
+
onItemClick: (item: Option, valueName?: string) => void
|
|
24
29
|
}
|
|
25
30
|
export default useSelect
|