af-mobile-client-vue3 1.4.9 → 1.4.11

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.
@@ -1,27 +1,27 @@
1
- // 时间工具:提供简单的日期时间格式化
2
-
3
- export function pad2(num: number): string {
4
- return num < 10 ? `0${num}` : `${num}`
5
- }
6
-
7
- /**
8
- * 按照简单占位符格式化当前时间
9
- * 支持占位:YYYY MM DD HH mm ss
10
- * @param format 默认 'YYYY-MM-DD HH:mm:ss'
11
- */
12
- export function formatNow(format: string = 'YYYY-MM-DD HH:mm:ss'): string {
13
- const d = new Date()
14
- const map: Record<string, string> = {
15
- YYYY: `${d.getFullYear()}`,
16
- MM: pad2(d.getMonth() + 1),
17
- DD: pad2(d.getDate()),
18
- HH: pad2(d.getHours()),
19
- mm: pad2(d.getMinutes()),
20
- ss: pad2(d.getSeconds()),
21
- }
22
- let out = format
23
- Object.keys(map).forEach((k) => {
24
- out = out.replace(new RegExp(k, 'g'), map[k])
25
- })
26
- return out
27
- }
1
+ // 时间工具:提供简单的日期时间格式化
2
+
3
+ export function pad2(num: number): string {
4
+ return num < 10 ? `0${num}` : `${num}`
5
+ }
6
+
7
+ /**
8
+ * 按照简单占位符格式化当前时间
9
+ * 支持占位:YYYY MM DD HH mm ss
10
+ * @param format 默认 'YYYY-MM-DD HH:mm:ss'
11
+ */
12
+ export function formatNow(format: string = 'YYYY-MM-DD HH:mm:ss'): string {
13
+ const d = new Date()
14
+ const map: Record<string, string> = {
15
+ YYYY: `${d.getFullYear()}`,
16
+ MM: pad2(d.getMonth() + 1),
17
+ DD: pad2(d.getDate()),
18
+ HH: pad2(d.getHours()),
19
+ mm: pad2(d.getMinutes()),
20
+ ss: pad2(d.getSeconds()),
21
+ }
22
+ let out = format
23
+ Object.keys(map).forEach((k) => {
24
+ out = out.replace(new RegExp(k, 'g'), map[k])
25
+ })
26
+ return out
27
+ }
@@ -5,10 +5,10 @@ import wx from 'weixin-js-sdk'
5
5
  export interface WechatConfig {
6
6
  debug: boolean
7
7
  appId: string
8
- timestamp: string
8
+ timestamp: number
9
9
  nonceStr: string
10
10
  signature: string
11
- jsApiList: string[]
11
+ jsApiList: any[]
12
12
  }
13
13
 
14
14
  // 微信扫码配置
@@ -63,36 +63,10 @@ export function configWechatSDK(config: WechatConfig): Promise<void> {
63
63
  })
64
64
  }
65
65
 
66
- // 微信扫码
67
- export function scanQRCode(config: WechatScanConfig): Promise<WechatScanResult> {
68
- return new Promise((resolve, reject) => {
69
- if (!isWechatBrowser()) {
70
- reject(new Error('非微信环境,无法使用微信扫码'))
71
- return
72
- }
73
-
74
- wx.scanQRCode({
75
- needResult: config.needResult,
76
- scanType: config.scanType,
77
- success: (res: WechatScanResult) => {
78
- console.log('微信扫码成功:', res)
79
- resolve(res)
80
- },
81
- fail: (res: any) => {
82
- console.error('微信扫码失败:', res)
83
- reject(new Error(`微信扫码失败: ${res.errMsg}`))
84
- },
85
- cancel: () => {
86
- reject(new Error('用户取消扫码'))
87
- },
88
- })
89
- })
90
- }
91
-
92
66
  // 获取微信签名(模拟)
