af-mobile-client-vue3 1.2.29 → 1.2.30
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 = reactive({})
|
|
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
|
|
126
|
+
const val = form[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,8 +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
|
-
form
|
|
212
|
-
|
|
211
|
+
Object.assign(form, props.formData || {})
|
|
213
212
|
// 清理并重新设置验证规则
|
|
214
213
|
setupValidationRules()
|
|
215
214
|
}
|
|
@@ -278,7 +277,7 @@ function resetForm() {
|
|
|
278
277
|
formGroupName.value = 'default'
|
|
279
278
|
myServiceName.value = ''
|
|
280
279
|
tableName.value = ''
|
|
281
|
-
form
|
|
280
|
+
Object.assign(form, {})
|
|
282
281
|
Object.keys(rules).forEach(key => delete rules[key])
|
|
283
282
|
myGetDataParams.value = {}
|
|
284
283
|
}
|
|
@@ -286,12 +285,12 @@ function resetForm() {
|
|
|
286
285
|
// 监听 formData 变化
|
|
287
286
|
watch(() => props.formData, (newVal) => {
|
|
288
287
|
if (newVal) {
|
|
289
|
-
form
|
|
288
|
+
Object.assign(form, newVal)
|
|
290
289
|
}
|
|
291
290
|
})
|
|
292
291
|
|
|
293
292
|
watch(
|
|
294
|
-
|
|
293
|
+
form,
|
|
295
294
|
(val) => {
|
|
296
295
|
if (typeof formDataChange === 'function') {
|
|
297
296
|
formDataChange(val)
|
|
@@ -324,7 +323,7 @@ function init(params: InitParams) {
|
|
|
324
323
|
else if (formItems) {
|
|
325
324
|
// 直接使用传入的配置初始化
|
|
326
325
|
setupFormConfig(formItems)
|
|
327
|
-
form
|
|
326
|
+
Object.assign(form, formData || props.formData || {})
|
|
328
327
|
myGetDataParams.value = getDataParams
|
|
329
328
|
|
|
330
329
|
// 设置表名
|
|
@@ -366,14 +365,14 @@ function loadParamLogicNameData(paramLogicName) {
|
|
|
366
365
|
}
|
|
367
366
|
runLogic(paramLogicName, logicParam || {}, props.serviceName).then((data: any) => {
|
|
368
367
|
if (data) {
|
|
369
|
-
|
|
368
|
+
setForm(data)
|
|
370
369
|
}
|
|
371
370
|
})
|
|
372
371
|
}
|
|
373
372
|
}
|
|
374
373
|
|
|
375
374
|
function setForm(obj: object) {
|
|
376
|
-
Object.assign(form
|
|
375
|
+
Object.assign(form, obj)
|
|
377
376
|
}
|
|
378
377
|
|
|
379
378
|
// 获取表单字段实际值
|
|
@@ -481,7 +480,7 @@ async function appendSilenceAddFields(form: any) {
|
|
|
481
480
|
}
|
|
482
481
|
|
|
483
482
|
function prepareForm() {
|
|
484
|
-
const formObj = { ...form
|
|
483
|
+
const formObj = { ...form }
|
|
485
484
|
const cleanedForm: any = {}
|
|
486
485
|
|
|
487
486
|
for (const key of Object.keys(formObj)) {
|