vue2-client 1.8.182 → 1.8.184-test

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.182",
3
+ "version": "1.8.184-test",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -41,7 +41,9 @@
41
41
  </a-select-option>
42
42
  </template>
43
43
  <template v-else>
44
- <template v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
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 v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
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 v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
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 => {
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <a-row type="flex" :gutter="48">
3
- <a-col :span="6" v-if="xTreeConfigName">
2
+ <a-row type="flex" :gutter="16">
3
+ <a-col :span="6" v-if="xTreeConfigName" :style="{ maxWidth: '300px' }">
4
4
  <x-tree
5
5
  :config-name="xTreeConfigName"
6
6
  :env="env"
@@ -9,7 +9,7 @@
9
9
  ref="xtree"
10
10
  ></x-tree>
11
11
  </a-col>
12
- <a-col :span="xTreeConfigName?18:24">
12
+ <a-col :span="xTreeConfigName ? 18 : 24" :style="{ flex: xTreeConfigName ? '1' : 'none' }">
13
13
  <a-skeleton :loading="loading" :paragraph="{ rows: 4 }"/>
14
14
  <div v-show="!loading">
15
15
  <template v-if="!loadError">
@@ -14,6 +14,9 @@ export default {
14
14
  components: {
15
15
  XReport
16
16
  },
17
+ mounted () {
18
+ console.log(this.$route)
19
+ },
17
20
  data () {
18
21
  return {
19
22
  test: {
@@ -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
- const user = localStorage.getItem(process.env.VUE_APP_USER_KEY)
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 }
@@ -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: