af-mobile-client-vue3 1.2.30 → 1.2.31
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
|
@@ -80,7 +80,7 @@ const formDataChange = inject('formDataChange', null)
|
|
|
80
80
|
// 核心状态
|
|
81
81
|
const xFormRef = ref<FormInstance>()
|
|
82
82
|
const loaded = ref(false)
|
|
83
|
-
const form =
|
|
83
|
+
const form = ref({})
|
|
84
84
|
const rules = reactive({})
|
|
85
85
|
const myGetDataParams = ref({})
|
|
86
86
|
|
|
@@ -123,7 +123,7 @@ const previewLonLatKey = computed(() => {
|
|
|
123
123
|
})
|
|
124
124
|
|
|
125
125
|
const previewMapPoint = computed(() => {
|
|
126
|
-
const val = form[previewLonLatKey.value]
|
|
126
|
+
const val = form.value[previewLonLatKey.value]
|
|
127
127
|
if (val && typeof val === 'string' && val.includes(',')) {
|
|
128
128
|
const [lon, lat] = val.split(',').map(Number)
|
|
129
129
|
if (!Number.isNaN(lon) && !Number.isNaN(lat)) {
|
|
@@ -208,7 +208,7 @@ function setupFormConfig(config: GroupFormItems) {
|
|
|
208
208
|
formConfig.value = config
|
|
209
209
|
myServiceName.value = props.serviceName || ''
|
|
210
210
|
formGroupName.value = config.groupName || 'default'
|
|
211
|
-
|
|
211
|
+
form.value = props.formData || {}
|
|
212
212
|
// 清理并重新设置验证规则
|
|
213
213
|
setupValidationRules()
|
|
214
214
|
}
|
|
@@ -277,7 +277,7 @@ function resetForm() {
|
|
|
277
277
|
formGroupName.value = 'default'
|
|
278
278
|
myServiceName.value = ''
|
|
279
279
|
tableName.value = ''
|
|
280
|
-
|
|
280
|
+
form.value = {}
|
|
281
281
|
Object.keys(rules).forEach(key => delete rules[key])
|
|
282
282
|
myGetDataParams.value = {}
|
|
283
283
|
}
|
|
@@ -289,15 +289,11 @@ watch(() => props.formData, (newVal) => {
|
|
|
289
289
|
}
|
|
290
290
|
})
|
|
291
291
|
|
|
292
|
-
watch(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
{ deep: true },
|
|
300
|
-
)
|
|
292
|
+
watch(form, (newVal) => {
|
|
293
|
+
if (typeof formDataChange === 'function') {
|
|
294
|
+
formDataChange(newVal)
|
|
295
|
+
}
|
|
296
|
+
}, { deep: true })
|
|
301
297
|
|
|
302
298
|
// 组件挂载时初始化
|
|
303
299
|
onBeforeMount(() => {
|
|
@@ -323,7 +319,7 @@ function init(params: InitParams) {
|
|
|
323
319
|
else if (formItems) {
|
|
324
320
|
// 直接使用传入的配置初始化
|
|
325
321
|
setupFormConfig(formItems)
|
|
326
|
-
|
|
322
|
+
form.value = formData || props.formData || {}
|
|
327
323
|
myGetDataParams.value = getDataParams
|
|
328
324
|
|
|
329
325
|
// 设置表名
|
|
@@ -365,14 +361,14 @@ function loadParamLogicNameData(paramLogicName) {
|
|
|
365
361
|
}
|
|
366
362
|
runLogic(paramLogicName, logicParam || {}, props.serviceName).then((data: any) => {
|
|
367
363
|
if (data) {
|
|
368
|
-
|
|
364
|
+
form.value = data
|
|
369
365
|
}
|
|
370
366
|
})
|
|
371
367
|
}
|
|
372
368
|
}
|
|
373
369
|
|
|
374
370
|
function setForm(obj: object) {
|
|
375
|
-
Object.assign(form, obj)
|
|
371
|
+
Object.assign(form.value, obj)
|
|
376
372
|
}
|
|
377
373
|
|
|
378
374
|
// 获取表单字段实际值
|
|
@@ -480,7 +476,7 @@ async function appendSilenceAddFields(form: any) {
|
|
|
480
476
|
}
|
|
481
477
|
|
|
482
478
|
function prepareForm() {
|
|
483
|
-
const formObj = { ...form }
|
|
479
|
+
const formObj = { ...form.value }
|
|
484
480
|
const cleanedForm: any = {}
|
|
485
481
|
|
|
486
482
|
for (const key of Object.keys(formObj)) {
|