af-mobile-client-vue3 1.3.18 → 1.3.19
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
|
@@ -31,6 +31,7 @@ const {
|
|
|
31
31
|
scanOptions,
|
|
32
32
|
customAdd = false,
|
|
33
33
|
customEdit = false,
|
|
34
|
+
customDelete = false,
|
|
34
35
|
hideAllActions = false,
|
|
35
36
|
} = defineProps<{
|
|
36
37
|
configName?: string
|
|
@@ -42,9 +43,10 @@ const {
|
|
|
42
43
|
type?: string | string[] // 显示类型:可以是单个类型或类型数组 'nfc' / ['scan', 'nfc']
|
|
43
44
|
defaultMode?: string // 默认模式
|
|
44
45
|
}
|
|
45
|
-
//
|
|
46
|
+
// 是否自定义新增、编辑、删除按钮
|
|
46
47
|
customAdd?: boolean
|
|
47
48
|
customEdit?: boolean
|
|
49
|
+
customDelete?: boolean
|
|
48
50
|
// 是否隐藏所有操作按钮
|
|
49
51
|
hideAllActions?: boolean
|
|
50
52
|
}>()
|
|
@@ -52,7 +54,7 @@ const {
|
|
|
52
54
|
const emit = defineEmits<{
|
|
53
55
|
(e: 'toDetail', item: any): void
|
|
54
56
|
(e: 'update', item: any): void
|
|
55
|
-
(e: '
|
|
57
|
+
(e: 'delete', item: any): void
|
|
56
58
|
(e: 'add'): void
|
|
57
59
|
(e: string, item: any): void
|
|
58
60
|
(e: 'updateCondition', params: any): void
|
|
@@ -234,9 +236,9 @@ function initComponent() {
|
|
|
234
236
|
buttonState.value = result.buttonState
|
|
235
237
|
buttonPermissions.value = result.buttonPermissions
|
|
236
238
|
if (buttonState.value.edit && buttonState.value.edit === true && (filterButtonPermissions('edit').state === false || ((filterButtonPermissions('edit').state === true && userState.f.resources.f_role_name.includes((filterButtonPermissions('edit').roleStr))))))
|
|
237
|
-
allActions.value.push({ text: '修改', func: '
|
|
239
|
+
allActions.value.push({ text: '修改', func: 'update' })
|
|
238
240
|
if (buttonState.value.delete && buttonState.value.delete === true && (filterButtonPermissions('delete').state === false || ((filterButtonPermissions('delete').state === true && userState.f.resources.f_role_name.includes((filterButtonPermissions('delete').roleStr))))))
|
|
239
|
-
allActions.value.push({ text: '删除', func: '
|
|
241
|
+
allActions.value.push({ text: '删除', func: 'delete' })
|
|
240
242
|
}
|
|
241
243
|
splitArrayAt(allActions.value, 3)
|
|
242
244
|
|
|
@@ -429,14 +431,19 @@ const reversedMainActions = computed(() => {
|
|
|
429
431
|
// 设置 Popover 的事件
|
|
430
432
|
function onSelectMenu(item: any, event: any) {
|
|
431
433
|
if (event.text === '删除') {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
434
|
+
if (customDelete) {
|
|
435
|
+
emit('delete', item)
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
showConfirmDialog({
|
|
439
|
+
title: '删除',
|
|
440
|
+
message:
|
|
441
|
+
'请确认是否删除!!!',
|
|
442
|
+
}).then(() => {
|
|
443
|
+
emit(event.func, item)
|
|
444
|
+
}).catch(() => {
|
|
445
|
+
})
|
|
446
|
+
}
|
|
440
447
|
}
|
|
441
448
|
else if (event.text === '修改') {
|
|
442
449
|
if (customEdit) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { openApiLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
2
|
+
import { getConfigByName, openApiLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
3
3
|
import { useSettingStore } from '@af-mobile-client-vue3/stores/modules/setting'
|
|
4
4
|
import {
|
|
5
5
|
showFailToast,
|
|
@@ -24,6 +24,7 @@ interface FormData {
|
|
|
24
24
|
name: string
|
|
25
25
|
phone: string
|
|
26
26
|
gender: string
|
|
27
|
+
code: string
|
|
27
28
|
email: string
|
|
28
29
|
username: string
|
|
29
30
|
password: string
|
|
@@ -62,6 +63,7 @@ const formData = ref<FormData>({
|
|
|
62
63
|
name: '',
|
|
63
64
|
phone: '',
|
|
64
65
|
gender: '',
|
|
66
|
+
code: '',
|
|
65
67
|
email: '',
|
|
66
68
|
username: '',
|
|
67
69
|
password: '',
|
|
@@ -79,6 +81,8 @@ const openId = ref('')
|
|
|
79
81
|
// 错误信息
|
|
80
82
|
const errors = ref<Errors>({})
|
|
81
83
|
|
|
84
|
+
const registerConfig = ref({})
|
|
85
|
+
|
|
82
86
|
// 状态管理
|
|
83
87
|
const isSubmitting = ref<boolean>(false)
|
|
84
88
|
const showSuccess = ref<boolean>(false)
|
|
@@ -106,6 +110,14 @@ function validateName(): boolean {
|
|
|
106
110
|
delete errors.value.name
|
|
107
111
|
return true
|
|
108
112
|
}
|
|
113
|
+
function validateCode(): boolean {
|
|
114
|
+
if (!formData.value.code.trim()) {
|
|
115
|
+
errors.value.code = '员工编号不能为空'
|
|
116
|
+
return false
|
|
117
|
+
}
|
|
118
|
+
delete errors.value.code
|
|
119
|
+
return true
|
|
120
|
+
}
|
|
109
121
|
|
|
110
122
|
function validatePhone(): boolean {
|
|
111
123
|
const phoneRegex = /^1[3-9]\d{9}$/
|
|
@@ -205,6 +217,7 @@ function validateGender(): boolean {
|
|
|
205
217
|
function validateAll(): boolean {
|
|
206
218
|
const validations = [
|
|
207
219
|
validateName(),
|
|
220
|
+
validateCode(),
|
|
208
221
|
validatePhone(),
|
|
209
222
|
validateEmail(),
|
|
210
223
|
validateUsername(),
|
|
@@ -268,6 +281,18 @@ async function fetchOrganizationInfo(strategyId: any): Promise<void> {
|
|
|
268
281
|
}
|
|
269
282
|
}
|
|
270
283
|
|
|
284
|
+
async function initConfig(): Promise<void> {
|
|
285
|
+
try {
|
|
286
|
+
getConfigByName('registerConfig', (res: any) => {
|
|
287
|
+
console.log('res', res)
|
|
288
|
+
}, 'af-system')
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
console.error('获取组织信息失败:', error)
|
|
292
|
+
showToast('获取组织信息失败')
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
271
296
|
// 提交注册
|
|
272
297
|
async function submitRegistration(): Promise<void> {
|
|
273
298
|
if (usernameStatus.value === 'checking') {
|
|
@@ -302,6 +327,7 @@ function resetForm(): void {
|
|
|
302
327
|
name: '',
|
|
303
328
|
phone: '',
|
|
304
329
|
gender: '',
|
|
330
|
+
code: '',
|
|
305
331
|
email: '',
|
|
306
332
|
username: '',
|
|
307
333
|
password: '',
|
|
@@ -357,6 +383,8 @@ function goBack() {
|
|
|
357
383
|
|
|
358
384
|
// 组件挂载时获取组织信息
|
|
359
385
|
onMounted(async () => {
|
|
386
|
+
console.log('route.query', route.query)
|
|
387
|
+
console.log('route.params', route.params)
|
|
360
388
|
const strategyId = route.query.strategyId || route.params.strategyId
|
|
361
389
|
openId.value = route.query.openId as string || route.params.openId as string
|
|
362
390
|
formData.value.openId = openId.value
|
|
@@ -450,16 +478,30 @@ onMounted(async () => {
|
|
|
450
478
|
</template>
|
|
451
479
|
<template #input>
|
|
452
480
|
<VanRadioGroup v-model="formData.gender" @change="validateGender">
|
|
453
|
-
<VanRadio name="
|
|
481
|
+
<VanRadio name="男">
|
|
454
482
|
男
|
|
455
483
|
</VanRadio>
|
|
456
|
-
<VanRadio name="
|
|
484
|
+
<VanRadio name="女">
|
|
457
485
|
女
|
|
458
486
|
</VanRadio>
|
|
459
487
|
</VanRadioGroup>
|
|
460
488
|
</template>
|
|
461
489
|
</VanField>
|
|
462
|
-
|
|
490
|
+
<!-- 员工编号 -->
|
|
491
|
+
<VanField
|
|
492
|
+
v-model="formData.code"
|
|
493
|
+
label="员工编号"
|
|
494
|
+
placeholder="请输入员工编号"
|
|
495
|
+
:error="!!errors.code"
|
|
496
|
+
:error-message="errors.code"
|
|
497
|
+
label-align="top"
|
|
498
|
+
@blur="validateCode"
|
|
499
|
+
>
|
|
500
|
+
<template #label>
|
|
501
|
+
<i class="i-solar-user-id-bold text-purple-500" />
|
|
502
|
+
员工编号 <span class="required">*</span>
|
|
503
|
+
</template>
|
|
504
|
+
</VanField>
|
|
463
505
|
<!-- 邮箱 -->
|
|
464
506
|
<VanField
|
|
465
507
|
v-model="formData.email"
|