system-clients 3.2.96 → 3.2.97-weinan

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 (230) hide show
  1. package/.eslintrc.js +16 -16
  2. package/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  5. package/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  6. package/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  7. package/.gradle/7.4/fileChanges/last-build.bin +0 -0
  8. package/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  9. package/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  10. package/.gradle/7.4/gc.properties +0 -0
  11. package/.gradle/8.5/checksums/checksums.lock +0 -0
  12. package/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock +0 -0
  13. package/.gradle/8.5/dependencies-accessors/gc.properties +0 -0
  14. package/.gradle/8.5/executionHistory/executionHistory.bin +0 -0
  15. package/.gradle/8.5/executionHistory/executionHistory.lock +0 -0
  16. package/.gradle/8.5/fileChanges/last-build.bin +0 -0
  17. package/.gradle/8.5/fileHashes/fileHashes.bin +0 -0
  18. package/.gradle/8.5/fileHashes/fileHashes.lock +0 -0
  19. package/.gradle/8.5/gc.properties +0 -0
  20. package/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  21. package/.gradle/buildOutputCleanup/cache.properties +2 -0
  22. package/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  23. package/.gradle/file-system.probe +0 -0
  24. package/.gradle/vcs-1/gc.properties +0 -0
  25. package/SystemClient.iml +8 -8
  26. package/build/webpack.base.conf.js +85 -85
  27. package/build.gradle +6 -6
  28. package/examples/LoginPage/App.vue +21 -21
  29. package/examples/LoginPage/index.html +11 -11
  30. package/examples/LoginPage/main.js +15 -15
  31. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  32. package/gradle/wrapper/gradle-wrapper.properties +7 -0
  33. package/gradlew +249 -0
  34. package/gradlew.bat +92 -0
  35. package/index.html +21 -21
  36. package/package.json +105 -105
  37. package/src/components/Main.vue +961 -937
  38. package/src/components/TabButton.vue +201 -201
  39. package/src/components/Tabs.vue +67 -67
  40. package/src/components/Util.js +343 -343
  41. package/src/components/addressManage/AddressCascadingMenu.vue +145 -145
  42. package/src/components/common/ProgressBase.vue +83 -83
  43. package/src/components/equipment/EquipmentManage.vue +83 -83
  44. package/src/components/equipment/PcAdd.vue +115 -115
  45. package/src/components/equipment/PcList.vue +119 -119
  46. package/src/components/equipment/PcManage.vue +61 -61
  47. package/src/components/equipment/PhoneAdd.vue +118 -118
  48. package/src/components/equipment/PhoneList.vue +113 -113
  49. package/src/components/equipment/PhoneManage.vue +61 -61
  50. package/src/components/equipment/PosAdd.vue +323 -319
  51. package/src/components/equipment/PosList.vue +294 -292
  52. package/src/components/equipment/PosManage.vue +138 -138
  53. package/src/components/equipment/PosManageBoth.vue +125 -125
  54. package/src/components/equipment/PosParamAdd.vue +236 -236
  55. package/src/components/equipment/PosParamList.vue +121 -121
  56. package/src/components/equipment/PosParamManage.vue +51 -51
  57. package/src/components/materialManage/materialData.vue +44 -44
  58. package/src/components/materialManage/materialList.vue +255 -255
  59. package/src/components/parammanage/ParamManage.vue +42 -42
  60. package/src/components/parammanage/ParamPage.vue +337 -337
  61. package/src/components/parammanage/ParamPages.vue +222 -222
  62. package/src/components/parammanage/SinglePage.vue +235 -235
  63. package/src/components/parammanage/SinglePages.vue +167 -167
  64. package/src/components/server/AddChangeMsg.vue +66 -66
  65. package/src/components/server/ChangeDeclare.vue +45 -45
  66. package/src/components/server/ImageVieweTest.vue +56 -56
  67. package/src/components/server/ImageViewer.vue +350 -350
  68. package/src/components/server/LeftTree.vue +111 -111
  69. package/src/components/server/LoadData.vue +55 -55
  70. package/src/components/server/Login.vue +566 -548
  71. package/src/components/server/LoginPage.vue +235 -235
  72. package/src/components/server/LoginView.vue +128 -128
  73. package/src/components/server/Menu.vue +188 -188
  74. package/src/components/server/ModifyPw.vue +125 -126
  75. package/src/components/server/PcdBuildingSelect.vue +241 -243
  76. package/src/components/server/ResSelect.vue +175 -169
  77. package/src/components/server/ResSelectGroup.vue +211 -211
  78. package/src/components/server/RightTree.vue +348 -348
  79. package/src/components/server/RoleSelector.vue +89 -90
  80. package/src/components/server/TestResSelect.vue +58 -58
  81. package/src/components/server/TestResSelectGroup.vue +388 -388
  82. package/src/filiale/baole/Login.vue +568 -570
  83. package/src/filiale/baole/system.js +5 -5
  84. package/src/filiale/bayan/PosAdd.vue +369 -0
  85. package/src/filiale/bayan/PosList.vue +349 -0
  86. package/src/filiale/bayan/PosManage.vue +138 -0
  87. package/src/filiale/bayan/system.js +6 -0
  88. package/src/filiale/chengtou/Login.vue +537 -539
  89. package/src/filiale/chengtou/system.js +5 -5
  90. package/src/filiale/dongguan/Login.vue +900 -902
  91. package/src/filiale/dongguan/Main.vue +715 -717
  92. package/src/filiale/dongguan/system.js +6 -6
  93. package/src/filiale/furuike/Login.vue +583 -587
  94. package/src/filiale/furuike/Main.vue +827 -840
  95. package/src/filiale/furuike/system.js +7 -7
  96. package/src/filiale/gehua/Main.vue +807 -809
  97. package/src/filiale/gehua/system.js +6 -6
  98. package/src/filiale/konggang/Login.vue +470 -472
  99. package/src/filiale/konggang/system.js +7 -7
  100. package/src/filiale/qianneng/Login.vue +582 -584
  101. package/src/filiale/qianneng/Main.vue +816 -818
  102. package/src/filiale/qianneng/ModifyPw.vue +107 -108
  103. package/src/filiale/qianneng/system.js +11 -11
  104. package/src/filiale/rizhao/LeftTree.vue +111 -111
  105. package/src/filiale/rizhao/Login.vue +791 -793
  106. package/src/filiale/rizhao/Main.vue +611 -611
  107. package/src/filiale/rizhao/system.js +14 -14
  108. package/src/filiale/shiquan/Login.vue +564 -566
  109. package/src/filiale/shiquan/system.js +8 -8
  110. package/src/filiale/tianyi/Login.vue +571 -573
  111. package/src/filiale/tianyi/system.js +5 -5
  112. package/src/filiale/tongchuan/Login.vue +561 -563
  113. package/src/filiale/tongchuan/Main.vue +1019 -1021
  114. package/src/filiale/tongchuan/system.js +7 -7
  115. package/src/filiale/weinan/Main.vue +923 -924
  116. package/src/filiale/weinan/system.js +7 -7
  117. package/src/filiale/wenxi/Login.vue +535 -537
  118. package/src/filiale/wenxi/Main.vue +785 -787
  119. package/src/filiale/wenxi/system.js +10 -10
  120. package/src/filiale/wuhai/LeftTree.vue +141 -141
  121. package/src/filiale/wuhai/Main.vue +807 -810
  122. package/src/filiale/wuhai/system.js +10 -10
  123. package/src/filiale/yuchuan/Login.vue +889 -891
  124. package/src/filiale/yuchuan/Main.vue +864 -866
  125. package/src/filiale/yuchuan/system.js +10 -10
  126. package/src/filiale/zhoukou/Main.vue +807 -809
  127. package/src/filiale/zhoukou/system.js +6 -6
  128. package/src/plugins/EncryptUtil.js +53 -53
  129. package/src/plugins/GetLoginInfoService.js +631 -474
  130. package/src/plugins/HeatGetLoginInfoService.js +491 -491
  131. package/src/plugins/validation.js +15 -15
  132. package/src/stores/AppData.js +38 -38
  133. package/src/stores/HeatAppData.js +38 -38
  134. package/src/styles/fonts/glyphicons-halflings-regular.svg +288 -288
  135. package/src/styles/less/.csscomb.json +304 -304
  136. package/src/styles/less/.csslintrc +19 -19
  137. package/src/styles/less/alerts.less +73 -73
  138. package/src/styles/less/aofeng/animate.min.css +10 -10
  139. package/src/styles/less/aofeng/expandcss.less +569 -569
  140. package/src/styles/less/aofeng/login.less +367 -367
  141. package/src/styles/less/aofeng/standard.less +2507 -2507
  142. package/src/styles/less/aofeng/themeOne/BinaryTemplate.less +690 -690
  143. package/src/styles/less/aofeng/themeOne/loginStyle.less +1586 -1586
  144. package/src/styles/less/aofeng/themeOne/systemStyle.less +2650 -2650
  145. package/src/styles/less/aofeng/themeOne.less +17 -17
  146. package/src/styles/less/aofeng/themeTwo/newStyle1.less +415 -415
  147. package/src/styles/less/aofeng/themeTwo.less +3 -3
  148. package/src/styles/less/badges.less +66 -66
  149. package/src/styles/less/bootstrap.less +66 -66
  150. package/src/styles/less/breadcrumbs.less +26 -26
  151. package/src/styles/less/button-groups.less +247 -247
  152. package/src/styles/less/buttons.less +172 -172
  153. package/src/styles/less/carousel.less +269 -269
  154. package/src/styles/less/close.less +34 -34
  155. package/src/styles/less/code.less +69 -69
  156. package/src/styles/less/component-animations.less +33 -33
  157. package/src/styles/less/dropdowns.less +216 -216
  158. package/src/styles/less/fonts-list.less +25 -25
  159. package/src/styles/less/forms.less +626 -626
  160. package/src/styles/less/glyphicons.less +305 -305
  161. package/src/styles/less/grid.less +84 -84
  162. package/src/styles/less/input-groups.less +167 -167
  163. package/src/styles/less/jumbotron.less +52 -52
  164. package/src/styles/less/labels.less +64 -64
  165. package/src/styles/less/list-group.less +141 -141
  166. package/src/styles/less/manageStyle/manageChile.less +180 -180
  167. package/src/styles/less/manageStyle/manageStyle/manageChile.less +180 -180
  168. package/src/styles/less/manageStyle/manageStyle/manageStyle.less +1102 -1102
  169. package/src/styles/less/manageStyle/manageStyle/safeStyle.less +498 -498
  170. package/src/styles/less/manageStyle/manageStyle.less +1102 -1102
  171. package/src/styles/less/manageStyle/safeStyle.less +498 -498
  172. package/src/styles/less/media.less +66 -66
  173. package/src/styles/less/mixins/alerts.less +14 -14
  174. package/src/styles/less/mixins/background-variant.less +9 -9
  175. package/src/styles/less/mixins/border-radius.less +18 -18
  176. package/src/styles/less/mixins/buttons.less +69 -69
  177. package/src/styles/less/mixins/center-block.less +7 -7
  178. package/src/styles/less/mixins/clearfix.less +22 -22
  179. package/src/styles/less/mixins/forms.less +90 -90
  180. package/src/styles/less/mixins/gradients.less +59 -59
  181. package/src/styles/less/mixins/grid-framework.less +92 -92
  182. package/src/styles/less/mixins/grid.less +122 -122
  183. package/src/styles/less/mixins/hide-text.less +21 -21
  184. package/src/styles/less/mixins/image.less +33 -33
  185. package/src/styles/less/mixins/labels.less +12 -12
  186. package/src/styles/less/mixins/list-group.less +30 -30
  187. package/src/styles/less/mixins/nav-divider.less +10 -10
  188. package/src/styles/less/mixins/nav-vertical-align.less +9 -9
  189. package/src/styles/less/mixins/opacity.less +8 -8
  190. package/src/styles/less/mixins/pagination.less +24 -24
  191. package/src/styles/less/mixins/panels.less +24 -24
  192. package/src/styles/less/mixins/progress-bar.less +10 -10
  193. package/src/styles/less/mixins/reset-filter.less +8 -8
  194. package/src/styles/less/mixins/reset-text.less +18 -18
  195. package/src/styles/less/mixins/resize.less +6 -6
  196. package/src/styles/less/mixins/responsive-visibility.less +15 -15
  197. package/src/styles/less/mixins/size.less +10 -10
  198. package/src/styles/less/mixins/tab-focus.less +9 -9
  199. package/src/styles/less/mixins/table-row.less +44 -44
  200. package/src/styles/less/mixins/text-emphasis.less +9 -9
  201. package/src/styles/less/mixins/text-overflow.less +8 -8
  202. package/src/styles/less/mixins/vendor-prefixes.less +227 -227
  203. package/src/styles/less/mixins.less +40 -40
  204. package/src/styles/less/modals.less +151 -151
  205. package/src/styles/less/navbar.less +660 -660
  206. package/src/styles/less/navs.less +285 -285
  207. package/src/styles/less/normalize.less +424 -424
  208. package/src/styles/less/pager.less +76 -76
  209. package/src/styles/less/pagination.less +89 -89
  210. package/src/styles/less/panels.less +275 -275
  211. package/src/styles/less/popovers.less +131 -131
  212. package/src/styles/less/print.less +101 -101
  213. package/src/styles/less/progress-bars.less +87 -87
  214. package/src/styles/less/responsive-embed.less +35 -35
  215. package/src/styles/less/responsive-utilities.less +194 -194
  216. package/src/styles/less/scaffolding.less +161 -161
  217. package/src/styles/less/stand.less +207 -207
  218. package/src/styles/less/tables.less +312 -312
  219. package/src/styles/less/theme.less +291 -291
  220. package/src/styles/less/thumbnails.less +36 -36
  221. package/src/styles/less/tooltip.less +102 -102
  222. package/src/styles/less/type.less +316 -316
  223. package/src/styles/less/utilities.less +55 -55
  224. package/src/styles/less/variables.less +899 -899
  225. package/src/styles/less/wells.less +29 -29
  226. package/src/system.js +125 -121
  227. package/src/util/Daiban.json +12 -12
  228. package/yarn-error.log +6896 -6896
  229. package/src/filiale/ruihua/Login.vue +0 -549
  230. package/src/filiale/ruihua/system.js +0 -5
