af-mobile-client-vue3 1.0.95 → 1.0.97

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.
Files changed (113) hide show
  1. package/.env +6 -6
  2. package/.env.development +4 -4
  3. package/.env.envoiceShow +6 -6
  4. package/.env.production +6 -6
  5. package/.husky/commit-msg +1 -1
  6. package/.husky/pre-commit +1 -1
  7. package/.vscode/settings.json +61 -61
  8. package/build/vite/index.ts +91 -91
  9. package/eslint.config.js +9 -1
  10. package/mock/modules/user.mock.ts +152 -152
  11. package/package.json +2 -1
  12. package/public/favicon.svg +4 -4
  13. package/public/safari-pinned-tab.svg +32 -32
  14. package/scripts/verifyCommit.js +19 -19
  15. package/src/App.vue +43 -43
  16. package/src/api/user/index.ts +40 -40
  17. package/src/bootstrap.ts +18 -18
  18. package/src/components/core/App/MicroAppView.vue +3 -3
  19. package/src/components/core/NavBar/index.vue +12 -12
  20. package/src/components/core/SvgIcon/index.vue +1 -1
  21. package/src/components/core/Tabbar/index.vue +38 -38
  22. package/src/components/core/Uploader/index.vue +1 -1
  23. package/src/components/core/XGridDropOption/index.vue +151 -151
  24. package/src/components/core/XMultiSelect/index.vue +183 -183
  25. package/src/components/data/XCellDetail/index.vue +106 -106
  26. package/src/components/data/XCellList/XCellList.md +28 -28
  27. package/src/components/data/XCellList/index.vue +50 -11
  28. package/src/components/data/XCellListFilter/QrScanner/index.vue +1 -1
  29. package/src/components/data/XCellListFilter/VpnRecognition/index.vue +3 -3
  30. package/src/components/data/XCellListFilter/index.vue +160 -62
  31. package/src/components/data/XForm/index.vue +2 -2
  32. package/src/components/data/XFormGroup/index.vue +3 -3
  33. package/src/components/data/XFormItem/index.vue +25 -26
  34. package/src/components/data/XOlMap/demo.vue +209 -0
  35. package/src/components/data/XOlMap/index.vue +644 -0
  36. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
  37. package/src/components/data/XReportForm/index.vue +1079 -1079
  38. package/src/components/data/XReportGrid/XAddReport/XAddReport.vue +4 -7
  39. package/src/components/data/XReportGrid/XAddReport/index.md +3 -7
  40. package/src/components/data/XReportGrid/XAddReport/index.ts +2 -2
  41. package/src/components/data/XReportGrid/XReport.vue +25 -38
  42. package/src/components/data/XReportGrid/XReportDesign.vue +46 -46
  43. package/src/components/data/XReportGrid/XReportDrawer/XReportDrawer.vue +3 -3
  44. package/src/components/data/XReportGrid/XReportDrawer/index.ts +2 -2
  45. package/src/components/data/XReportGrid/XReportJsonRender.vue +20 -7
  46. package/src/components/data/XReportGrid/XReportTrGroup.vue +4 -4
  47. package/src/components/data/XReportGrid/index.md +4 -6
  48. package/src/components/data/XSignature/index.vue +285 -285
  49. package/src/components/data/XTag/index.vue +10 -10
  50. package/src/components/layout/NormalDataLayout/index.vue +70 -70
  51. package/src/components/layout/TabBarLayout/index.vue +40 -40
  52. package/src/components.d.ts +53 -53
  53. package/src/env.d.ts +16 -16
  54. package/src/font-style/font.css +3 -3
  55. package/src/hooks/useCommon.ts +9 -9
  56. package/src/layout/GridView/index.vue +1 -1
  57. package/src/layout/PageLayout.vue +4 -4
  58. package/src/layout/SingleLayout.vue +2 -2
  59. package/src/locales/en-US.json +25 -25
  60. package/src/locales/zh-CN.json +25 -25
  61. package/src/plugins/AppData.ts +38 -38
  62. package/src/plugins/index.ts +1 -1
  63. package/src/router/guards.ts +59 -59
  64. package/src/router/index.ts +61 -60
  65. package/src/router/invoiceRoutes.ts +33 -33
  66. package/src/router/routes.ts +20 -14
  67. package/src/services/api/common.ts +109 -109
  68. package/src/services/api/manage.ts +8 -8
  69. package/src/services/restTools.ts +52 -52
  70. package/src/services/v3Api.ts +46 -35
  71. package/src/stores/modules/cachedView.ts +1 -1
  72. package/src/stores/modules/setting.ts +52 -52
  73. package/src/stores/modules/user.ts +5 -5
  74. package/src/stores/mutation-type.ts +7 -7
  75. package/src/styles/app.less +6 -1
  76. package/src/utils/Storage.ts +1 -1
  77. package/src/utils/authority-utils.ts +84 -84
  78. package/src/utils/crypto.ts +39 -39
  79. package/src/utils/http/index.ts +6 -6
  80. package/src/utils/i18n.ts +41 -41
  81. package/src/utils/indexedDB.ts +180 -180
  82. package/src/utils/mobileUtil.ts +26 -26
  83. package/src/utils/routerUtil.ts +271 -271
  84. package/src/utils/runEvalFunction.ts +13 -13
  85. package/src/utils/validate.ts +1 -1
  86. package/src/utils/wechatUtil.ts +9 -9
  87. package/src/views/chat/index.vue +1 -1
  88. package/src/views/common/LoadError.vue +64 -64
  89. package/src/views/common/NotFound.vue +68 -68
  90. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  91. package/src/views/component/XCellDetailView/index.vue +217 -216
  92. package/src/views/component/XCellListView/index.vue +1 -1
  93. package/src/views/component/XFormAppraiseView/index.vue +4 -4
  94. package/src/views/component/XFormGroupView/index.vue +1 -1
  95. package/src/views/component/XFormView/index.vue +6 -7
  96. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  97. package/src/views/component/XReportFormView/index.vue +13 -13
  98. package/src/views/component/XReportGridView/index.vue +2 -3
  99. package/src/views/component/XSignatureView/index.vue +50 -50
  100. package/src/views/component/index.vue +4 -4
  101. package/src/views/component/menu.vue +117 -117
  102. package/src/views/component/notice.vue +46 -46
  103. package/src/views/component/topNav.vue +36 -36
  104. package/src/views/invoiceShow/index.vue +61 -62
  105. package/src/views/user/login/ForgetPasswordForm.vue +94 -93
  106. package/src/views/user/login/LoginForm.vue +8 -7
  107. package/src/views/user/login/LoginTitle.vue +68 -68
  108. package/src/views/user/login/index.vue +22 -22
  109. package/src/views/user/my/index.vue +230 -230
  110. package/src/vue-router.d.ts +9 -9
  111. package/tsconfig.json +43 -43
  112. package/uno.config.ts +1 -1
  113. package/vite.config.ts +123 -123
