af-mobile-client-vue3 1.2.24 → 1.2.26
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
|
@@ -37,6 +37,7 @@ interface GroupFormItems {
|
|
|
37
37
|
showSubmitBtn?: boolean
|
|
38
38
|
groupName?: string
|
|
39
39
|
tableName?: string
|
|
40
|
+
paramLogicName?: string
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
interface InitParams {
|
|
@@ -64,7 +65,7 @@ const props = withDefaults(defineProps<{
|
|
|
64
65
|
mode: '查询',
|
|
65
66
|
submitButton: true,
|
|
66
67
|
isHandleFormKey: true,
|
|
67
|
-
paramLogicNameParam:
|
|
68
|
+
paramLogicNameParam: {},
|
|
68
69
|
})
|
|
69
70
|
|
|
70
71
|
const emits = defineEmits(['onSubmit', 'xFormItemEmitFunc'])
|
|
@@ -170,29 +171,6 @@ async function loadFormConfig(): Promise<void> {
|
|
|
170
171
|
return new Promise((resolve, reject) => {
|
|
171
172
|
getConfigByName(props.configName!, (result) => {
|
|
172
173
|
if (result) {
|
|
173
|
-
// 如果有 paramLogicName,自动请求并赋值
|
|
174
|
-
if (result.paramLogicName && (!props.formData || (props.formData && Object.keys(props.formData).length === 0))) {
|
|
175
|
-
let logicParam = props.paramLogicNameParam
|
|
176
|
-
if (typeof logicParam === 'string') {
|
|
177
|
-
try {
|
|
178
|
-
logicParam = JSON.parse(logicParam)
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
logicParam = { value: logicParam }
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
logicParam = {
|
|
185
|
-
...logicParam,
|
|
186
|
-
currUserName: userStore.getUserInfo().name,
|
|
187
|
-
currUserId: userStore.getUserInfo().id,
|
|
188
|
-
orgId: userStore.getUserInfo().orgid,
|
|
189
|
-
}
|
|
190
|
-
runLogic(result.paramLogicName, logicParam || {}, props.serviceName).then((data: any) => {
|
|
191
|
-
if (data) {
|
|
192
|
-
form.value = data
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
}
|
|
196
174
|
setupFormConfig(result)
|
|
197
175
|
resolve()
|
|
198
176
|
}
|
|
@@ -220,6 +198,7 @@ async function initWithGroupFormItems() {
|
|
|
220
198
|
|
|
221
199
|
// 设置表单配置
|
|
222
200
|
function setupFormConfig(config: GroupFormItems) {
|
|
201
|
+
loadParamLogicNameData(config.paramLogicName)
|
|
223
202
|
formConfig.value = config
|
|
224
203
|
myServiceName.value = props.serviceName || ''
|
|
225
204
|
formGroupName.value = config.groupName || 'default'
|
|
@@ -351,6 +330,32 @@ function init(params: InitParams) {
|
|
|
351
330
|
}
|
|
352
331
|
}
|
|
353
332
|
|
|
333
|
+
function loadParamLogicNameData(paramLogicName) {
|
|
334
|
+
// 如果有 paramLogicName,自动请求并赋值
|
|
335
|
+
if (paramLogicName && (!props.formData || (props.formData && Object.keys(props.formData).length === 0))) {
|
|
336
|
+
let logicParam = props?.paramLogicNameParam || {}
|
|
337
|
+
if (typeof logicParam === 'string') {
|
|
338
|
+
try {
|
|
339
|
+
logicParam = JSON.parse(logicParam)
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
logicParam = { value: logicParam }
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
logicParam = {
|
|
346
|
+
...logicParam,
|
|
347
|
+
currUserName: userStore.getUserInfo().name,
|
|
348
|
+
currUserId: userStore.getUserInfo().id,
|
|
349
|
+
orgId: userStore.getUserInfo().orgid,
|
|
350
|
+
}
|
|
351
|
+
runLogic(paramLogicName, logicParam || {}, props.serviceName).then((data: any) => {
|
|
352
|
+
if (data) {
|
|
353
|
+
form.value = data
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
354
359
|
function setForm(obj: object) {
|
|
355
360
|
Object.assign(form.value, obj)
|
|
356
361
|
}
|
|
@@ -37,7 +37,7 @@ export interface UserInfo {
|
|
|
37
37
|
|
|
38
38
|
interface IUserState {
|
|
39
39
|
token?: string
|
|
40
|
-
userInfo:
|
|
40
|
+
userInfo: any
|
|
41
41
|
lastUpdateTime: number
|
|
42
42
|
permissions: string[]
|
|
43
43
|
roles: [{ id: string, operation: string[] }]
|
|
@@ -102,7 +102,7 @@ export const useUserStore = defineStore('app-user', () => {
|
|
|
102
102
|
const setToken = (token: string | undefined) => {
|
|
103
103
|
Storage.set(ACCESS_TOKEN, token)
|
|
104
104
|
}
|
|
105
|
-
const setUserInfo = (info:
|
|
105
|
+
const setUserInfo = (info: any | null) => {
|
|
106
106
|
userState.value.userInfo = info
|
|
107
107
|
userState.value.lastUpdateTime = new Date().getTime()
|
|
108
108
|
Storage.set(CURRENT_USER, info)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { UserInfo } from '@af-mobile-client-vue3/stores/modules/user'
|
|
3
2
|
import type { FormInstance } from 'vant'
|
|
4
3
|
import { LoginStateEnum, useFormRules, useLoginState } from '@af-mobile-client-vue3/hooks/useLogin'
|
|
5
4
|
import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
|
|
@@ -159,21 +158,10 @@ function closeWindows() {
|
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
async function afterGeneral(result) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
id: result.id,
|
|
161
|
+
const user: any = {
|
|
162
|
+
...result,
|
|
165
163
|
username: result.ename,
|
|
166
|
-
password: formData.password,
|
|
167
|
-
name: result.name,
|
|
168
164
|
avatar: result.avatar ? result.avatar : setting.getSetting()?.defaultAvatarUrl,
|
|
169
|
-
functions: result.functions,
|
|
170
|
-
rolestr: result.rolestr,
|
|
171
|
-
f_operator: result.name,
|
|
172
|
-
f_operatorid: result.id,
|
|
173
|
-
f_orgid: result.orgid,
|
|
174
|
-
f_orgname: result.orgs,
|
|
175
|
-
f_depid: result.f_department_id,
|
|
176
|
-
f_depname: result.f_department_name,
|
|
177
165
|
}
|
|
178
166
|
userState.setUserInfo(user)
|
|
179
167
|
// 如果result中没有返回 权限 需要主动获取权限列表
|