@@ -1,474 +1,631 @@
1
- import Vue from 'vue'
2
- import {HttpResetClass} from 'vue-client'
3
- import cryptJS from './EncryptUtil'
4
-
5
- let loginGen = async function (username, password, cue) {
6
- let data = {username, password,resourceName:'客服系统'}
7
- const getLogin = await Vue.resetpost('/api/af-auth/login', data,
8
- {resolveMsg: null, rejectMsg: null,headerConfig:{'Content-type': "application/json"}
9
- })
10
- if (getLogin.data) {
11
- //获取jwt
12
- Vue.$login.jwt = getLogin.data.resources.data.id
13
- Vue.$login.jwtNew = getLogin.data.access_token
14
- // 调用远程登录服务,获取所有有权访问的功能
15
- Vue.$login.f = getLogin.data.resources.data
16
- // 把登录用户添加到cookie里
17
- Vue.cookie.set('loginId', Vue.$login.f.id)
18
- try {
19
- //获取有权限的功能树
20
- let hasRight = await Vue.resetpost(`/rs/search`, {
21
- source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
22
- userid: Vue.$login.f.id
23
- }, { resolveMsg: null, rejectMsg: null })
24
- //准备替换功能树
25
- var fun = []
26
- hasRight.data[0].children[0].children.forEach((item) => {
27
- if (item.name === '客服系统') {
28
- item.children.forEach((item1) => {
29
- fun.push(item1)
30
- })
31
- }
32
- })
33
- Vue.$login.f.functions = fun
34
- } catch (error) {
35
- }
36
- if (Vue.$login.f.id !== '11') {
37
- try {
38
- let getAllArea = await Vue.resetpost('/rs/search', {
39
- source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
40
- userid: Vue.$login.f.id
41
- }, {resolveMsg: null, rejectMsg: null})
42
-
43
- let areaTemp = []
44
- for (let i = 0; i < getAllArea.data.length; i++) {
45
- areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
46
- }
47
- Vue.$login.f.f_allArea = areaTemp
48
- } catch (error) {
49
- Vue.$login.f.f_allArea = []
50
- console.log('获取区县', error)
51
- }
52
- // 获取抄表员
53
- try {
54
- let getGasman = await Vue.resetpost('/rs/search', {
55
- source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
56
- userid: Vue.$login.f.id
57
- }, {resolveMsg: null, rejectMsg: null})
58
- let gasman = []
59
- for (let i = 0; i < getGasman.data.length; i++) {
60
- gasman.push(getGasman.data[i])
61
- }
62
- Vue.$login.f.f_gasman = gasman
63
- } catch (error) {
64
- Vue.$login.f.f_gasman = []
65
- console.log('抄表员模块', error)
66
- }
67
- // 获取安装人
68
- try {
69
- let getInstallman = await Vue.resetpost('/rs/search', {
70
- source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
71
- userid: Vue.$login.f.id
72
- }, {resolveMsg: null, rejectMsg: null})
73
- console.log('获取安装员', getInstallman)
74
- let installman = []
75
- for (let i = 0; i < getInstallman.data.length; i++) {
76
- installman.push(getInstallman.data[i])
77
- }
78
- Vue.$login.f.f_installman = installman
79
- } catch (error) {
80
- Vue.$login.f.f_installman = []
81
- console.log('安装人模块', error)
82
- }
83
- // 获取资源服务权限
84
- try {
85
- let getLic = await Vue.resetpost('/rs/search', {
86
- data: {
87
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
88
- userid: Vue.$login.f.id
89
- }
90
- }, {resolveMsg: null, rejectMsg: null})
91
- let arry = []
92
- getLic.data.forEach((item) => {
93
- arry.push(item.name)
94
- })
95
- Vue.$login.f.lics = arry
96
- } catch (error) {
97
- Vue.$login.f.f_gasman = []
98
- console.log('资源服务权限', error)
99
- }
100
- // TODO 处理界面细节
101
- try {
102
- let viewDetails = await Vue.resetpost('rs/search', {
103
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
104
- userid: Vue.$login.f.id
105
- }, {resolveMsg: null, rejectMsg: null})
106
- let r = viewDetails.data
107
- Vue.$login.r = []
108
- r.forEach(x => Vue.$login.r.push(x.name))
109
- } catch (error) {
110
- Vue.$login.r = []
111
- console.log('加载模块失败', error)
112
- }
113
- // 调用登录后处理
114
- for (let proc of Vue.$login.afterLogin) {
115
- await proc(Vue.$login.f)
116
- }
117
- // 定时发送心跳
118
- if (cue) {
119
- setInterval(() => {
120
- let http = new HttpResetClass()
121
- //暂时不出现不出现异地登录校验
122
- http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {
123
- resolveMsg: null,
124
- rejectMsg: null
125
- }).then((req) => {
126
- if (req.data.forcestate && req.data.forcestate == 1) {
127
- Vue.showMessage("您被强制下线!", ['confirm']).then((res) => {
128
- location.reload()
129
- })
130
- } else if (req.data.status == 710) {
131
- Vue.showMessage(req.data.msg + ",您将被强制退出系统", ['confirm']).then((res) => {
132
- if (res === 'confirm') {
133
- location.reload()
134
- }
135
- })
136
- }
137
- })
138
- }, 2 * 60 * 1000)
139
- }
140
- }
141
-
142
- } else {
143
- let error = {status: 401, data: "登录失败,请稍后重试"}
144
- if (getLogin.data.code !== 500) {
145
- error = {status: getLogin.data.code, data: getLogin.data.msg}
146
- }
147
- // 抛出错误
148
- throw error
149
- }
150
- }
151
-
152
- let GetLoginInfoService = {
153
- // 登录后要处理的异步对象
154
- afterLogin: [],
155
- //验证码开关
156
- Verification: true,
157
- //构建时间开关
158
- versionTime: true,
159
- //
160
- SinglePageToken : {},
161
- //登录信息展示开关
162
- depPrompt: true,
163
- install(Vue, options) {
164
- // 给vue增添对话框显示方法
165
- Vue.$login = Vue.prototype.$login = GetLoginInfoService
166
- },
167
-
168
- f: {},
169
-
170
- /**
171
- * 登录
172
- * @param name
173
- * @param password
174
- * @param cue true/false 是/否显示异地登录
175
- */
176
- login(name, password, cue) {
177
- if (cue === undefined || cue === null || cue === '') {
178
- cue = true
179
- }
180
- Vue.$login.SinglePageToken = cryptJS.AESEncrypt(JSON.stringify({name,password}), "3KMKqvgwR8ULbR8Z")
181
- return loginGen(name, password, cue)
182
- },
183
-
184
- convertToIn(val) {
185
- let temp = ''
186
- if (val instanceof Array) {
187
- if (val.length >= 1) {
188
- temp = '('
189
- val.forEach((res) => {
190
- temp += `'${res}',`
191
- })
192
- temp = temp.substr(0, temp.length - 1) + ')'
193
- }
194
- }
195
- return temp
196
- },
197
-
198
- toStandardYearMonth() {
199
- let dt = new Date()
200
- let month = dt.getMonth() + 1
201
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
202
- },
203
-
204
- toStandardYearMonth1() {
205
- let dt = new Date()
206
- let month = dt.getMonth() + 1
207
- return dt.getFullYear() + (month < 10 ? '0' + month : month)
208
- },
209
-
210
- toStandardDateString() {
211
- let dt = new Date()
212
- let month = dt.getMonth() + 1
213
- let date = dt.getDate()
214
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
215
- },
216
-
217
- toStartAndEndDateString() {
218
- let dt = new Date()
219
- let month = dt.getMonth() + 1
220
- // let date = dt.getDate()
221
- return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
222
- dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
223
- // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
224
- },
225
-
226
- toStandardTimeString() {
227
- let dt = new Date()
228
- let month = dt.getMonth() + 1
229
- let date = dt.getDate()
230
- let hour = dt.getHours()
231
- let min = dt.getMinutes()
232
- let sec = dt.getSeconds()
233
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
234
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
235
- },
236
-
237
- guid() {
238
- let buf = new Uint16Array(8)
239
- window.crypto.getRandomValues(buf)
240
- let S4 = function (num) {
241
- let ret = num.toString(16)
242
- while (ret.length < 4) {
243
- ret = '0' + ret
244
- }
245
- return ret
246
- }
247
- 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]))
248
- },
249
-
250
- choices(role, param, hasBlank = false, blankHint = '请选择') {
251
- if (role == 'view') {
252
- Vue.getParams(param, [null])
253
- } else {
254
- let result = []
255
- if (hasBlank)
256
- result.push({label: blankHint, value: null})
257
- if (!Vue.param || !Vue.param[param])
258
- result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
259
- else {
260
- let p = Vue.param[param]
261
- p.forEach(function (item) {
262
- result.push({label: item.name, value: item.name})
263
- })
264
- }
265
- return result
266
- }
267
- },
268
-
269
- required(param) {
270
- if (typeof param === 'number' && param == 0)
271
- return false
272
- if (!param)
273
- return true
274
- param = param + ''
275
- param = param.trim()
276
- if (!param)
277
- return true
278
- return false
279
- },
280
-
281
- isInt(n) {
282
- return !window.isNaN(n) && n % 1 === 0
283
- },
284
-
285
- isFloat(n) {
286
- return !window.isNaN(n)
287
- },
288
-
289
- // this will convert all true/false to boolean
290
- booleanFilter(paper) {
291
- for (let key in paper) {
292
- if (!paper.hasOwnProperty(key))
293
- continue
294
- if (typeof paper[key] == 'object' && paper[key] != null) {
295
- booleanFilter(paper[key])
296
- } else {
297
- if (paper[key] === 'true' || paper[key] == 'false')
298
- paper[key] = (paper[key] === 'true')
299
- }
300
- }
301
- },
302
- // recursively traverse through each path
303
- ratifyPics(paper) {
304
- for (let key in paper) {
305
- if (key.endsWith('_path')) {
306
- if (!paper[key]) {
307
- paper[key] = 'rs/db/file/nopic.png'
308
- } else {
309
- paper[key] = 'rs/db/file/' + paper[key]
310
- }
311
- } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
312
- ratifyPics(paper[key])
313
- }
314
- }
315
- },
316
-
317
- // load script and other stuff
318
- loadscript(type, fileName) {
319
- return new Promise((resolve, reject) => {
320
- let element
321
- if (type == 'css') {
322
- element = document.createElement('link')
323
- element.setAttribute('rel', 'stylesheet')
324
- element.setAttribute('type', 'text/css')
325
- element.setAttribute('href', fileName)
326
- } else if (type == 'js') {
327
- element = document.createElement('script')
328
- element.setAttribute('type', 'text/javascript')
329
- element.setAttribute('src', fileName)
330
- }
331
- if (element) {
332
- element.setAttribute('async', '')
333
- element.setAttribute('defer', '')
334
- element.addEventListener('load', function () {
335
- resolve(element)
336
- }, false)
337
- element.addEventListener('error', function () {
338
- reject(element)
339
- }, false)
340
- document.body.appendChild(element)
341
- }
342
- })
343
- },
344
- // 不能选择器中截取掉多余的字符
345
- orgName(name) {
346
- return name.substring(10)
347
- },
348
-
349
- getNowDate(name) {
350
- // 求取当前时间的工具
351
- let myweekday = ''
352
- let year = ''
353
- let mydate = new Date()
354
- myweekday = mydate.getDay()
355
- let mymonth = mydate.getMonth() + 1
356
- let myday = mydate.getDate()
357
- let myyear = mydate.getYear()
358
- year = (myyear > 200) ? myyear : 1900 + myyear
359
- let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
360
- // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
361
- return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
362
- },
363
-
364
- addDate(date, days) {
365
- // 求取当前时间的工具
366
- let endDate = new Date(date)
367
- endDate = endDate.valueOf()
368
- endDate = endDate + days * 24 * 60 * 60 * 1000
369
- endDate = new Date(endDate)
370
- let month = endDate.getMonth() + 1
371
- let day = endDate.getDate()
372
- let hour = endDate.getHours()
373
- let min = endDate.getMinutes()
374
- let sec = endDate.getSeconds()
375
- return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
376
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
377
- // return a
378
- },
379
-
380
- // 通过地址栏的参数获取参数内容
381
- getUrlParames(param) {
382
- var query = window.location.search
383
- var iLen = param.length
384
- var iStart = query.indexOf(param)
385
- if (iStart === -1) {
386
- return ''
387
- }
388
- iStart += iLen + 1
389
- var iEnd = query.indexOf('&', iStart)
390
- if (iEnd === -1) {
391
- return query.substring(iStart)
392
- }
393
- return query.substring(iStart, iEnd)
394
- },
395
-
396
- // 从地址栏获取加密的参数
397
- getUrlCompileParames(param) {
398
- let code = unescape(window.location.search.slice(1, window.location.search.length))
399
- let query = String.fromCharCode(code.charCodeAt(0) - code.length)
400
- for (var i = 1; i < code.length; i++) {
401
- query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
402
- }
403
- let iLen = param.length
404
- let iStart = query.indexOf(param)
405
- if (iStart === -1) {
406
- return ''
407
- }
408
- iStart += iLen + 1
409
- let iEnd = query.indexOf('&', iStart)
410
- if (iEnd === -1) {
411
- return query.substring(iStart)
412
- }
413
- return query.substring(iStart, iEnd)
414
- },
415
-
416
- // 对字符串进行加密
417
- compileStr(code) {
418
- let c = String.fromCharCode(code.charCodeAt(0) + code.length)
419
- for (let i = 1; i < code.length; i++) {
420
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
421
- }
422
- return escape(c)
423
- },
424
- // 字符串进行解密
425
- uncompileStr(code) {
426
- code = unescape(code)
427
- let c = String.fromCharCode(code.charCodeAt(0) - code.length)
428
- for (var i = 1; i < code.length; i++) {
429
- c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
430
- }
431
- return c
432
- },
433
-
434
- dateDescripte(date) {
435
- let nowTime = new Date().getTime()
436
- let oldTime = new Date(date).getTime()
437
- let timeDiff = nowTime - oldTime
438
- // 规则说明
439
- // 小于等于2分钟为刚刚
440
- // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
441
- // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
442
- // 大于24小时小于等于30天为取整的天前(例如:12天前)
443
- // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
444
- // 大于365取整的年前,(例如:2年前)
445
- let minute = 1000 * 60
446
- let hour = minute * 60
447
- let day = hour * 24
448
- let month = day * 30
449
- let year = month * 12
450
- let des = ''
451
- if (timeDiff <= minute * 2) {
452
- des = '刚刚'
453
- } else if (minute * 2 < timeDiff && timeDiff < hour) {
454
- des = `${Math.floor(timeDiff / minute)}分钟前`
455
- } else if (hour < timeDiff && timeDiff <= day) {
456
- des = `${Math.floor(timeDiff / hour)}小时前`
457
- } else if (day < timeDiff && timeDiff <= month) {
458
- des = `${Math.floor(timeDiff / day)}天前`
459
- } else if (month < timeDiff && timeDiff <= year) {
460
- des = `${Math.floor(timeDiff / month)}个月前`
461
- } else if (year < timeDiff) {
462
- des = `${Math.floor(timeDiff / year)}年前`
463
- }
464
- return des
465
- },
466
-
467
- nextMonth20(date) {
468
- let ds = date.split('-')
469
- let nextMonth = ds[1] - 0 + 1
470
- return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
471
- }
472
- }
473
-
474
- export default GetLoginInfoService
1
+ import Vue from 'vue'
2
+ import {HttpResetClass} from 'vue-client'
3
+ import cryptJS from './EncryptUtil'
4
+
5
+ let loginGen = async function (name, password, cue) {
6
+ let data = {name: name, password: password}
7
+ data = '$' + cryptJS.RSAEncrypt(JSON.stringify(data))
8
+ const getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null})
9
+ if (getLogin.data.states === '登录成功') {
10
+ //获取jwt
11
+ Vue.$login.jwt = getLogin.data.jwt
12
+ Vue.$login.jwtNew = getLogin.data.jwtNew
13
+ // 调用远程登录服务,获取所有有权访问的功能
14
+ data = {username: name, password: password}
15
+ data = cryptJS.RSAEncrypt(JSON.stringify(data))
16
+ const resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
17
+ resolveMsg: null,
18
+ rejectMsg: null
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
+ }
24
+ console.log('登陆获取Util', JSON.stringify(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
+ }
32
+ // 把登录用户添加到cookie里
33
+ Vue.cookie.set('loginId', Vue.$login.f.id)
34
+ try {
35
+ //获取有权限的功能树
36
+ let hasRight = await Vue.resetpost(`/rs/search`, {
37
+ source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
38
+ userid: Vue.$login.f.id
39
+ }, { resolveMsg: null, rejectMsg: null })
40
+ console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
41
+ //准备替换功能树
42
+ var fun = []
43
+ hasRight.data[0].children[0].children.forEach((item) => {
44
+ if (item.name === '客服系统') {
45
+ item.children.forEach((item1) => {
46
+ fun.push(item1)
47
+ })
48
+ }
49
+ })
50
+ // console.log('替换前', JSON.stringify(Vue.$login.f.functions))
51
+ // console.log('替换后', JSON.stringify(fun))
52
+ Vue.$login.f.functions = fun
53
+ } catch (error) {
54
+ }
55
+ if (Vue.$login.f.id !== '11') {
56
+ try {
57
+ let getAllArea = await Vue.resetpost('/rs/search', {
58
+ source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
59
+ userid: Vue.$login.f.id
60
+ }, {resolveMsg: null, rejectMsg: null})
61
+
62
+ let areaTemp = []
63
+ for (let i = 0; i < getAllArea.data.length; i++) {
64
+ areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
65
+ }
66
+ Vue.$login.f.f_allArea = areaTemp
67
+ } catch (error) {
68
+ Vue.$login.f.f_allArea = []
69
+ console.log('获取区县', error)
70
+ }
71
+ // 获取抄表员
72
+ try {
73
+ let getGasman = await Vue.resetpost('/rs/search', {
74
+ source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
75
+ userid: Vue.$login.f.id
76
+ }, {resolveMsg: null, rejectMsg: null})
77
+ let gasman = []
78
+ for (let i = 0; i < getGasman.data.length; i++) {
79
+ gasman.push(getGasman.data[i])
80
+ }
81
+ Vue.$login.f.f_gasman = gasman
82
+ } catch (error) {
83
+ Vue.$login.f.f_gasman = []
84
+ console.log('抄表员模块', error)
85
+ }
86
+ // 获取安装人
87
+ try {
88
+ let getInstallman = await Vue.resetpost('/rs/search', {
89
+ source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
90
+ userid: Vue.$login.f.id
91
+ }, {resolveMsg: null, rejectMsg: null})
92
+ console.log('获取安装员', getInstallman)
93
+ let installman = []
94
+ for (let i = 0; i < getInstallman.data.length; i++) {
95
+ installman.push(getInstallman.data[i])
96
+ }
97
+ Vue.$login.f.f_installman = installman
98
+ } catch (error) {
99
+ Vue.$login.f.f_installman = []
100
+ console.log('安装人模块', error)
101
+ }
102
+ // 获取换表员
103
+ // try {
104
+ // let getChangeMeterman = await Vue.resetpost('/rs/search', {
105
+ // source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
106
+ // userid: Vue.$login.f.id
107
+ // }, {resolveMsg: null, rejectMsg: null})
108
+ // let changemeterman = []
109
+ // for (let i = 0; i < getChangeMeterman.data.length; i++) {
110
+ // changemeterman.push(getChangeMeterman.data[i])
111
+ // }
112
+ // Vue.$login.f.f_changemeterman = changemeterman
113
+ // }catch (error) {
114
+ // Vue.$login.f.f_changemeterman = []
115
+ // console.log('换表员模块',error)
116
+ // }
117
+ // 获取资源服务权限
118
+ try {
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) {
131
+ Vue.$login.f.f_gasman = []
132
+ console.log('资源服务权限', error)
133
+ }
134
+ // // 票据使用人
135
+ // try {
136
+ // let getPaperUseman = await Vue.resetpost('/rs/search', {
137
+ // source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
138
+ // userid: Vue.$login.f.id
139
+ // }, {resolveMsg: null, rejectMsg: null})
140
+ // let perperuseman = []
141
+ // for (let i = 0; i < getPaperUseman.data.length; i++) {
142
+ // perperuseman.push(getPaperUseman.data[i])
143
+ // }
144
+ // Vue.$login.f.f_paperUseman = perperuseman
145
+ // }catch (error) {
146
+ // Vue.$login.f.f_paperUseman = []
147
+ // console.log('票据使用人模块',error)
148
+ //
149
+ // }
150
+ // // 票据分配人
151
+ // try {
152
+ // let getPaperAllotman = await Vue.resetpost('/rs/search', {
153
+ // source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
154
+ // userid: Vue.$login.f.id
155
+ // }, {resolveMsg: null, rejectMsg: null})
156
+ // let paperallotman = []
157
+ // for (let i = 0; i < getPaperAllotman.data.length; i++) {
158
+ // paperallotman.push(getPaperAllotman.data[i])
159
+ // }
160
+ // Vue.$login.f.f_paperAllotman = paperallotman
161
+ // }catch (error) {
162
+ // Vue.$login.f.f_paperAllotman = []
163
+ // console.log('票据分配人模块',error)
164
+ // }
165
+ // TODO 处理界面细节
166
+ try {
167
+ let viewDetails = await Vue.resetpost('rs/search', {
168
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
169
+ userid: Vue.$login.f.id
170
+ }, {resolveMsg: null, rejectMsg: null})
171
+ let r = viewDetails.data
172
+ Vue.$login.r = []
173
+ r.forEach(x => Vue.$login.r.push(x.name))
174
+ } catch (error) {
175
+ Vue.$login.r = []
176
+ console.log('加载模块失败', error)
177
+ }
178
+ // 检查用户是否为话务员角色
179
+ try {
180
+ let http = new HttpResetClass()
181
+ // 先查询所有包含"话务员"的角色
182
+ let operatorRoles = await http.load('POST', '/rs/sql/singleTable', {
183
+ data: {
184
+ tablename: 't_role',
185
+ condition: `name LIKE '%话务员%'`
186
+ }
187
+ }, {resolveMsg: null, rejectMsg: null})
188
+ // 如果找到话务员角色,再查询用户是否有这些角色
189
+ if (operatorRoles.data && operatorRoles.data.length > 0) {
190
+ // 查询用户信息,检查用户的roles字段是否包含话务员角色的id
191
+ let userInfo = await http.load('POST', '/rs/sql/singleTable', {
192
+ data: {
193
+ tablename: 't_user',
194
+ condition: `id = '${Vue.$login.f.id}'`
195
+ }
196
+ }, {resolveMsg: null, rejectMsg: null})
197
+ if (userInfo.data && userInfo.data.length > 0) {
198
+ let userRoles = userInfo.data[0].roles || ''
199
+ // 将用户角色字符串转换为数组(处理逗号分隔的情况)
200
+ let userRoleArray = String(userRoles).split(',').map(r => String(r).trim())
201
+ // 检查用户的roles字段是否包含任何话务员角色的id
202
+ Vue.$login.f.isOperator = operatorRoles.data.some(role => {
203
+ return userRoleArray.includes(String(role.id))
204
+ })
205
+ } else {
206
+ Vue.$login.f.isOperator = false
207
+ }
208
+ } else {
209
+ Vue.$login.f.isOperator = false
210
+ }
211
+ console.log('话务员角色检查', Vue.$login.f.isOperator)
212
+ } catch (error) {
213
+ // 如果查询失败,默认不是话务员
214
+ Vue.$login.f.isOperator = false
215
+ console.log('检查话务员角色失败', error)
216
+ }
217
+ // 调用登录后处理
218
+ for (let proc of Vue.$login.afterLogin) {
219
+ await proc(Vue.$login.f)
220
+ }
221
+ // 启动未操作下线计时器(30分钟),话务员不受限制
222
+ if(Vue.$login.autoLoginout && !Vue.$login.f.isOperator){
223
+ console.log('启动自动登出计时器,超时时间:', Vue.$login.autoLoginTimeOut, '')
224
+ Vue.$login.startInactivityTimer(Vue.$login.autoLoginTimeOut)
225
+ } else {
226
+ if (!Vue.$login.autoLoginout) {
227
+ console.log('自动登出功能未启用 (autoLoginout = false)')
228
+ }
229
+ if (Vue.$login.f.isOperator) {
230
+ console.log('话务员账号,跳过自动登出计时器')
231
+ }
232
+ }
233
+
234
+ // 定时发送心跳
235
+ if (cue) {
236
+ setInterval(() => {
237
+ let http = new HttpResetClass()
238
+ //暂时不出现不出现异地登录校验
239
+ http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {
240
+ resolveMsg: null,
241
+ rejectMsg: null
242
+ }).then((req) => {
243
+ if (req.data.forcestate && req.data.forcestate == 1) {
244
+ Vue.showMessage("您被强制下线!", ['confirm']).then((res) => {
245
+ location.reload()
246
+ })
247
+ } else if (req.data.status == 710) {
248
+ // 如果是话务员角色,不受30分钟超时限制,不执行退出操作
249
+ if (Vue.$login.f.isOperator) {
250
+ console.log('话务员账号,忽略30分钟超时限制')
251
+ return
252
+ }
253
+ Vue.showMessage(req.data.msg + ",您将被强制退出系统", ['confirm']).then((res) => {
254
+ if (res === 'confirm') {
255
+ location.reload()
256
+ }
257
+ })
258
+ }
259
+ })
260
+ }, 2 * 60 * 1000)
261
+ }
262
+ }
263
+
264
+ } else {
265
+ let error = {status: 401, data: getLogin.data.states}
266
+ // 抛出错误
267
+ throw error
268
+ }
269
+ }
270
+
271
+ let GetLoginInfoService = {
272
+ // 登录后要处理的异步对象
273
+ afterLogin: [],
274
+ //验证码开关
275
+ Verification: true,
276
+ //构建时间开关
277
+ versionTime: true,
278
+ //长时间未操作退出开关
279
+ autoLoginout: false,
280
+ autoLoginTimeOut:30*60*1000,
281
+ //
282
+ SinglePageToken : {},
283
+ //登录信息展示开关
284
+ depPrompt: true,
285
+ install(Vue, options) {
286
+ // 给vue增添对话框显示方法
287
+ Vue.$login = Vue.prototype.$login = GetLoginInfoService
288
+ },
289
+
290
+ f: {},
291
+
292
+ /**
293
+ * 登录
294
+ * @param name
295
+ * @param password
296
+ * @param cue true/false 是/否显示异地登录
297
+ */
298
+ login(name, password, cue) {
299
+ if (cue === undefined || cue === null || cue === '') {
300
+ cue = true
301
+ }
302
+ Vue.$login.SinglePageToken = cryptJS.AESEncrypt(JSON.stringify({name,password}), "3KMKqvgwR8ULbR8Z")
303
+ return loginGen(name, password, cue)
304
+ },
305
+
306
+ convertToIn(val) {
307
+ let temp = ''
308
+ if (val instanceof Array) {
309
+ if (val.length >= 1) {
310
+ temp = '('
311
+ val.forEach((res) => {
312
+ temp += `'${res}',`
313
+ })
314
+ temp = temp.substr(0, temp.length - 1) + ')'
315
+ }
316
+ }
317
+ return temp
318
+ },
319
+
320
+ toStandardYearMonth() {
321
+ let dt = new Date()
322
+ let month = dt.getMonth() + 1
323
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
324
+ },
325
+
326
+ toStandardYearMonth1() {
327
+ let dt = new Date()
328
+ let month = dt.getMonth() + 1
329
+ return dt.getFullYear() + (month < 10 ? '0' + month : month)
330
+ },
331
+
332
+ toStandardDateString() {
333
+ let dt = new Date()
334
+ let month = dt.getMonth() + 1
335
+ let date = dt.getDate()
336
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
337
+ },
338
+
339
+ toStartAndEndDateString() {
340
+ let dt = new Date()
341
+ let month = dt.getMonth() + 1
342
+ // let date = dt.getDate()
343
+ return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
344
+ dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
345
+ // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
346
+ },
347
+
348
+ toStandardTimeString() {
349
+ let dt = new Date()
350
+ let month = dt.getMonth() + 1
351
+ let date = dt.getDate()
352
+ let hour = dt.getHours()
353
+ let min = dt.getMinutes()
354
+ let sec = dt.getSeconds()
355
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
356
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
357
+ },
358
+
359
+ guid() {
360
+ let buf = new Uint16Array(8)
361
+ window.crypto.getRandomValues(buf)
362
+ let S4 = function (num) {
363
+ let ret = num.toString(16)
364
+ while (ret.length < 4) {
365
+ ret = '0' + ret
366
+ }
367
+ return ret
368
+ }
369
+ 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]))
370
+ },
371
+
372
+ choices(role, param, hasBlank = false, blankHint = '请选择') {
373
+ if (role == 'view') {
374
+ Vue.getParams(param, [null])
375
+ } else {
376
+ let result = []
377
+ if (hasBlank)
378
+ result.push({label: blankHint, value: null})
379
+ if (!Vue.param || !Vue.param[param])
380
+ result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
381
+ else {
382
+ let p = Vue.param[param]
383
+ p.forEach(function (item) {
384
+ result.push({label: item.name, value: item.name})
385
+ })
386
+ }
387
+ return result
388
+ }
389
+ },
390
+
391
+ required(param) {
392
+ if (typeof param === 'number' && param == 0)
393
+ return false
394
+ if (!param)
395
+ return true
396
+ param = param + ''
397
+ param = param.trim()
398
+ if (!param)
399
+ return true
400
+ return false
401
+ },
402
+
403
+ isInt(n) {
404
+ return !window.isNaN(n) && n % 1 === 0
405
+ },
406
+
407
+ isFloat(n) {
408
+ return !window.isNaN(n)
409
+ },
410
+
411
+ // this will convert all true/false to boolean
412
+ booleanFilter(paper) {
413
+ for (let key in paper) {
414
+ if (!paper.hasOwnProperty(key))
415
+ continue
416
+ if (typeof paper[key] == 'object' && paper[key] != null) {
417
+ booleanFilter(paper[key])
418
+ } else {
419
+ if (paper[key] === 'true' || paper[key] == 'false')
420
+ paper[key] = (paper[key] === 'true')
421
+ }
422
+ }
423
+ },
424
+ // recursively traverse through each path
425
+ ratifyPics(paper) {
426
+ for (let key in paper) {
427
+ if (key.endsWith('_path')) {
428
+ if (!paper[key]) {
429
+ paper[key] = 'rs/db/file/nopic.png'
430
+ } else {
431
+ paper[key] = 'rs/db/file/' + paper[key]
432
+ }
433
+ } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
434
+ ratifyPics(paper[key])
435
+ }
436
+ }
437
+ },
438
+
439
+ // load script and other stuff
440
+ loadscript(type, fileName) {
441
+ return new Promise((resolve, reject) => {
442
+ let element
443
+ if (type == 'css') {
444
+ element = document.createElement('link')
445
+ element.setAttribute('rel', 'stylesheet')
446
+ element.setAttribute('type', 'text/css')
447
+ element.setAttribute('href', fileName)
448
+ } else if (type == 'js') {
449
+ element = document.createElement('script')
450
+ element.setAttribute('type', 'text/javascript')
451
+ element.setAttribute('src', fileName)
452
+ }
453
+ if (element) {
454
+ element.setAttribute('async', '')
455
+ element.setAttribute('defer', '')
456
+ element.addEventListener('load', function () {
457
+ resolve(element)
458
+ }, false)
459
+ element.addEventListener('error', function () {
460
+ reject(element)
461
+ }, false)
462
+ document.body.appendChild(element)
463
+ }
464
+ })
465
+ },
466
+ // 不能选择器中截取掉多余的字符
467
+ orgName(name) {
468
+ return name.substring(10)
469
+ },
470
+
471
+ getNowDate(name) {
472
+ // 求取当前时间的工具
473
+ let myweekday = ''
474
+ let year = ''
475
+ let mydate = new Date()
476
+ myweekday = mydate.getDay()
477
+ let mymonth = mydate.getMonth() + 1
478
+ let myday = mydate.getDate()
479
+ let myyear = mydate.getYear()
480
+ year = (myyear > 200) ? myyear : 1900 + myyear
481
+ let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
482
+ // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
483
+ return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
484
+ },
485
+
486
+ addDate(date, days) {
487
+ // 求取当前时间的工具
488
+ let endDate = new Date(date)
489
+ endDate = endDate.valueOf()
490
+ endDate = endDate + days * 24 * 60 * 60 * 1000
491
+ endDate = new Date(endDate)
492
+ let month = endDate.getMonth() + 1
493
+ let day = endDate.getDate()
494
+ let hour = endDate.getHours()
495
+ let min = endDate.getMinutes()
496
+ let sec = endDate.getSeconds()
497
+ return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
498
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
499
+ // return a
500
+ },
501
+
502
+ // 通过地址栏的参数获取参数内容
503
+ getUrlParames(param) {
504
+ var query = window.location.search
505
+ var iLen = param.length
506
+ var iStart = query.indexOf(param)
507
+ if (iStart === -1) {
508
+ return ''
509
+ }
510
+ iStart += iLen + 1
511
+ var iEnd = query.indexOf('&', iStart)
512
+ if (iEnd === -1) {
513
+ return query.substring(iStart)
514
+ }
515
+ return query.substring(iStart, iEnd)
516
+ },
517
+
518
+ // 从地址栏获取加密的参数
519
+ getUrlCompileParames(param) {
520
+ let code = unescape(window.location.search.slice(1, window.location.search.length))
521
+ let query = String.fromCharCode(code.charCodeAt(0) - code.length)
522
+ for (var i = 1; i < code.length; i++) {
523
+ query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
524
+ }
525
+ let iLen = param.length
526
+ let iStart = query.indexOf(param)
527
+ if (iStart === -1) {
528
+ return ''
529
+ }
530
+ iStart += iLen + 1
531
+ let iEnd = query.indexOf('&', iStart)
532
+ if (iEnd === -1) {
533
+ return query.substring(iStart)
534
+ }
535
+ return query.substring(iStart, iEnd)
536
+ },
537
+
538
+ // 对字符串进行加密
539
+ compileStr(code) {
540
+ let c = String.fromCharCode(code.charCodeAt(0) + code.length)
541
+ for (let i = 1; i < code.length; i++) {
542
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
543
+ }
544
+ return escape(c)
545
+ },
546
+ // 字符串进行解密
547
+ uncompileStr(code) {
548
+ code = unescape(code)
549
+ let c = String.fromCharCode(code.charCodeAt(0) - code.length)
550
+ for (var i = 1; i < code.length; i++) {
551
+ c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
552
+ }
553
+ return c
554
+ },
555
+
556
+ dateDescripte(date) {
557
+ let nowTime = new Date().getTime()
558
+ let oldTime = new Date(date).getTime()
559
+ let timeDiff = nowTime - oldTime
560
+ // 规则说明
561
+ // 小于等于2分钟为刚刚
562
+ // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
563
+ // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
564
+ // 大于24小时小于等于30天为取整的天前(例如:12天前)
565
+ // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
566
+ // 大于365取整的年前,(例如:2年前)
567
+ let minute = 1000 * 60
568
+ let hour = minute * 60
569
+ let day = hour * 24
570
+ let month = day * 30
571
+ let year = month * 12
572
+ let des = ''
573
+ if (timeDiff <= minute * 2) {
574
+ des = '刚刚'
575
+ } else if (minute * 2 < timeDiff && timeDiff < hour) {
576
+ des = `${Math.floor(timeDiff / minute)}分钟前`
577
+ } else if (hour < timeDiff && timeDiff <= day) {
578
+ des = `${Math.floor(timeDiff / hour)}小时前`
579
+ } else if (day < timeDiff && timeDiff <= month) {
580
+ des = `${Math.floor(timeDiff / day)}天前`
581
+ } else if (month < timeDiff && timeDiff <= year) {
582
+ des = `${Math.floor(timeDiff / month)}个月前`
583
+ } else if (year < timeDiff) {
584
+ des = `${Math.floor(timeDiff / year)}年前`
585
+ }
586
+ return des
587
+ },
588
+
589
+ nextMonth20(date) {
590
+ let ds = date.split('-')
591
+ let nextMonth = ds[1] - 0 + 1
592
+ return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
593
+ },
594
+ /**
595
+ * 启动未操作强制下线计时器
596
+ * @param timeout 超时时间(毫秒),默认30分钟
597
+ */
598
+ startInactivityTimer(timeout) {
599
+ console.log('startInactivityTimer 被调用,超时时间:', timeout, '秒')
600
+ // 清除已有的定时器
601
+ if (this._inactivityTimer) {
602
+ clearTimeout(this._inactivityTimer);
603
+ }
604
+ // 事件处理函数
605
+ const resetTimer = () => {
606
+ clearTimeout(this._inactivityTimer);
607
+ this._inactivityTimer = setTimeout(() => {
608
+ console.log('自动登出计时器触发,执行强制下线')
609
+ // 强制下线逻辑
610
+ // Vue.cookie.delete('loginId');
611
+ Vue.$login.f = {};
612
+ Vue.showMessage("长时间未操作,您已被强制下线", ['confirm']).then(() => {
613
+ location.reload();
614
+ });
615
+ }, timeout);
616
+ };
617
+ // 需要监听的事件
618
+ const events = ['mousemove', 'keydown', 'mousedown', 'scroll', 'touchstart'];
619
+ // 只绑定一次
620
+ if (!this._inactivityListenerAdded) {
621
+ events.forEach(event => {
622
+ window.addEventListener(event, resetTimer, true);
623
+ });
624
+ this._inactivityListenerAdded = true;
625
+ }
626
+ // 初始化计时器
627
+ resetTimer();
628
+ }
629
+ }
630
+
631
+ export default GetLoginInfoService