vue_zhongyou 1.0.15 → 1.0.16
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/package.json +1 -1
- package//345/212/237/350/203/275/344/273/243/347/240/201/AI/345/257/271/350/257/235/DynamicMobileForm.vue +22 -2
- package//346/217/222/344/273/266//344/273/245/346/227/245/344/270/272/351/211/264/357/274/232/350/241/260/351/200/200/346/227/266/344/273/243/347/224/237/345/255/230/346/214/207/345/215/227.epub +0 -0
package/package.json
CHANGED
|
@@ -211,6 +211,7 @@
|
|
|
211
211
|
<van-area
|
|
212
212
|
:area-list="areaList"
|
|
213
213
|
:columns-placeholder="addressPopup.columnsPlaceholder || ['请选择', '请选择', '请选择']"
|
|
214
|
+
:columns-num="addressPopup.columnsNum || 3"
|
|
214
215
|
v-model="addressPopup.value"
|
|
215
216
|
@confirm="onAddressConfirm"
|
|
216
217
|
@cancel="closeAddressPicker"
|
|
@@ -295,6 +296,7 @@ const addressPopup = ref({
|
|
|
295
296
|
field: null,
|
|
296
297
|
areaList: null,
|
|
297
298
|
columnsPlaceholder: null,
|
|
299
|
+
columnsNum: null,
|
|
298
300
|
value: ''
|
|
299
301
|
})
|
|
300
302
|
|
|
@@ -619,7 +621,8 @@ const openAddressPicker = (field) => {
|
|
|
619
621
|
visible: true,
|
|
620
622
|
field,
|
|
621
623
|
areaList: areaList,
|
|
622
|
-
columnsPlaceholder: field.columnsPlaceholder
|
|
624
|
+
columnsPlaceholder: field.columnsPlaceholder,
|
|
625
|
+
columnsNum: field.columnsNum || 3
|
|
623
626
|
}
|
|
624
627
|
|
|
625
628
|
// 如果表单数据中已有code值,则设置默认选中项
|
|
@@ -646,6 +649,11 @@ const openAddressPicker = (field) => {
|
|
|
646
649
|
const getCodeToAreaValue = (code) => {
|
|
647
650
|
if (!code) return ''
|
|
648
651
|
|
|
652
|
+
// 如果code是一个对象且包含code属性
|
|
653
|
+
if (typeof code === 'object' && code.code) {
|
|
654
|
+
code = code.code
|
|
655
|
+
}
|
|
656
|
+
|
|
649
657
|
// 确保code是字符串且长度为6
|
|
650
658
|
const codeStr = String(code).padEnd(6, '0')
|
|
651
659
|
|
|
@@ -676,7 +684,14 @@ const onAddressConfirm = ({ selectedOptions }) => {
|
|
|
676
684
|
}
|
|
677
685
|
}
|
|
678
686
|
|
|
679
|
-
|
|
687
|
+
// 构造包含code和text的对象
|
|
688
|
+
const addressText = selectedOptions.map(opt => opt.text).join('')
|
|
689
|
+
const addressObject = {
|
|
690
|
+
code: code,
|
|
691
|
+
text: addressText
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
updateFieldValue(addressPopup.value.field.field, addressObject)
|
|
680
695
|
|
|
681
696
|
// 触发modelValue更新
|
|
682
697
|
emit('update:modelValue', snapshot())
|
|
@@ -686,6 +701,11 @@ const onAddressConfirm = ({ selectedOptions }) => {
|
|
|
686
701
|
|
|
687
702
|
const getAddressText = (field) => {
|
|
688
703
|
const value = formData[field.field]
|
|
704
|
+
// 如果value是一个对象且包含text属性,直接返回text
|
|
705
|
+
if (value && typeof value === 'object' && value.text) {
|
|
706
|
+
return value.text
|
|
707
|
+
}
|
|
708
|
+
|
|
689
709
|
// 如果value是一个对象且包含code属性
|
|
690
710
|
if (value && typeof value === 'object' && value.code) {
|
|
691
711
|
return getCodeToAddressText(value.code)
|