wui-components-v2 1.2.10 → 1.2.12
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.
|
@@ -303,11 +303,7 @@ console.log(props, '3333333333333')
|
|
|
303
303
|
</wd-button>
|
|
304
304
|
</template>
|
|
305
305
|
</template>
|
|
306
|
-
<wd-button
|
|
307
|
-
v-if="isShowAction !== false && props.item.buttons.includes('copy') && isActionVisible(props.buttonEditAction)"
|
|
308
|
-
size="small"
|
|
309
|
-
@click="handleCopy"
|
|
310
|
-
>
|
|
306
|
+
<wd-button v-if="isShowAction !== false && props.item.buttons.includes('copy')" size="small" @click="handleCopy">
|
|
311
307
|
复制
|
|
312
308
|
</wd-button>
|
|
313
309
|
<wd-button
|
|
@@ -102,7 +102,10 @@ function toggleCollapse(contentId: string) {
|
|
|
102
102
|
<!-- 订单卡片容器 -->
|
|
103
103
|
<view class="mx-auto max-w-md space-y-4">
|
|
104
104
|
<!-- 订单卡片2 -->
|
|
105
|
-
<view
|
|
105
|
+
<view
|
|
106
|
+
class="ma-2 overflow-hidden rounded-xl bg-white shadow-sm dark:bg-[var(--wot-dark-background2)]"
|
|
107
|
+
@click="emit('click')"
|
|
108
|
+
>
|
|
106
109
|
<!-- 订单头部 -->
|
|
107
110
|
<view v-if="props.primaryColumn" class="flex items-center justify-between border-b border-gray-100 p-4">
|
|
108
111
|
<view class="flex min-w-0 flex-1 items-center gap-4 text-base text-gray-800 font-medium dark:text-white">
|
|
@@ -134,22 +137,6 @@ function toggleCollapse(contentId: string) {
|
|
|
134
137
|
<!-- <slot name="detailAddress" /> -->
|
|
135
138
|
</view>
|
|
136
139
|
</view>
|
|
137
|
-
<view
|
|
138
|
-
v-if="props.labelColumn"
|
|
139
|
-
class="whitespace-nowrap rounded px-1 py-1 text-sm text-white font-700"
|
|
140
|
-
:style="{
|
|
141
|
-
color: labelColumns?.find(
|
|
142
|
-
item => props.labelColumn && item.value === data.fieldMap[props.labelColumn.sourceId]
|
|
143
|
-
)?.css?.color,
|
|
144
|
-
}"
|
|
145
|
-
>
|
|
146
|
-
{{
|
|
147
|
-
formatItemData(
|
|
148
|
-
data.fieldMap[props.labelColumn.sourceId],
|
|
149
|
-
props.labelColumn.extControlType || props.labelColumn.controlType
|
|
150
|
-
)
|
|
151
|
-
}}
|
|
152
|
-
</view>
|
|
153
140
|
</view>
|
|
154
141
|
|
|
155
142
|
<!-- 订单内容 -->
|
|
@@ -185,7 +172,9 @@ function toggleCollapse(contentId: string) {
|
|
|
185
172
|
display: grid;
|
|
186
173
|
grid-template-rows: 0fr;
|
|
187
174
|
opacity: 0;
|
|
188
|
-
transition:
|
|
175
|
+
transition:
|
|
176
|
+
grid-template-rows 0.3s ease,
|
|
177
|
+
opacity 0.25s ease;
|
|
189
178
|
}
|
|
190
179
|
.fold-collapse > view {
|
|
191
180
|
overflow: hidden;
|
|
@@ -62,7 +62,7 @@ const giveDefaultValue = (value: any) => {
|
|
|
62
62
|
defaultValue[key] = typeof val === 'string' && val.includes('@R@') ? val.split('@R@')[0] : val
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return defaultValue[value]
|
|
65
|
+
return defaultValue[value] ?? ''
|
|
66
66
|
}
|
|
67
67
|
giveDefaultValue({})
|
|
68
68
|
// 初始化表单数据
|
|
@@ -79,10 +79,18 @@ function initFormData() {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'relselect') {
|
|
82
|
-
|
|
83
|
-
(props.entity && props.entity[item.sourceId]
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
const rawRel =
|
|
83
|
+
(props.entity && props.entity[item.sourceId]) || item.transDefaultValue || item.defaultValue || ''
|
|
84
|
+
// 解析 $$user. 占位符:取当前用户对应扩展字段的值(实体字段为 code@R@name,需保留完整值供回显)
|
|
85
|
+
let resolvedRel: any = rawRel
|
|
86
|
+
if (typeof rawRel === 'string' && rawRel.includes('$$user.')) {
|
|
87
|
+
const ukey = rawRel.split('$$user.')[1]
|
|
88
|
+
const { extInfo = {} } = uni.getStorageSync('userInfo') || {}
|
|
89
|
+
const fmap = extInfo.fieldMap || {}
|
|
90
|
+
const uval = fmap[ukey]
|
|
91
|
+
resolvedRel = uval !== undefined && uval !== null ? String(uval) : ''
|
|
92
|
+
}
|
|
93
|
+
return (models[item.sourceId] = resolvedRel ? String(resolvedRel).split('@,@') : [])
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
// 文件
|
|
@@ -136,7 +144,7 @@ function initFormData() {
|
|
|
136
144
|
return (models[item.sourceId] = isYes ? '是' : '否')
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
return (models[item.sourceId] = (props.entity && props.entity[item.sourceId]) || item.transDefaultValue || '')
|
|
147
|
+
return (models[item.sourceId] = (props.entity && props.entity[item.sourceId]) || item.transDefaultValue || item.defaultValue || '')
|
|
140
148
|
})
|
|
141
149
|
|
|
142
150
|
// 遍历 models,处理 $$user. 前缀
|
|
@@ -551,6 +559,17 @@ function submit() {
|
|
|
551
559
|
if (Object.prototype.hasOwnProperty.call(model.value, key)) {
|
|
552
560
|
fields.value?.forEach((item: Fields) => {
|
|
553
561
|
if (item.sourceId === key) {
|
|
562
|
+
// 表单不显示的字段(hidden 或由 title 含 'y' 隐藏)一律传空,
|
|
563
|
+
// 避免把隐藏字段里残留的旧值一并提交
|
|
564
|
+
const visible = !item.title?.includes('y') && !item.hidden
|
|
565
|
+
if (!visible) {
|
|
566
|
+
const ct = ControlTypeSupportor.getControlType(item)
|
|
567
|
+
const isArrayType = ['multiselect', 'tree-entity-select', 'relselect', 'file', 'relfile'].includes(
|
|
568
|
+
ct
|
|
569
|
+
)
|
|
570
|
+
data[key] = isArrayType ? [] : ''
|
|
571
|
+
return
|
|
572
|
+
}
|
|
554
573
|
if (ControlTypeSupportor.getControlType(item) === 'file') {
|
|
555
574
|
data[key] = toRaw(model.value[key][0])
|
|
556
575
|
} else if (
|
|
@@ -569,8 +588,8 @@ function submit() {
|
|
|
569
588
|
})
|
|
570
589
|
}
|
|
571
590
|
}
|
|
572
|
-
console.log('data',
|
|
573
|
-
resolve(
|
|
591
|
+
console.log('data', clearValueMap, data)
|
|
592
|
+
resolve(data)
|
|
574
593
|
} else {
|
|
575
594
|
reject(valid)
|
|
576
595
|
}
|