@@ -36,26 +36,36 @@
36
36
  ### 基础列表
37
37
 
38
38
  ```vue
39
+ <script setup lang="ts">
40
+ const serviceName = 'userService'
41
+
42
+ function handleDetail(item) {
43
+ // 处理详情点击
44
+ }
45
+ </script>
46
+
39
47
  <template>
40
48
  <XCellList
41
- config-name="listConfig"
49
+ config-name="listConfig"
42
50
  :service-name="serviceName"
43
51
  @to-detail="handleDetail"
44
52
  />
45
53
  </template>
54
+ ```
55
+
56
+ ### 带筛选的表单
46
57
 
58
+ ```vue
47
59
  <script setup lang="ts">
60
+ const configName = 'searchForm'
48
61
  const serviceName = 'userService'
62
+ const formData = ref({})
49
63
 
50
- const handleDetail = (item) => {
51
- // 处理详情点击
64
+ function handleSubmit(data) {
65
+ console.log('表单提交:', data)
52
66
  }
53
67
  </script>
54
- ```
55
-
56
- ### 带筛选的表单
57
68
 
58
- ```vue
59
69
  <template>
60
70
  <XFormGroup
61
71
  :config-name="configName"
@@ -65,16 +75,6 @@ const handleDetail = (item) => {
65
75
  @submit="handleSubmit"
66
76
  />
67
77
  </template>
68
-
69
- <script setup lang="ts">
70
- const configName = 'searchForm'
71
- const serviceName = 'userService'
72
- const formData = ref({})
73
-
74
- const handleSubmit = (data) => {
75
- console.log('表单提交:', data)
76
- }
77
- </script>
78
78
  ```
79
79
 
80
80
  ## API 文档