93
67
  export async function getWechatSignature(url: string): Promise<{
94
68
  appId: string
95
- timestamp: string
69
+ timestamp: number
96
70
  nonceStr: string
97
71
  signature: string
98
72
  }> {
@@ -1,138 +1,107 @@
1
- <script setup lang="ts">
2
- import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
- import { defineEmits, ref } from 'vue'
6
- import { useRouter } from 'vue-router'
7
-
8
- // 定义事件
9
- const emit = defineEmits(['deleteRow'])
10
-
11
- // 多选操作配置
12
- const multiSelectActions = ref([
13
- { name: '批量审核', key: 'batchAudit', color: '#000000', icon: 'passed' },
14
- ])
15
-
16
- const userInfo = useUserStore().getUserInfo()
17
- // 访问路由
18
- const router = useRouter()
19
- // 获取默认值
20
- const idKey = ref('o_id')
21
-
22
- // 简易crud表单测试
23
- const configName = ref('lngChargeAuditMobileCRUD')
24
- const serviceName = ref('af-gaslink')
25
-
26
- // 资源权限测试
27
- // const configName = ref('crud_sources_test')
28
- // const serviceName = ref('af-system')
29
-
30
- // 实际业务测试
31
- // const configName = ref('lngChargeAuditMobileCRUD')
32
- // const serviceName = ref('af-gaslink')
33
-
34
- // 跳转到详情页面
35
- // function toDetail(item) {
36
- // router.push({
37
- // name: 'XCellDetailView',
38
- // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
39
- // query: {
40
- // operName: item[operNameKey.value],
41
- // method:item[methodKey.value],
42
- // requestMethod:item[requestMethodKey.value],
43
- // operatorType:item[operatorTypeKey.value],
44
- // operUrl:item[operUrlKey.value],
45
- // operIp:item[operIpKey.value],
46
- // costTime:item[costTimeKey.value],
47
- // operTime:item[operTimeKey.value],
48
- //
49
- // title: item[titleKey.value],
50
- // businessType: item[businessTypeKey.value],
51
- // status:item[statusKey.value]
52
- // }
53
- // })
54
- // }
55
-
56
- // 跳转到表单——以表单组来渲染纯表单
57
- function toDetail(item) {
58
- router.push({
59
- name: 'XFormView',
60
- query: {
61
- id: item[idKey.value],
62
- // id: item.rr_id,
63
- // o_id: item.o_id,
64
- },
65
- })
66
- }
67
-
68
- // 新增功能
69
- // function addOption(totalCount) {
70
- // router.push({
71
- // name: 'XFormView',
72
- // params: { id: totalCount, openid: totalCount },
73
- // query: {
74
- // configName: configName.value,
75
- // serviceName: serviceName.value,
76
- // mode: '新增',
77
- // },
78
- // })
79
- // }
80
-
81
- // 修改功能
82
- // function updateRow(result) {
83
- // router.push({
84
- // name: 'XFormView',
85
- // params: { id: result.o_id, openid: result.o_id },
86
- // query: {
87
- // configName: configName.value,
88
- // serviceName: serviceName.value,
89
- // mode: '修改',
90
- // },
91
- // })
92
- // }
93
-
94
- // 删除功能
95
- function deleteRow(result) {
96
- emit('deleteRow', result.o_id)
97
- }
98
-
99
- // 多选操作处理
100
- function handleMultiSelectAction(action: string, selectedItems: any[], selectedItemsArray: any[]) {
101
- console.log('多选操作:', action, selectedItems, selectedItemsArray)
102
- }
103
-
104
- // 选择变化处理
105
- function handleSelectionChange(selectedItems: any[]) {
106
- console.log('选择变化,当前选中:', selectedItems.length, '个项目')
107
- // 可以在这里更新UI状态,比如显示选中数量等
108
- }
109
-
110
- // 数据加载完成后处理 @after-load
111
- function afterLoad(result) {
112
- console.log('afterLoad:', result)
113
- }
114
- function emitFunc(func, data) {
115
- console.log('emitFunc:', func, data)
116
- }
117
- </script>
118
-
119
- <template>
120
- <NormalDataLayout id="XCellListView" title="工作计划">
121
- <template #layout_content>
122
- <XCellList
123
- config-name="scanCodeAndNFCRUD"
124
- service-name="af-safecheck"
125
- :enable-multi-select="true"
126
- id-key="t_id"
127
- :multi-select-actions="multiSelectActions"
128
- @to-detail="toDetail"
129
- @multi-select-action="handleMultiSelectAction"
130
- @selection-change="handleSelectionChange"
131
- @x-form-item-emit-func="emitFunc"
132
- />
133
- </template>
134
- </NormalDataLayout>
135
- </template>
136
-
137
- <style scoped lang="less">
138
- </style>
1
+ <script setup lang="ts">
2
+ import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { defineEmits, ref } from 'vue'
5
+ import { useRouter } from 'vue-router'
6
+
7
+ // 定义事件
8
+ const emit = defineEmits(['deleteRow'])
9
+ // 访问路由
10
+ const router = useRouter()
11
+ // 获取默认值
12
+ // const idKey = ref('o_id')
13
+
14
+ // 简易crud表单测试
15
+ const configName = ref('ceshiCRUD')
16
+ const serviceName = ref('af-safecheck')
17
+
18
+ // 资源权限测试
19
+ // const configName = ref('crud_sources_test')
20
+ // const serviceName = ref('af-system')
21
+
22
+ // 实际业务测试
23
+ // const configName = ref('lngChargeAuditMobileCRUD')
24
+ // const serviceName = ref('af-gaslink')
25
+
26
+ // 跳转到详情页面
27
+ // function toDetail(item) {
28
+ // router.push({
29
+ // name: 'XCellDetailView',
30
+ // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
31
+ // query: {
32
+ // operName: item[operNameKey.value],
33
+ // method:item[methodKey.value],
34
+ // requestMethod:item[requestMethodKey.value],
35
+ // operatorType:item[operatorTypeKey.value],
36
+ // operUrl:item[operUrlKey.value],
37
+ // operIp:item[operIpKey.value],
38
+ // costTime:item[costTimeKey.value],
39
+ // operTime:item[operTimeKey.value],
40
+ //
41
+ // title: item[titleKey.value],
42
+ // businessType: item[businessTypeKey.value],
43
+ // status:item[statusKey.value]
44
+ // }
45
+ // })
46
+ // }
47
+
48
+ // 跳转到表单——以表单组来渲染纯表单
49
+ // function toDetail(item) {
50
+ // router.push({
51
+ // name: 'XFormGroupView',
52
+ // query: {
53
+ // id: item[idKey.value],
54
+ // // id: item.rr_id,
55
+ // // o_id: item.o_id,
56
+ // },
57
+ // })
58
+ // }
59
+
60
+ // 新增功能
61
+ // function addOption(totalCount) {
62
+ // router.push({
63
+ // name: 'XFormView',
64
+ // params: { id: totalCount, openid: totalCount },
65
+ // query: {
66
+ // configName: configName.value,
67
+ // serviceName: serviceName.value,
68
+ // mode: '新增',
69
+ // },
70
+ // })
71
+ // }
72
+
73
+ // 修改功能
74
+ // function updateRow(result) {
75
+ // router.push({
76
+ // name: 'XFormView',
77
+ // params: { id: result.o_id, openid: result.o_id },
78
+ // query: {
79
+ // configName: configName.value,
80
+ // serviceName: serviceName.value,
81
+ // mode: '修改',
82
+ // },
83
+ // })
84
+ // }
85
+
86
+ // 删除功能
87
+ // function deleteRow(result) {
88
+ // emit('deleteRow', result.o_id)
89
+ // }
90
+ // const fixQueryForm = ref({
91
+ // f_operator_id: '487184754014158848',
92
+ // })
93
+ </script>
94
+
95
+ <template>
96
+ <NormalDataLayout id="XCellListView" title="工作计划">
97
+ <template #layout_content>
98
+ <XCellList
99
+ :config-name="configName"
100
+ :service-name="serviceName"
101
+ />
102
+ </template>
103
+ </NormalDataLayout>
104
+ </template>
105
+
106
+ <style scoped lang="less">
107
+ </style>
@@ -1,82 +1,91 @@
1
- <script setup lang="ts">
2
- import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { showDialog } from 'vant'
5
- import { ref } from 'vue'
6
- import { useRoute } from 'vue-router'
7
-
8
- // const configName = ref('reviewFormGroup')
9
- // const serviceName = ref('af-revenue')
10
-
11
- // 纯表单
12
- // const configName = ref('form_check_test')
13
- // const serviceName = ref('af-system')
14
-
15
- // const configName = ref("计划下发Form")
16
- // const serviceName = ref("af-linepatrol")
17
-
18
- // 表单组
19
- const configName = ref('lngChargeAuditMobileFormGroup')
20
- const serviceName = ref('af-gaslink')
21
-
22
- const formData = ref({})
23
- const formGroup = ref(null)
24
- const route = useRoute()
25
- const isInit = ref(false)
26
- function submit(_result) {
27
- showDialog({ message: '提交成功' }).then(() => {
28
- console.log('12121')
29
- // history.back()
30
- })
31
- }
32
-
33
- // 表单组——数据
34
- // function initComponents () {
35
- // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
36
- // formData.value = {...res}
37
- // })
38
- // }
39
-
40
- // 纯表单——数据
41
- // function initComponents() {
42
- // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
43
- // }
44
-
45
- // function initComponents() {
46
- // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
47
- // console.log('res------', res)
48
- // formData.value = { ...res }
49
- // formGroup.value.init({
50
- // configName: configName.value,
51
- // serviceName: serviceName.value,
52
- // groupFormData: { ...res },
53
- // mode: "新增"
54
- // })
55
- // isInit.value = true
56
- // })
57
- // }
58
-
59
- // onBeforeMount(() => {
60
- // initComponents()
61
- // })
62
- </script>
63
-
64
- <template>
65
- <NormalDataLayout id="XFormGroupView" title="纯表单">
66
- <template #layout_content>
67
- <!-- v-if="isInit" -->
68
- <XFormGroup
69
- ref="formGroup"
70
- config-name="ApplyAddContractFormGroup"
71
- service-name="af-apply"
72
- :group-form-data="formData"
73
- mode="新增"
74
- @submit="submit"
75
- />
76
- </template>
77
- </NormalDataLayout>
78
- </template>
79
-
80
- <style scoped lang="less">
81
-
82
- </style>
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { showDialog } from 'vant'
5
+ import { ref } from 'vue'
6
+ import { useRoute } from 'vue-router'
7
+
8
+ // 纯表单
9
+ const configName = ref('appapplyuserinfoFormGroup')
10
+ const serviceName = ref('af-apply')
11
+
12
+ // const configName = ref("计划下发Form")
13
+ // const serviceName = ref("af-linepatrol")
14
+
15
+ // 表单组
16
+ // const configName = ref('lngChargeAuditMobileFormGroup')
17
+ // const serviceName = ref('af-gaslink')
18
+
19
+ const formData = ref({ t_userinfo: { f_user_name: 111 } })
20
+ const formGroup = ref(null)
21
+ const route = useRoute()
22
+ const isInit = ref(false)
23
+ function submit(_result) {
24
+ showDialog({ message: '提交成功' })
25
+ history.back()
26
+ }
27
+ const myXForm = ref([])
28
+ function setRef(value: any) {
29
+ console.log('myXForm', myXForm)
30
+ formGroup.value.setRef(myXForm.value)
31
+ console.log(formGroup)
32
+ }
33
+ // 表单组——数据
34
+ // function initComponents () {
35
+ // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
36
+ // formData.value = {...res}
37
+ // })
38
+ // }
39
+
40
+ // 纯表单——数据
41
+ // function initComponents() {
42
+ // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
43
+ // }
44
+
45
+ // function initComponents() {
46
+ // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
47
+ // console.log('res------', res)
48
+ // formData.value = { ...res }
49
+ // formGroup.value.init({
50
+ // configName: configName.value,
51
+ // serviceName: serviceName.value,
52
+ // groupFormData: { ...res },
53
+ // mode: "新增"
54
+ // })
55
+ // isInit.value = true
56
+ // })
57
+ // }
58
+
59
+ // onBeforeMount(() => {
60
+ // initComponents()
61
+ // })
62
+ function a() {
63
+ }
64
+ </script>
65
+
66
+ <template>
67
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
68
+ <template #layout_content>
69
+ <button @click="a">
70
+ 修改
71
+ </button>
72
+ <!-- v-if="isInit" -->
73
+ <XFormGroup
74
+ ref="formGroup"
75
+ :config-name="configName"
76
+ :service-name="serviceName"
77
+ :group-form-data="formData"
78
+ mode="新增"
79
+ @submit="submit"
80
+ >
81
+ <!-- <template #device="{ setRef, removeRef, item, formData }">
82
+ <XFormView :setRef="setRef" :formGroupName="'myXForm'"/>
83
+ </template> -->
84
+ </XFormGroup>
85
+ </template>
86
+ </NormalDataLayout>
87
+ </template>
88
+
89
+ <style scoped lang="less">
90
+
91
+ </style>
@@ -1,46 +1,61 @@
1
- <script setup lang="ts">
2
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { ref } from 'vue'
5
- import {
6
- Button as VanButton,
7
- } from 'vant'
8
-
9
- const configName = ref('测试Form')
10
- const serviceName = ref('af-safecheck')
11
- const formGroupAddConstruction = ref()
12
-
13
- // 提交测试
14
- function onSubmit(form) {
15
- console.log('事件触发提交表单----', form)
16
- }
17
- async function onAsyncSubmit() {
18
- const res = await formGroupAddConstruction.value.asyncSubmit()
19
- console.log('异步提交表单----', res)
20
- }
21
- function emitFunc(func, data) {
22
- console.log('emitFunc:', func, data)
23
- }
24
- </script>
25
-
26
- <template>
27
- <NormalDataLayout id="XFormGroupView" title="纯表单">
28
- <template #layout_content>
29
- <XForm
30
- ref="formGroupAddConstruction"
31
- mode="新增"
32
- :config-name="configName"
33
- :show-tab-header="false"
34
- service-name="af-safecheck"
35
- :is-group-form="true"
36
- @on-submit="onSubmit"
37
- @x-form-item-emit-func="emitFunc"
38
- />
39
- </template>
40
- </NormalDataLayout>
41
- <van-button type="primary" @click="onAsyncSubmit">提交</van-button>
42
- </template>
43
-
44
- <style scoped lang="less">
45
-
46
- </style>
1
+ <script setup lang="ts">
2
+ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
5
+ import { ref } from 'vue'
6
+ import {
7
+ showFailToast,
8
+ showSuccessToast,
9
+ Button as VanButton,
10
+ CellGroup as VanCellGroup,
11
+ Form as VanForm,
12
+ } from 'vant'
13
+
14
+ const configName = ref('lngSecurityChecktestForm')
15
+ const serviceName = ref('af-safecheck')
16
+ function aaa() {
17
+ mobileUtil.execute({
18
+ funcName: 'startNfcScan',
19
+ param: { a: 1 },
20
+ callbackFunc: (result) => {
21
+ console.log('回调了test111', JSON.stringify(result))
22
+ return 222
23
+ },
24
+ })
25
+ }
26
+ function bbb() {
27
+ mobileUtil.execute({
28
+ funcName: 'scanBarcode',
29
+ param: { a: 1 },
30
+ callbackFunc: (result) => {
31
+ console.log('回调了test111', JSON.stringify(result))
32
+ return 222
33
+ },
34
+ })
35
+ }
36
+ const formGroupAddConstruction = ref(null)
37
+ </script>
38
+
39
+ <template>
40
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
41
+ <template #layout_content>
42
+ <VanButton @click="aaa">
43
+ 测试nfc
44
+ </VanButton>
45
+ <VanButton @click="bbb">
46
+ 扫码
47
+ </VanButton>
48
+ <XForm
49
+ ref="formGroupAddConstruction"
50
+ mode="新增"
51
+ :config-name="configName"
52
+ :service-name="serviceName"
53
+ :form-readonly="false"
54
+ />
55
+ </template>
56
+ </NormalDataLayout>
57
+ </template>
58
+
59
+ <style scoped lang="less">
60
+
61
+ </style>
@@ -10,6 +10,7 @@ import { UserType } from '@af-mobile-client-vue3/types/auth'
10
10
  import { isWechat } from '@af-mobile-client-vue3/utils/platform-auth'
11
11
  import { funcToRouter, loadRoutes } from '@af-mobile-client-vue3/utils/routerUtil'
12
12
  import { secureStorageBatchWrite, secureStorageRead } from '@af-mobile-client-vue3/utils/secureStorage'
13
+ import bcrypt from 'bcryptjs'
13
14
  import {
14
15
  closeToast,
15
16
  showDialog,
@@ -123,7 +124,7 @@ function handleSubmit() {
123
124
  console.warn(setting)
124
125
  const data: any = await userState.Login({
125
126
  username,
126
- password,
127
+ password: bcrypt.hashSync(password, 10),
127
128
  resourceName: setting.getSetting()?.routerName || '智慧手机',
128
129
  })
129
130
  login.f = data