system-phone 3.1.1 → 3.1.4

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 (106) hide show
  1. package/.gradle/buildOutputCleanup/cache.properties +2 -2
  2. package/SystemPhone.iml +8 -8
  3. package/build/dev-server.js +141 -141
  4. package/build/webpack.base.conf.js +82 -82
  5. package/build.gradle +27 -27
  6. package/gradle/wrapper/gradle-wrapper.properties +5 -5
  7. package/gradlew +183 -183
  8. package/gradlew.bat +100 -100
  9. package/index.html +21 -21
  10. package/package.json +1 -1
  11. package/src/App.vue +25 -25
  12. package/src/Util.js +415 -415
  13. package/src/assets//346/215/242/350/241/250/347/273/264/344/277/256.png +0 -0
  14. package/src/assets//351/200/232/347/224/250/350/203/214/346/231/257/345/233/276.png +0 -0
  15. package/src/components/AloneLoadParams.vue +26 -26
  16. package/src/components/AlreadyService.vue +193 -193
  17. package/src/components/AttendManage.vue +534 -534
  18. package/src/components/LoadAppdata.vue +38 -38
  19. package/src/components/LoginApp.vue +732 -732
  20. package/src/components/LoginAppNew.vue +587 -587
  21. package/src/components/LoginAppV4.vue +716 -716
  22. package/src/components/ModifyPassWord.vue +216 -216
  23. package/src/components/NavBottom.vue +117 -117
  24. package/src/components/NavBottomV.vue +141 -141
  25. package/src/components/NavBottomVVV.vue +185 -185
  26. package/src/components/OnlineManage.vue +256 -256
  27. package/src/components/PhoneAllInfo.vue +68 -68
  28. package/src/components/PhoneChangemeterInfo.vue +116 -116
  29. package/src/components/PhoneImageInfo.vue +102 -102
  30. package/src/components/PhoneInfoTable.vue +39 -39
  31. package/src/components/PhoneMeterInfo.vue +132 -132
  32. package/src/components/PhoneRepairInfo.vue +146 -146
  33. package/src/components/PhoneSafeInfo.vue +101 -101
  34. package/src/components/PhoneSellInfo.vue +148 -148
  35. package/src/components/PhoneSellInfoLite.vue +112 -112
  36. package/src/components/PhoneUser.vue +202 -202
  37. package/src/components/PhoneUserDetil.vue +70 -70
  38. package/src/components/PhoneUserFind.vue +138 -138
  39. package/src/components/RightTree.vue +217 -217
  40. package/src/components/SystemSetUp.vue +332 -332
  41. package/src/components/TabBarPhone.vue +81 -81
  42. package/src/components/Test.vue +14 -14
  43. package/src/components/ToolsPage.vue +199 -199
  44. package/src/components/UploadManage.vue +194 -194
  45. package/src/components/gaomi/NavBottomV.vue +223 -223
  46. package/src/components/gaomi/NavBottomVVVV.vue +210 -210
  47. package/src/components/gaomi/Scroller.vue +63 -63
  48. package/src/components/gaomi/SystemSetUp.vue +186 -186
  49. package/src/components/gaomi/ToolsPage.vue +168 -168
  50. package/src/components/idea/feedBack.vue +150 -150
  51. package/src/components/idea/feedbackAdd.vue +366 -366
  52. package/src/components/info/ConfigInfo.vue +122 -122
  53. package/src/components/info/FindUserInfo.vue +157 -157
  54. package/src/components/info/InfoTable.vue +37 -37
  55. package/src/components/iot/InstructMessage.vue +313 -313
  56. package/src/components/iot/IotBaseInfo.vue +97 -97
  57. package/src/components/iot/IotMeterInfo.vue +77 -77
  58. package/src/components/iot/iotMonitoringMain.vue +501 -501
  59. package/src/components/online/ApplyOnline.vue +581 -581
  60. package/src/components/online/BJZhongRan/ApplyOnline.vue +600 -600
  61. package/src/components/screen/ChargeContentPage.vue +656 -656
  62. package/src/components/screen/ContentPage.vue +611 -611
  63. package/src/components/screen/GongdanContentPage.vue +149 -149
  64. package/src/components/screen/ListCountItem.vue +93 -93
  65. package/src/components/screen/ModuleTitle.vue +48 -48
  66. package/src/components/screen/SafeOrderContentPage.vue +440 -440
  67. package/src/components/screen/SecurityCheckItem.vue +50 -50
  68. package/src/components/screen/TotalItem.vue +76 -76
  69. package/src/components/screen/TotalUserNumber.vue +77 -77
  70. package/src/components/screen/WorkOrderItem.vue +51 -51
  71. package/src/components/screen/WorkOrderRightDownItem.vue +103 -103
  72. package/src/components/screen/WorkOrderRightItem.vue +115 -115
  73. package/src/components/userinfo/paymentQuery.vue +189 -189
  74. package/src/components/userinfo/queryFile.vue +190 -190
  75. package/src/components/wasm.vue +18 -18
  76. package/src/expandcssAndroid.less +521 -521
  77. package/src/filiale/liaoyuan/NavBottomVVV.vue +186 -0
  78. package/src/filiale/liaoyuan/ToolsPage.vue +199 -0
  79. package/src/filiale/liaoyuan/systemphonegrid.js +5 -0
  80. package/src/filiale/yulinyuchuan/AlreadyService.vue +194 -194
  81. package/src/filiale/yulinyuchuan/AttendManage.vue +537 -537
  82. package/src/filiale/yulinyuchuan/LoginApp.vue +741 -741
  83. package/src/filiale/yulinyuchuan/OnlineManage.vue +256 -256
  84. package/src/filiale/yulinyuchuan/SystemSetUp.vue +332 -332
  85. package/src/filiale/yulinyuchuan/UploadManage.vue +195 -195
  86. package/src/filiale/yulinyuchuan/systemphonegrid.js +9 -9
  87. package/src/filiale/yulinyuchuanTY/AlreadyService.vue +194 -0
  88. package/src/filiale/yulinyuchuanTY/AttendManage.vue +537 -0
  89. package/src/filiale/yulinyuchuanTY/LoginApp.vue +741 -0
  90. package/src/filiale/yulinyuchuanTY/OnlineManage.vue +256 -0
  91. package/src/filiale/yulinyuchuanTY/SystemSetUp.vue +332 -0
  92. package/src/filiale/yulinyuchuanTY/UploadManage.vue +195 -0
  93. package/src/filiale/yulinyuchuanTY/systemphonegrid.js +9 -0
  94. package/src/index.js +9 -9
  95. package/src/main.js +38 -38
  96. package/src/plugins/const.js +404 -404
  97. package/src/plugins/vue-py.js +37 -37
  98. package/src/stores/AppData.js +79 -79
  99. package/src/systemphone-gaomi.js +105 -105
  100. package/src/systemphone.js +60 -60
  101. package/src/systemphonegrid.js +185 -185
  102. package/src/util/LdapHelper.js +75 -75
  103. package/static/const.js +404 -404
  104. package/static/layui/font/iconfont.svg +554 -554
  105. package/static/vue-py.js +37 -37
  106. package/static/wasm_exec.js +465 -465
