@tplc/business 0.3.99 → 0.3.100
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 +2 -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 +38 -34
- package/components/lcb-list/components/TreeSelect/type.ts +5 -1
- package/components/lcb-list/hooks/useSelect.ts +21 -11
- 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 +5 -2
- package/types/components/lcb-list/types.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.100](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.99...v0.3.100) (2025-03-22)
|
|
6
|
+
|
|
5
7
|
### [0.3.99](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.3.98...v0.3.99) (2025-03-22)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -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,34 @@ 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 { onItemClick, options, getChecked } = useSelect(props, { model: innerValue })
|
|
85
|
+
const { onItemClick, options, getChecked } = useSelect(props, { model: innerValue, extraModel })
|
|
82
86
|
const currentCategory = ref(0)
|
|
83
|
-
const treeObj = computed(() => {
|
|
84
|
-
return options.value.reduce(
|
|
85
|
-
(prev, next) => {
|
|
86
|
-
next?.children?.forEach((item) => {
|
|
87
|
-
prev[item.value as string] = item.label
|
|
88
|
-
})
|
|
89
|
-
return prev
|
|
90
|
-
},
|
|
91
|
-
{} as Record<string, string>,
|
|
92
|
-
)
|
|
93
|
-
})
|
|
94
87
|
const onSubmit = () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
let count = 0
|
|
89
|
+
options.value.forEach((item) => {
|
|
90
|
+
if (item.valueName) {
|
|
91
|
+
count += extraModel.value[item.valueName]
|
|
92
|
+
? props.mode !== 'multiple'
|
|
93
|
+
? 1
|
|
94
|
+
: extraModel.value[item.valueName].length
|
|
95
|
+
: 0
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
count += innerValue.value ? (props.mode !== 'multiple' ? 1 : innerValue.value.length) : 0
|
|
99
|
+
modelCount.value = count
|
|
100
|
+
emits('submit', {
|
|
101
|
+
...extraModel.value,
|
|
102
|
+
[props.valueName]: innerValue.value,
|
|
98
103
|
})
|
|
99
104
|
}
|
|
100
|
-
watchEffect(() => {
|
|
101
|
-
if (props.mode !== 'multiple') {
|
|
102
|
-
modelTitle.value = treeObj.value[innerValue.value as string]
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
105
|
const onCategoryClick = (index: number) => {
|
|
106
106
|
currentCategory.value = index
|
|
107
107
|
toView.value = `grid_${index}`
|
|
@@ -134,6 +134,10 @@ const onGridScroll = (e) => {
|
|
|
134
134
|
}
|
|
135
135
|
})
|
|
136
136
|
}
|
|
137
|
+
const onCancel = () => {
|
|
138
|
+
innerValue.value = undefined
|
|
139
|
+
extraModel.value = {}
|
|
140
|
+
}
|
|
137
141
|
</script>
|
|
138
142
|
<style lang="scss" scoped>
|
|
139
143
|
@import '@tplc/wot/components/common/abstracts/variable';
|
|
@@ -4,22 +4,31 @@ const useSelect = (
|
|
|
4
4
|
props: FilterItemProps,
|
|
5
5
|
{
|
|
6
6
|
model,
|
|
7
|
+
extraModel,
|
|
7
8
|
}: {
|
|
8
9
|
model: Ref<string | string[] | undefined>
|
|
10
|
+
extraModel?: Ref<Record<string, any>>
|
|
9
11
|
},
|
|
10
12
|
) => {
|
|
11
13
|
const options = ref<Option[]>(props.options || [])
|
|
12
|
-
const onItemClick = (item: Option) => {
|
|
14
|
+
const onItemClick = (item: Option, valueName?: string) => {
|
|
15
|
+
let val: string[] | string | undefined
|
|
16
|
+
const currentValue = valueName ? extraModel?.value[valueName] : model.value
|
|
13
17
|
if (props.mode === 'multiple') {
|
|
14
|
-
if (typeof
|
|
15
|
-
|
|
18
|
+
if (typeof currentValue === 'object' && currentValue.includes(item.value as string)) {
|
|
19
|
+
val = currentValue.filter((v) => v !== item.value)
|
|
16
20
|
} else {
|
|
17
|
-
|
|
21
|
+
val = [...(currentValue || []), item.value as string]
|
|
18
22
|
}
|
|
19
|
-
} else if (
|
|
20
|
-
|
|
23
|
+
} else if (currentValue === item.value) {
|
|
24
|
+
val = undefined
|
|
21
25
|
} else {
|
|
22
|
-
|
|
26
|
+
val = item.value
|
|
27
|
+
}
|
|
28
|
+
if (valueName && extraModel) {
|
|
29
|
+
extraModel.value[valueName] = val
|
|
30
|
+
} else {
|
|
31
|
+
model.value = val
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -30,11 +39,12 @@ const useSelect = (
|
|
|
30
39
|
options.value = data
|
|
31
40
|
}
|
|
32
41
|
})
|
|
33
|
-
const getChecked = (item: Option) => {
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
const getChecked = (item: Option, valueName?: string) => {
|
|
43
|
+
const currentValue = valueName ? extraModel?.value[valueName] : model.value
|
|
44
|
+
if (Array.isArray(currentValue)) {
|
|
45
|
+
return currentValue.includes(`${item.value}`)
|
|
36
46
|
} else {
|
|
37
|
-
return Boolean(
|
|
47
|
+
return Boolean(currentValue && currentValue === item.value)
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
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,10 @@ declare const useSelect: (
|
|
|
4
4
|
props: FilterItemProps,
|
|
5
5
|
{
|
|
6
6
|
model,
|
|
7
|
+
extraModel,
|
|
7
8
|
}: {
|
|
8
9
|
model: Ref<string | string[] | undefined>
|
|
10
|
+
extraModel?: Ref<Record<string, any>>
|
|
9
11
|
},
|
|
10
12
|
) => {
|
|
11
13
|
options: Ref<
|
|
@@ -17,9 +19,10 @@ declare const useSelect: (
|
|
|
17
19
|
min?: number | undefined
|
|
18
20
|
children?: any[] | undefined
|
|
19
21
|
unit?: string | undefined
|
|
22
|
+
valueName?: string | undefined
|
|
20
23
|
}[]
|
|
21
24
|
>
|
|
22
|
-
getChecked: (item: Option) => boolean
|
|
23
|
-
onItemClick: (item: Option) => void
|
|
25
|
+
getChecked: (item: Option, valueName?: string) => boolean
|
|
26
|
+
onItemClick: (item: Option, valueName?: string) => void
|
|
24
27
|
}
|
|
25
28
|
export default useSelect
|