af-mobile-client-vue3 1.2.54 → 1.2.56

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.2.54",
4
+ "version": "1.2.56",
5
5
  "packageManager": "pnpm@10.12.3",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -6,7 +6,7 @@ import {
6
6
  ActionSheet,
7
7
  Uploader as vanUploader,
8
8
  } from 'vant'
9
- import { ref, watch } from 'vue'
9
+ import { ref } from 'vue'
10
10
 
11
11
  const props = defineProps({
12
12
  imageList: Array<any>,
@@ -19,11 +19,6 @@ const emit = defineEmits(['updateFileList'])
19
19
 
20
20
  const imageList = ref<Array<any>>(props.imageList ?? [])
21
21
 
22
- // 同步 props.imageList 到内部 imageList,保证每次变化都响应
23
- watch(() => props.imageList, (newVal) => {
24
- imageList.value = Array.isArray(newVal) ? [...newVal] : []
25
- }, { immediate: true })
26
-
27
22
  // 触发拍照
28
23
  function triggerCamera() {
29
24
  mobileUtil.execute({
@@ -84,8 +79,8 @@ function handlePhotoUpload(photoData: any) {
84
79
  funcName: 'uploadResource',
85
80
  param,
86
81
  callbackFunc: (result: any) => {
82
+ const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
87
83
  if (result.status === 'success') {
88
- const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
89
84
  if (index !== -1) {
90
85
  imageList.value[index].uid = result.data.id
91
86
  imageList.value[index].id = result.data.id
@@ -95,17 +90,20 @@ function handlePhotoUpload(photoData: any) {
95
90
  }
96
91
  }
97
92
  else {
98
- const index = imageList.value.findIndex(item => item.uid === tempFile.uid)
99
93
  if (index !== -1) {
100
94
  imageList.value[index].status = 'failed'
101
95
  imageList.value[index].message = '上传失败'
102
96
  }
103
97
  }
104
98
 
99
+ const doneIds = Object.values(imageList.value)
100
+ .filter(item => item.status === 'done')
101
+ .map(item => item.id)
102
+
105
103
  if (props.outerIndex !== undefined)
106
- emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
104
+ emit('updateFileList', doneIds, props.outerIndex)
107
105
  else
108
- emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
106
+ emit('updateFileList', doneIds)
109
107
  },
110
108
  })
111
109
  }
@@ -118,10 +116,13 @@ function deleteFileFunction(file: any) {
118
116
  const targetIndex = imageList.value.findIndex(item => item.id === file.id)
119
117
  if (targetIndex !== -1) {
120
118
  imageList.value.splice(targetIndex, 1)
119
+ const doneIds = Object.values(imageList.value)
120
+ .filter(item => item.status === 'done')
121
+ .map(item => item.id)
121
122
  if (props.outerIndex !== undefined)
122
- emit('updateFileList', imageList.value.filter(item => item.status === 'done'), props.outerIndex)
123
+ emit('updateFileList', doneIds, props.outerIndex)
123
124
  else
124
- emit('updateFileList', imageList.value.filter(item => item.status === 'done'))
125
+ emit('updateFileList', doneIds)
125
126
  }
126
127
  }
127
128
  })
@@ -361,18 +361,7 @@ watch(
361
361
  )
362
362
 
363
363
  function updateFile(files, _index) {
364
- // 处理文件数据
365
- // 更新本地值
366
- modelData.value = files.map((file) => {
367
- const newFile = { ...file }
368
- if (newFile.content)
369
- delete newFile.content
370
- if (newFile.file)
371
- delete newFile.file
372
- if (newFile.objectUrl)
373
- delete newFile.objectUrl
374
- return newFile
375
- })
364
+ modelData.value = files
376
365
  }
377
366
 
378
367
  // 表单校验的类型校验
@@ -384,7 +373,7 @@ function formTypeCheck(attr, value) {
384
373
  switch (attr.rule.type) {
385
374
  case 'string':
386
375
  if (value.length === 0) {
387
- errorMessage.value = `${attr.name}必须为有效的字符串`
376
+ errorMessage.value = `请输入${attr.name}`
388
377
  return
389
378
  }
390
379
  break
@@ -529,7 +518,7 @@ const readonly = computed(() => {
529
518
  // 提示内容
530
519
  const placeholder = computed(() => {
531
520
  if (attr.addOrEdit === 'readonly')
532
- return ' 暂无内容 ~ '
521
+ return '暂无内容 ~ '
533
522
  else
534
523
  return attr.placeholder ? attr.placeholder : `请选择${attr.name}`
535
524
  })
@@ -1229,6 +1218,7 @@ function findOptionInTree(options, value) {
1229
1218
  <VanField
1230
1219
  v-if="(attr.type === 'input' || attr.type === 'intervalPicker') && showItem"
1231
1220
  v-model="(modelData as string)"
1221
+ style="align-items: center"
1232
1222
  :label="labelData"
1233
1223
  :label-align="labelAlign"
1234
1224
  :input-align="attr.inputAlign ? attr.inputAlign : 'left'"
@@ -1,97 +1,97 @@
1
- <script setup lang="ts">
2
- import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
- import { runLogic } from '@af-mobile-client-vue3/services/api/common'
4
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
- import dayjs from 'dayjs/esm/index'
6
- import { showToast } from 'vant'
7
- import { onMounted, ref } from 'vue'
8
- import { useRoute } from 'vue-router'
9
-
10
- const configName = ref('appapplyuserinfoFormGroup')
11
- const serviceName = ref('af-apply')
12
- const route = useRoute()
13
- const userInfo = useUserStore().getUserInfo()
14
- const workflowId = ref('2909')
15
- const userinfoid = ref('93015')
16
- const model = ref('编辑')
17
- const groupFormData = ref({})
18
-
19
- function submit(res) {
20
- if (model.value === '新增') {
21
- res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
22
- res.t_userinfo.f_orgid = userInfo.f_orgid
23
- res.t_userinfo.f_orgname = userInfo.f_orgname
24
- res.t_userinfo.f_depid = userInfo.f_depid
25
- res.t_userinfo.f_depname = userInfo.f_depname
26
- res.t_userinfo.f_operatorid = userInfo.f_operatorid
27
- res.t_userinfo.f_operator = userInfo.f_operator
28
- res.t_userinfo.f_workflow_id = this.f_workflow_id
29
- res.t_userinfo.f_user_state = '预备'
30
-
31
- res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
32
- res.t_userfiles.f_orgid = userInfo.f_orgid
33
- res.t_userfiles.f_orgname = userInfo.f_orgname
34
- res.t_userfiles.f_depid = userInfo.f_depid
35
- res.t_userfiles.f_depname = userInfo.f_depname
36
- res.t_userfiles.f_operatorid = userInfo.f_operatorid
37
- res.t_userfiles.f_operator = userInfo.f_operator
38
- res.t_userfiles.f_workflow_id = this.f_workflow_id
39
- res.t_userfiles.f_table_state = '待开通'
40
- }
41
- let saveData = res
42
- if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
43
- saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
44
- }
45
- if (saveData.t_userfiles.f_price_id.length > 0) {
46
- saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
47
- }
48
- if (model.value === '编辑') {
49
- saveData = Object.assign(saveData, {
50
- f_operator_record: userInfo.f_operator,
51
- f_operatorid_record: userInfo.f_operatorid,
52
- f_orgid_record: userInfo.f_orgid,
53
- f_orgname_record: userInfo.f_orgname,
54
- f_depid_record: userInfo.f_depid,
55
- f_depname_record: userInfo.f_depname,
56
- })
57
- }
58
- runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
59
- showToast('操作成功!')
60
- history.back()
61
- })
62
- }
63
- const isInit = ref(false)
64
- function init() {
65
- if (model.value === '编辑') {
66
- runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
67
- if (res.t_userfiles.f_gasmodel_id) {
68
- res.t_userfiles.f_gasmodel_id = 76
69
- }
70
- // if (res.t_userfiles.f_price_id) {
71
- // res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
72
- // }
73
- console.log('1111111----,', res)
74
- groupFormData.value = res
75
- isInit.value = true
76
- })
77
- }
78
- }
79
- onMounted(() => {
80
- init()
81
- })
82
- </script>
83
-
84
- <template>
85
- <XFormGroup
86
- v-if="isInit"
87
- mode="修改"
88
- :config-name="configName"
89
- :service-name="serviceName"
90
- :group-form-data="groupFormData"
91
- @submit="submit"
92
- />
93
- </template>
94
-
95
- <style scoped lang="less">
96
-
97
- </style>
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import { runLogic } from '@af-mobile-client-vue3/services/api/common'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
+ import dayjs from 'dayjs/esm/index'
6
+ import { showToast } from 'vant'
7
+ import { onMounted, ref } from 'vue'
8
+ import { useRoute } from 'vue-router'
9
+
10
+ const configName = ref('appapplyuserinfoFormGroup')
11
+ const serviceName = ref('af-apply')
12
+ const route = useRoute()
13
+ const userInfo = useUserStore().getUserInfo()
14
+ const workflowId = ref('3045')
15
+ const userinfoid = ref('93116')
16
+ const model = ref('编辑')
17
+ const groupFormData = ref({})
18
+
19
+ function submit(res) {
20
+ if (model.value === '新增') {
21
+ res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
22
+ res.t_userinfo.f_orgid = userInfo.f_orgid
23
+ res.t_userinfo.f_orgname = userInfo.f_orgname
24
+ res.t_userinfo.f_depid = userInfo.f_depid
25
+ res.t_userinfo.f_depname = userInfo.f_depname
26
+ res.t_userinfo.f_operatorid = userInfo.f_operatorid
27
+ res.t_userinfo.f_operator = userInfo.f_operator
28
+ res.t_userinfo.f_workflow_id = this.f_workflow_id
29
+ res.t_userinfo.f_user_state = '预备'
30
+
31
+ res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
32
+ res.t_userfiles.f_orgid = userInfo.f_orgid
33
+ res.t_userfiles.f_orgname = userInfo.f_orgname
34
+ res.t_userfiles.f_depid = userInfo.f_depid
35
+ res.t_userfiles.f_depname = userInfo.f_depname
36
+ res.t_userfiles.f_operatorid = userInfo.f_operatorid
37
+ res.t_userfiles.f_operator = userInfo.f_operator
38
+ res.t_userfiles.f_workflow_id = this.f_workflow_id
39
+ res.t_userfiles.f_table_state = '待开通'
40
+ }
41
+ let saveData = res
42
+ if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
43
+ saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
44
+ }
45
+ if (saveData.t_userfiles.f_price_id.length > 0) {
46
+ saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
47
+ }
48
+ if (model.value === '编辑') {
49
+ saveData = Object.assign(saveData, {
50
+ f_operator_record: userInfo.f_operator,
51
+ f_operatorid_record: userInfo.f_operatorid,
52
+ f_orgid_record: userInfo.f_orgid,
53
+ f_orgname_record: userInfo.f_orgname,
54
+ f_depid_record: userInfo.f_depid,
55
+ f_depname_record: userInfo.f_depname,
56
+ })
57
+ }
58
+ runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
59
+ showToast('操作成功!')
60
+ history.back()
61
+ })
62
+ }
63
+ const isInit = ref(false)
64
+ function init() {
65
+ if (model.value === '编辑') {
66
+ runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
67
+ // if (res.t_userfiles.f_gasmodel_id) {
68
+ // res.t_userfiles.f_gasmodel_id = 76
69
+ // }
70
+ // if (res.t_userfiles.f_price_id) {
71
+ // res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
72
+ // }
73
+ console.log('1111111----,', res)
74
+ groupFormData.value = res
75
+ isInit.value = true
76
+ })
77
+ }
78
+ }
79
+ onMounted(() => {
80
+ init()
81
+ })
82
+ </script>
83
+
84
+ <template>
85
+ <XFormGroup
86
+ v-if="isInit"
87
+ mode="修改"
88
+ :config-name="configName"
89
+ :service-name="serviceName"
90
+ :group-form-data="groupFormData"
91
+ @submit="submit"
92
+ />
93
+ </template>
94
+
95
+ <style scoped lang="less">
96
+
97
+ </style>