system-clients 3.2.60 → 3.2.61-gehua

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.
@@ -1,10 +1,11 @@
1
1
  import Vue from 'vue'
2
2
  import {HttpResetClass} from 'vue-client'
3
3
  import cryptJS from './EncryptUtil'
4
+
4
5
  let loginGen = async function (name, password, cue) {
5
6
  let data = {name: name, password: password}
6
- data = '$'+cryptJS.RSAEncrypt(JSON.stringify(data))
7
- let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null})
7
+ data = '$' + cryptJS.RSAEncrypt(JSON.stringify(data))
8
+ const getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null})
8
9
  if (getLogin.data.states === '登录成功') {
9
10
  //获取jwt
10
11
  Vue.$login.jwt = getLogin.data.jwt
@@ -12,30 +13,35 @@ let loginGen = async function (name, password, cue) {
12
13
  // 调用远程登录服务,获取所有有权访问的功能
13
14
  data = {username: name, password: password}
14
15
  data = cryptJS.RSAEncrypt(JSON.stringify(data))
15
- let resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
16
+ const resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
16
17
  resolveMsg: null,
17
18
  rejectMsg: null
18
19
  })
20
+ // 兼容旧版ldao
21
+ if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg && resource.data.code !== 200) {
22
+ throw {status: 555, data: resource.data.msg}
23
+ }
19
24
  console.log('登陆获取Util', JSON.stringify(resource.data))
20
- Vue.$login.f = resource.data
25
+
26
+ // 兼容旧版ldao,旧版不返回code
27
+ if ((JSON.stringify(resource.data).startsWith("{") || JSON.stringify(resource.data).startsWith("[")) && resource.data.code && resource.data.msg) {
28
+ Vue.$login.f = resource.data.data
29
+ } else {
30
+ Vue.$login.f = resource.data
31
+ }
21
32
  // 把登录用户添加到cookie里
22
33
  Vue.cookie.set('loginId', Vue.$login.f.id)
23
-
24
34
  try {
25
35
  //获取有权限的功能树
26
36
  let hasRight = await Vue.resetpost(`/rs/search`, {
27
- source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
28
- userid: Vue.$login.f.id
29
- },
30
- {
31
- resolveMsg: null,
32
- rejectMsg: null
33
- })
37
+ source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
38
+ userid: Vue.$login.f.id
39
+ }, { resolveMsg: null, rejectMsg: null })
34
40
  console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
35
41
  //准备替换功能树
