af-mobile-client-vue3 1.5.87 → 1.5.89

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 (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/data/UserDetail/index.vue +3 -3
  3. package/src/router/routes.ts +17 -0
  4. package/src/stores/modules/safecheckStore.ts +47 -0
  5. package/src/utils/PhotoClean.ts +21 -0
  6. package/src/utils/appBackManager.ts +23 -0
  7. package/src/views/SafeInspection/SecurityCertificate/AddDevice/composables/useDeviceForm.ts +129 -0
  8. package/src/views/SafeInspection/SecurityCertificate/AddDevice/index.vue +661 -0
  9. package/src/views/SafeInspection/SecurityCertificate/AddDevice/types/device.ts +59 -0
  10. package/src/views/SafeInspection/SecurityCertificate/OverallHiddenDangers/index.vue +376 -0
  11. package/src/views/SafeInspection/SecurityCertificate/contractSign/index.vue +80 -0
  12. package/src/views/SafeInspection/SecurityCertificate/index.vue +3078 -0
  13. package/src/views/SafeInspection/SecurityCertificate/photoAiRecognition/components/PhotoCaptureCard.vue +301 -0
  14. package/src/views/SafeInspection/SecurityCertificate/photoAiRecognition/components/PhotoRecognitionInfo.vue +123 -0
  15. package/src/views/SafeInspection/SecurityCertificate/photoAiRecognition/components/PhotoStepHeader.vue +187 -0
  16. package/src/views/SafeInspection/SecurityCertificate/photoAiRecognition/index.vue +763 -0
  17. package/src/views/SafeInspection/SecurityCertificate/photoSignature/index.vue +248 -0
  18. package/src/views/SafeInspection/SecurityCertificate/slots/GasDevice.vue +132 -0
  19. package/src/views/SafeInspection/SecurityCertificate/userInfo/index.vue +77 -0
  20. package/src/views/SafeInspection/SecurityCertificate/userInfo/upaddress.vue +239 -0
  21. package/src/views/SafeInspection/SecurityFormItem/CameraView/PhotoClean.ts +21 -0
  22. package/src/views/SafeInspection/SecurityFormItem/CameraView/index.vue +560 -0
  23. package/src/views/SafeInspection/SecurityFormItem/FormItem.vue +413 -0
  24. package/src/views/SafeInspection/SecurityFormItem/SignatureComponent/signature.ts +37 -0
  25. package/src/views/SafeInspection/SecurityFormItem/XMultiSelect/index.vue +194 -0
  26. package/src/views/SafeInspection/SecurityFormItem/XSignature/index.vue +68 -0
  27. package/src/views/SafeInspection/SecurityFormItem/index.vue +418 -0
  28. package/src/views/component/SecurityCertificateView/index.vue +242 -0
  29. package/src/views/component/index.vue +4 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.5.87",
4
+ "version": "1.5.89",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -121,11 +121,11 @@ const filteredRecordEntries = computed(() => {
121
121
  if (!user.value?.f_meter_type)
122
122
  return []
123
123
 
124
- return props?.recordEntries || props?.recordEntries?.length === 0
125
- ? allRecords.value.filter(entry =>
124
+ return props?.recordEntries && props?.recordEntries?.length > 0
125
+ ? props.recordEntries.filter(entry =>
126
126
  entry.forMeterTypes.includes(user.value!.f_meter_type),
127
127
  )
128
- : props.recordEntries.filter(entry =>
128
+ : allRecords.value.filter(entry =>
129
129
  entry.forMeterTypes.includes(user.value!.f_meter_type),
130
130
  )
131
131
  })
@@ -10,6 +10,7 @@ import IconifyView from '@af-mobile-client-vue3/views/component/IconifyView/inde
10
10
  import ComponentView from '@af-mobile-client-vue3/views/component/index.vue'
11
11
  import MateChatView from '@af-mobile-client-vue3/views/component/MateChat/MateChatView.vue'
12
12
  import OtherChargeForm from '@af-mobile-client-vue3/views/component/OtherCharge/index.vue'
13
+ import SecurityCertificateView from '@af-mobile-client-vue3/views/component/SecurityCertificateView/index.vue'
13
14
  import StepView from '@af-mobile-client-vue3/views/component/StepView/index.vue'
14
15
  import UserDetailView from '@af-mobile-client-vue3/views/component/UserDetailView/index.vue'
15
16
  import UserDetailPage from '@af-mobile-client-vue3/views/component/UserDetailView/UserDetailPage.vue'
@@ -26,6 +27,7 @@ import XReportGridView from '@af-mobile-client-vue3/views/component/XReportGridV
26
27
  import XRequestView from '@af-mobile-client-vue3/views/component/XRequestView/index.vue'
27
28
  import XSignatureView from '@af-mobile-client-vue3/views/component/XSignatureView/index.vue'
28
29
  import AuthLoading from '@af-mobile-client-vue3/views/loading/AuthLoading.vue'
30
+ import SecurityCertificate from '@af-mobile-client-vue3/views/SafeInspection/SecurityCertificate/index.vue'
29
31
  import employeeBinding from '@af-mobile-client-vue3/views/user/employeeBinding/index.vue'
30
32
  import login from '@af-mobile-client-vue3/views/user/login/index.vue'
31
33
  import my from '@af-mobile-client-vue3/views/user/my/index.vue'
@@ -194,6 +196,11 @@ const routes: Array<RouteRecordRaw> = [
194
196
  name: 'UserDetailView',
195
197
  component: UserDetailView,
196
198
  },
199
+ {
200
+ path: '/Component/SecurityCertificateView',
201
+ name: 'SecurityCertificateView',
202
+ component: SecurityCertificateView,
203
+ },
197
204
  {
198
205
  path: '/Component/UserDetail/:userInfoId',
199
206
  name: 'UserDetailRoute',
@@ -431,6 +438,16 @@ const routes: Array<RouteRecordRaw> = [
431
438
  title: '用户注册',
432
439
  },
433
440
  },
441
+ {
442
+ path: '/SecurityCertificate',
443
+ name: 'SecurityCertificate',
444
+ component: SecurityCertificate,
445
+ meta: {
446
+ index: 0,
447
+ title: '安检单填写',
448
+ keepAlive: true,
449
+ },
450
+ },
434
451
  {
435
452
  path: '/wechat/employeeBinding',
436
453
  name: 'employeeBinding',
@@ -0,0 +1,47 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+
4
+ const useSafecheckStore = defineStore('safecheck', () => {
5
+ // 换表id
6
+ const changeTableId = ref(null)
7
+ const tenantName = ref(null)
8
+
9
+ // 设置换表id
10
+ function setChangeTableId(id) {
11
+ changeTableId.value = id
12
+ }
13
+
14
+ // 设置租户名称
15
+ function setTenantName(name) {
16
+ tenantName.value = name
17
+ }
18
+
19
+ // 获取换表id
20
+ function getChangeTableId() {
21
+ return changeTableId.value
22
+ }
23
+
24
+ // 获取租户名称
25
+ function getTenantName() {
26
+ return tenantName.value
27
+ }
28
+
29
+ // 清空换表id
30
+ function clearChangeTableId() {
31
+ changeTableId.value = null
32
+ }
33
+
34
+ return {
35
+ changeTableId,
36
+ tenantName,
37
+ setTenantName,
38
+ getTenantName,
39
+ setChangeTableId,
40
+ getChangeTableId,
41
+ clearChangeTableId,
42
+ }
43
+ }, {
44
+ persist: true, // 如果需要持久化
45
+ })
46
+
47
+ export default useSafecheckStore
@@ -0,0 +1,21 @@
1
+ // 提取对象中的图片/文件ID数组(兼容多种字段名)
2
+ export function getPhotosFromAny(obj: any, type: string): string[] {
3
+ const candidates = [obj[type]]
4
+
5
+ for (const c of candidates) {
6
+ if (Array.isArray(c) && c.length > 0) {
7
+ // 检查是否为对象数组,如果是则提取photo_name字段
8
+ if (typeof c[0] === 'object' && c[0] !== null) {
9
+ const ids = c.map((item: any) => {
10
+ const id = item?.photo_name || item?.id || item?.uid || item?.fileId || item?.value
11
+ || item?.response?.id || item?.response?.fileId || item?.resourceId
12
+ return id != null && id !== '' ? String(id) : null
13
+ }).filter((id: string | null) => id !== null)
14
+ return ids as string[]
15
+ }
16
+ // 如果是字符串数组,直接返回
17
+ return c as string[]
18
+ }
19
+ }
20
+ return []
21
+ }
@@ -0,0 +1,23 @@
1
+ // 已移除类式 API,统一使用函数式 API
2
+
3
+ // 模块级简化 API:按需绑定 window.__appBack,并更新接管状态
4
+ let __moduleIntercept = false
5
+
6
+ export function setAppBackIntercept(shouldIntercept: boolean): boolean {
7
+ __moduleIntercept = !!shouldIntercept
8
+ try {
9
+ const w: any = window.__MICRO_APP_ENVIRONMENT__ ? (window as any).rawWindow as any : window as any
10
+ // 若未绑定,则按需绑定;并打个标记,避免覆盖业务自定义实现
11
+ if (!w.__appBack || typeof w.__appBack !== 'function' || !w.__appBack.__managedByAppBack) {
12
+ const fn = () => __moduleIntercept
13
+ ;(fn as any).__managedByAppBack = true
14
+ w.__appBack = fn
15
+ }
16
+ }
17
+ catch {}
18
+ return __moduleIntercept
19
+ }
20
+
21
+ export function getAppBackIntercept(): boolean {
22
+ return __moduleIntercept
23
+ }
@@ -0,0 +1,129 @@
1
+ import dayjs from 'dayjs/esm/index'
2
+ import { showToast } from 'vant'
3
+ import { computed, ref } from 'vue'
4
+
5
+ export function useDeviceForm(initialDevices: any[] = []) {
6
+ // 设备数据
7
+ const devices = ref<any[]>(initialDevices)
8
+
9
+ // 加载状态
10
+ const isLoading = ref(false)
11
+
12
+ // 错误信息
13
+ const error = ref<string | null>(null)
14
+
15
+ // 计算属性
16
+ const deviceCount = computed(() => devices.value.length)
17
+ const hasDevices = computed(() => deviceCount.value > 0)
18
+
19
+ // 添加设备(支持附加自定义字段,例如设备类型)
20
+ const addDevice = (userInfo: any, extra: Record<string, any> = {}): boolean => {
21
+ try {
22
+ const newDevice = {
23
+ f_operate_date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
24
+ f_operator: userInfo.name || '',
25
+ f_operatorid: userInfo.id || '',
26
+ f_orgid: userInfo.orgid || '',
27
+ f_orgname: userInfo.orgname || '',
28
+ f_depid: userInfo.f_department_id || '',
29
+ f_depname: userInfo.f_department_name || '',
30
+ // 允许透传外部附加字段,例如:deviceType、deviceTypeName 或后端需要的字段名
31
+ ...extra,
32
+ }
33
+
34
+ devices.value.push(newDevice)
35
+ return true
36
+ }
37
+ catch (err) {
38
+ const errorMessage = err instanceof Error ? err.message : '添加设备失败'
39
+ console.error('添加设备失败:', err)
40
+ error.value = errorMessage
41
+ return false
42
+ }
43
+ }
44
+
45
+ // 删除设备
46
+ const removeDevice = (index: number) => {
47
+ if (index < 0 || index >= devices.value.length) {
48
+ showToast('设备索引无效')
49
+ return false
50
+ }
51
+
52
+ try {
53
+ devices.value.splice(index, 1)
54
+ showToast('已删除')
55
+ return true
56
+ }
57
+ catch (err) {
58
+ const errorMessage = err instanceof Error ? err.message : '删除设备失败'
59
+ console.error('删除设备失败:', err)
60
+ showToast(errorMessage)
61
+ error.value = errorMessage
62
+ return false
63
+ }
64
+ }
65
+
66
+ // 更新设备
67
+ const updateDevice = (index: number, deviceData: Partial<any>) => {
68
+ if (index < 0 || index >= devices.value.length) {
69
+ showToast('设备索引无效')
70
+ return false
71
+ }
72
+
73
+ try {
74
+ devices.value[index] = { ...devices.value[index], ...deviceData }
75
+ return true
76
+ }
77
+ catch (err) {
78
+ const errorMessage = err instanceof Error ? err.message : '更新设备失败'
79
+ console.error('更新设备失败:', err)
80
+ showToast(errorMessage)
81
+ error.value = errorMessage
82
+ return false
83
+ }
84
+ }
85
+
86
+ // 重置设备列表
87
+ const resetDevices = () => {
88
+ devices.value = []
89
+ error.value = null
90
+ }
91
+
92
+ // 设置设备列表
93
+ const setDevices = (newDevices: any[]) => {
94
+ devices.value = [...newDevices]
95
+ }
96
+
97
+ // 获取设备数据
98
+ const getDevices = () => {
99
+ return [...devices.value]
100
+ }
101
+
102
+ // 清除错误
103
+ const clearError = () => {
104
+ error.value = null
105
+ }
106
+
107
+ return {
108
+ // 状态
109
+ // devices: readonly(devices),
110
+ // isLoading: readonly(isLoading),
111
+ // error: readonly(error),
112
+ devices,
113
+ isLoading,
114
+ error,
115
+
116
+ // 计算属性
117
+ deviceCount,
118
+ hasDevices,
119
+
120
+ // 方法
121
+ addDevice,
122
+ removeDevice,
123
+ updateDevice,
124
+ resetDevices,
125
+ setDevices,
126
+ getDevices,
127
+ clearError,
128
+ }
129
+ }