af-mobile-client-vue3 1.3.94 → 1.3.96

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.3.94",
4
+ "version": "1.3.96",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -235,18 +235,18 @@ function initComponent() {
235
235
 
236
236
  if (item.mobileColumnType === 'mobile_header_column') {
237
237
  try {
238
- // 只有在 item.btnIcon 是字符串时才尝试解析
239
238
  if (typeof item.btnIcon === 'string') {
240
- const parsed = JSON.parse(item.btnIcon)
241
- // 只有解析结果是数组才赋值
242
- if (Array.isArray(parsed)) {
243
- btnList.value = parsed
244
- }
239
+ // 字符串 => 直接作为数组的一项
240
+ btnList.value = [item.btnIcon]
241
+ }
242
+ else if (Array.isArray(item.btnIcon)) {
243
+ // 已经是数组 => 直接赋值
244
+ btnList.value = item.btnIcon
245
245
  }
246
+ // 其他类型不处理
246
247
  }
247
248
  catch (e) {
248
- // 解析失败,不做任何处理(保留原来的值)
249
- console.error('btnIcon JSON 解析失败:', e)
249
+ console.error('btnIcon 处理异常:', e)
250
250
  }
251
251
  }
252
252
 
@@ -596,7 +596,7 @@ function filterButtonPermissions(btn) {
596
596
 
597
597
  // 处理按钮点击
598
598
  function handleButtonClick(btn, item) {
599
- emit(`${btn.btnIcon}`, item)
599
+ emit(`${btn}`, item)
600
600
  }
601
601
 
602
602
  /**
@@ -11,11 +11,13 @@ import { post } from '@af-mobile-client-vue3/services/restTools'
11
11
  import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
12
12
  import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
13
13
  import { getDict } from '@af-mobile-client-vue3/utils/dictUtil'
14
+ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
14
15
  import { executeStrFunctionByContext } from '@af-mobile-client-vue3/utils/runEvalFunction'
15
16
  import { areaList } from '@vant/area-data'
16
17
  import dayjs from 'dayjs/esm/index'
17
18
  import { debounce } from 'lodash-es'
18
19
  import {
20
+ showToast,
19
21
  Area as VanArea,
20
22
  Button as VanButton,
21
23
  Calendar as VanCalendar,
@@ -914,6 +916,36 @@ function findOptionInTree(options, value) {
914
916
 
915
917
  return null
916
918
  }
919
+
920
+ // 扫码/NFC
921
+ function scanCodeOrNfc(attr) {
922
+ if (attr.type === 'scanCode') {
923
+ // 扫码逻辑
924
+ mobileUtil.execute({
925
+ funcName: 'scanBarcode',
926
+ param: {},
927
+ callbackFunc: (res: any) => {
928
+ console.log('让我看看你扫码结果:--', res)
929
+ if (res && res.status === 'success') {
930
+ if (res.data.status && res.data.status === 'cancelled') {
931
+ showToast(res.data?.message || '扫码已取消')
932
+ return
933
+ }
934
+ modelData.value = res.data?.rawValue
935
+ showToast('扫码成功')
936
+ }
937
+ else {
938
+ showToast('扫码失败')
939
+ }
940
+ },
941
+ })
942
+ }
943
+ else if (attr.type === 'nfc') {
944
+ // NFC逻辑
945
+ console.log('--------NFC功能即将开发--------')
946
+ showToast('NFC功能即将开发')
947
+ }
948
+ }
917
949
  </script>
918
950
 
919
951
  <template>
@@ -1319,7 +1351,7 @@ function findOptionInTree(options, value) {
1319
1351
 
1320
1352
  <!-- 文本输入框 -->
1321
1353
  <VanField
1322
- v-if="(attr.type === 'input' || attr.type === 'intervalPicker') && showItem"
1354
+ v-if="(attr.type === 'input' || attr.type === 'intervalPicker' || attr.type === 'scanCode' || attr.type === 'nfc') && showItem"
1323
1355
  v-model="(modelData as string)"
1324
1356
  style="align-items: center"
1325
1357
  :label="labelData"
@@ -1346,7 +1378,7 @@ function findOptionInTree(options, value) {
1346
1378
  @blur="() => formTypeCheck(attr, modelData as string)"
1347
1379
  >
1348
1380
  <VanButton
1349
- v-if="!props.formReadonly && attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
1381
+ v-if="(attr.type === 'input' || attr.type === 'intervalPicker') && !props.formReadonly && attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
1350
1382
  class="action-btn"
1351
1383
  round
1352
1384
  type="primary"
@@ -1355,6 +1387,16 @@ function findOptionInTree(options, value) {
1355
1387
  >
1356
1388
  {{ attr.inputOnAfterName }}
1357
1389
  </VanButton>
1390
+ <VanButton
1391
+ v-if="(attr.type === 'scanCode' || attr.type === 'nfc') && !props.formReadonly"
1392
+ class="action-btn"
1393
+ round
1394
+ type="primary"
1395
+ size="small"
1396
+ @click="scanCodeOrNfc(attr)"
1397
+ >
1398
+ {{ attr.type === 'scanCode' ? '扫码' : 'NFC' }}
1399
+ </VanButton>
1358
1400
  </template>
1359
1401
  </VanField>
1360
1402
 
@@ -12,7 +12,7 @@ const router = useRouter()
12
12
  // const idKey = ref('o_id')
13
13
 
14
14
  // 简易crud表单测试
15
- const configName = ref('ceshiCRUD')
15
+ const configName = ref('temporarySecurityCheckCRUD')
16
16
  const serviceName = ref('af-safecheck')
17
17
 
18
18
  // 资源权限测试
@@ -90,6 +90,14 @@ const serviceName = ref('af-safecheck')
90
90
  // const fixQueryForm = ref({
91
91
  // f_operator_id: '487184754014158848',
92
92
  // })
93
+ function phone(row: any) {
94
+ console.log('>>>> phone')
95
+ }
96
+
97
+ function mapView() {
98
+ // 进行地图查看
99
+ console.log('等待你处理地图查看事件')
100
+ }
93
101
  </script>
94
102
 
95
103
  <template>
@@ -98,6 +106,8 @@ const serviceName = ref('af-safecheck')
98
106
  <XCellList
99
107
  :config-name="configName"
100
108
  :service-name="serviceName"
109
+ @phone="phone"
110
+ @map-marked="mapView"
101
111
  />
102
112
  </template>
103
113
  </NormalDataLayout>