@@ -132,20 +132,20 @@ interface ListConfig {
132
132
  // 操作按钮配置
133
133
  actionArr?: Array<{
134
134
  text: string
135
- func: string
135
+ func: string
136
136
  }>
137
137
  }[]
138
-
138
+
139
139
  // 按钮状态
140
140
  buttonState: {
141
141
  add?: boolean
142
142
  edit?: boolean
143
143
  delete?: boolean
144
144
  }
145
-
145
+
146
146
  // 是否显示排序
147
147
  showSortIcon?: boolean
148
-
148
+
149
149
  // 查询表单配置
150
150
  formJson: FormItem[]
151
151
  }
@@ -157,28 +157,28 @@ interface ListConfig {
157
157
  interface FormItem {
158
158
  // 表单项类型
159
159
  type: 'input' | 'select' | 'date' | 'checkbox' | 'radio' | 'switch' | 'textarea' | 'uploader'
160
-
160
+
161
161
  // 字段名
162
162
  model: string
163
-
163
+
164
164
  // 标签名
165
165
  name: string
166
-
166
+
167
167
  // 校验规则
168
168
  rule?: {
169
169
  required: string
170
170
  type: 'string' | 'number' | 'integer' | 'float'
171
171
  }
172
-
172
+
173
173
  // 占位提示
174
174
  placeholder?: string
175
-
175
+
176
176
  // 数据源配置
177
177
  keyName?: string
178
-
178
+
179
179
  // 是否只读
180
180
  readonly?: boolean
181
-
181
+
182
182
  // 是否禁用
183
183
  disabled?: boolean
184
184
  }
@@ -1,6 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { computed, defineEmits, defineProps, onBeforeMount, ref, watch } from 'vue'
2
+ import XBadge from '@af-mobile-client-vue3/components/data/XBadge/index.vue'
3
+ import XCellListFilter from '@af-mobile-client-vue3/components/data/XCellListFilter/index.vue'
4
+ import { getConfigByName, query } from '@af-mobile-client-vue3/services/api/common'
5
+ import LoadError from '@af-mobile-client-vue3/views/common/LoadError.vue'
3
6
  import {
7
+ showConfirmDialog,
4
8
  BackTop as VanBackTop,
5
9
  Button as VanButton,
6
10
  Col as VanCol,
@@ -12,12 +16,8 @@ import {
12
16
  Search as VanSearch,
13
17
  Space as VanSpace,
14
18
  Tag as VanTag,
15
- showConfirmDialog,
16
19
  } from 'vant'
17
- import XBadge from '@af-mobile-client-vue3/components/data/XBadge/index.vue'
18
- import { getConfigByName, query } from '@af-mobile-client-vue3/services/api/common'
19
- import LoadError from '@af-mobile-client-vue3/views/common/LoadError.vue'
20
- import XCellListFilter from '@af-mobile-client-vue3/components/data/XCellListFilter/index.vue'
20
+ import { computed, defineEmits, defineProps, onBeforeMount, ref, watch } from 'vue'
21
21
  import { useRouter } from 'vue-router'
22
22
 
23
23
  const { configName, serviceName, fixQueryForm } = withDefaults(defineProps<{
@@ -25,11 +25,17 @@ const { configName, serviceName, fixQueryForm } = withDefaults(defineProps<{
25
25
  fixQueryForm?: object
26
26
  idKey?: string
27
27
  serviceName?: string
28
+ scanOptions?: {
29
+ show?: boolean // 是否显示扫码按钮
30
+ type?: string | string[] // 显示类型:可以是单个类型或类型数组 'nfc' / ['scan', 'nfc']
31
+ defaultMode?: string // 默认模式
32
+ }
28
33
  }>(), {
29
34
  configName: '',
30
35
  fixQueryForm: null,
31
36
  idKey: 'o_id',
32
37
  serviceName: undefined,
38
+ scanOptions: undefined,
33
39
  })
34
40
 
35
41
  const emit = defineEmits([])
@@ -144,8 +150,13 @@ function initComponent() {
144
150
  tagList.value.push(item)
145
151
  }
146
152
  else if (item.slotType === 'action' && item.actionArr) {
147
- for (let j = 0; j < item.actionArr.length; j++)
148
- allActions.value.push({ text: item.actionArr[j].text, func: item.actionArr[j].func })
153
+ for (let j = 0; j < item.actionArr.length; j++) {
154
+ allActions.value.push({
155
+ text: item.actionArr[j].text,
156
+ func: item.actionArr[j].func,
157
+ customFunction: item.actionArr[j].customFunction,
158
+ })
159
+ }
149
160
  }
150
161
 
151
162
  if (item.showTitleBtn)
@@ -258,7 +269,7 @@ function handleFunctionStyle(funcString, param) {
258
269
 
259
270
  return func(param)
260
271
  }
261
- catch (error) {
272
+ catch {
262
273
  return {}
263
274
  }
264
275
  }
@@ -317,6 +328,32 @@ function addOption() {
317
328
  function handleButtonClick(btn, item) {
318
329
  emit(`${btn.btnIcon}`, item)
319
330
  }
331
+
332
+ // 处理自定义函数
333
+ function evaluateCustomFunction(funcString: string | undefined, record: any, index: number): boolean {
334
+ try {
335
+ // 如果 customFunction 不存在,返回 true 表示正常显示
336
+ if (!funcString || funcString === '')
337
+ return true
338
+
339
+ // 匹配参数名、函数体
340
+ const innerFuncRegex = /function\s*\((\w+)\s*,\s*(\w+)\)\s*\{([\s\S]*)\}/
341
+ const matches = funcString.match(innerFuncRegex)
342
+
343
+ if (!matches)
344
+ return true
345
+
346
+ const [, param1, param2, functionBody] = matches
347
+
348
+ // eslint-disable-next-line no-new-func
349
+ const func = new Function(param1, param2, functionBody)
350
+ return func(record, index)
351
+ }
352
+ catch (error) {
353
+ console.error('Error evaluating custom function:', error)
354
+ return true
355
+ }
356
+ }
320
357
  </script>
321
358
 
322
359
  <template>
@@ -342,6 +379,7 @@ function handleButtonClick(btn, item) {
342
379
  :order-list="orderList"
343
380
  :form-query="formQueryList"
344
381
  :button-state="buttonState"
382
+ :scan-options="scanOptions"
345
383
  @on-refresh="onRefresh"
346
384
  @add-option="addOption"
347
385
  />
@@ -457,12 +495,12 @@ function handleButtonClick(btn, item) {
457
495
  <VanPopover
458
496
  v-model:show="showPopover[index]"
459
497
  placement="bottom-start"
460
- :actions="otherActions"
498
+ :actions="otherActions.filter(action => evaluateCustomFunction(action.customFunction, item, index))"
461
499
  @select="onSelectMenu(item, $event)"
462
500
  >
463
501
  <template #reference>
464
502
  <div
465
- v-show="otherActions && otherActions.length !== 0"
503
+ v-show="otherActions && otherActions.length !== 0 && otherActions.some(action => evaluateCustomFunction(action.customFunction, item, index))"
466
504
  class="more-button"
467
505
  >
468
506
  <span>⋯</span>
@@ -475,6 +513,7 @@ function handleButtonClick(btn, item) {
475
513
  <VanSpace>
476
514
  <VanButton
477
515
  v-for="button in reversedMainActions"
516
+ v-show="evaluateCustomFunction(button.customFunction, item, index)"
478
517
  :key="button.func"
479
518
  type="primary"
480
519
  size="small"
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { nextTick, onMounted, onUnmounted, ref } from 'vue'
3
2
  import { Icon as VanIcon } from 'vant'
3
+ import { nextTick, onMounted, onUnmounted, ref } from 'vue'
4
4
  import { startScanAnimation, stopScanAnimation } from './startScanAnimation'
5
5
 
6
6
  // 扫码框的引用
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue'
3
2
  import { Icon as VanIcon } from 'vant'
3
+ import { ref } from 'vue'
4
4
 
5
5
  defineEmits(['close'])
6
6
 
@@ -12,9 +12,9 @@ const isScanning = ref(true)
12
12
  <div class="scanner-container">
13
13
  <div class="scanner-bg">
14
14
  <div class="scan-circle">
15
- <VanIcon name="idcard" size="60" color="rgb(59,130,246)"/>
15
+ <VanIcon name="idcard" size="60" color="rgb(59,130,246)" />
16
16
  </div>
17
- <div class="scan-ripple" v-if="isScanning" />
17
+ <div v-if="isScanning" class="scan-ripple" />
18
18
  <div class="scan-tip">
19
19
  准备读取NFC
20
20
  </div>
@@ -1,16 +1,16 @@
1
1
  <script setup lang="ts">
2
- import { defineEmits, defineModel, defineProps, nextTick, ref } from 'vue'
2
+ import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
3
+ import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
3
4
  import {
5
+ showFailToast,
4
6
  Button as VanButton,
5
7
  Col as VanCol,
6
8
  DropdownItem as VanDropdownItem,
7
9
  DropdownMenu as VanDropdownMenu,
8
10
  Icon as VanIcon,
9
11
  Row as VanRow,
10
- showFailToast,
11
12
  } from 'vant'
12
- import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
13
- import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
13
+ import { computed, defineEmits, defineModel, defineProps, ref } from 'vue'
14
14
  import QrScanner from './QrScanner/index.vue'
15
15
  import VpnRecognition from './VpnRecognition/index.vue'
16
16
 
@@ -22,6 +22,11 @@ const props = defineProps<{
22
22
  orderList?: any[]
23
23
  formQuery?: any[]
24
24
  buttonState?: any
25
+ scanOptions?: {
26
+ show?: boolean // 是否显示扫码按钮
27
+ type?: string | string[] // 显示类型:可以是单个类型,也可以是类型数组
28
+ defaultMode?: string // 默认模式
29
+ }
25
30
  }>()
26
31
 
27
32
  const emit = defineEmits([
@@ -34,6 +39,34 @@ const emit = defineEmits([
34
39
  'onScan',
35
40
  'onNFC',
36
41
  ])
42
+
43
+ // 定义扫描模式枚举,便于扩展
44
+ const SCAN_MODES = {
45
+ SCAN: 'scan', // 扫码模式
46
+ NFC: 'nfc', // NFC读取模式
47
+ // 可扩展
48
+ }
49
+
50
+ // 定义扫描模式配置
51
+ const SCAN_MODE_CONFIGS = {
52
+ [SCAN_MODES.SCAN]: {
53
+ icon: 'scan',
54
+ title: '扫码',
55
+ component: QrScanner,
56
+ closeText: '关闭扫描',
57
+ },
58
+ [SCAN_MODES.NFC]: {
59
+ icon: 'wifi',
60
+ title: 'NFC',
61
+ component: VpnRecognition,
62
+ closeText: '关闭读取',
63
+ },
64
+ // 可扩展
65
+ }
66
+
67
+ // 获取所有可用的扫描模式列表
68
+ const AVAILABLE_MODES = Object.keys(SCAN_MODE_CONFIGS)
69
+
37
70
  // 排序字段
38
71
  const currentOrderVal = defineModel('orderVal')
39
72
  // 排序规则
@@ -53,13 +86,111 @@ const colFieldNames = {
53
86
  // 查询条件参数 !!!!!建议最后点击确认的时候完成这个的整理
54
87
  const conditionParams = ref({})
55
88
 
56
- // 视图模式
57
- const scanType = ref('scan') // 'scan' 或 'nfc'
89
+ // 视图模式 - 当前选中的扫描模式
90
+ const scanType = ref(getDefaultScanType())
58
91
 
59
92
  const scanMenuShow = ref(false)
60
93
  const filterMenuShow = ref(false)
61
94
  const showScanner = ref(true)
62
95
 
96
+ // 获取默认扫描模式
97
+ function getDefaultScanType() {
98
+ // 如果指定了默认模式且该模式有效,则使用默认模式
99
+ if (props.scanOptions?.defaultMode && isModeAvailable(props.scanOptions.defaultMode))
100
+ return props.scanOptions.defaultMode
101
+
102
+ // 确定启用的模式列表
103
+ const enabledModes = getEnabledModes()
104
+
105
+ // 如果有可用模式,使用第一个可用模式
106
+ if (enabledModes.length > 0)
107
+ return enabledModes[0]
108
+
109
+ // 兜底默认为扫码模式
110
+ return SCAN_MODES.SCAN
111
+ }
112
+
113
+ // 获取启用的模式列表
114
+ function getEnabledModes() {
115
+ // 如果没有指定type,则默认全部可用
116
+ if (!props.scanOptions?.type)
117
+ return AVAILABLE_MODES
118
+
119
+ // 如果type是字符串,转换为数组处理
120
+ const typeList = Array.isArray(props.scanOptions.type)
121
+ ? props.scanOptions.type
122
+ : [props.scanOptions.type]
123
+
124
+ // 过滤出有效的模式
125
+ return typeList.filter(mode => isModeAvailable(mode))
126
+ }
127
+
128
+ // 检查模式是否有效
129
+ function isModeAvailable(mode) {
130
+ return AVAILABLE_MODES.includes(mode)
131
+ }
132
+
133
+ // 是否显示扫码按钮
134
+ const showScanButton = computed(() => {
135
+ // 如果没有传递scanOptions,默认不显示
136
+ if (!props.scanOptions)
137
+ return false
138
+
139
+ // 如果定义了scanOptions.show,优先使用它
140
+ if (props.scanOptions.show !== undefined)
141
+ return props.scanOptions.show
142
+
143
+ // 其次检查buttonState.scan
144
+ if (props.buttonState?.scan !== undefined)
145
+ return props.buttonState.scan !== false
146
+
147
+ // 默认不显示
148
+ return false
149
+ })
150
+
151
+ // 获取启用的扫描模式列表
152
+ const enabledScanModes = computed(() => getEnabledModes())
153
+
154
+ // 处理扫码菜单显示
155
+ function handleScanMenuChange(value: boolean) {
156
+ scanMenuShow.value = value
157
+ if (value) {
158
+ filterMenuShow.value = false
159
+
160
+ // 确保当前模式在启用列表中
161
+ if (!enabledScanModes.value.includes(scanType.value))
162
+ scanType.value = getDefaultScanType()
163
+
164
+ // 重新挂载组件
165
+ showScanner.value = false
166
+ setTimeout(() => {
167
+ showScanner.value = true
168
+ }, 10)
169
+ }
170
+ else {
171
+ showScanner.value = false
172
+ }
173
+ }
174
+
175
+ // 切换到指定的扫描模式
176
+ function switchToMode(mode) {
177
+ // 确保模式有效且已启用
178
+ if (isModeAvailable(mode) && enabledScanModes.value.includes(mode)) {
179
+ scanType.value = mode
180
+ // 重新挂载组件
181
+ showScanner.value = false
182
+ setTimeout(() => {
183
+ showScanner.value = true
184
+ }, 10)
185
+ // 发出对应事件
186
+ if (mode === SCAN_MODES.SCAN)
187
+ emit('onScan')
188
+ else if (mode === SCAN_MODES.NFC)
189
+ emit('onNFC')
190
+ // 可扩展
191
+ }
192
+ }
193
+
63
194
  // 重置某个选项
64
195
  function resetOptionItem(type) {
65
196
  if (conditionParams.value[type] !== undefined)
@@ -106,23 +237,6 @@ function addOption() {
106
237
  emit('addOption')
107
238
  }
108
239
 
109
- // 处理扫码菜单显示
110
- function handleScanMenuChange(value: boolean) {
111
- scanMenuShow.value = value
112
- if (value) {
113
- filterMenuShow.value = false
114
- scanType.value = 'scan'
115
- // 先设为false再设为true,强制重新挂载组件
116
- showScanner.value = false
117
- setTimeout(() => {
118
- showScanner.value = true
119
- }, 10)
120
- }
121
- else {
122
- showScanner.value = false
123
- }
124
- }
125
-
126
240
  // 处理筛选菜单显示
127
241
  function handleFilterMenuChange(value: boolean) {
128
242
  filterMenuShow.value = value
@@ -132,24 +246,6 @@ function handleFilterMenuChange(value: boolean) {
132
246
  }
133
247
  }
134
248
 
135
- // 处理扫码
136
- function handleScan() {
137
- scanType.value = 'scan'
138
- // 重新挂载扫描组件
139
- showScanner.value = false
140
- setTimeout(() => {
141
- showScanner.value = true
142
- }, 10)
143
- emit('onScan')
144
- }
145
-
146
- // 处理NFC
147
- function handleNFC() {
148
- scanType.value = 'nfc'
149
- showScanner.value = false
150
- emit('onNFC')
151
- }
152
-
153
249
  // 处理关闭扫描按钮点击
154
250
  function handleCloseScanButton() {
155
251
  listFilterMenu.value.close(false)
@@ -159,39 +255,39 @@ function handleCloseScanButton() {
159
255
  <template>
160
256
  <div id="XCellListFilter">
161
257
  <div class="filter-buttons">
162
- <VanDropdownMenu :close-on-click-outside="false" class="filter-dropdown-menu" ref="listFilterMenu">
163
- <VanDropdownItem v-model="scanMenuShow" @change="handleScanMenuChange">
258
+ <VanDropdownMenu ref="listFilterMenu" :close-on-click-outside="false" class="filter-dropdown-menu">
259
+ <VanDropdownItem v-if="showScanButton" v-model="scanMenuShow" @change="handleScanMenuChange">
164
260
  <template #title>
165
261
  <div class="filter-icon-box">
166
262
  <VanIcon name="apps-o" size="24" class="filter-icon" />
167
263
  </div>
168
264
  </template>
265
+
266
+ <!-- 显示选项卡 -->
169
267
  <div class="scan-tab-wrapper">
170
268
  <div class="scan-tabs">
269
+ <!-- 动态生成扫描模式选项卡 -->
171
270
  <div
271
+ v-for="mode in enabledScanModes"
272
+ :key="mode"
172
273
  class="scan-tab-item"
173
- :class="{ active: scanType === 'scan' }"
174
- @click="handleScan"
175
- >
176
- <VanIcon name="scan" class="tab-icon" />
177
- 扫码
178
- </div>
179
- <div
180
- class="scan-tab-item"
181
- :class="{ active: scanType === 'nfc' }"
182
- @click="handleNFC"
274
+ :class="{ active: scanType === mode }"
275
+ @click="switchToMode(mode)"
183
276
  >
184
- <VanIcon name="wifi" class="tab-icon" />
185
- NFC
277
+ <VanIcon :name="SCAN_MODE_CONFIGS[mode].icon" class="tab-icon" />
278
+ {{ SCAN_MODE_CONFIGS[mode].title }}
186
279
  </div>
187
280
  </div>
188
281
  </div>
189
- <div v-if="scanType === 'scan'" class="scanORnfc">
190
- <QrScanner v-if="showScanner" @close="handleCloseScanButton" />
191
- </div>
192
- <div v-if="scanType === 'nfc'" class="scanORnfc">
193
- <VpnRecognition @close="handleCloseScanButton" />
282
+
283
+ <!-- 动态显示当前选中的扫描组件 -->
284
+ <div v-if="showScanner" class="scanORnfc">
285
+ <component
286
+ :is="SCAN_MODE_CONFIGS[scanType].component"
287
+ @close="handleCloseScanButton"
288
+ />
194
289
  </div>
290
+
195
291
  <div class="closeItem">
196
292
  <VanButton
197
293
  type="primary"
@@ -200,11 +296,13 @@ function handleCloseScanButton() {
200
296
  icon="cross"
201
297
  @click="handleCloseScanButton"
202
298
  >
203
- {{ scanType === 'scan' ? '关闭扫描' : '关闭读取' }}
299
+ {{ SCAN_MODE_CONFIGS[scanType].closeText }}
204
300
  </VanButton>
205
301
  </div>
206
302
  </VanDropdownItem>
207
- <VanDropdownItem v-model="filterMenuShow" @change="handleFilterMenuChange">
303
+
304
+ <!-- 筛选按钮 -->
305
+ <VanDropdownItem v-if="!props.buttonState || props.buttonState.filter !== false" v-model="filterMenuShow" @change="handleFilterMenuChange">
208
306
  <template #title>
209
307
  <div class="filter-icon-box">
210
308
  <VanIcon name="filter-o" size="24" class="filter-icon" />
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
+ import type { FormInstance } from 'vant'
3
+ import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
2
4
  import {
3
5
  Button as VanButton,
4
6
  CellGroup as VanCellGroup,
5
7
  Form as VanForm,
6
8
  } from 'vant'
7
- import type { FormInstance } from 'vant'
8
9
  import { computed, defineEmits, defineProps, onBeforeMount, reactive, ref, watch } from 'vue'
9
- import XFormItem from '@af-mobile-client-vue3/components/data/XFormItem/index.vue'
10
10
 
11
11
  interface FormItem {
12
12
  addOrEdit: string
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
+ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
+ import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
2
4
  import {
3
5
  Button as VanButton,
4
6
  Tab as VanTab,
5
7
  Tabs as VanTabs,
6
8
  } from 'vant'
7
9
  import { defineEmits, defineProps, onBeforeMount, ref, watch } from 'vue'
8
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
9
- import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
10
10
 
11
11
  const props = withDefaults(defineProps<{
12
12
  configName?: string
@@ -80,7 +80,7 @@ async function submit() {
80
80
  await res.validate()
81
81
  formData.value[res.formGroupName] = res.form
82
82
  }
83
- emit('submit', formData)
83
+ emit('submit', formData.value)
84
84
  }
85
85
 
86
86
  // function initXForm(index: number) {