package/src/Util.js CHANGED
@@ -1,415 +1,415 @@
1
- import Vue from 'vue'
2
- import { HttpResetClass } from 'vue-client'
3
-
4
-
5
- export var f = {
6
- id: '',
7
- // role: null 如果是话务员,该值为null
8
- role: 'repairman'
9
- }
10
-
11
- export var attendant = {
12
- aModule: 1,
13
- aChannel: 0
14
- }
15
-
16
- // 当前登录用户的ip地址
17
- export var ip = '127.0.0.1'
18
-
19
- export function afterCallBz(id, name) {
20
- let http = new HttpResetClass()
21
- http.load('POST', data.voiceUrl,
22
- {
23
- aId: id,
24
- RecordsID: '',
25
- aChannel: attendant.aChannel,
26
- aModule: attendant.aModule,
27
- aBzType: "save",
28
- bzExtra: null,
29
- bzId: null,
30
- aName: name
31
- },
32
- {
33
- resolveMsg: null,
34
- rejectMsg: null
35
- }).then((req) => {
36
- console.log("话后调用成功")
37
- })
38
- }
39
-
40
- export function getDaysInOneMonth (year, month) {
41
- month = parseInt(month, 10)
42
- var d = new Date(year, month, 0)
43
- return d.getDate()
44
- }
45
-
46
- export function getAttendanceState(item, timeToWork, timeToGo) {
47
- item.f_state = ''
48
- if(!item.f_signin_time || !item.f_knockoff_time)
49
- item.f_state = '缺勤'
50
- else {
51
- let signin_time = item.f_signin_time.substring(11, 16)
52
- let knockoff_time = item.f_knockoff_time.substring(11, 16)
53
- if(signin_time > timeToWork)
54
- item.f_state = '迟到'
55
- if(knockoff_time < timeToGo)
56
- item.f_state = item.f_state + '早退'
57
- }
58
- if(!item.f_state)
59
- item.f_state = '正常'
60
- }
61
-
62
- export function toStandardYearMonth() {
63
- let dt = new Date()
64
- let month = dt.getMonth()+1
65
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month)
66
- }
67
-
68
- export function toStandardDateString() {
69
- let dt = new Date()
70
- let month = dt.getMonth()+1
71
- let date = dt.getDate()
72
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
73
- }
74
-
75
- export function toStandardTimeString() {
76
- let dt = new Date()
77
- let month = dt.getMonth()+1
78
- let date = dt.getDate()
79
- let hour = dt.getHours()
80
- let min = dt.getMinutes()
81
- let sec = dt.getSeconds()
82
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
83
- + ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
84
- }
85
- export function toStandardTimeStringByTimestamp(time) {
86
- let dt = new Date(time)
87
- let month = dt.getMonth()+1
88
- let date = dt.getDate()
89
- let hour = dt.getHours()
90
- let min = dt.getMinutes()
91
- let sec = dt.getSeconds()
92
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
93
- + ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
94
- }
95
-
96
- export function to3339TimeString() {
97
- let dt = new Date()
98
- let month = dt.getMonth()+1
99
- let date = dt.getDate()
100
- let hour = dt.getHours()
101
- let min = dt.getMinutes()
102
- let sec = dt.getSeconds()
103
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
104
- + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
105
- }
106
-
107
- export function parse3339String(strDate) {
108
- return new Date(
109
- strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
110
- strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
111
- )
112
- }
113
-
114
- export function format3339TimeString(dt) {
115
- let month = dt.getMonth()+1
116
- let date = dt.getDate()
117
- let hour = dt.getHours()
118
- let min = dt.getMinutes()
119
- let sec = dt.getSeconds()
120
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
121
- + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
122
- }
123
-
124
- export function guid() {
125
- let buf = new Uint16Array(8)
126
- window.crypto.getRandomValues(buf)
127
- let S4 = function(num) {
128
- let ret = num.toString(16)
129
- while(ret.length < 4){
130
- ret = '0' + ret
131
- }
132
- return ret
133
- }
134
- 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]))
135
- }
136
-
137
- export function choices(role, param, hasBlank = false, blankHint='请选择') {
138
- if(role == 'view') {
139
- Vue.getParams(param, [null])
140
- } else {
141
- let result = []
142
- if(hasBlank)
143
- result.push({label: blankHint, value: null})
144
- if(!Vue.param || !Vue.param[param])
145
- result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
146
- else {
147
- //console.log(param)
148
- //console.log(JSON.stringify(Vue.param))
149
- let p = Vue.param[param]
150
- p.forEach(function(item) {
151
- result.push({label: item.name, value: item.name})
152
- })
153
- }
154
- return result
155
- }
156
- }
157
-
158
- export function required(param) {
159
- if(typeof param === 'number' && param == 0)
160
- return false
161
- if(!param)
162
- return true
163
- param = param + ''
164
- param = param.trim()
165
- if(!param)
166
- return true
167
- return false
168
- }
169
-
170
- export function isInt(n){
171
- console.log('判断整数' + n)
172
- return !window.isNaN(n) && n % 1 === 0
173
- }
174
-
175
- export function isFloat(n){
176
- console.log('判断小数' + n)
177
- return !window.isNaN(n)
178
- }
179
-
180
- // this will convert all true/false to boolean
181
- export function booleanFilter(paper) {
182
- for(let key in paper) {
183
- if(!paper.hasOwnProperty(key))
184
- continue
185
- if(typeof paper[key] == "object" && paper[key] != null) {
186
- booleanFilter(paper[key]);
187
- } else {
188
- if(paper[key] === "true" || paper[key] == "false")
189
- paper[key] = (paper[key] === "true")
190
- }
191
- }
192
- }
193
- // recursively traverse through each path
194
- export function ratifyPics(paper) {
195
- for(let key in paper) {
196
- if(key.endsWith('_path')) {
197
- if(!paper[key]) {
198
- paper[key] = 'rs/db/file/nopic.png'
199
- } else {
200
- paper[key] = 'rs/db/file/' + paper[key]
201
- }
202
- } else if(paper[key] !== null && typeof(paper[key]) == "object") {
203
- ratifyPics(paper[key])
204
- }
205
- }
206
- }
207
-
208
- // load script and other stuff
209
- export function loadscript(type, fileName) {
210
- return new Promise((resolve, reject)=> {
211
- let element
212
- if(type == 'css') {
213
- element = document.createElement('link')
214
- element.setAttribute("rel", "stylesheet")
215
- element.setAttribute("type", "text/css")
216
- element.setAttribute("href", fileName)
217
- } else if(type == 'js') {
218
- element = document.createElement('script')
219
- element.setAttribute("type","text/javascript")
220
- element.setAttribute("src", fileName)
221
- }
222
- if(element) {
223
- element.setAttribute('async', '')
224
- element.setAttribute('defer', '')
225
- element.addEventListener('load', function() {
226
- resolve(element)
227
- console.log('load script resolved')
228
- }, false)
229
- element.addEventListener('error', function() {
230
- reject(element)
231
- console.log('load script rejected')
232
- }, false)
233
- document.body.appendChild(element)
234
- }
235
- })
236
- }
237
- // 不能选择器中截取掉多余的字符
238
- export function orgName (name) {
239
- return name.substring(10)
240
- }
241
-
242
- export function getNowDate (name) {
243
- let year = ''
244
- let month = ''
245
- let day = ''
246
- let hour = ''
247
- let minutes = ''
248
- let seconds = ''
249
- let mydate = new Date()
250
- let mymonth = mydate.getMonth() + 1
251
- let myday = mydate.getDate()
252
- let myyear = mydate.getYear()
253
- let myhour = mydate.getHours()
254
- let myminutes = mydate.getMinutes()
255
- let myseconds = mydate.getSeconds()
256
- year = (myyear > 200) ? myyear : 1900 + myyear
257
- month = (mymonth > 9) ? mymonth : '0' + mymonth
258
- day = (myday > 9) ? myday : '0' + myday
259
- hour = (myhour > 9) ? myhour : '0' + myhour
260
- minutes = (myminutes > 9) ? myminutes : '0' + myminutes
261
- seconds = (myseconds > 9) ? myseconds : '0' + myseconds
262
- // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
263
- return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
264
- }
265
- // 数组深度复制
266
- export function deepcopy (obj) {
267
- let out = []
268
- let len = obj.length
269
- for (let i = 0; i < len; i++) {
270
- if (obj[i] instanceof Array) {
271
- out[i] = deepcopy(obj[i])
272
- } else {
273
- if (typeof obj[i] === 'object') {
274
- out[i] = Object.assign({}, out[i], obj[i])
275
- } else {
276
- out[i] = obj[i]
277
- }
278
- }
279
- }
280
- return out
281
- }
282
-
283
- export function dateDescripte (date) {
284
- let nowTime = new Date().getTime()
285
- let oldTime = new Date(date).getTime()
286
- let timeDiff = nowTime - oldTime
287
- // 规则说明
288
- // 小于等于2分钟为刚刚
289
- // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
290
- // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
291
- // 大于24小时小于等于30天为取整的天前(例如:12天前)
292
- // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
293
- // 大于365取整的年前,(例如:2年前)
294
- let minute = 1000 * 60
295
- let hour = minute * 60
296
- let day = hour * 24
297
- let month = day * 30
298
- let year = month * 12
299
- let des = ''
300
- if (timeDiff <= minute * 2) {
301
- des = '刚刚'
302
- } else if (minute * 2 < timeDiff && timeDiff < hour) {
303
- des = `${Math.floor(timeDiff / minute)}分钟前`
304
- } else if (hour < timeDiff && timeDiff <= day) {
305
- des = `${Math.floor(timeDiff / hour)}小时前`
306
- } else if (day < timeDiff && timeDiff <= month) {
307
- des = `${Math.floor(timeDiff / day)}天前`
308
- } else if (month < timeDiff && timeDiff <= year) {
309
- des = `${Math.floor(timeDiff / month)}个月前`
310
- } else if (year < timeDiff) {
311
- des = `${Math.floor(timeDiff / year)}年前`
312
- }
313
- return des
314
- }
315
-
316
- // 通过地址栏的参数获取参数内容
317
- export function getUrlParames (param) {
318
- var query = window.location.search
319
- var iLen = param.length
320
- var iStart = query.indexOf(param)
321
- if (iStart === -1) {
322
- return ''
323
- }
324
- iStart += iLen + 1
325
- var iEnd = query.indexOf('&', iStart)
326
- if (iEnd === -1) {
327
- return query.substring(iStart)
328
- }
329
- return query.substring(iStart, iEnd)
330
- }
331
-
332
- // 从地址栏获取加密的参数
333
- export function getUrlCompileParames (param) {
334
- var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
335
- var iLen = param.length
336
- var iStart = query.indexOf(param)
337
- if (iStart === -1) {
338
- return ''
339
- }
340
- iStart += iLen + 1
341
- var iEnd = query.indexOf('&', iStart)
342
- if (iEnd === -1) {
343
- return query.substring(iStart)
344
- }
345
- return query.substring(iStart, iEnd)
346
- }
347
-
348
- // 对字符串进行加密
349
- export function compileStr (code) {
350
- let c = String.fromCharCode(code.charCodeAt(0) + code.length)
351
- for (let i = 1; i < code.length; i++) {
352
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
353
- }
354
- return escape(c)
355
- }
356
- // 字符串进行解密
357
- export function uncompileStr (code) {
358
- code = unescape(code)
359
- let c = String.fromCharCode(code.charCodeAt(0) - code.length)
360
- for (var i = 1; i < code.length; i++) {
361
- c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
362
- }
363
- return c
364
- }
365
-
366
- export function getCurrentTime () {
367
- return Date.parse(new Date());
368
- }
369
-
370
- export function uuid() {
371
- var s = [];
372
- var hexDigits = "0123456789abcdef";
373
- for (var i = 0; i < 36; i++) {
374
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
375
- }
376
- s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
377
- s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
378
- s[8] = s[13] = s[18] = s[23] = "-";
379
-
380
- var uuid = s.join("");
381
- return uuid;
382
- }
383
-
384
-
385
- export function randnum() {
386
- var s = [];
387
- var hexDigits = "0123456789abcdef";
388
- for (var i = 0; i <10; i++) {
389
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
390
- }
391
- var randnum = s.join("");
392
- return randnum;
393
- }
394
- // export function getNowDate () {
395
- // // 求取当前时间的工具
396
- // let myweekday = ''
397
- // let year = ''
398
- // let mydate = new Date()
399
- // myweekday = mydate.getDay()
400
- // let mymonth = mydate.getMonth() + 1
401
- // let myday = mydate.getDate()
402
- // let myyear = mydate.getYear()
403
- // year = (myyear > 200) ? myyear : 1900 + myyear
404
- // let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
405
- // let weekday = week[myweekday]
406
- //
407
- // // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
408
- // return year + '年' + mymonth + '月' + myday + '日 ' + weekday
409
- // }
410
- //
411
- // export function getImgsrc (name) {
412
- // return "http://127.0.0.1:8081/images/"+name+".gif"
413
- // }
414
- //
415
- // export var f;
1
+ import Vue from 'vue'
2
+ import { HttpResetClass } from 'vue-client'
3
+
4
+
5
+ export var f = {
6
+ id: '',
7
+ // role: null 如果是话务员,该值为null
8
+ role: 'repairman'
9
+ }
10
+
11
+ export var attendant = {
12
+ aModule: 1,
13
+ aChannel: 0
14
+ }
15
+
16
+ // 当前登录用户的ip地址
17
+ export var ip = '127.0.0.1'
18
+
19
+ export function afterCallBz(id, name) {
20
+ let http = new HttpResetClass()
21
+ http.load('POST', data.voiceUrl,
22
+ {
23
+ aId: id,
24
+ RecordsID: '',
25
+ aChannel: attendant.aChannel,
26
+ aModule: attendant.aModule,
27
+ aBzType: "save",
28
+ bzExtra: null,
29
+ bzId: null,
30
+ aName: name
31
+ },
32
+ {
33
+ resolveMsg: null,
34
+ rejectMsg: null
35
+ }).then((req) => {
36
+ console.log("话后调用成功")
37
+ })
38
+ }
39
+
40
+ export function getDaysInOneMonth (year, month) {
41
+ month = parseInt(month, 10)
42
+ var d = new Date(year, month, 0)
43
+ return d.getDate()
44
+ }
45
+
46
+ export function getAttendanceState(item, timeToWork, timeToGo) {
47
+ item.f_state = ''
48
+ if(!item.f_signin_time || !item.f_knockoff_time)
49
+ item.f_state = '缺勤'
50
+ else {
51
+ let signin_time = item.f_signin_time.substring(11, 16)
52
+ let knockoff_time = item.f_knockoff_time.substring(11, 16)
53
+ if(signin_time > timeToWork)
54
+ item.f_state = '迟到'
55
+ if(knockoff_time < timeToGo)
56
+ item.f_state = item.f_state + '早退'
57
+ }
58
+ if(!item.f_state)
59
+ item.f_state = '正常'
60
+ }
61
+
62
+ export function toStandardYearMonth() {
63
+ let dt = new Date()
64
+ let month = dt.getMonth()+1
65
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month)
66
+ }
67
+
68
+ export function toStandardDateString() {
69
+ let dt = new Date()
70
+ let month = dt.getMonth()+1
71
+ let date = dt.getDate()
72
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
73
+ }
74
+
75
+ export function toStandardTimeString() {
76
+ let dt = new Date()
77
+ let month = dt.getMonth()+1
78
+ let date = dt.getDate()
79
+ let hour = dt.getHours()
80
+ let min = dt.getMinutes()
81
+ let sec = dt.getSeconds()
82
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
83
+ + ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
84
+ }
85
+ export function toStandardTimeStringByTimestamp(time) {
86
+ let dt = new Date(time)
87
+ let month = dt.getMonth()+1
88
+ let date = dt.getDate()
89
+ let hour = dt.getHours()
90
+ let min = dt.getMinutes()
91
+ let sec = dt.getSeconds()
92
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
93
+ + ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
94
+ }
95
+
96
+ export function to3339TimeString() {
97
+ let dt = new Date()
98
+ let month = dt.getMonth()+1
99
+ let date = dt.getDate()
100
+ let hour = dt.getHours()
101
+ let min = dt.getMinutes()
102
+ let sec = dt.getSeconds()
103
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
104
+ + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
105
+ }
106
+
107
+ export function parse3339String(strDate) {
108
+ return new Date(
109
+ strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
110
+ strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
111
+ )
112
+ }
113
+
114
+ export function format3339TimeString(dt) {
115
+ let month = dt.getMonth()+1
116
+ let date = dt.getDate()
117
+ let hour = dt.getHours()
118
+ let min = dt.getMinutes()
119
+ let sec = dt.getSeconds()
120
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
121
+ + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
122
+ }
123
+
124
+ export function guid() {
125
+ let buf = new Uint16Array(8)
126
+ window.crypto.getRandomValues(buf)
127
+ let S4 = function(num) {
128
+ let ret = num.toString(16)
129
+ while(ret.length < 4){
130
+ ret = '0' + ret
131
+ }
132
+ return ret
133
+ }
134
+ 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]))
135
+ }
136
+
137
+ export function choices(role, param, hasBlank = false, blankHint='请选择') {
138
+ if(role == 'view') {
139
+ Vue.getParams(param, [null])
140
+ } else {
141
+ let result = []
142
+ if(hasBlank)
143
+ result.push({label: blankHint, value: null})
144
+ if(!Vue.param || !Vue.param[param])
145
+ result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
146
+ else {
147
+ //console.log(param)
148
+ //console.log(JSON.stringify(Vue.param))
149
+ let p = Vue.param[param]
150
+ p.forEach(function(item) {
151
+ result.push({label: item.name, value: item.name})
152
+ })
153
+ }
154
+ return result
155
+ }
156
+ }
157
+
158
+ export function required(param) {
159
+ if(typeof param === 'number' && param == 0)
160
+ return false
161
+ if(!param)
162
+ return true
163
+ param = param + ''
164
+ param = param.trim()
165
+ if(!param)
166
+ return true
167
+ return false
168
+ }
169
+
170
+ export function isInt(n){
171
+ console.log('判断整数' + n)
172
+ return !window.isNaN(n) && n % 1 === 0
173
+ }
174
+
175
+ export function isFloat(n){
176
+ console.log('判断小数' + n)
177
+ return !window.isNaN(n)
178
+ }
179
+
180
+ // this will convert all true/false to boolean
181
+ export function booleanFilter(paper) {
182
+ for(let key in paper) {
183
+ if(!paper.hasOwnProperty(key))
184
+ continue
185
+ if(typeof paper[key] == "object" && paper[key] != null) {
186
+ booleanFilter(paper[key]);
187
+ } else {
188
+ if(paper[key] === "true" || paper[key] == "false")
189
+ paper[key] = (paper[key] === "true")
190
+ }
191
+ }
192
+ }
193
+ // recursively traverse through each path
194
+ export function ratifyPics(paper) {
195
+ for(let key in paper) {
196
+ if(key.endsWith('_path')) {
197
+ if(!paper[key]) {
198
+ paper[key] = 'rs/db/file/nopic.png'
199
+ } else {
200
+ paper[key] = 'rs/db/file/' + paper[key]
201
+ }
202
+ } else if(paper[key] !== null && typeof(paper[key]) == "object") {
203
+ ratifyPics(paper[key])
204
+ }
205
+ }
206
+ }
207
+
208
+ // load script and other stuff
209
+ export function loadscript(type, fileName) {
210
+ return new Promise((resolve, reject)=> {
211
+ let element
212
+ if(type == 'css') {
213
+ element = document.createElement('link')
214
+ element.setAttribute("rel", "stylesheet")
215
+ element.setAttribute("type", "text/css")
216
+ element.setAttribute("href", fileName)
217
+ } else if(type == 'js') {
218
+ element = document.createElement('script')
219
+ element.setAttribute("type","text/javascript")
220
+ element.setAttribute("src", fileName)
221
+ }
222
+ if(element) {
223
+ element.setAttribute('async', '')
224
+ element.setAttribute('defer', '')
225
+ element.addEventListener('load', function() {
226
+ resolve(element)
227
+ console.log('load script resolved')
228
+ }, false)
229
+ element.addEventListener('error', function() {
230
+ reject(element)
231
+ console.log('load script rejected')
232
+ }, false)
233
+ document.body.appendChild(element)
234
+ }
235
+ })
236
+ }
237
+ // 不能选择器中截取掉多余的字符
238
+ export function orgName (name) {
239
+ return name.substring(10)
240
+ }
241
+
242
+ export function getNowDate (name) {
243
+ let year = ''
244
+ let month = ''
245
+ let day = ''
246
+ let hour = ''
247
+ let minutes = ''
248
+ let seconds = ''
249
+ let mydate = new Date()
250
+ let mymonth = mydate.getMonth() + 1
251
+ let myday = mydate.getDate()
252
+ let myyear = mydate.getYear()
253
+ let myhour = mydate.getHours()
254
+ let myminutes = mydate.getMinutes()
255
+ let myseconds = mydate.getSeconds()
256
+ year = (myyear > 200) ? myyear : 1900 + myyear
257
+ month = (mymonth > 9) ? mymonth : '0' + mymonth
258
+ day = (myday > 9) ? myday : '0' + myday
259
+ hour = (myhour > 9) ? myhour : '0' + myhour
260
+ minutes = (myminutes > 9) ? myminutes : '0' + myminutes
261
+ seconds = (myseconds > 9) ? myseconds : '0' + myseconds
262
+ // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
263
+ return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
264
+ }
265
+ // 数组深度复制
266
+ export function deepcopy (obj) {
267
+ let out = []
268
+ let len = obj.length
269
+ for (let i = 0; i < len; i++) {
270
+ if (obj[i] instanceof Array) {
271
+ out[i] = deepcopy(obj[i])
272
+ } else {
273
+ if (typeof obj[i] === 'object') {
274
+ out[i] = Object.assign({}, out[i], obj[i])
275
+ } else {
276
+ out[i] = obj[i]
277
+ }
278
+ }
279
+ }
280
+ return out
281
+ }
282
+
283
+ export function dateDescripte (date) {
284
+ let nowTime = new Date().getTime()
285
+ let oldTime = new Date(date).getTime()
286
+ let timeDiff = nowTime - oldTime
287
+ // 规则说明
288
+ // 小于等于2分钟为刚刚
289
+ // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
290
+ // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
291
+ // 大于24小时小于等于30天为取整的天前(例如:12天前)
292
+ // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
293
+ // 大于365取整的年前,(例如:2年前)
294
+ let minute = 1000 * 60
295
+ let hour = minute * 60
296
+ let day = hour * 24
297
+ let month = day * 30
298
+ let year = month * 12
299
+ let des = ''
300
+ if (timeDiff <= minute * 2) {
301
+ des = '刚刚'
302
+ } else if (minute * 2 < timeDiff && timeDiff < hour) {
303
+ des = `${Math.floor(timeDiff / minute)}分钟前`
304
+ } else if (hour < timeDiff && timeDiff <= day) {
305
+ des = `${Math.floor(timeDiff / hour)}小时前`
306
+ } else if (day < timeDiff && timeDiff <= month) {
307
+ des = `${Math.floor(timeDiff / day)}天前`
308
+ } else if (month < timeDiff && timeDiff <= year) {
309
+ des = `${Math.floor(timeDiff / month)}个月前`
310
+ } else if (year < timeDiff) {
311
+ des = `${Math.floor(timeDiff / year)}年前`
312
+ }
313
+ return des
314
+ }
315
+
316
+ // 通过地址栏的参数获取参数内容
317
+ export function getUrlParames (param) {
318
+ var query = window.location.search
319
+ var iLen = param.length
320
+ var iStart = query.indexOf(param)
321
+ if (iStart === -1) {
322
+ return ''
323
+ }
324
+ iStart += iLen + 1
325
+ var iEnd = query.indexOf('&', iStart)
326
+ if (iEnd === -1) {
327
+ return query.substring(iStart)
328
+ }
329
+ return query.substring(iStart, iEnd)
330
+ }
331
+
332
+ // 从地址栏获取加密的参数
333
+ export function getUrlCompileParames (param) {
334
+ var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
335
+ var iLen = param.length
336
+ var iStart = query.indexOf(param)
337
+ if (iStart === -1) {
338
+ return ''
339
+ }
340
+ iStart += iLen + 1
341
+ var iEnd = query.indexOf('&', iStart)
342
+ if (iEnd === -1) {
343
+ return query.substring(iStart)
344
+ }
345
+ return query.substring(iStart, iEnd)
346
+ }
347
+
348
+ // 对字符串进行加密
349
+ export function compileStr (code) {
350
+ let c = String.fromCharCode(code.charCodeAt(0) + code.length)
351
+ for (let i = 1; i < code.length; i++) {
352
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
353
+ }
354
+ return escape(c)
355
+ }
356
+ // 字符串进行解密
357
+ export function uncompileStr (code) {
358
+ code = unescape(code)
359
+ let c = String.fromCharCode(code.charCodeAt(0) - code.length)
360
+ for (var i = 1; i < code.length; i++) {
361
+ c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
362
+ }
363
+ return c
364
+ }
365
+
366
+ export function getCurrentTime () {
367
+ return Date.parse(new Date());
368
+ }
369
+
370
+ export function uuid() {
371
+ var s = [];
372
+ var hexDigits = "0123456789abcdef";
373
+ for (var i = 0; i < 36; i++) {
374
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
375
+ }
376
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
377
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
378
+ s[8] = s[13] = s[18] = s[23] = "-";
379
+
380
+ var uuid = s.join("");
381
+ return uuid;
382
+ }
383
+
384
+
385
+ export function randnum() {
386
+ var s = [];
387
+ var hexDigits = "0123456789abcdef";
388
+ for (var i = 0; i <10; i++) {
389
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
390
+ }
391
+ var randnum = s.join("");
392
+ return randnum;
393
+ }
394
+ // export function getNowDate () {
395
+ // // 求取当前时间的工具
396
+ // let myweekday = ''
397
+ // let year = ''
398
+ // let mydate = new Date()
399
+ // myweekday = mydate.getDay()
400
+ // let mymonth = mydate.getMonth() + 1
401
+ // let myday = mydate.getDate()
402
+ // let myyear = mydate.getYear()
403
+ // year = (myyear > 200) ? myyear : 1900 + myyear
404
+ // let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
405
+ // let weekday = week[myweekday]
406
+ //
407
+ // // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
408
+ // return year + '年' + mymonth + '月' + myday + '日 ' + weekday
409
+ // }
410
+ //
411
+ // export function getImgsrc (name) {
412
+ // return "http://127.0.0.1:8081/images/"+name+".gif"
413
+ // }
414
+ //
415
+ // export var f;