af-mobile-client-vue3 1.0.77 → 1.0.78
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/src/components/core/Uploader/index.vue +12 -4
- package/src/components/data/XFormGroup/index.vue +42 -8
- package/src/components/data/XFormItem/index.vue +1 -1
- package/src/views/component/XCellListView/index.vue +2 -0
- package/src/views/component/XFormGroupView/index.vue +27 -6
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Uploader as vanUploader,
|
|
4
4
|
} from 'vant'
|
|
5
|
-
import { ref } from 'vue'
|
|
5
|
+
import { onMounted, ref } from 'vue'
|
|
6
6
|
import { deleteFile, upload } from '@af-mobile-client-vue3/services/api/common'
|
|
7
7
|
|
|
8
8
|
const props = defineProps({
|
|
@@ -76,12 +76,18 @@ function deleteFileFunction(file: any) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// ------------------------- 初始化 -------------------------
|
|
79
|
-
initComponent()
|
|
80
79
|
|
|
81
80
|
function initComponent() {
|
|
82
|
-
if (props.imageList.length > 0)
|
|
83
|
-
imageList.value =
|
|
81
|
+
if (props.imageList.length > 0) {
|
|
82
|
+
imageList.value = props.imageList.map((item) => {
|
|
83
|
+
return { id: item.id, name: item.f_filename, url: item.f_downloadpath }
|
|
84
|
+
})
|
|
85
|
+
}
|
|
84
86
|
}
|
|
87
|
+
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
initComponent()
|
|
90
|
+
})
|
|
85
91
|
</script>
|
|
86
92
|
|
|
87
93
|
<template>
|
|
@@ -95,6 +101,8 @@ function initComponent() {
|
|
|
95
101
|
<van-uploader
|
|
96
102
|
v-else-if="props.authority === 'admin'"
|
|
97
103
|
v-model="imageList"
|
|
104
|
+
multiple
|
|
105
|
+
:preview-image="true"
|
|
98
106
|
:after-read="fileUpload"
|
|
99
107
|
:before-delete="deleteFileFunction"
|
|
100
108
|
/>
|
|
@@ -20,14 +20,39 @@ const props = withDefaults(defineProps<{
|
|
|
20
20
|
mode: '查询',
|
|
21
21
|
})
|
|
22
22
|
const emit = defineEmits(['submit'])
|
|
23
|
+
|
|
24
|
+
interface Form {
|
|
25
|
+
configName?: string
|
|
26
|
+
serviceName?: string
|
|
27
|
+
groupFormData?: object
|
|
28
|
+
mode?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
const groupItems = ref([])
|
|
24
32
|
const formData = ref({})
|
|
25
33
|
const submitGroup = ref(false)
|
|
26
34
|
const submitSimple = ref(false)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
const isInit = ref(false)
|
|
36
|
+
const initStatus = ref(false)
|
|
37
|
+
const propsData = ref({})
|
|
38
|
+
|
|
39
|
+
// 组件初始化函数
|
|
40
|
+
function init(params: Form) {
|
|
41
|
+
initStatus.value = true
|
|
42
|
+
propsData.value = {
|
|
43
|
+
// configName: '',
|
|
44
|
+
// serviceName: undefined,
|
|
45
|
+
// groupFormData: () => ({}),
|
|
46
|
+
// mode: '查询',
|
|
47
|
+
configName: props.configName,
|
|
48
|
+
serviceName: props.serviceName,
|
|
49
|
+
groupFormData: props.groupFormData,
|
|
50
|
+
mode: props.mode,
|
|
51
|
+
...params,
|
|
52
|
+
}
|
|
53
|
+
formData.value = propsData.value.groupFormData
|
|
54
|
+
getConfigByName(propsData.value.configName, (result) => {
|
|
55
|
+
if (result?.groups) {
|
|
31
56
|
submitGroup.value = true
|
|
32
57
|
groupItems.value = result.groups
|
|
33
58
|
result.groups.forEach((group) => {
|
|
@@ -39,13 +64,15 @@ function initComponents() {
|
|
|
39
64
|
submitSimple.value = result.showSubmitBtn
|
|
40
65
|
groupItems.value = [{ ...result }]
|
|
41
66
|
}
|
|
42
|
-
|
|
67
|
+
isInit.value = true
|
|
68
|
+
}, propsData.value.serviceName)
|
|
43
69
|
}
|
|
44
70
|
watch(() => props.groupFormData, (_val) => {
|
|
45
71
|
formData.value = { ...formData.value, ...props.groupFormData }
|
|
46
72
|
})
|
|
47
73
|
onBeforeMount(() => {
|
|
48
|
-
|
|
74
|
+
if (!initStatus.value)
|
|
75
|
+
init(props)
|
|
49
76
|
})
|
|
50
77
|
const xFormListRef = ref([])
|
|
51
78
|
async function submit() {
|
|
@@ -55,10 +82,17 @@ async function submit() {
|
|
|
55
82
|
}
|
|
56
83
|
emit('submit', formData)
|
|
57
84
|
}
|
|
85
|
+
|
|
86
|
+
// function initXForm(index: number) {
|
|
87
|
+
// 获取自身示例
|
|
88
|
+
// refs[`xFormListRef-${index}`].init({})
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
defineExpose({ init })
|
|
58
92
|
</script>
|
|
59
93
|
|
|
60
94
|
<template>
|
|
61
|
-
<div id="x-form-group">
|
|
95
|
+
<div v-if="isInit" id="x-form-group">
|
|
62
96
|
<VanTabs scrollspy sticky>
|
|
63
97
|
<VanTab
|
|
64
98
|
v-for="(item, index) in groupItems"
|
|
@@ -67,7 +101,7 @@ async function submit() {
|
|
|
67
101
|
>
|
|
68
102
|
<div class="x-form-group-item">
|
|
69
103
|
<XForm
|
|
70
|
-
ref="xFormListRef"
|
|
104
|
+
:ref="`xFormListRef-${index}`"
|
|
71
105
|
:mode="props.mode"
|
|
72
106
|
:group-form-items="item"
|
|
73
107
|
:form-data="item.groupName ? formData[item.groupName] : formData"
|
|
@@ -243,7 +243,7 @@ function formTypeCheck(attr, value) {
|
|
|
243
243
|
}
|
|
244
244
|
break
|
|
245
245
|
case 'landlineNumber':
|
|
246
|
-
if (!/^(0\d{2,3}-\
|
|
246
|
+
if (!/^(0\d{2,3}[-\s]?)\d{7,8}$/.test(value)) {
|
|
247
247
|
errorMessage.value = `请输入正确的座机号码`
|
|
248
248
|
return
|
|
249
249
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
|
|
3
3
|
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
|
-
import {
|
|
4
|
+
import {onBeforeMount, onMounted, ref} from 'vue'
|
|
5
5
|
import { showDialog } from 'vant'
|
|
6
|
-
|
|
6
|
+
import {runLogic} from "@af-mobile-client-vue3/services/api/common";
|
|
7
|
+
import { useRoute } from 'vue-router'
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
// 纯表单
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const configName = ref("form_check_test")
|
|
12
|
+
const serviceName = ref("af-system")
|
|
11
13
|
|
|
12
14
|
// const configName = ref("计划下发Form")
|
|
13
15
|
// const serviceName = ref("af-linepatrol")
|
|
14
16
|
|
|
15
17
|
// 表单组
|
|
16
|
-
const configName = ref("lngChargeAuditMobileFormGroup")
|
|
17
|
-
const serviceName = ref("af-gaslink")
|
|
18
|
+
// const configName = ref("lngChargeAuditMobileFormGroup")
|
|
19
|
+
// const serviceName = ref("af-gaslink")
|
|
18
20
|
|
|
19
21
|
const formData = ref({})
|
|
22
|
+
const formGroup = ref(null)
|
|
23
|
+
const route = useRoute()
|
|
24
|
+
const isInit = ref(false)
|
|
20
25
|
function submit(_result) {
|
|
21
26
|
showDialog({ message: '提交成功' }).then(() => {
|
|
22
27
|
history.back()
|
|
@@ -35,6 +40,20 @@ function submit(_result) {
|
|
|
35
40
|
// formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
|
|
36
41
|
// }
|
|
37
42
|
|
|
43
|
+
// function initComponents() {
|
|
44
|
+
// runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
|
|
45
|
+
// console.log('res------', res)
|
|
46
|
+
// formData.value = { ...res }
|
|
47
|
+
// formGroup.value.init({
|
|
48
|
+
// configName: configName.value,
|
|
49
|
+
// serviceName: serviceName.value,
|
|
50
|
+
// groupFormData: { ...res },
|
|
51
|
+
// mode: "新增"
|
|
52
|
+
// })
|
|
53
|
+
// isInit.value = true
|
|
54
|
+
// })
|
|
55
|
+
// }
|
|
56
|
+
|
|
38
57
|
// onBeforeMount(() => {
|
|
39
58
|
// initComponents()
|
|
40
59
|
// })
|
|
@@ -43,7 +62,9 @@ function submit(_result) {
|
|
|
43
62
|
<template>
|
|
44
63
|
<NormalDataLayout id="XFormGroupView" title="纯表单">
|
|
45
64
|
<template #layout_content>
|
|
65
|
+
<!-- v-if="isInit"-->
|
|
46
66
|
<XFormGroup
|
|
67
|
+
ref="formGroup"
|
|
47
68
|
:config-name="configName"
|
|
48
69
|
:service-name="serviceName"
|
|
49
70
|
:group-form-data="formData"
|