36
- var fun=[]
42
+ var fun = []
37
43
  hasRight.data[0].children[0].children.forEach((item) => {
38
- if(item.name=='客服系统'){
44
+ if (item.name === '客服系统') {
39
45
  item.children.forEach((item1) => {
40
46
  fun.push(item1)
41
47
  })
@@ -43,8 +49,8 @@ let loginGen = async function (name, password, cue) {
43
49
  })
44
50
  // console.log('替换前', JSON.stringify(Vue.$login.f.functions))
45
51
  // console.log('替换后', JSON.stringify(fun))
46
- Vue.$login.f.functions=fun
47
- }catch (error) {
52
+ Vue.$login.f.functions = fun
53
+ } catch (error) {
48
54
  }
49
55
  if (Vue.$login.f.id !== '11') {
50
56
  try {
@@ -58,9 +64,9 @@ let loginGen = async function (name, password, cue) {
58
64
  areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
59
65
  }
60
66
  Vue.$login.f.f_allArea = areaTemp
61
- }catch (error) {
62
- Vue.$login.f.f_allArea =[]
63
- console.log('获取区县',error)
67
+ } catch (error) {
68
+ Vue.$login.f.f_allArea = []
69
+ console.log('获取区县', error)
64
70
  }
65
71
  // 获取抄表员
66
72
  try {
@@ -73,9 +79,9 @@ let loginGen = async function (name, password, cue) {
73
79
  gasman.push(getGasman.data[i])
74
80
  }
75
81
  Vue.$login.f.f_gasman = gasman
76
- }catch (error) {
82
+ } catch (error) {
77
83
  Vue.$login.f.f_gasman = []
78
- console.log('抄表员模块',error)
84
+ console.log('抄表员模块', error)
79
85
  }
80
86
  // 获取安装人
81
87
  try {
@@ -89,9 +95,9 @@ let loginGen = async function (name, password, cue) {
89
95
  installman.push(getInstallman.data[i])
90
96
  }
91
97
  Vue.$login.f.f_installman = installman
92
- }catch (error) {
93
- Vue.$login.f.f_installman =[]
94
- console.log('安装人模块',error)
98
+ } catch (error) {
99
+ Vue.$login.f.f_installman = []
100
+ console.log('安装人模块', error)
95
101
  }
96
102
  // 获取换表员
97
103
  // try {
@@ -108,20 +114,22 @@ let loginGen = async function (name, password, cue) {
108
114
  // Vue.$login.f.f_changemeterman = []
109
115
  // console.log('换表员模块',error)
110
116
  // }
111
- // 获取资源服务权限
117
+ // 获取资源服务权限
112
118
  try {
113
- let getLic = await Vue.resetpost('/rs/search', {data: {
114
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
115
- userid: Vue.$login.f.id
116
- }}, {resolveMsg: null, rejectMsg: null})
117
- let arry=[]
118
- getLic.data.forEach((item) => {
119
- arry.push(item.name)
120
- })
121
- Vue.$login.f.lics=arry
122
- }catch (error) {
119
+ let getLic = await Vue.resetpost('/rs/search', {
120
+ data: {
121
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
122
+ userid: Vue.$login.f.id
123
+ }
124
+ }, {resolveMsg: null, rejectMsg: null})
125
+ let arry = []
126
+ getLic.data.forEach((item) => {
127
+ arry.push(item.name)
128
+ })
129
+ Vue.$login.f.lics = arry
130
+ } catch (error) {
123
131
  Vue.$login.f.f_gasman = []
124
- console.log('资源服务权限',error)
132
+ console.log('资源服务权限', error)
125
133
  }
126
134
  // // 票据使用人
127
135
  // try {
@@ -163,26 +171,29 @@ let loginGen = async function (name, password, cue) {
163
171
  let r = viewDetails.data
164
172
  Vue.$login.r = []
165
173
  r.forEach(x => Vue.$login.r.push(x.name))
166
- }catch (error) {
174
+ } catch (error) {
167
175
  Vue.$login.r = []
168
- console.log('加载模块失败',error)
176
+ console.log('加载模块失败', error)
169
177
  }
170
178
  // 调用登录后处理
171
- for(let proc of Vue.$login.afterLogin) {
179
+ for (let proc of Vue.$login.afterLogin) {
172
180
  await proc(Vue.$login.f)
173
181
  }
174
182
  // 定时发送心跳
175
- if (cue){
176
- setInterval(()=> {
183
+ if (cue) {
184
+ setInterval(() => {
177
185
  let http = new HttpResetClass()
178
186
  //暂时不出现不出现异地登录校验
179
- http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
180
- if(req.data.forcestate && req.data.forcestate == 1){
187
+ http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {
188
+ resolveMsg: null,
189
+ rejectMsg: null
190
+ }).then((req) => {
191
+ if (req.data.forcestate && req.data.forcestate == 1) {
181
192
  Vue.showMessage("您被强制下线!", ['confirm']).then((res) => {
182
193
  location.reload()
183
194
  })
184
- }else if(req.data.status==710){
185
- Vue.showMessage(req.data.msg+",您将被强制退出系统", ['confirm']).then((res) => {
195
+ } else if (req.data.status == 710) {
196
+ Vue.showMessage(req.data.msg + ",您将被强制退出系统", ['confirm']).then((res) => {
186
197
  if (res === 'confirm') {
187
198
  location.reload()
188
199
  }
@@ -201,20 +212,19 @@ let loginGen = async function (name, password, cue) {
201
212
  }
202
213
 
203
214
  let GetLoginInfoService = {
215
+ SinglePageToken:{},
204
216
  // 登录后要处理的异步对象
205
217
  afterLogin: [],
206
218
  //验证码开关
207
219
  Verification: true,
208
220
  //登录信息展示开关
209
221
  depPrompt: true,
210
- install (Vue, options) {
222
+ install(Vue, options) {
211
223
  // 给vue增添对话框显示方法
212
224
  Vue.$login = Vue.prototype.$login = GetLoginInfoService
213
225
  },
214
226
 
215
- f: {
216
-
217
- },
227
+ f: {},
218
228
 
219
229
  /**
220
230
  * 登录
@@ -222,14 +232,15 @@ let GetLoginInfoService = {
222
232
  * @param password
223
233
  * @param cue true/false 是/否显示异地登录
224
234
  */
225
- login (name, password, cue) {
226
- if (cue === undefined || cue === null || cue === ''){
235
+ login(name, password, cue) {
236
+ if (cue === undefined || cue === null || cue === '') {
227
237
  cue = true
228
238
  }
239
+ Vue.$login.SinglePageToken = cryptJS.AESEncrypt(JSON.stringify({name,password}), "3KMKqvgwR8ULbR8Z")
229
240
  return loginGen(name, password, cue)
230
241
  },
231
242
 
232
- convertToIn (val) {
243
+ convertToIn(val) {
233
244
  let temp = ''
234
245
  if (val instanceof Array) {
235
246
  if (val.length >= 1) {
@@ -243,26 +254,26 @@ let GetLoginInfoService = {
243
254
  return temp
244
255
  },
245
256
 
246
- toStandardYearMonth () {
257
+ toStandardYearMonth() {
247
258
  let dt = new Date()
248
259
  let month = dt.getMonth() + 1
249
260
  return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
250
261
  },
251
262
 
252
- toStandardYearMonth1 () {
263
+ toStandardYearMonth1() {
253
264
  let dt = new Date()
254
265
  let month = dt.getMonth() + 1
255
266
  return dt.getFullYear() + (month < 10 ? '0' + month : month)
256
267
  },
257
268
 
258
- toStandardDateString () {
269
+ toStandardDateString() {
259
270
  let dt = new Date()
260
271
  let month = dt.getMonth() + 1
261
272
  let date = dt.getDate()
262
273
  return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
263
274
  },
264
275
 
265
- toStartAndEndDateString () {
276
+ toStartAndEndDateString() {
266
277
  let dt = new Date()
267
278
  let month = dt.getMonth() + 1
268
279
  // let date = dt.getDate()
@@ -271,7 +282,7 @@ let GetLoginInfoService = {
271
282
  // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
272
283
  },
273
284
 
274
- toStandardTimeString () {
285
+ toStandardTimeString() {
275
286
  let dt = new Date()
276
287
  let month = dt.getMonth() + 1
277
288
  let date = dt.getDate()
@@ -282,7 +293,7 @@ let GetLoginInfoService = {
282
293
  ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
283
294
  },
284
295
 
285
- guid () {
296
+ guid() {
286
297
  let buf = new Uint16Array(8)
287
298
  window.crypto.getRandomValues(buf)
288
299
  let S4 = function (num) {
@@ -295,7 +306,7 @@ let GetLoginInfoService = {
295
306
  return (S4(buf[0]) + S4(buf[1]) + S4(buf[2]) + S4(buf[3]) + S4(buf[4]) + S4(buf[5]) + S4(buf[6]) + S4(buf[7]))
296
307
  },
297
308
 
298
- choices (role, param, hasBlank = false, blankHint = '请选择') {
309
+ choices(role, param, hasBlank = false, blankHint = '请选择') {
299
310
  if (role == 'view') {
300
311
  Vue.getParams(param, [null])
301
312
  } else {
@@ -314,7 +325,7 @@ let GetLoginInfoService = {
314
325
  }
315
326
  },
316
327
 
317
- required (param) {
328
+ required(param) {
318
329
  if (typeof param === 'number' && param == 0)
319
330
  return false
320
331
  if (!param)
@@ -326,16 +337,16 @@ let GetLoginInfoService = {
326
337
  return false
327
338
  },
328
339
 
329
- isInt (n) {
340
+ isInt(n) {
330
341
  return !window.isNaN(n) && n % 1 === 0
331
342
  },
332
343
 
333
- isFloat (n) {
344
+ isFloat(n) {
334
345
  return !window.isNaN(n)
335
346
  },
336
347
 
337
348
  // this will convert all true/false to boolean
338
- booleanFilter (paper) {
349
+ booleanFilter(paper) {
339
350
  for (let key in paper) {
340
351
  if (!paper.hasOwnProperty(key))
341
352
  continue
@@ -348,7 +359,7 @@ let GetLoginInfoService = {
348
359
  }
349
360
  },
350
361
  // recursively traverse through each path
351
- ratifyPics (paper) {
362
+ ratifyPics(paper) {
352
363
  for (let key in paper) {
353
364
  if (key.endsWith('_path')) {
354
365
  if (!paper[key]) {
@@ -363,7 +374,7 @@ let GetLoginInfoService = {
363
374
  },
364
375
 
365
376
  // load script and other stuff
366
- loadscript (type, fileName) {
377
+ loadscript(type, fileName) {
367
378
  return new Promise((resolve, reject) => {
368
379
  let element
369
380
  if (type == 'css') {
@@ -390,11 +401,11 @@ let GetLoginInfoService = {
390
401
  })
391
402
  },
392
403
  // 不能选择器中截取掉多余的字符
393
- orgName (name) {
404
+ orgName(name) {
394
405
  return name.substring(10)
395
406
  },
396
407
 
397
- getNowDate (name) {
408
+ getNowDate(name) {
398
409
  // 求取当前时间的工具
399
410
  let myweekday = ''
400
411
  let year = ''
@@ -409,7 +420,7 @@ let GetLoginInfoService = {
409
420
  return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
410
421
  },
411
422
 
412
- addDate (date, days) {
423
+ addDate(date, days) {
413
424
  // 求取当前时间的工具
414
425
  let endDate = new Date(date)
415
426
  endDate = endDate.valueOf()
@@ -426,7 +437,7 @@ let GetLoginInfoService = {
426
437
  },
427
438
 
428
439
  // 通过地址栏的参数获取参数内容
429
- getUrlParames (param) {
440
+ getUrlParames(param) {
430
441
  var query = window.location.search
431
442
  var iLen = param.length
432
443
  var iStart = query.indexOf(param)
@@ -442,7 +453,7 @@ let GetLoginInfoService = {
442
453
  },
443
454
 
444
455
  // 从地址栏获取加密的参数
445
- getUrlCompileParames (param) {
456
+ getUrlCompileParames(param) {
446
457
  let code = unescape(window.location.search.slice(1, window.location.search.length))
447
458
  let query = String.fromCharCode(code.charCodeAt(0) - code.length)
448
459
  for (var i = 1; i < code.length; i++) {
@@ -462,7 +473,7 @@ let GetLoginInfoService = {
462
473
  },
463
474
 
464
475
  // 对字符串进行加密
465
- compileStr (code) {
476
+ compileStr(code) {
466
477
  let c = String.fromCharCode(code.charCodeAt(0) + code.length)
467
478
  for (let i = 1; i < code.length; i++) {
468
479
  c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
@@ -470,7 +481,7 @@ let GetLoginInfoService = {
470
481
  return escape(c)
471
482
  },
472
483
  // 字符串进行解密
473
- uncompileStr (code) {
484
+ uncompileStr(code) {
474
485
  code = unescape(code)
475
486
  let c = String.fromCharCode(code.charCodeAt(0) - code.length)
476
487
  for (var i = 1; i < code.length; i++) {
@@ -479,7 +490,7 @@ let GetLoginInfoService = {
479
490
  return c
480
491
  },
481
492
 
482
- dateDescripte (date) {
493
+ dateDescripte(date) {
483
494
  let nowTime = new Date().getTime()
484
495
  let oldTime = new Date(date).getTime()
485
496
  let timeDiff = nowTime - oldTime
@@ -512,7 +523,7 @@ let GetLoginInfoService = {
512
523
  return des
513
524
  },
514
525
 
515
- nextMonth20 (date) {
526
+ nextMonth20(date) {
516
527
  let ds = date.split('-')
517
528
  let nextMonth = ds[1] - 0 + 1
518
529
  return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'