af-mobile-client-vue3 1.6.21 → 1.6.23
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
CHANGED
|
@@ -98,6 +98,8 @@ const formType = {
|
|
|
98
98
|
text: 'text', // 表单项类型
|
|
99
99
|
number: 'number',
|
|
100
100
|
date: 'date',
|
|
101
|
+
year: 'year',
|
|
102
|
+
yearMonth: 'yearMonth',
|
|
101
103
|
radio: 'radio',
|
|
102
104
|
checkbox: 'checkbox',
|
|
103
105
|
multipleSelect: 'multipleSelect',
|
|
@@ -117,11 +119,27 @@ const debouncedCustomFunc = ref<((ctx: any, cfg: any, userDetail: any, safeConfi
|
|
|
117
119
|
// 拍照/上传相关信息
|
|
118
120
|
const cameraData = ref(undefined)
|
|
119
121
|
// 日期选择器默认值
|
|
120
|
-
const datePickerDefault = ref([
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
]
|
|
122
|
+
const datePickerDefault = ref<string[]>([])
|
|
123
|
+
|
|
124
|
+
watch(() => currentVal[dataStructure.fieldType], (type) => {
|
|
125
|
+
if (type === formType.year)
|
|
126
|
+
datePickerDefault.value = [dayjs().format('YYYY')]
|
|
127
|
+
else if (type === formType.yearMonth)
|
|
128
|
+
datePickerDefault.value = [dayjs().format('YYYY'), dayjs().format('MM')]
|
|
129
|
+
else if (type === formType.date)
|
|
130
|
+
datePickerDefault.value = [dayjs().format('YYYY'), dayjs().format('MM'), dayjs().format('DD')]
|
|
131
|
+
else
|
|
132
|
+
datePickerDefault.value = []
|
|
133
|
+
}, { immediate: true })
|
|
134
|
+
|
|
135
|
+
const columnsType = computed(() => {
|
|
136
|
+
const type = currentVal[dataStructure.fieldType]
|
|
137
|
+
if (type === formType.year)
|
|
138
|
+
return ['year'] as any
|
|
139
|
+
if (type === formType.yearMonth)
|
|
140
|
+
return ['year', 'month'] as any
|
|
141
|
+
return ['year', 'month', 'day'] as any
|
|
142
|
+
})
|
|
125
143
|
|
|
126
144
|
function safeParseJson(jsonStr: any): any {
|
|
127
145
|
if (typeof jsonStr !== 'string')
|
|
@@ -141,6 +159,8 @@ function confirm(selVal, selObj) {
|
|
|
141
159
|
|
|
142
160
|
switch (currentVal[dataStructure.fieldType]) {
|
|
143
161
|
case formType.date:
|
|
162
|
+
case formType.year:
|
|
163
|
+
case formType.yearMonth:
|
|
144
164
|
currentVal.value = selVal.selectedValues.join('-')
|
|
145
165
|
selVal = currentVal.value
|
|
146
166
|
showPicker.value = false
|
|
@@ -249,7 +269,7 @@ const datePickerMaxDate = computed(() => {
|
|
|
249
269
|
@blur="confirm"
|
|
250
270
|
/>
|
|
251
271
|
<VanField
|
|
252
|
-
v-else-if="currentVal[dataStructure.fieldType] === formType.date"
|
|
272
|
+
v-else-if="currentVal[dataStructure.fieldType] === formType.date || currentVal[dataStructure.fieldType] === formType.year || currentVal[dataStructure.fieldType] === formType.yearMonth"
|
|
253
273
|
v-model="currentVal[dataStructure.fieldValue]"
|
|
254
274
|
center
|
|
255
275
|
is-link
|
|
@@ -392,7 +412,7 @@ const datePickerMaxDate = computed(() => {
|
|
|
392
412
|
</VanField>
|
|
393
413
|
<!-- {{ currentVal }} -->
|
|
394
414
|
<VanPopup v-model:show="showPicker" position="bottom">
|
|
395
|
-
<VanDatePicker v-model="datePickerDefault" :min-date="datePickerMinDate" :max-date="datePickerMaxDate" @confirm="confirm" @cancel="showPicker = false" />
|
|
415
|
+
<VanDatePicker v-model="datePickerDefault" :columns-type="columnsType" :min-date="datePickerMinDate" :max-date="datePickerMaxDate" @confirm="confirm" @cancel="showPicker = false" />
|
|
396
416
|
</VanPopup>
|
|
397
417
|
<slot :item="currentVal" />
|
|
398
418
|
</template>
|