vue2-client 1.8.159 → 1.8.161

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.159",
3
+ "version": "1.8.161",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,9 +1,9 @@
1
1
  <template><div ref="domRef">Loading...</div></template>
2
2
 
3
3
  <script>
4
- // import "amis/sdk/sdk.js";
5
- // import "amis/sdk/sdk.css";
6
- // import "amis/sdk/iconfont.css";
4
+ // import 'amis/sdk/sdk.js'
5
+ // import 'amis/sdk/sdk.css'
6
+ // import 'amis/sdk/iconfont.css'
7
7
 
8
8
  // 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
9
9
  // https://aisuda.bce.baidu.com/amis/zh-CN/style/index
@@ -11,6 +11,8 @@
11
11
  import qs from 'qs'
12
12
  import Vue from 'vue'
13
13
  import Index from '@vue2-client/base-client/components/index.js'
14
+ import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
15
+
14
16
  let React
15
17
  let amisLib
16
18
  let scoped
@@ -185,6 +187,10 @@ export default {
185
187
  ...this.props,
186
188
  },
187
189
  {
190
+ requestAdaptor (api) {
191
+ api.headers.Authorization = localStorage.getItem(ACCESS_TOKEN)
192
+ return api
193
+ },
188
194
  // 覆盖 amis env
189
195
  // 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
190
196
  jumpTo: (to, action) => {
@@ -80,6 +80,10 @@ export default {
80
80
  configData: {
81
81
  type: Object,
82
82
  default: undefined
83
+ },
84
+ serverName: {
85
+ type: String,
86
+ default: 'af-system'
83
87
  }
84
88
  },
85
89
  components: {
@@ -516,7 +520,7 @@ export default {
516
520
 
517
521
  // 挨个获取插槽
518
522
  waitForDownloadSlotName.forEach(configName => {
519
- getConfigByName(configName, 'af-system', res => {
523
+ getConfigByName(configName, this.serverName, res => {
520
524
  this.configFromWeb[configName] = res
521
525
  count++
522
526
  })
@@ -617,7 +621,7 @@ export default {
617
621
  this.configInit()
618
622
  }
619
623
  } else {
620
- getConfigByName(this.configName, 'af-system', res => {
624
+ getConfigByName(this.configName, this.serverName, res => {
621
625
  this.config = res
622
626
  if (this.config.designMode === 'json') {
623
627
  this.jsonConfigInit()
@@ -3,34 +3,226 @@
3
3
  </template>
4
4
  <script>
5
5
  import AMISRenderer from '@vue2-client/base-client/components/common/AMisRender'
6
- // import Vue from 'vue'
7
- // import Index from '@vue2-client/base-client/components/index.js'
8
- //
9
- // const vms = {}
10
- // const store = Vue.$store
11
- // const router = Vue.$router
12
- // const i18n = Vue.$i18n
6
+ import Vue from 'vue'
7
+ // import router from '@vue2-client/router'
8
+ // import store from 'core-js/internals/shared-store'
9
+ // import { i18n } from '../../../index'
10
+ import Index from '@vue2-client/base-client/components/index.js'
13
11
 
14
- const schema = {
12
+ const vms = {}
13
+ const store = Vue.$store
14
+ const router = Vue.$router
15
+ const i18n = Vue.$i18n
16
+
17
+ // const schema = {
18
+ // // 原生与自定义组件混用
19
+ // type: 'page',
20
+ // css: {
21
+ // },
22
+ // body: [
23
+ // // {
24
+ // // type: 'grid',
25
+ // // columns: [
26
+ // // {
27
+ // // mode: 'horizontal',
28
+ // // body: {
29
+ // // name: 'queryParams',
30
+ // // type: 'input-text',
31
+ // // label: '查询值'
32
+ // // },
33
+ // // md: 4
34
+ // // }
35
+ // // ]
36
+ // // },
37
+ // {
38
+ // type: 'grid',
39
+ // columns: [
40
+ // {
41
+ // body: [
42
+ // {
43
+ // type: 'input-tree',
44
+ // name: 'test_tree',
45
+ // label: '树选择框',
46
+ // options: [
47
+ // {
48
+ // label: '查询配置',
49
+ // children: [
50
+ // {
51
+ // label: '字典管理',
52
+ // value: 'crud_dictionary_manage'
53
+ // },
54
+ // {
55
+ // label: '操作日志',
56
+ // value: 'crud_oper_log_manage'
57
+ // }
58
+ // ]
59
+ // }
60
+ // ]
61
+ // // source: {
62
+ // // method: 'post',
63
+ // // url: '/api/af-system/logic/get_root_nodes'
64
+ // // },
65
+ // }
66
+ // ],
67
+ // id: 'u:b1d2075dc231',
68
+ // md: 1.5
69
+ // },
70
+ // {
71
+ // body: [
72
+ // // {
73
+ // // type: 'table-view',
74
+ // // name: 'table-view1',
75
+ // // api: '',
76
+ // // trs: [
77
+ // // {
78
+ // // background: '#F7F7F7',
79
+ // // tds: [
80
+ // // {
81
+ // // align: 'center',
82
+ // // body: {
83
+ // // type: 'tpl',
84
+ // // tpl: '地区'
85
+ // // }
86
+ // // },
87
+ // // {
88
+ // // align: 'center',
89
+ // // body: {
90
+ // // type: 'tpl',
91
+ // // tpl: '城市'
92
+ // // }
93
+ // // },
94
+ // // {
95
+ // // align: 'center',
96
+ // // body: {
97
+ // // type: 'tpl',
98
+ // // tpl: '销量'
99
+ // // }
100
+ // // }
101
+ // // ]
102
+ // // },
103
+ // // {
104
+ // // tds: [
105
+ // // {
106
+ // // align: 'center',
107
+ // // colspan: 2,
108
+ // // rowspan: 2,
109
+ // // body: {
110
+ // // type: 'tpl',
111
+ // // tpl: '${queryParams}'
112
+ // // }
113
+ // // },
114
+ // // {
115
+ // // body: {
116
+ // // type: 'tpl',
117
+ // // tpl: '北京'
118
+ // // },
119
+ // // }
120
+ // // ]
121
+ // // },
122
+ // // {
123
+ // // tds: [
124
+ // // {
125
+ // // body: {
126
+ // // type: 'tpl',
127
+ // // tpl: '上京'
128
+ // // },
129
+ // // }
130
+ // // ]
131
+ // // }
132
+ // // ]
133
+ // // },
134
+ // // {
135
+ // //
136
+ // // },
137
+ // // {
138
+ // // type: 'table-view',
139
+ // // trs: [
140
+ // // {
141
+ // // background: '#F7F7F7',
142
+ // // tds: [
143
+ // // {
144
+ // // align: 'center',
145
+ // // body: {
146
+ // // type: 'tpl',
147
+ // // tpl: '地区'
148
+ // // }
149
+ // // },
150
+ // // {
151
+ // // align: 'center',
152
+ // // body: {
153
+ // // type: 'tpl',
154
+ // // tpl: '城市'
155
+ // // }
156
+ // // },
157
+ // // {
158
+ // // align: 'center',
159
+ // // body: {
160
+ // // type: 'tpl',
161
+ // // tpl: '销量'
162
+ // // }
163
+ // // }
164
+ // // ]
165
+ // // },
166
+ // // {
167
+ // // tds: [
168
+ // // {
169
+ // // align: 'center',
170
+ // // colspan: 3,
171
+ // // body: {
172
+ // // type: 'tpl',
173
+ // // tpl: '北京'
174
+ // // }
175
+ // // },
176
+ // //
177
+ // // ]
178
+ // // }
179
+ // // ]
180
+ // // },
181
+ // {
182
+ // name: 'xTable', // 如果要放在 form 中,需要设置 name,onChange 将会设置这个值
183
+ // type: 'custom',
184
+ // // onMount 将会在组件创建时执行,默认会创建一个空 div 标签,也可以设置 inline: true 来创建 span 标签
185
+ // // dom 是 dom 节点,value 是初始数据,比如表单 name 初始拿到的数据,onChange 只有在表单下才会有
186
+ // onMount: (dom, value, onChange) => {
187
+ // const vm = new Vue({
188
+ // router,
189
+ // store,
190
+ // i18n,
191
+ // render: h => h(Index.XFormTable, {
192
+ // props: {
193
+ // queryParamsName: `crud_dictionary_manage`
194
+ // }
195
+ // })
196
+ // })
197
+ // vms.XFormTable = vm
198
+ // dom.appendChild(vm.$mount().$el)
199
+ // },
200
+ // // onUpdate 将会在数据更新时被调用
201
+ // // dom 是 dom 节点、data 将包含表单所有数据,prevData 是之前表单的所有数据
202
+ // onUpdate: (dom, data, prevData) => {
203
+ // console.log('数据有变化', data)
204
+ // const vm = vms.XFormTable
205
+ // vm.$children[0].active(data)
206
+ // },
207
+ // // onUnmount 将会在组件被销毁的时候调用,用于清理资源
208
+ // onUnmount: () => {
209
+ // console.log('组件被销毁')
210
+ // },
211
+ // },
212
+ // ],
213
+ // id: 'u:e4e49c147c06'
214
+ // }
215
+ // ],
216
+ // }
217
+ // ]
218
+ // }
219
+
220
+ const schema2 = {
15
221
  // 原生与自定义组件混用
16
222
  type: 'page',
17
223
  css: {
18
224
  },
19
225
  body: [
20
- {
21
- type: 'grid',
22
- columns: [
23
- {
24
- mode: 'horizontal',
25
- body: {
26
- name: 'queryParams',
27
- type: 'input-text',
28
- label: '查询值'
29
- },
30
- md: 4
31
- }
32
- ]
33
- },
34
226
  {
35
227
  type: 'grid',
36
228
  columns: [
@@ -38,16 +230,23 @@ const schema = {
38
230
  body: [
39
231
  {
40
232
  type: 'input-tree',
41
- name: 'test',
233
+ name: 'test_tree',
42
234
  label: '树选择框',
43
- source: {
44
- method: 'post',
45
- url: '/api/af-system/logic/get_root_nodes'
46
- },
47
- // api: {
48
- // method: 'post',
49
- // url: '/api/af-system/logic/get_root_nodes'
50
- // }
235
+ options: [
236
+ {
237
+ label: '查询配置',
238
+ children: [
239
+ {
240
+ label: '字典管理',
241
+ value: 'crud_dictionary_manage'
242
+ },
243
+ {
244
+ label: '操作日志',
245
+ value: 'crud_oper_log_manage'
246
+ }
247
+ ]
248
+ }
249
+ ]
51
250
  }
52
251
  ],
53
252
  id: 'u:b1d2075dc231',
@@ -55,146 +254,37 @@ const schema = {
55
254
  },
56
255
  {
57
256
  body: [
58
- {
59
- type: 'table-view',
60
- name: 'table-view1',
61
- api: '',
62
- trs: [
63
- {
64
- background: '#F7F7F7',
65
- tds: [
66
- {
67
- align: 'center',
68
- body: {
69
- type: 'tpl',
70
- tpl: '地区'
71
- }
72
- },
73
- {
74
- align: 'center',
75
- body: {
76
- type: 'tpl',
77
- tpl: '城市'
78
- }
79
- },
80
- {
81
- align: 'center',
82
- body: {
83
- type: 'tpl',
84
- tpl: '销量'
85
- }
86
- }
87
- ]
88
- },
89
- {
90
- tds: [
91
- {
92
- align: 'center',
93
- colspan: 2,
94
- rowspan: 2,
95
- body: {
96
- type: 'tpl',
97
- tpl: '${queryParams}'
98
- }
99
- },
100
- {
101
- body: {
102
- type: 'tpl',
103
- tpl: '北京'
104
- },
105
- }
106
- ]
107
- },
108
- {
109
- tds: [
110
- {
111
- body: {
112
- type: 'tpl',
113
- tpl: '上京'
114
- },
115
- }
116
- ]
117
- }
118
- ]
119
- },
120
- {
121
-
122
- },
123
257
  {
124
- type: 'table-view',
125
- trs: [
126
- {
127
- background: '#F7F7F7',
128
- tds: [
129
- {
130
- align: 'center',
131
- body: {
132
- type: 'tpl',
133
- tpl: '地区'
134
- }
135
- },
136
- {
137
- align: 'center',
138
- body: {
139
- type: 'tpl',
140
- tpl: '城市'
141
- }
142
- },
143
- {
144
- align: 'center',
145
- body: {
146
- type: 'tpl',
147
- tpl: '销量'
148
- }
258
+ name: 'xTable', // 如果要放在 form 中,需要设置 name,onChange 将会设置这个值
259
+ type: 'custom',
260
+ // onMount 将会在组件创建时执行,默认会创建一个空 div 标签,也可以设置 inline: true 来创建 span 标签
261
+ // dom 是 dom 节点,value 是初始数据,比如表单 name 初始拿到的数据,onChange 只有在表单下才会有
262
+ onMount: (dom, value, onChange) => {
263
+ const vm = new Vue({
264
+ router,
265
+ store,
266
+ i18n,
267
+ render: h => h(Index.XFormTable, {
268
+ props: {
269
+ queryParamsName: `crud_dictionary_manage`
149
270
  }
150
- ]
151
- },
152
- {
153
- tds: [
154
- {
155
- align: 'center',
156
- colspan: 3,
157
- body: {
158
- type: 'tpl',
159
- tpl: '北京'
160
- }
161
- },
162
-
163
- ]
164
- }
165
- ]
271
+ })
272
+ })
273
+ vms.XFormTable = vm
274
+ dom.appendChild(vm.$mount().$el)
275
+ },
276
+ // onUpdate 将会在数据更新时被调用
277
+ // dom 是 dom 节点、data 将包含表单所有数据,prevData 是之前表单的所有数据
278
+ onUpdate: (dom, data, prevData) => {
279
+ console.log('数据有变化', data)
280
+ const vm = vms.XFormTable
281
+ vm.$children[0].active(data)
282
+ },
283
+ // onUnmount 将会在组件被销毁的时候调用,用于清理资源
284
+ onUnmount: () => {
285
+ console.log('组件被销毁')
286
+ },
166
287
  },
167
- // {
168
- // name: 'username', // 如果要放在 form 中,需要设置 name,onChange 将会设置这个值
169
- // type: 'custom',
170
- // // onMount 将会在组件创建时执行,默认会创建一个空 div 标签,也可以设置 inline: true 来创建 span 标签
171
- // // dom 是 dom 节点,value 是初始数据,比如表单 name 初始拿到的数据,onChange 只有在表单下才会有
172
- // onMount: (dom, value, onChange) => {
173
- // const vm = new Vue({
174
- // router,
175
- // store,
176
- // i18n,
177
- // render: h => h(Index.XFormTable, {
178
- // props: {
179
- // queryParamsName: `crud_dictionary_manage`
180
- // }
181
- // })
182
- // })
183
- // vms.XFormTable = vm
184
- // dom.appendChild(vm.$mount().$el)
185
- // },
186
- // // onUpdate 将会在数据更新时被调用
187
- // // dom 是 dom 节点、data 将包含表单所有数据,prevData 是之前表单的所有数据
188
- // onUpdate: (dom, data, prevData) => {
189
- // console.log('数据有变化', data)
190
- // const vm = vms.XFormTable
191
- // vm.$children[0].active(data)
192
- // },
193
- // // onUnmount 将会在组件被销毁的时候调用,用于清理资源
194
- // onUnmount: () => {
195
- // console.log('组件被销毁')
196
- // },
197
- // }
198
288
  ],
199
289
  id: 'u:e4e49c147c06'
200
290
  }
@@ -214,7 +304,8 @@ export default {
214
304
 
215
305
  },
216
306
  data: () => ({
217
- schema: schema,
307
+ outerVue: this,
308
+ schema: schema2,
218
309
  locals: { fixedQueryForm: {} },
219
310
  vms: {},
220
311
  queryParamsName: 'crud_dictionary_manage'
@@ -1,6 +1,6 @@
1
1
  import { hasAuthority } from '@vue2-client/utils/authority-utils'
2
2
  import { loginIgnore } from '@vue2-client/router/index'
3
- import { checkAuthorization } from '@vue2-client/utils/request'
3
+ import { checkAuthorization, METHOD, request } from '@vue2-client/utils/request'
4
4
  import NProgress from 'nprogress'
5
5
  import { logout } from '@vue2-client/services/user'
6
6
  import {
@@ -39,7 +39,11 @@ const loginGuard = (to, from, next, options) => {
39
39
  window.microApp.dispatch({ type: '子应用发送给主应用的数据', to: to.path })
40
40
  }
41
41
  const urlParams = new URLSearchParams(window.location.search)
42
+ // 如果是需要我们自己登陆的项目
42
43
  const token = urlParams.get('token')
44
+ // 如果是v2 的项目 资源管理和营收分开库的那种项目 传递用户信息进来
45
+ const tokenV2 = urlParams.get('tokenV2')
46
+ // 如果是 v4 的父项目,通过localStorage传递信息
43
47
  const V4_LOGIN_DATA_KEY = localStorage.getItem('v4LoginData')
44
48
  if (token) {
45
49
  const { AESDecrypt } = AES
@@ -69,6 +73,34 @@ const loginGuard = (to, from, next, options) => {
69
73
  next()
70
74
  }
71
75
  }
76
+ } else if (tokenV2) {
77
+ const { AESDecrypt } = AES
78
+ const info = AESDecrypt(tokenV2, '3KMKqvgwR8ULbR8Z')
79
+ request(`/rs/user/${info.name}/${info.password}/智慧燃气`, METHOD.GET).then(
80
+ res => {
81
+ const curUser = {
82
+ name: res.name,
83
+ username: res.name,
84
+ orgid: res.name,
85
+ avatar: '',
86
+ ename: res.ename,
87
+ id: res.id,
88
+ orgName: res.f_fengongsi,
89
+ contact: '',
90
+ phone: '',
91
+ orgs: res.orgs
92
+ }
93
+ Vue.$store.commit('account/setUser', Object.assign(curUser, res))
94
+ const login = {
95
+ f: res,
96
+ jwt: res.id,
97
+ r: res.roles
98
+ }
99
+ Vue.$store.commit('account/setLogin', login)
100
+ loadRoutes(funcToRouter(res.functions))
101
+ next()
102
+ }
103
+ )
72
104
  } else if (V4_LOGIN_DATA_KEY) {
73
105
  const v4LoginData = JSON.parse(localStorage.getItem('userInfo'))
74
106
  const curUser = {