wui-components-v2 1.2.64 → 1.2.65
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.
|
@@ -12,8 +12,10 @@ defineOptions({
|
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
// ★ 显式 emit click,保证微信小程序下 @click 能正常触发(小程序自定义组件不会自动透传原生 tap)
|
|
15
|
+
// select:勾选模式下点击整行卡片时触发,携带记录 code
|
|
15
16
|
const emit = defineEmits<{
|
|
16
17
|
(e: 'click'): void
|
|
18
|
+
(e: 'select', code: string): void
|
|
17
19
|
}>()
|
|
18
20
|
|
|
19
21
|
const props = withDefaults(
|
|
@@ -29,6 +31,10 @@ const props = withDefaults(
|
|
|
29
31
|
groups: Groups
|
|
30
32
|
enumColumn?: Enums
|
|
31
33
|
index: number
|
|
34
|
+
/**
|
|
35
|
+
* 是否处于勾选模式。为 true 时点击整行触发 select 事件。
|
|
36
|
+
*/
|
|
37
|
+
selectMode?: boolean
|
|
32
38
|
/**
|
|
33
39
|
* 标题旁标签是否展示,由父级读取控制,默认不展示。
|
|
34
40
|
*/
|
|
@@ -138,7 +144,7 @@ function toggleCollapse(contentId: string) {
|
|
|
138
144
|
<!-- 订单卡片2 -->
|
|
139
145
|
<view
|
|
140
146
|
class="ma-2 overflow-hidden rounded-xl bg-white shadow-sm dark:bg-[var(--wot-dark-background2)]"
|
|
141
|
-
@click="emit('click')"
|
|
147
|
+
@click.stop="selectMode ? emit('select', data.code) : emit('click')"
|
|
142
148
|
>
|
|
143
149
|
<!-- 订单头部 -->
|
|
144
150
|
<view v-if="props.primaryColumn" class="flex items-center justify-between border-b border-gray-100 p-4">
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, defineOptions, defineProps } from 'vue'
|
|
2
|
+
import { computed, defineEmits, defineOptions, defineProps } from 'vue'
|
|
3
3
|
import type { Columns, Entities, Enums, FoldCardModel, Groups } from '../../type'
|
|
4
4
|
import { formatItemData } from '../../utils'
|
|
5
5
|
import ControlTypeSupportor from '../../utils/control-type-supportor'
|
|
6
6
|
|
|
7
7
|
defineOptions({
|
|
8
8
|
name: 'ProductCard',
|
|
9
|
+
// 关闭属性透传,避免根节点原生 @click 与显式 emit('click') 重复触发
|
|
10
|
+
inheritAttrs: false,
|
|
9
11
|
})
|
|
10
12
|
|
|
13
|
+
// 显式 emit click / select,供外层 @click / @select 监听整行点击
|
|
14
|
+
const emit = defineEmits<{
|
|
15
|
+
(e: 'click'): void
|
|
16
|
+
(e: 'select', code: string): void
|
|
17
|
+
}>()
|
|
18
|
+
|
|
11
19
|
const props = defineProps<{
|
|
12
20
|
columns: Columns[]
|
|
13
21
|
collapseNum?: number
|
|
@@ -22,6 +30,10 @@ const props = defineProps<{
|
|
|
22
30
|
cardShowCols?: Columns[]
|
|
23
31
|
index: number
|
|
24
32
|
mainPicture?: Columns
|
|
33
|
+
/**
|
|
34
|
+
* 是否处于勾选模式。为 true 时点击整行触发 select 事件。
|
|
35
|
+
*/
|
|
36
|
+
selectMode?: boolean
|
|
25
37
|
}>()
|
|
26
38
|
|
|
27
39
|
// 标签字段
|
|
@@ -45,7 +57,10 @@ function isControlType(item: Columns): string {
|
|
|
45
57
|
<!-- 订单卡片容器 -->
|
|
46
58
|
<view class="mx-auto max-w-md space-y-4">
|
|
47
59
|
<!-- 订单卡片2 -->
|
|
48
|
-
<view
|
|
60
|
+
<view
|
|
61
|
+
class="ma-2 overflow-hidden rounded-xl bg-white p-2 shadow-sm dark:bg-[var(--wot-dark-background2)]"
|
|
62
|
+
@click="selectMode ? emit('select', data.code) : emit('click')"
|
|
63
|
+
>
|
|
49
64
|
<view class="flex">
|
|
50
65
|
<!-- 图片 -->
|
|
51
66
|
<wd-img
|
|
@@ -323,6 +323,10 @@ function batchDelete() {
|
|
|
323
323
|
// 批量执行 action:需要表单输入则弹窗,否则直接提交
|
|
324
324
|
async function batchAction(item: rowActions) {
|
|
325
325
|
if (item?.path) {
|
|
326
|
+
if (!hasSelected.value) {
|
|
327
|
+
toast.warning({ msg: '请先勾选要处理的记录' })
|
|
328
|
+
return
|
|
329
|
+
}
|
|
326
330
|
uni.navigateTo({
|
|
327
331
|
url: item.path + '?sourceId=' + internalSourceId.value + '&codes=' + selectedCodesStr.value,
|
|
328
332
|
})
|
|
@@ -537,27 +541,31 @@ function tabSearchClick(data: any) {
|
|
|
537
541
|
model="complex"
|
|
538
542
|
:card-show-cols="config.cardShowCols"
|
|
539
543
|
:main-picture="config.mainPicture"
|
|
544
|
+
:select-mode="inSelectMode"
|
|
545
|
+
@select="toggleSelect"
|
|
540
546
|
>
|
|
541
547
|
<template #buttons>
|
|
542
|
-
<
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
548
|
+
<view v-if="!inSelectMode" @click.stop>
|
|
549
|
+
<slot name="cardBotomButtons" :data="item" />
|
|
550
|
+
<CardBotomButtons
|
|
551
|
+
:primary-column="config.primaryColumn"
|
|
552
|
+
:add-event="addEvent"
|
|
553
|
+
:detail-button-handle="detailButtonHandle"
|
|
554
|
+
:zpaging="Zpaging"
|
|
555
|
+
:enum-column="enumColumn"
|
|
556
|
+
:actions="config.actions"
|
|
557
|
+
:row-actions="config.rowActions"
|
|
558
|
+
:ractions="config.ractions"
|
|
559
|
+
:source-id="internalSourceId"
|
|
560
|
+
:item="config"
|
|
561
|
+
:code="item.code"
|
|
562
|
+
:page-type="pageType"
|
|
563
|
+
:data="item"
|
|
564
|
+
:is-show-action="isShowAction"
|
|
565
|
+
:copy-mode="config.copyMode"
|
|
566
|
+
:edit-button-config="editButtonConfig"
|
|
567
|
+
/>
|
|
568
|
+
</view>
|
|
561
569
|
</template>
|
|
562
570
|
</productCard>
|
|
563
571
|
</view>
|
|
@@ -579,6 +587,8 @@ function tabSearchClick(data: any) {
|
|
|
579
587
|
:show-detail-popup="showDetailPopup"
|
|
580
588
|
:detail-button-handle="detailButtonHandle"
|
|
581
589
|
model="complex"
|
|
590
|
+
:select-mode="inSelectMode"
|
|
591
|
+
@select="toggleSelect"
|
|
582
592
|
>
|
|
583
593
|
<template #select>
|
|
584
594
|
<view v-if="inSelectMode" @click.stop>
|
|
@@ -586,27 +596,29 @@ function tabSearchClick(data: any) {
|
|
|
586
596
|
</view>
|
|
587
597
|
</template>
|
|
588
598
|
<template #buttons>
|
|
589
|
-
<
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
599
|
+
<view v-if="!inSelectMode" @click.stop>
|
|
600
|
+
<slot name="cardBotomButtons" :data="item" />
|
|
601
|
+
<CardBotomButtons
|
|
602
|
+
:primary-column="config.primaryColumn"
|
|
603
|
+
:add-event="addEvent"
|
|
604
|
+
:detail-button-handle="detailButtonHandle"
|
|
605
|
+
:zpaging="Zpaging"
|
|
606
|
+
:enum-column="enumColumn"
|
|
607
|
+
:actions="config.actions"
|
|
608
|
+
:row-actions="config.rowActions"
|
|
609
|
+
:ractions="config.ractions"
|
|
610
|
+
:source-id="internalSourceId"
|
|
611
|
+
:item="config"
|
|
612
|
+
:code="item.code"
|
|
613
|
+
:page-type="pageType"
|
|
614
|
+
:data="item"
|
|
615
|
+
:button-delete-action="config.buttonDeleteAction"
|
|
616
|
+
:button-edit-action="config.buttonEditAction"
|
|
617
|
+
:is-show-action="isShowAction"
|
|
618
|
+
:copy-mode="config.copyMode"
|
|
619
|
+
:edit-button-config="editButtonConfig"
|
|
620
|
+
/>
|
|
621
|
+
</view>
|
|
610
622
|
</template>
|
|
611
623
|
</foldCard2>
|
|
612
624
|
</view>
|