wui-components-v2 1.1.83 → 1.1.85
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/components/add-address-page/add-address-page.vue +4 -2
- package/components/custom-date-picker/custom-date-picker.vue +4 -3
- package/components/custom-select-picker/custom-select-picker.vue +11 -3
- package/components/form-control/form-control.vue +63 -38
- package/components/user-choose/user-choose.vue +3 -0
- package/components/wui-select-popup/wui-select-popup.vue +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="rounded-md mb-3">
|
|
3
3
|
<view class="rounded-md shadow-md dark:bg-[#252530] pb-3">
|
|
4
|
-
<wd-textarea v-model="personDetail" placeholder="「粘贴识别」或输入文本,智能拆分、姓名、电话和地址" />
|
|
4
|
+
<wd-textarea v-model="personDetail" :readonly="readonly" placeholder="「粘贴识别」或输入文本,智能拆分、姓名、电话和地址" />
|
|
5
5
|
<view class="flex justify-end align-center px-3">
|
|
6
|
-
<view class="px-3 text-white bg-[#007AFF] rounded-md py-1 text-sm box-border" @click="identifyingFn">
|
|
6
|
+
<view v-if="!readonly" class="px-3 text-white bg-[#007AFF] rounded-md py-1 text-sm box-border" @click="identifyingFn">
|
|
7
7
|
智能识别
|
|
8
8
|
</view>
|
|
9
9
|
</view>
|
|
@@ -20,6 +20,7 @@ defineOptions({
|
|
|
20
20
|
})
|
|
21
21
|
const props = defineProps<{
|
|
22
22
|
group: any
|
|
23
|
+
readonly?: boolean
|
|
23
24
|
}>()
|
|
24
25
|
const model = defineModel<any>()
|
|
25
26
|
const personDetail = ref('')
|
|
@@ -29,6 +30,7 @@ const form = ref(null)
|
|
|
29
30
|
* @description: 智能识别
|
|
30
31
|
*/
|
|
31
32
|
function identifyingFn() {
|
|
33
|
+
if (props.readonly) return
|
|
32
34
|
if (!personDetail.value) {
|
|
33
35
|
toast.info('请输入内容')
|
|
34
36
|
return
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
type: { type: String, default: 'date' },
|
|
14
14
|
min: String,
|
|
15
15
|
max: String,
|
|
16
|
+
readonly: { type: Boolean, default: false },
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
const emit = defineEmits<{
|
|
@@ -64,9 +65,9 @@ console.log('labelText', props)
|
|
|
64
65
|
|
|
65
66
|
<template>
|
|
66
67
|
<div class="flex items-center justify-between">
|
|
67
|
-
<wd-input v-model="labelText" readonly :placeholder="placeholder" class="flex-1" @click="open = true" />
|
|
68
|
-
<wd-icon v-if="labelText" name="close-circle" size="16px" @click="clear" />
|
|
69
|
-
<wd-icon v-else name="right" size="16px" @click="clear" />
|
|
68
|
+
<wd-input v-model="labelText" readonly :placeholder="placeholder" class="flex-1" @click="!readonly && (open = true)" />
|
|
69
|
+
<wd-icon v-if="!readonly && labelText" name="close-circle" size="16px" @click="clear" />
|
|
70
|
+
<wd-icon v-else-if="!readonly" name="right" size="16px" @click="clear" />
|
|
70
71
|
</div>
|
|
71
72
|
|
|
72
73
|
<wd-calendar
|
|
@@ -14,6 +14,7 @@ const props = defineProps({
|
|
|
14
14
|
labelKey: { type: String, default: 'label' },
|
|
15
15
|
valueKey: { type: String, default: 'value' },
|
|
16
16
|
type: { type: String, default: 'radio' },
|
|
17
|
+
readonly: { type: Boolean, default: false },
|
|
17
18
|
})
|
|
18
19
|
|
|
19
20
|
const emit = defineEmits<{
|
|
@@ -63,9 +64,15 @@ const labelText = computed(() => {
|
|
|
63
64
|
|
|
64
65
|
<template>
|
|
65
66
|
<div class="flex items-center justify-between">
|
|
66
|
-
<wd-input
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
<wd-input
|
|
68
|
+
v-model="labelText"
|
|
69
|
+
readonly
|
|
70
|
+
:placeholder="placeholder"
|
|
71
|
+
class="flex-1"
|
|
72
|
+
@click="!readonly && (open = true)"
|
|
73
|
+
/>
|
|
74
|
+
<wd-icon v-if="!readonly && labelText" name="close-circle" size="16px" @click="clear" />
|
|
75
|
+
<wd-icon v-else-if="!readonly" name="right" size="16px" @click="clear" />
|
|
69
76
|
</div>
|
|
70
77
|
|
|
71
78
|
<wd-select-picker
|
|
@@ -76,6 +83,7 @@ const labelText = computed(() => {
|
|
|
76
83
|
value-key="value"
|
|
77
84
|
class="custom-select-picker"
|
|
78
85
|
:type="type as any"
|
|
86
|
+
:readonly="readonly"
|
|
79
87
|
/>
|
|
80
88
|
</template>
|
|
81
89
|
|
|
@@ -111,7 +111,7 @@ function initFormData() {
|
|
|
111
111
|
|
|
112
112
|
// 时间
|
|
113
113
|
if (
|
|
114
|
-
ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === '
|
|
114
|
+
ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'eetime' ||
|
|
115
115
|
ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'date'
|
|
116
116
|
) {
|
|
117
117
|
return (models[item.sourceId] =
|
|
@@ -193,31 +193,26 @@ const subRelMonitor = computed(() =>
|
|
|
193
193
|
// 仅当字段类型(extControlType)不在排除列表中才参与联动监听
|
|
194
194
|
.filter((item: any) => !EXCLUDE_CONTROL_TYPES.includes(item.extControlType))
|
|
195
195
|
.flatMap((item: any) =>
|
|
196
|
-
REL_FIELD_CONFIG
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
useA: !!rel.extRefPageId,
|
|
217
|
-
extRefPageId: rel.extRefPageId,
|
|
218
|
-
}
|
|
219
|
-
})
|
|
220
|
-
.filter((m: any) => m && m.paramSourceId && m.valueSourceKey)
|
|
196
|
+
REL_FIELD_CONFIG.map(({ key, assignment }) => {
|
|
197
|
+
const rel = (item as any)[key]
|
|
198
|
+
// subRelValueField:兼容嵌套在 rel 字段下,或 item 同级(仅 relValueField 兼容同级)
|
|
199
|
+
const subRel = rel?.subRelValueField || (key === 'relValueField' ? (item as any).subRelValueField : undefined)
|
|
200
|
+
if (!rel || !subRel) return null
|
|
201
|
+
// 找到原始字段对象(props.fieldGroup.fields 中):filteredFields 每次重算会浅拷贝生成新对象,
|
|
202
|
+
// 只改拷贝对象会在重算时丢失 max/min,因此同时持有原始对象引用,双写以保证不丢值
|
|
203
|
+
const rawItem = (props.fieldGroup?.fields || []).find((f: any) => f.sourceId === item.sourceId) || item
|
|
204
|
+
return {
|
|
205
|
+
monitorKey: `${item.sourceId}__${key}`, // 唯一键,避免多 rel 字段共用 paramSourceId 相互干扰
|
|
206
|
+
item, // filteredFields 中的拷贝对象,直接改可立即触发模板更新
|
|
207
|
+
rawItem, // 原始字段对象,改它可在 filteredFields 重算后保留 max/min
|
|
208
|
+
itemSourceId: item.sourceId,
|
|
209
|
+
assignment, // 'value' | 'max' | 'min'
|
|
210
|
+
valueSourceKey: subRel.sourceId, // 从接口返回 fieldMap 取值所用的 key
|
|
211
|
+
paramSourceId: rel.sourceId || rel.id, // 请求参数来源字段
|
|
212
|
+
useA: !!rel.extRefPageId,
|
|
213
|
+
extRefPageId: rel.extRefPageId,
|
|
214
|
+
}
|
|
215
|
+
}).filter((m: any) => m && m.paramSourceId && m.valueSourceKey)
|
|
221
216
|
)
|
|
222
217
|
)
|
|
223
218
|
const { setFieldValue, getFieldValue } = useFormFieldValues()
|
|
@@ -281,11 +276,23 @@ watch(
|
|
|
281
276
|
const fromStore = getFieldValue(m.paramSourceId)
|
|
282
277
|
const fromEntity = (props.entity as any)?.[m.paramSourceId]
|
|
283
278
|
const finalVal =
|
|
284
|
-
local !== undefined && local !== ''
|
|
285
|
-
|
|
286
|
-
|
|
279
|
+
local !== undefined && local !== ''
|
|
280
|
+
? local
|
|
281
|
+
: fromStore !== undefined && fromStore !== ''
|
|
282
|
+
? fromStore
|
|
283
|
+
: fromEntity !== undefined && fromEntity !== ''
|
|
284
|
+
? fromEntity
|
|
287
285
|
: undefined
|
|
288
|
-
console.log(
|
|
286
|
+
console.log(
|
|
287
|
+
`[subRel] 来源取值 ${m.monitorKey} sourceId=${m.paramSourceId} | local=`,
|
|
288
|
+
local,
|
|
289
|
+
'| store=',
|
|
290
|
+
fromStore,
|
|
291
|
+
'| props.entity=',
|
|
292
|
+
fromEntity,
|
|
293
|
+
'=> 采用',
|
|
294
|
+
finalVal
|
|
295
|
+
)
|
|
289
296
|
snapshot[m.monitorKey] = finalVal
|
|
290
297
|
})
|
|
291
298
|
return snapshot
|
|
@@ -295,10 +302,18 @@ watch(
|
|
|
295
302
|
const val = newVal[m.monitorKey]
|
|
296
303
|
const prev = lastSubRelSnapshot.value[m.monitorKey]
|
|
297
304
|
lastSubRelSnapshot.value[m.monitorKey] = val
|
|
298
|
-
console.log(
|
|
299
|
-
'
|
|
300
|
-
|
|
301
|
-
'|
|
|
305
|
+
console.log(
|
|
306
|
+
'[subRel] 处理',
|
|
307
|
+
m.monitorKey,
|
|
308
|
+
'| assignment=',
|
|
309
|
+
m.assignment,
|
|
310
|
+
'| 参数来源sourceId=',
|
|
311
|
+
m.paramSourceId,
|
|
312
|
+
'| 取到的值val=',
|
|
313
|
+
val,
|
|
314
|
+
'| 上次值prev=',
|
|
315
|
+
prev
|
|
316
|
+
)
|
|
302
317
|
// 仅在选中值存在且发生变化时请求,避免无意义重复调用
|
|
303
318
|
if (val !== undefined && val !== null && val !== '' && val !== prev) {
|
|
304
319
|
try {
|
|
@@ -308,11 +323,11 @@ watch(
|
|
|
308
323
|
if (m.useA) {
|
|
309
324
|
api = topData
|
|
310
325
|
apiName = '/v3/ltmpl/top-data'
|
|
311
|
-
param = { top: 1,
|
|
326
|
+
param = { top: 1, secondCriterion: val, sourceId: m.extRefPageId }
|
|
312
327
|
} else {
|
|
313
328
|
api = dtmplData
|
|
314
329
|
apiName = '/v3/dtmpl/data'
|
|
315
|
-
param = { top: 1,
|
|
330
|
+
param = { top: 1, secondCriterion: val, sourceId: m.paramSourceId }
|
|
316
331
|
}
|
|
317
332
|
console.log('[subRel] >>> 发起请求', apiName, '参数=', param)
|
|
318
333
|
const res = await api(param)
|
|
@@ -352,10 +367,12 @@ watch(
|
|
|
352
367
|
}
|
|
353
368
|
} else {
|
|
354
369
|
// 没进请求分支:常见原因是 val 为空(跨页面没取到值)或值未变化
|
|
355
|
-
console.warn(
|
|
370
|
+
console.warn(
|
|
371
|
+
'[subRel] ✗ 未发起请求 ——',
|
|
356
372
|
val === undefined || val === null || val === ''
|
|
357
373
|
? `参数来源值 val 为空(跨页面存储未取到 sourceId=${m.paramSourceId} 的值)`
|
|
358
|
-
: `值未发生变化(prev=${prev})`
|
|
374
|
+
: `值未发生变化(prev=${prev})`
|
|
375
|
+
)
|
|
359
376
|
}
|
|
360
377
|
}
|
|
361
378
|
},
|
|
@@ -606,6 +623,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
606
623
|
:placeholder="`请选择${item.title}`"
|
|
607
624
|
:columns="enumColumn && formatSelectColumns(enumColumn[item.mstrucId])"
|
|
608
625
|
type="radio"
|
|
626
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
609
627
|
/>
|
|
610
628
|
</wd-form-item>
|
|
611
629
|
<wd-form-item
|
|
@@ -625,6 +643,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
625
643
|
:title="item.title"
|
|
626
644
|
:add-event="addEvent"
|
|
627
645
|
:ext-control-type="item.extControlType"
|
|
646
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
628
647
|
/>
|
|
629
648
|
</wd-form-item>
|
|
630
649
|
<wd-form-item
|
|
@@ -640,6 +659,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
640
659
|
:placeholder="`请选择${item.title}`"
|
|
641
660
|
:columns="enumColumn && formatSelectColumns(enumColumn[item.mstrucId])"
|
|
642
661
|
type="checkbox"
|
|
662
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
643
663
|
/>
|
|
644
664
|
</wd-form-item>
|
|
645
665
|
<wd-form-item
|
|
@@ -655,6 +675,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
655
675
|
type="date"
|
|
656
676
|
:clearable="!item.disabled"
|
|
657
677
|
:placeholder="`请选择${item.title}`"
|
|
678
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
658
679
|
/>
|
|
659
680
|
</wd-form-item>
|
|
660
681
|
<wd-form-item
|
|
@@ -671,6 +692,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
671
692
|
type="datetime"
|
|
672
693
|
:clearable="!item.disabled"
|
|
673
694
|
:placeholder="`请选择${item.title}`"
|
|
695
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
674
696
|
/>
|
|
675
697
|
</wd-form-item>
|
|
676
698
|
<wd-form-item
|
|
@@ -687,6 +709,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
687
709
|
use-second
|
|
688
710
|
:clearable="!item.disabled"
|
|
689
711
|
:placeholder="`请选择${item.title}`"
|
|
712
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
690
713
|
/>
|
|
691
714
|
</wd-form-item>
|
|
692
715
|
<wd-form-item
|
|
@@ -703,6 +726,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
703
726
|
use-second
|
|
704
727
|
:clearable="!item.disabled"
|
|
705
728
|
:placeholder="`请选择${item.title}`"
|
|
729
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
706
730
|
/>
|
|
707
731
|
</wd-form-item>
|
|
708
732
|
<wd-form-item
|
|
@@ -719,6 +743,7 @@ console.log('clearValueMap', clearValueMap)
|
|
|
719
743
|
use-second
|
|
720
744
|
:clearable="!item.disabled"
|
|
721
745
|
:placeholder="`请选择${item.title}`"
|
|
746
|
+
:readonly="item.disabled || item.rowEditType === 'readonly'"
|
|
722
747
|
/>
|
|
723
748
|
</wd-form-item>
|
|
724
749
|
<wd-form-item
|
|
@@ -31,6 +31,7 @@ const props = defineProps({
|
|
|
31
31
|
sourceId: String,
|
|
32
32
|
title: String,
|
|
33
33
|
extControlType: String,
|
|
34
|
+
readonly: { type: Boolean, default: false },
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
const emit = defineEmits<{
|
|
@@ -49,6 +50,7 @@ const showValue = reactive({
|
|
|
49
50
|
const EVENT_NAME = `userChooseSelected_${generateHighResolutionID()}`
|
|
50
51
|
|
|
51
52
|
const addUser = () => {
|
|
53
|
+
if (props.readonly) return
|
|
52
54
|
const addEvent = generateHighResolutionID()
|
|
53
55
|
// 当前已有数据时,跳转到编辑页面
|
|
54
56
|
if (currentValue.value && typeof currentValue.value === 'string') {
|
|
@@ -69,6 +71,7 @@ const addUser = () => {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
const toAddressList = () => {
|
|
74
|
+
if (props.readonly) return
|
|
72
75
|
uni.navigateTo({
|
|
73
76
|
url: `/pages/select-list/index?sourceId=${props.sourceId}&title=${props.title}&extControlType=${props.extControlType}&selectEvent=${EVENT_NAME}`,
|
|
74
77
|
})
|
|
@@ -425,8 +425,8 @@ console.log(props, 'props')
|
|
|
425
425
|
|
|
426
426
|
<!-- 右侧箭头 -->
|
|
427
427
|
<view class="cell-arrow">
|
|
428
|
-
<wd-icon v-if="clearable && displayValue" name="close-circle" size="16px" @click.stop="clear" />
|
|
429
|
-
<wd-icon name="right"
|
|
428
|
+
<wd-icon v-if="clearable && !readonly && displayValue" name="close-circle" size="16px" @click.stop="clear" />
|
|
429
|
+
<wd-icon v-else-if="!readonly" name="right" size="16px"></wd-icon>
|
|
430
430
|
</view>
|
|
431
431
|
</view>
|
|
432
432
|
|