system-clients 3.1.97 → 3.1.98-aode

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.
Files changed (65) hide show
  1. package/.eslintrc.js +16 -16
  2. package/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  3. package/.gradle/{6.1.1 → 7.1}/executionHistory/executionHistory.bin +0 -0
  4. package/.gradle/7.1/executionHistory/executionHistory.lock +0 -0
  5. package/.gradle/{6.1.1 → 7.1}/fileHashes/fileHashes.bin +0 -0
  6. package/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
  7. package/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/.gradle/buildOutputCleanup/cache.properties +2 -2
  9. package/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  10. package/.gradle/checksums/checksums.lock +0 -0
  11. package/build/webpack.base.conf.js +10 -17
  12. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  13. package/gradle/wrapper/gradle-wrapper.properties +5 -5
  14. package/gradlew +185 -183
  15. package/gradlew.bat +7 -18
  16. package/package.json +4 -4
  17. package/src/components/Main.vue +428 -538
  18. package/src/components/equipment/EquipmentManage.vue +1 -1
  19. package/src/components/equipment/PcAdd.vue +5 -5
  20. package/src/components/equipment/PcList.vue +5 -5
  21. package/src/components/equipment/PhoneAdd.vue +4 -4
  22. package/src/components/equipment/PhoneList.vue +4 -4
  23. package/src/components/equipment/PosAdd.vue +45 -231
  24. package/src/components/equipment/PosList.vue +68 -198
  25. package/src/components/equipment/PosManage.vue +9 -80
  26. package/src/components/parammanage/ParamManage.vue +2 -2
  27. package/src/components/parammanage/ParamPage.vue +314 -336
  28. package/src/components/parammanage/SinglePage.vue +4 -4
  29. package/src/components/server/Login.vue +716 -734
  30. package/src/components/server/ResSelect.vue +0 -5
  31. package/src/components/server/ResSelectGroup.vue +118 -155
  32. package/src/components/server/RightTree.vue +257 -262
  33. package/src/components/server/RoleSelector.vue +4 -3
  34. package/src/plugins/GetLoginInfoService.js +495 -514
  35. package/src/styles/less/aofeng/standard.less +60 -446
  36. package/src/styles/less/aofeng/themeOne/BinaryTemplate.less +13 -13
  37. package/src/styles/less/aofeng/themeOne/systemStyle.less +18 -18
  38. package/src/styles/less/fonts-list.less +4 -4
  39. package/src/styles/less/stand.less +1 -1
  40. package/src/styles/less/tables.less +0 -50
  41. package/src/styles/less/type.less +3 -16
  42. package/src/styles/less/variables.less +3 -6
  43. package/src/system.js +0 -10
  44. package/static/aodelogo.png +0 -0
  45. package/static/aodenewlogo.png +0 -0
  46. package/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  47. package/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  48. package/src/components/TabButton.vue +0 -201
  49. package/src/components/Tabs.vue +0 -67
  50. package/src/components/equipment/PosManageBoth.vue +0 -125
  51. package/src/components/equipment/PosParamAdd.vue +0 -236
  52. package/src/components/equipment/PosParamList.vue +0 -121
  53. package/src/components/equipment/PosParamManage.vue +0 -51
  54. package/src/components/server/ImageVieweTest.vue +0 -56
  55. package/src/components/server/ImageViewer.vue +0 -350
  56. package/src/components/server/PcdBuildingSelect.vue +0 -241
  57. package/src/styles/less/manageStyle/manageStyle/manageChile.less +0 -180
  58. package/src/styles/less/manageStyle/manageStyle/manageStyle.less +0 -1102
  59. package/src/styles/less/manageStyle/manageStyle/safeStyle.less +0 -498
  60. package/static/newStyle/about-us.png +0 -0
  61. package/yarn-error.log +0 -6896
  62. /package/.gradle/{5.2.1 → 7.1/dependencies-accessors}/gc.properties +0 -0
  63. /package/.gradle/{6.1.1 → 7.1}/fileChanges/last-build.bin +0 -0
  64. /package/.gradle/{6.1.1 → 7.1}/gc.properties +0 -0
  65. /package/static/{logo.png → ewmlogo.png} +0 -0
