vue2-client 1.8.183 → 1.8.184
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
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
</a-select-option>
|
|
42
42
|
</template>
|
|
43
43
|
<template v-else>
|
|
44
|
-
<template
|
|
44
|
+
<template
|
|
45
|
+
v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
|
|
46
|
+
||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
|
|
45
47
|
<a-select-option
|
|
46
48
|
v-for="(item,index) in option"
|
|
47
49
|
:key="index.value"
|
|
@@ -119,7 +121,9 @@
|
|
|
119
121
|
</a-select-option>
|
|
120
122
|
</template>
|
|
121
123
|
<template v-else>
|
|
122
|
-
<template
|
|
124
|
+
<template
|
|
125
|
+
v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
|
|
126
|
+
||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
|
|
123
127
|
<a-select-option
|
|
124
128
|
v-for="(item,index) in option"
|
|
125
129
|
:key="index"
|
|
@@ -171,7 +175,9 @@
|
|
|
171
175
|
</a-radio>
|
|
172
176
|
</template>
|
|
173
177
|
<template v-else>
|
|
174
|
-
<template
|
|
178
|
+
<template
|
|
179
|
+
v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
|
|
180
|
+
||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
|
|
175
181
|
<a-radio v-for="(item,index) in option" :key="index" :value="item.value">
|
|
176
182
|
{{ item.label }}
|
|
177
183
|
</a-radio>
|
|
@@ -323,6 +329,8 @@ import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
|
323
329
|
import moment from 'moment'
|
|
324
330
|
import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
|
|
325
331
|
import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
|
|
332
|
+
import { searchToOption } from '@vue2-client/services/v3Api'
|
|
333
|
+
import { mapState } from 'vuex'
|
|
326
334
|
|
|
327
335
|
export default {
|
|
328
336
|
name: 'XFormItem',
|
|
@@ -410,6 +418,9 @@ export default {
|
|
|
410
418
|
created () {
|
|
411
419
|
this.init()
|
|
412
420
|
},
|
|
421
|
+
computed: {
|
|
422
|
+
...mapState('account', { currUser: 'user' })
|
|
423
|
+
},
|
|
413
424
|
watch: {
|
|
414
425
|
attr: {
|
|
415
426
|
handler () {
|
|
@@ -419,8 +430,8 @@ export default {
|
|
|
419
430
|
},
|
|
420
431
|
form: {
|
|
421
432
|
handler (newVal) {
|
|
422
|
-
const value = newVal[this.attr.model]
|
|
423
|
-
const isEmpty = !value || !value.toString()
|
|
433
|
+
// const value = newVal[this.attr.model]
|
|
434
|
+
// const isEmpty = !value || !value.toString()
|
|
424
435
|
// 查询表单点击重置按钮时清空树形选择框选中状态
|
|
425
436
|
// if (this.$refs.xTreeSelect && this.attr.type === 'treeSelect' && isEmpty) {
|
|
426
437
|
// this.$refs.xTreeSelect.setValue(undefined)
|
|
@@ -443,6 +454,12 @@ export default {
|
|
|
443
454
|
}
|
|
444
455
|
if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
|
|
445
456
|
this.getData({}, res => this.getDataCallback(res))
|
|
457
|
+
} if (this.attr.keyName && this.attr.keyName.indexOf('search@') !== -1) {
|
|
458
|
+
// `tool.getFullTree(this.getRights().where(row.getType()==$organization$))`
|
|
459
|
+
this.getDataCallback(searchToOption({
|
|
460
|
+
source: this.attr.keyName.substring(6),
|
|
461
|
+
userid: this.currUser.id
|
|
462
|
+
}))
|
|
446
463
|
} else if (this.attr.keyName && this.attr.keyName.indexOf('config@') !== -1) {
|
|
447
464
|
const configName = this.attr.keyName.substring(7)
|
|
448
465
|
getConfigByName(configName, this.serviceName, res => {
|
package/src/router/guards.js
CHANGED
|
@@ -51,8 +51,9 @@ const loginGuard = (to, from, next, options) => {
|
|
|
51
51
|
const { store, message, router } = options
|
|
52
52
|
if (
|
|
53
53
|
(!loginIgnore.includes(to) || to.name === '404') &&
|
|
54
|
-
!checkSingleAuthorization()
|
|
54
|
+
!checkSingleAuthorization('SinglePage', token)
|
|
55
55
|
) {
|
|
56
|
+
localStorage.setItem('SinglePage_TOKEN', token)
|
|
56
57
|
startLogin({
|
|
57
58
|
...info,
|
|
58
59
|
pathname: window.location.pathname,
|
|
@@ -61,7 +62,12 @@ const loginGuard = (to, from, next, options) => {
|
|
|
61
62
|
})
|
|
62
63
|
} else {
|
|
63
64
|
const roles = store.getters['account/roles']
|
|
64
|
-
|
|
65
|
+
let user = {}
|
|
66
|
+
try {
|
|
67
|
+
user = JSON.parse(localStorage.getItem(process.env.VUE_APP_USER_KEY))
|
|
68
|
+
} catch (e) {
|
|
69
|
+
user = localStorage.getItem(process.env.VUE_APP_USER_KEY)
|
|
70
|
+
}
|
|
65
71
|
const setUser = store._mutations['account/setUser'][0]
|
|
66
72
|
setUser(user)
|
|
67
73
|
if (roles.length === 0 && !loginIgnore.includes(to)) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { METHOD, request } from '@vue2-client/utils/request'
|
|
2
|
+
|
|
3
|
+
export async function searchToOption (params) {
|
|
4
|
+
return search(params).then(res => {
|
|
5
|
+
return res.data.map(item => {
|
|
6
|
+
return {
|
|
7
|
+
label: item.name,
|
|
8
|
+
value: item.id
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function search (params) {
|
|
15
|
+
return request('/rs/search', METHOD.POST, params)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default { searchToOption, search }
|
package/src/utils/login.js
CHANGED
|
@@ -13,17 +13,20 @@ import {
|
|
|
13
13
|
// 认证类型
|
|
14
14
|
const AUTH_TYPE = {
|
|
15
15
|
BEARER: 'Bearer',
|
|
16
|
+
SinglePage: 'SinglePage',
|
|
16
17
|
BASIC: 'basic',
|
|
17
18
|
AUTH1: 'auth1',
|
|
18
19
|
AUTH2: 'auth2',
|
|
19
20
|
}
|
|
20
|
-
export function checkSingleAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
21
|
+
export function checkSingleAuthorization (authType = AUTH_TYPE.BEARER, token) {
|
|
21
22
|
switch (authType) {
|
|
22
23
|
case AUTH_TYPE.BEARER:
|
|
23
24
|
if (localStorage.getItem(V4_ACCESS_TOKEN)) {
|
|
24
25
|
return true
|
|
25
26
|
}
|
|
26
27
|
break
|
|
28
|
+
case AUTH_TYPE.SinglePage:
|
|
29
|
+
return token === localStorage.getItem('SinglePage_TOKEN')
|
|
27
30
|
case AUTH_TYPE.BASIC:
|
|
28
31
|
case AUTH_TYPE.AUTH1:
|
|
29
32
|
case AUTH_TYPE.AUTH2:
|