af-mobile-client-vue3 1.0.77 → 1.0.79

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.0.77",
4
+ "version": "1.0.79",
5
5
  "description": "Vue + Vite component lib",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -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 = JSON.parse(JSON.stringify(props.imageList))
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
- function initComponents() {
28
- getConfigByName(props.configName, (result) => {
29
- formData.value = props.groupFormData
30
- if (result.groups) {
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
- }, props.serviceName)
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
- initComponents()
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"
@@ -66,6 +100,7 @@ async function submit() {
66
100
  :title="item.describe ? item.describe : item.tableName "
67
101
  >
68
102
  <div class="x-form-group-item">
103
+ <!-- :ref="`xFormListRef-${index}`" -->
69
104
  <XForm
70
105
  ref="xFormListRef"
71
106
  :mode="props.mode"
@@ -243,7 +243,7 @@ function formTypeCheck(attr, value) {
243
243
  }
244
244
  break
245
245
  case 'landlineNumber':
246
- if (!/^(0\d{2,3}-\d{7,8})$|^(0\d{2,3}\d{7,8})$|^$0\d{2,3}$\s?\d{7,8}$/.test(value)) {
246
+ if (!/^(0\d{2,3}[-\s]?)\d{7,8}$/.test(value)) {
247
247
  errorMessage.value = `请输入正确的座机号码`
248
248
  return
249
249
  }
@@ -51,6 +51,8 @@ function toDetail(item) {
51
51
  name: 'XFormGroupView',
52
52
  query: {
53
53
  id: item[idKey.value],
54
+ // id: item.rr_id,
55
+ // o_id: item.o_id,
54
56
  },
55
57
  })
56
58
  }
@@ -1,22 +1,25 @@
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 { onBeforeMount, ref } from 'vue'
4
+ import { onBeforeMount, onMounted, ref } from 'vue'
5
5
  import { showDialog } from 'vant'
6
- // import {runLogic} from "@af-mobile-client-vue3/services/api/common";
6
+ import { useRoute } from 'vue-router'
7
7
 
8
8
  // 纯表单
9
- // const configName = ref("form_check_test")
10
- // const serviceName = ref("af-system")
9
+ const configName = ref('form_check_test')
10
+ const serviceName = ref('af-system')
11
11
 
12
12
  // const configName = ref("计划下发Form")
13
13
  // const serviceName = ref("af-linepatrol")
14
14
 
15
15
  // 表单组
16
- const configName = ref("lngChargeAuditMobileFormGroup")
17
- const serviceName = ref("af-gaslink")
16
+ // const configName = ref('lngChargeAuditMobileFormGroup')
17
+ // const serviceName = ref('af-gaslink')
18
18
 
19
19
  const formData = ref({})
20
+ const formGroup = ref(null)
21
+ const route = useRoute()
22
+ const isInit = ref(false)
20
23
  function submit(_result) {
21
24
  showDialog({ message: '提交成功' }).then(() => {
22
25
  history.back()
@@ -35,6 +38,20 @@ function submit(_result) {
35
38
  // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
36
39
  // }
37
40
 
41
+ // function initComponents() {
42
+ // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
43
+ // console.log('res------', res)
44
+ // formData.value = { ...res }
45
+ // formGroup.value.init({
46
+ // configName: configName.value,
47
+ // serviceName: serviceName.value,
48
+ // groupFormData: { ...res },
49
+ // mode: "新增"
50
+ // })
51
+ // isInit.value = true
52
+ // })
53
+ // }
54
+
38
55
  // onBeforeMount(() => {
39
56
  // initComponents()
40
57
  // })
@@ -43,7 +60,9 @@ function submit(_result) {
43
60
  <template>
44
61
  <NormalDataLayout id="XFormGroupView" title="纯表单">
45
62
  <template #layout_content>
63
+ <!-- v-if="isInit" -->
46
64
  <XFormGroup
65
+ ref="formGroup"
47
66
  :config-name="configName"
48
67
  :service-name="serviceName"
49
68
  :group-form-data="formData"