@@ -1,514 +1,495 @@
1
- import Vue from 'vue'
2
- import JSEncrypt from 'jsencrypt'
3
- import {HttpResetClass} from 'vue-client'
4
-
5
- let loginGen = async function (name, password) {
6
- let data = {name: name, password: password}
7
- // rsa加密
8
- let encrypt = new JSEncrypt();
9
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
10
- console.log(data)
11
-
12
- let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
13
- if (getLogin.data.states === '登录成功') {
14
- // 调用远程登录服务,获取所有有权访问的功能
15
- data = {username: name, password: password}
16
- data = encrypt.encrypt(JSON.stringify(data))
17
- let resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
18
- resolveMsg: null,
19
- rejectMsg: null
20
- })
21
- console.log('登陆获取Util', JSON.stringify(resource.data))
22
- Vue.$login.f = resource.data
23
- //获取jwt
24
- Vue.$login.jwt = getLogin.data.jwt
25
- // 把登录用户添加到cookie里
26
- Vue.cookie.set('loginId', Vue.$login.f.id)
27
-
28
- try {
29
- //获取有权限的功能树
30
- let hasRight = await Vue.resetpost(`/rs/search`, {
31
- source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
32
- userid: Vue.$login.f.id
33
- },
34
- {
35
- resolveMsg: null,
36
- rejectMsg: null
37
- })
38
- console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
39
- //准备替换功能树
40
- var fun=[]
41
- hasRight.data[0].children[0].children.forEach((item) => {
42
- if(item.name=='客服系统'){
43
- item.children.forEach((item1) => {
44
- fun.push(item1)
45
- })
46
- }
47
- })
48
- // console.log('替换前', JSON.stringify(Vue.$login.f.functions))
49
- // console.log('替换后', JSON.stringify(fun))
50
- Vue.$login.f.functions=fun
51
- }catch (error) {
52
- }
53
- if (Vue.$login.f.id !== '11') {
54
- try {
55
- let getAllArea = await Vue.resetpost('/rs/search', {
56
- source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
57
- userid: Vue.$login.f.id
58
- }, {resolveMsg: null, rejectMsg: null})
59
-
60
- let areaTemp = []
61
- for (let i = 0; i < getAllArea.data.length; i++) {
62
- areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
63
- }
64
- Vue.$login.f.f_allArea = areaTemp
65
- }catch (error) {
66
- Vue.$login.f.f_allArea =[]
67
- console.log('获取区县',error)
68
- }
69
- // 获取抄表员
70
- try {
71
- let getGasman = await Vue.resetpost('/rs/search', {
72
- source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
73
- userid: Vue.$login.f.id
74
- }, {resolveMsg: null, rejectMsg: null})
75
- let gasman = []
76
- for (let i = 0; i < getGasman.data.length; i++) {
77
- gasman.push(getGasman.data[i])
78
- }
79
- Vue.$login.f.f_gasman = gasman
80
- }catch (error) {
81
- Vue.$login.f.f_gasman = []
82
- console.log('抄表员模块',error)
83
- }
84
- // // 获取安装人
85
- // try {
86
- // let getInstallman = await Vue.resetpost('/rs/search', {
87
- // source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
88
- // userid: Vue.$login.f.id
89
- // }, {resolveMsg: null, rejectMsg: null})
90
- // console.log('获取安装员', getInstallman)
91
- // let installman = []
92
- // for (let i = 0; i < getInstallman.data.length; i++) {
93
- // installman.push(getInstallman.data[i])
94
- // }
95
- // Vue.$login.f.f_installman = installman
96
- // }catch (error) {
97
- // Vue.$login.f.f_installman =[]
98
- // console.log('安装人模块',error)
99
- // }
100
- // 获取换表员
101
- // try {
102
- // let getChangeMeterman = await Vue.resetpost('/rs/search', {
103
- // source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
104
- // userid: Vue.$login.f.id
105
- // }, {resolveMsg: null, rejectMsg: null})
106
- // let changemeterman = []
107
- // for (let i = 0; i < getChangeMeterman.data.length; i++) {
108
- // changemeterman.push(getChangeMeterman.data[i])
109
- // }
110
- // Vue.$login.f.f_changemeterman = changemeterman
111
- // }catch (error) {
112
- // Vue.$login.f.f_changemeterman = []
113
- // console.log('换表员模块',error)
114
- // }
115
- // 获取资源服务权限
116
- try {
117
- let getLic = await Vue.resetpost('/rs/search', {data: {
118
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
119
- userid: Vue.$login.f.id
120
- }}, {resolveMsg: null, rejectMsg: null})
121
- let arry=[]
122
- getLic.data.forEach((item) => {
123
- arry.push(item.name)
124
- })
125
- Vue.$login.f.lics=arry
126
- }catch (error) {
127
- Vue.$login.f.f_gasman = []
128
- console.log('资源服务权限',error)
129
- }
130
- // // 票据使用人
131
- // try {
132
- // let getPaperUseman = await Vue.resetpost('/rs/search', {
133
- // source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
134
- // userid: Vue.$login.f.id
135
- // }, {resolveMsg: null, rejectMsg: null})
136
- // let perperuseman = []
137
- // for (let i = 0; i < getPaperUseman.data.length; i++) {
138
- // perperuseman.push(getPaperUseman.data[i])
139
- // }
140
- // Vue.$login.f.f_paperUseman = perperuseman
141
- // }catch (error) {
142
- // Vue.$login.f.f_paperUseman = []
143
- // console.log('票据使用人模块',error)
144
- //
145
- // }
146
- // // 票据分配人
147
- // try {
148
- // let getPaperAllotman = await Vue.resetpost('/rs/search', {
149
- // source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
150
- // userid: Vue.$login.f.id
151
- // }, {resolveMsg: null, rejectMsg: null})
152
- // let paperallotman = []
153
- // for (let i = 0; i < getPaperAllotman.data.length; i++) {
154
- // paperallotman.push(getPaperAllotman.data[i])
155
- // }
156
- // Vue.$login.f.f_paperAllotman = paperallotman
157
- // }catch (error) {
158
- // Vue.$login.f.f_paperAllotman = []
159
- // console.log('票据分配人模块',error)
160
- // }
161
- // TODO 处理界面细节
162
- try {
163
- let viewDetails = await Vue.resetpost('rs/search', {
164
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
165
- userid: Vue.$login.f.id
166
- }, {resolveMsg: null, rejectMsg: null})
167
- let r = viewDetails.data
168
- Vue.$login.r = []
169
- r.forEach(x => Vue.$login.r.push(x.name))
170
- }catch (error) {
171
- Vue.$login.r = []
172
- console.log('加载模块失败',error)
173
- }
174
- // 调用登录后处理
175
- for(let proc of Vue.$login.afterLogin) {
176
- await proc(Vue.$login.f)
177
- }
178
- // 定时发送心跳
179
- setInterval(()=> {
180
- let http = new HttpResetClass()
181
- //暂时不出现不出现异地登录校验
182
- http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
183
- //if(req.data.status==710){
184
- // Vue.showMessage(req.data.msg+",您将被强制退出系统", ['confirm']).then((res) => {
185
- // if (res === 'confirm') {
186
- // location.reload()
187
- // }
188
- //})
189
- //}
190
- })
191
- }, 2 * 60 * 1000)
192
- }
193
-
194
- } else {
195
- let error = {status: 401, data: getLogin.data.states}
196
- // 抛出错误
197
- throw error
198
- }
199
- }
200
-
201
- let GetLoginInfoService = {
202
- // 登录后要处理的异步对象
203
- afterLogin: [],
204
- //验证码开关
205
- Verification: true,
206
- install (Vue, options) {
207
- // 给vue增添对话框显示方法
208
- Vue.$login = Vue.prototype.$login = GetLoginInfoService
209
- },
210
-
211
- f: {
212
-
213
- },
214
-
215
- /**
216
- * 登录
217
- * @param name
218
- * @param password
219
- */
220
- login (name, password) {
221
- return loginGen(name, password)
222
- },
223
-
224
- convertToIn (val) {
225
- let temp = ''
226
- if (val instanceof Array) {
227
- if (val.length >= 1) {
228
- temp = '('
229
- val.forEach((res) => {
230
- temp += `'${res}',`
231
- })
232
- temp = temp.substr(0, temp.length - 1) + ')'
233
- }
234
- }
235
- return temp
236
- },
237
-
238
- toStandardYearMonth () {
239
- let dt = new Date()
240
- let month = dt.getMonth() + 1
241
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
242
- },
243
-
244
- toStandardYearMonth1 () {
245
- let dt = new Date()
246
- let month = dt.getMonth() + 1
247
- return dt.getFullYear() + (month < 10 ? '0' + month : month)
248
- },
249
-
250
- toStandardDateString () {
251
- let dt = new Date()
252
- let month = dt.getMonth() + 1
253
- let date = dt.getDate()
254
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
255
- },
256
-
257
- toStartAndEndDateString () {
258
- let dt = new Date()
259
- let month = dt.getMonth() + 1
260
- // let date = dt.getDate()
261
- return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
262
- dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
263
- // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
264
- },
265
-
266
- toStandardTimeString () {
267
- let dt = new Date()
268
- let month = dt.getMonth() + 1
269
- let date = dt.getDate()
270
- let hour = dt.getHours()
271
- let min = dt.getMinutes()
272
- let sec = dt.getSeconds()
273
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
274
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
275
- },
276
-
277
- guid () {
278
- let buf = new Uint16Array(8)
279
- window.crypto.getRandomValues(buf)
280
- let S4 = function (num) {
281
- let ret = num.toString(16)
282
- while (ret.length < 4) {
283
- ret = '0' + ret
284
- }
285
- return ret
286
- }
287
- 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]))
288
- },
289
-
290
- choices (role, param, hasBlank = false, blankHint = '请选择') {
291
- if (role == 'view') {
292
- Vue.getParams(param, [null])
293
- } else {
294
- let result = []
295
- if (hasBlank)
296
- result.push({label: blankHint, value: null})
297
- if (!Vue.param || !Vue.param[param])
298
- result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
299
- else {
300
- let p = Vue.param[param]
301
- p.forEach(function (item) {
302
- result.push({label: item.name, value: item.name})
303
- })
304
- }
305
- return result
306
- }
307
- },
308
-
309
- required (param) {
310
- if (typeof param === 'number' && param == 0)
311
- return false
312
- if (!param)
313
- return true
314
- param = param + ''
315
- param = param.trim()
316
- if (!param)
317
- return true
318
- return false
319
- },
320
-
321
- isInt (n) {
322
- return !window.isNaN(n) && n % 1 === 0
323
- },
324
-
325
- isFloat (n) {
326
- return !window.isNaN(n)
327
- },
328
-
329
- // this will convert all true/false to boolean
330
- booleanFilter (paper) {
331
- for (let key in paper) {
332
- if (!paper.hasOwnProperty(key))
333
- continue
334
- if (typeof paper[key] == 'object' && paper[key] != null) {
335
- booleanFilter(paper[key])
336
- } else {
337
- if (paper[key] === 'true' || paper[key] == 'false')
338
- paper[key] = (paper[key] === 'true')
339
- }
340
- }
341
- },
342
- // recursively traverse through each path
343
- ratifyPics (paper) {
344
- for (let key in paper) {
345
- if (key.endsWith('_path')) {
346
- if (!paper[key]) {
347
- paper[key] = 'rs/db/file/nopic.png'
348
- } else {
349
- paper[key] = 'rs/db/file/' + paper[key]
350
- }
351
- } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
352
- ratifyPics(paper[key])
353
- }
354
- }
355
- },
356
-
357
- // load script and other stuff
358
- loadscript (type, fileName) {
359
- return new Promise((resolve, reject) => {
360
- let element
361
- if (type == 'css') {
362
- element = document.createElement('link')
363
- element.setAttribute('rel', 'stylesheet')
364
- element.setAttribute('type', 'text/css')
365
- element.setAttribute('href', fileName)
366
- } else if (type == 'js') {
367
- element = document.createElement('script')
368
- element.setAttribute('type', 'text/javascript')
369
- element.setAttribute('src', fileName)
370
- }
371
- if (element) {
372
- element.setAttribute('async', '')
373
- element.setAttribute('defer', '')
374
- element.addEventListener('load', function () {
375
- resolve(element)
376
- }, false)
377
- element.addEventListener('error', function () {
378
- reject(element)
379
- }, false)
380
- document.body.appendChild(element)
381
- }
382
- })
383
- },
384
- // 不能选择器中截取掉多余的字符
385
- orgName (name) {
386
- return name.substring(10)
387
- },
388
-
389
- getNowDate (name) {
390
- // 求取当前时间的工具
391
- let myweekday = ''
392
- let year = ''
393
- let mydate = new Date()
394
- myweekday = mydate.getDay()
395
- let mymonth = mydate.getMonth() + 1
396
- let myday = mydate.getDate()
397
- let myyear = mydate.getYear()
398
- year = (myyear > 200) ? myyear : 1900 + myyear
399
- let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
400
- // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
401
- return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
402
- },
403
-
404
- addDate (date, days) {
405
- // 求取当前时间的工具
406
- let endDate = new Date(date)
407
- endDate = endDate.valueOf()
408
- endDate = endDate + days * 24 * 60 * 60 * 1000
409
- endDate = new Date(endDate)
410
- let month = endDate.getMonth() + 1
411
- let day = endDate.getDate()
412
- let hour = endDate.getHours()
413
- let min = endDate.getMinutes()
414
- let sec = endDate.getSeconds()
415
- return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
416
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
417
- // return a
418
- },
419
-
420
- // 通过地址栏的参数获取参数内容
421
- getUrlParames (param) {
422
- var query = window.location.search
423
- var iLen = param.length
424
- var iStart = query.indexOf(param)
425
- if (iStart === -1) {
426
- return ''
427
- }
428
- iStart += iLen + 1
429
- var iEnd = query.indexOf('&', iStart)
430
- if (iEnd === -1) {
431
- return query.substring(iStart)
432
- }
433
- return query.substring(iStart, iEnd)
434
- },
435
-
436
- // 从地址栏获取加密的参数
437
- getUrlCompileParames (param) {
438
- let code = unescape(window.location.search.slice(1, window.location.search.length))
439
- let query = String.fromCharCode(code.charCodeAt(0) - code.length)
440
- for (var i = 1; i < code.length; i++) {
441
- query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
442
- }
443
- let iLen = param.length
444
- let iStart = query.indexOf(param)
445
- if (iStart === -1) {
446
- return ''
447
- }
448
- iStart += iLen + 1
449
- let iEnd = query.indexOf('&', iStart)
450
- if (iEnd === -1) {
451
- return query.substring(iStart)
452
- }
453
- return query.substring(iStart, iEnd)
454
- },
455
-
456
- // 对字符串进行加密
457
- compileStr (code) {
458
- let c = String.fromCharCode(code.charCodeAt(0) + code.length)
459
- for (let i = 1; i < code.length; i++) {
460
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
461
- }
462
- return escape(c)
463
- },
464
- // 字符串进行解密
465
- uncompileStr (code) {
466
- code = unescape(code)
467
- let c = String.fromCharCode(code.charCodeAt(0) - code.length)
468
- for (var i = 1; i < code.length; i++) {
469
- c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
470
- }
471
- return c
472
- },
473
-
474
- dateDescripte (date) {
475
- let nowTime = new Date().getTime()
476
- let oldTime = new Date(date).getTime()
477
- let timeDiff = nowTime - oldTime
478
- // 规则说明
479
- // 小于等于2分钟为刚刚
480
- // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
481
- // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
482
- // 大于24小时小于等于30天为取整的天前(例如:12天前)
483
- // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
484
- // 大于365取整的年前,(例如:2年前)
485
- let minute = 1000 * 60
486
- let hour = minute * 60
487
- let day = hour * 24
488
- let month = day * 30
489
- let year = month * 12
490
- let des = ''
491
- if (timeDiff <= minute * 2) {
492
- des = '刚刚'
493
- } else if (minute * 2 < timeDiff && timeDiff < hour) {
494
- des = `${Math.floor(timeDiff / minute)}分钟前`
495
- } else if (hour < timeDiff && timeDiff <= day) {
496
- des = `${Math.floor(timeDiff / hour)}小时前`
497
- } else if (day < timeDiff && timeDiff <= month) {
498
- des = `${Math.floor(timeDiff / day)}天前`
499
- } else if (month < timeDiff && timeDiff <= year) {
500
- des = `${Math.floor(timeDiff / month)}个月前`
501
- } else if (year < timeDiff) {
502
- des = `${Math.floor(timeDiff / year)}年前`
503
- }
504
- return des
505
- },
506
-
507
- nextMonth20 (date) {
508
- let ds = date.split('-')
509
- let nextMonth = ds[1] - 0 + 1
510
- return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
511
- }
512
- }
513
-
514
- export default GetLoginInfoService
1
+ import Vue from 'vue'
2
+ import JSEncrypt from 'jsencrypt'
3
+ import {HttpResetClass} from 'vue-client'
4
+
5
+ let loginGen = async function (name, password) {
6
+ let data = {name: name, password: password}
7
+ // rsa加密
8
+ let encrypt = new JSEncrypt();
9
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
10
+ const getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
11
+ if (getLogin.data.states === '登录成功') {
12
+ // 调用远程登录服务,获取所有有权访问的功能
13
+ data = {username: name, password: password}
14
+ data = encrypt.encrypt(JSON.stringify(data))
15
+ const resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
16
+ resolveMsg: null, rejectMsg: null
17
+ })
18
+
19
+ if (resource.data.code !== 200) {
20
+ throw {status: resource.data.code, data: resource.data.msg}
21
+ }
22
+
23
+ console.log('登陆获取Util', resource.data)
24
+ Vue.$login.f = resource.data.data
25
+ //获取jwt
26
+ Vue.$login.jwt = getLogin.data.jwt
27
+ // 把登录用户添加到cookie里
28
+ Vue.cookie.set('loginId', Vue.$login.f.id)
29
+
30
+ try {
31
+ //获取有权限的功能树
32
+ let hasRight = await Vue.resetpost(`/rs/search`, {
33
+ source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))", userid: Vue.$login.f.id
34
+ }, {
35
+ resolveMsg: null, rejectMsg: null
36
+ })
37
+ console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
38
+ //准备替换功能树
39
+ var fun = []
40
+ hasRight.data[0].children[0].children.forEach((item) => {
41
+ if (item.name == '客服系统') {
42
+ item.children.forEach((item1) => {
43
+ fun.push(item1)
44
+ })
45
+ }
46
+ })
47
+ Vue.$login.f.functions = fun
48
+ } catch (error) {
49
+ }
50
+ if (Vue.$login.f.id !== '11') {
51
+ try {
52
+ let getAllArea = await Vue.resetpost('/rs/search', {
53
+ source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()', userid: Vue.$login.f.id
54
+ }, {resolveMsg: null, rejectMsg: null})
55
+
56
+ let areaTemp = []
57
+ for (let i = 0; i < getAllArea.data.length; i++) {
58
+ areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
59
+ }
60
+ Vue.$login.f.f_allArea = areaTemp
61
+ } catch (error) {
62
+ Vue.$login.f.f_allArea = []
63
+ console.log('获取区县', error)
64
+ }
65
+ // 获取抄表员
66
+ try {
67
+ let getGasman = await Vue.resetpost('/rs/search', {
68
+ source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()', userid: Vue.$login.f.id
69
+ }, {resolveMsg: null, rejectMsg: null})
70
+ let gasman = []
71
+ for (let i = 0; i < getGasman.data.length; i++) {
72
+ gasman.push(getGasman.data[i])
73
+ }
74
+ Vue.$login.f.f_gasman = gasman
75
+ } catch (error) {
76
+ Vue.$login.f.f_gasman = []
77
+ console.log('抄表员模块', error)
78
+ }
79
+ // // 获取安装人
80
+ // try {
81
+ // let getInstallman = await Vue.resetpost('/rs/search', {
82
+ // source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
83
+ // userid: Vue.$login.f.id
84
+ // }, {resolveMsg: null, rejectMsg: null})
85
+ // console.log('获取安装员', getInstallman)
86
+ // let installman = []
87
+ // for (let i = 0; i < getInstallman.data.length; i++) {
88
+ // installman.push(getInstallman.data[i])
89
+ // }
90
+ // Vue.$login.f.f_installman = installman
91
+ // }catch (error) {
92
+ // Vue.$login.f.f_installman =[]
93
+ // console.log('安装人模块',error)
94
+ // }
95
+ // 获取换表员
96
+ // try {
97
+ // let getChangeMeterman = await Vue.resetpost('/rs/search', {
98
+ // source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
99
+ // userid: Vue.$login.f.id
100
+ // }, {resolveMsg: null, rejectMsg: null})
101
+ // let changemeterman = []
102
+ // for (let i = 0; i < getChangeMeterman.data.length; i++) {
103
+ // changemeterman.push(getChangeMeterman.data[i])
104
+ // }
105
+ // Vue.$login.f.f_changemeterman = changemeterman
106
+ // }catch (error) {
107
+ // Vue.$login.f.f_changemeterman = []
108
+ // console.log('换表员模块',error)
109
+ // }
110
+ // 获取资源服务权限
111
+ try {
112
+ let getLic = await Vue.resetpost('/rs/search', {
113
+ data: {
114
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
115
+ userid: Vue.$login.f.id
116
+ }
117
+ }, {resolveMsg: null, rejectMsg: null})
118
+ let arry = []
119
+ getLic.data.forEach((item) => {
120
+ arry.push(item.name)
121
+ })
122
+ Vue.$login.f.lics = arry
123
+ } catch (error) {
124
+ Vue.$login.f.f_gasman = []
125
+ console.log('资源服务权限', error)
126
+ }
127
+ // // 票据使用人
128
+ // try {
129
+ // let getPaperUseman = await Vue.resetpost('/rs/search', {
130
+ // source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
131
+ // userid: Vue.$login.f.id
132
+ // }, {resolveMsg: null, rejectMsg: null})
133
+ // let perperuseman = []
134
+ // for (let i = 0; i < getPaperUseman.data.length; i++) {
135
+ // perperuseman.push(getPaperUseman.data[i])
136
+ // }
137
+ // Vue.$login.f.f_paperUseman = perperuseman
138
+ // }catch (error) {
139
+ // Vue.$login.f.f_paperUseman = []
140
+ // console.log('票据使用人模块',error)
141
+ //
142
+ // }
143
+ // // 票据分配人
144
+ // try {
145
+ // let getPaperAllotman = await Vue.resetpost('/rs/search', {
146
+ // source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
147
+ // userid: Vue.$login.f.id
148
+ // }, {resolveMsg: null, rejectMsg: null})
149
+ // let paperallotman = []
150
+ // for (let i = 0; i < getPaperAllotman.data.length; i++) {
151
+ // paperallotman.push(getPaperAllotman.data[i])
152
+ // }
153
+ // Vue.$login.f.f_paperAllotman = paperallotman
154
+ // }catch (error) {
155
+ // Vue.$login.f.f_paperAllotman = []
156
+ // console.log('票据分配人模块',error)
157
+ // }
158
+ // TODO 处理界面细节
159
+ try {
160
+ let viewDetails = await Vue.resetpost('rs/search', {
161
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
162
+ userid: Vue.$login.f.id
163
+ }, {resolveMsg: null, rejectMsg: null})
164
+ let r = viewDetails.data
165
+ Vue.$login.r = []
166
+ r.forEach(x => Vue.$login.r.push(x.name))
167
+ } catch (error) {
168
+ Vue.$login.r = []
169
+ console.log('加载模块失败', error)
170
+ }
171
+ // 调用登录后处理
172
+ for (let proc of Vue.$login.afterLogin) {
173
+ await proc(Vue.$login.f)
174
+ }
175
+ // 定时发送心跳
176
+ setInterval(() => {
177
+ let http = new HttpResetClass()
178
+ //暂时不出现不出现异地登录校验
179
+ http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
180
+ if (req.data.status == 710) {
181
+ Vue.showMessage(req.data.msg + ",您将被强制退出系统", ['confirm']).then((res) => {
182
+ if (res === 'confirm') {
183
+ location.reload()
184
+ }
185
+ })
186
+ }
187
+ })
188
+ }, 2 * 60 * 1000)
189
+ }
190
+
191
+ } else {
192
+ // 抛出错误
193
+ throw {status: 401, data: getLogin.data.states}
194
+ }
195
+ }
196
+
197
+ let GetLoginInfoService = {
198
+ // 登录后要处理的异步对象
199
+ afterLogin: [], //验证码开关
200
+ Verification: true, install(Vue, options) {
201
+ // 给vue增添对话框显示方法
202
+ Vue.$login = Vue.prototype.$login = GetLoginInfoService
203
+ },
204
+
205
+ f: {},
206
+
207
+ /**
208
+ * 登录
209
+ * @param name
210
+ * @param password
211
+ */
212
+ login(name, password) {
213
+ return loginGen(name, password)
214
+ },
215
+
216
+ convertToIn(val) {
217
+ let temp = ''
218
+ if (val instanceof Array) {
219
+ if (val.length >= 1) {
220
+ temp = '('
221
+ val.forEach((res) => {
222
+ temp += `'${res}',`
223
+ })
224
+ temp = temp.substr(0, temp.length - 1) + ')'
225
+ }
226
+ }
227
+ return temp
228
+ },
229
+
230
+ toStandardYearMonth() {
231
+ let dt = new Date()
232
+ let month = dt.getMonth() + 1
233
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
234
+ },
235
+
236
+ toStandardYearMonth1() {
237
+ let dt = new Date()
238
+ let month = dt.getMonth() + 1
239
+ return dt.getFullYear() + (month < 10 ? '0' + month : month)
240
+ },
241
+
242
+ toStandardDateString() {
243
+ let dt = new Date()
244
+ let month = dt.getMonth() + 1
245
+ let date = dt.getDate()
246
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
247
+ },
248
+
249
+ toStartAndEndDateString() {
250
+ let dt = new Date()
251
+ let month = dt.getMonth() + 1
252
+ // let date = dt.getDate()
253
+ return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01', dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
254
+ // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
255
+ },
256
+
257
+ toStandardTimeString() {
258
+ let dt = new Date()
259
+ let month = dt.getMonth() + 1
260
+ let date = dt.getDate()
261
+ let hour = dt.getHours()
262
+ let min = dt.getMinutes()
263
+ let sec = dt.getSeconds()
264
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
265
+ },
266
+
267
+ guid() {
268
+ let buf = new Uint16Array(8)
269
+ window.crypto.getRandomValues(buf)
270
+ let S4 = function (num) {
271
+ let ret = num.toString(16)
272
+ while (ret.length < 4) {
273
+ ret = '0' + ret
274
+ }
275
+ return ret
276
+ }
277
+ 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]))
278
+ },
279
+
280
+ choices(role, param, hasBlank = false, blankHint = '请选择') {
281
+ if (role == 'view') {
282
+ Vue.getParams(param, [null])
283
+ } else {
284
+ let result = []
285
+ if (hasBlank) result.push({label: blankHint, value: null})
286
+ if (!Vue.param || !Vue.param[param]) result.push({
287
+ label: '请在系统设置里更新参数',
288
+ value: '请在系统设置里更新参数'
289
+ }) else {
290
+ let p = Vue.param[param]
291
+ p.forEach(function (item) {
292
+ result.push({label: item.name, value: item.name})
293
+ })
294
+ }
295
+ return result
296
+ }
297
+ },
298
+
299
+ required(param) {
300
+ if (typeof param === 'number' && param == 0) return false
301
+ if (!param) return true
302
+ param = param + ''
303
+ param = param.trim()
304
+ if (!param) return true
305
+ return false
306
+ },
307
+
308
+ isInt(n) {
309
+ return !window.isNaN(n) && n % 1 === 0
310
+ },
311
+
312
+ isFloat(n) {
313
+ return !window.isNaN(n)
314
+ },
315
+
316
+ // this will convert all true/false to boolean
317
+ booleanFilter(paper) {
318
+ for (let key in paper) {
319
+ if (!paper.hasOwnProperty(key)) continue
320
+ if (typeof paper[key] == 'object' && paper[key] != null) {
321
+ booleanFilter(paper[key])
322
+ } else {
323
+ if (paper[key] === 'true' || paper[key] == 'false') paper[key] = (paper[key] === 'true')
324
+ }
325
+ }
326
+ }, // recursively traverse through each path
327
+ ratifyPics(paper) {
328
+ for (let key in paper) {
329
+ if (key.endsWith('_path')) {
330
+ if (!paper[key]) {
331
+ paper[key] = 'rs/db/file/nopic.png'
332
+ } else {
333
+ paper[key] = 'rs/db/file/' + paper[key]
334
+ }
335
+ } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
336
+ ratifyPics(paper[key])
337
+ }
338
+ }
339
+ },
340
+
341
+ // load script and other stuff
342
+ loadscript(type, fileName) {
343
+ return new Promise((resolve, reject) => {
344
+ let element
345
+ if (type == 'css') {
346
+ element = document.createElement('link')
347
+ element.setAttribute('rel', 'stylesheet')
348
+ element.setAttribute('type', 'text/css')
349
+ element.setAttribute('href', fileName)
350
+ } else if (type == 'js') {
351
+ element = document.createElement('script')
352
+ element.setAttribute('type', 'text/javascript')
353
+ element.setAttribute('src', fileName)
354
+ }
355
+ if (element) {
356
+ element.setAttribute('async', '')
357
+ element.setAttribute('defer', '')
358
+ element.addEventListener('load', function () {
359
+ resolve(element)
360
+ }, false)
361
+ element.addEventListener('error', function () {
362
+ reject(element)
363
+ }, false)
364
+ document.body.appendChild(element)
365
+ }
366
+ })
367
+ }, // 不能选择器中截取掉多余的字符
368
+ orgName(name) {
369
+ return name.substring(10)
370
+ },
371
+
372
+ getNowDate(name) {
373
+ // 求取当前时间的工具
374
+ let myweekday = ''
375
+ let year = ''
376
+ let mydate = new Date()
377
+ myweekday = mydate.getDay()
378
+ let mymonth = mydate.getMonth() + 1
379
+ let myday = mydate.getDate()
380
+ let myyear = mydate.getYear()
381
+ year = (myyear > 200) ? myyear : 1900 + myyear
382
+ let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
383
+ // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
384
+ return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
385
+ },
386
+
387
+ addDate(date, days) {
388
+ // 求取当前时间的工具
389
+ let endDate = new Date(date)
390
+ endDate = endDate.valueOf()
391
+ endDate = endDate + days * 24 * 60 * 60 * 1000
392
+ endDate = new Date(endDate)
393
+ let month = endDate.getMonth() + 1
394
+ let day = endDate.getDate()
395
+ let hour = endDate.getHours()
396
+ let min = endDate.getMinutes()
397
+ let sec = endDate.getSeconds()
398
+ return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
399
+ // return a
400
+ },
401
+
402
+ // 通过地址栏的参数获取参数内容
403
+ getUrlParames(param) {
404
+ var query = window.location.search
405
+ var iLen = param.length
406
+ var iStart = query.indexOf(param)
407
+ if (iStart === -1) {
408
+ return ''
409
+ }
410
+ iStart += iLen + 1
411
+ var iEnd = query.indexOf('&', iStart)
412
+ if (iEnd === -1) {
413
+ return query.substring(iStart)
414
+ }
415
+ return query.substring(iStart, iEnd)
416
+ },
417
+
418
+ // 从地址栏获取加密的参数
419
+ getUrlCompileParames(param) {
420
+ let code = unescape(window.location.search.slice(1, window.location.search.length))
421
+ let query = String.fromCharCode(code.charCodeAt(0) - code.length)
422
+ for (var i = 1; i < code.length; i++) {
423
+ query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
424
+ }
425
+ let iLen = param.length
426
+ let iStart = query.indexOf(param)
427
+ if (iStart === -1) {
428
+ return ''
429
+ }
430
+ iStart += iLen + 1
431
+ let iEnd = query.indexOf('&', iStart)
432
+ if (iEnd === -1) {
433
+ return query.substring(iStart)
434
+ }
435
+ return query.substring(iStart, iEnd)
436
+ },
437
+
438
+ // 对字符串进行加密
439
+ compileStr(code) {
440
+ let c = String.fromCharCode(code.charCodeAt(0) + code.length)
441
+ for (let i = 1; i < code.length; i++) {
442
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
443
+ }
444
+ return escape(c)
445
+ }, // 字符串进行解密
446
+ uncompileStr(code) {
447
+ code = unescape(code)
448
+ let c = String.fromCharCode(code.charCodeAt(0) - code.length)
449
+ for (var i = 1; i < code.length; i++) {
450
+ c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
451
+ }
452
+ return c
453
+ },
454
+
455
+ dateDescripte(date) {
456
+ let nowTime = new Date().getTime()
457
+ let oldTime = new Date(date).getTime()
458
+ let timeDiff = nowTime - oldTime
459
+ // 规则说明
460
+ // 小于等于2分钟为刚刚
461
+ // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
462
+ // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
463
+ // 大于24小时小于等于30天为取整的天前(例如:12天前)
464
+ // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
465
+ // 大于365取整的年前,(例如:2年前)
466
+ let minute = 1000 * 60
467
+ let hour = minute * 60
468
+ let day = hour * 24
469
+ let month = day * 30
470
+ let year = month * 12
471
+ let des = ''
472
+ if (timeDiff <= minute * 2) {
473
+ des = '刚刚'
474
+ } else if (minute * 2 < timeDiff && timeDiff < hour) {
475
+ des = `${Math.floor(timeDiff / minute)}分钟前`
476
+ } else if (hour < timeDiff && timeDiff <= day) {
477
+ des = `${Math.floor(timeDiff / hour)}小时前`
478
+ } else if (day < timeDiff && timeDiff <= month) {
479
+ des = `${Math.floor(timeDiff / day)}天前`
480
+ } else if (month < timeDiff && timeDiff <= year) {
481
+ des = `${Math.floor(timeDiff / month)}个月前`
482
+ } else if (year < timeDiff) {
483
+ des = `${Math.floor(timeDiff / year)}年前`
484
+ }
485
+ return des
486
+ },
487
+
488
+ nextMonth20(date) {
489
+ let ds = date.split('-')
490
+ let nextMonth = ds[1] - 0 + 1
491
+ return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
492
+ }
493
+ }
494
+
495
+ export default GetLoginInfoService