eoss-ui 0.4.47 → 0.4.48

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 (82) hide show
  1. package/lib/button-group.js +126 -20
  2. package/lib/button.js +126 -20
  3. package/lib/card.js +4 -4
  4. package/lib/cascader.js +4 -4
  5. package/lib/checkbox-group.js +132 -26
  6. package/lib/clients.js +4 -4
  7. package/lib/data-table-form.js +191 -77
  8. package/lib/data-table.js +134 -28
  9. package/lib/date-picker.js +133 -27
  10. package/lib/dialog.js +196 -75
  11. package/lib/editor.js +20 -63
  12. package/lib/enterprise.js +4 -4
  13. package/lib/eoss-ui.common.js +377 -172
  14. package/lib/error-page.js +4 -4
  15. package/lib/flow-group.js +126 -20
  16. package/lib/flow-list.js +127 -21
  17. package/lib/flow.js +182 -35
  18. package/lib/form.js +126 -20
  19. package/lib/handle-user.js +126 -20
  20. package/lib/handler.js +126 -20
  21. package/lib/icons.js +12 -12
  22. package/lib/index.js +1 -1
  23. package/lib/input-number.js +126 -20
  24. package/lib/input.js +130 -23
  25. package/lib/label.js +4 -4
  26. package/lib/login.js +155 -30
  27. package/lib/main.js +215 -38
  28. package/lib/mainComp.js +136 -32
  29. package/lib/menu.js +4 -4
  30. package/lib/nav.js +132 -26
  31. package/lib/notify.js +4 -4
  32. package/lib/page.js +126 -20
  33. package/lib/pagination.js +4 -4
  34. package/lib/player.js +144 -38
  35. package/lib/qr-code.js +134 -28
  36. package/lib/radio-group.js +126 -20
  37. package/lib/select-ganged.js +126 -20
  38. package/lib/select.js +126 -20
  39. package/lib/selector-panel.js +134 -28
  40. package/lib/selector.js +134 -28
  41. package/lib/sizer.js +126 -20
  42. package/lib/steps.js +133 -27
  43. package/lib/switch.js +126 -20
  44. package/lib/table-form.js +126 -20
  45. package/lib/tabs-panel.js +4 -4
  46. package/lib/tabs.js +133 -27
  47. package/lib/theme-chalk/form.css +1 -1
  48. package/lib/theme-chalk/handler.css +1 -1
  49. package/lib/theme-chalk/index.css +1 -1
  50. package/lib/theme-chalk/login.css +1 -1
  51. package/lib/theme-chalk/main.css +1 -1
  52. package/lib/tips.js +126 -20
  53. package/lib/toolbar.js +6 -4
  54. package/lib/tree-group.js +126 -20
  55. package/lib/tree.js +126 -20
  56. package/lib/upload.js +126 -20
  57. package/lib/utils/util.js +111 -5
  58. package/lib/wujie.js +126 -20
  59. package/lib/wxlogin.js +127 -21
  60. package/package.json +2 -4
  61. package/packages/data-table/src/column.vue +1 -0
  62. package/packages/editor/src/main.vue +4 -5
  63. package/packages/flow/src/main.vue +84 -36
  64. package/packages/input/src/main.vue +4 -3
  65. package/packages/login/src/main.vue +13 -1
  66. package/packages/login/src/resetPassword.vue +13 -7
  67. package/packages/main/src/settings.vue +28 -3
  68. package/packages/main/src/userinfo.vue +17 -3
  69. package/packages/mainComp/src/main.vue +1 -1
  70. package/packages/mainComp/src/userinfo.vue +11 -17
  71. package/packages/theme-chalk/lib/form.css +1 -1
  72. package/packages/theme-chalk/lib/handler.css +1 -1
  73. package/packages/theme-chalk/lib/index.css +1 -1
  74. package/packages/theme-chalk/lib/login.css +1 -1
  75. package/packages/theme-chalk/lib/main.css +1 -1
  76. package/packages/theme-chalk/src/form.scss +130 -0
  77. package/packages/theme-chalk/src/handler.scss +0 -3
  78. package/packages/theme-chalk/src/login.scss +47 -6
  79. package/packages/theme-chalk/src/main.scss +53 -1
  80. package/packages/toolbar/src/main.vue +2 -0
  81. package/src/index.js +1 -1
  82. package/src/utils/util.js +151 -43
package/src/index.js CHANGED
@@ -117,7 +117,7 @@ if (typeof window !== 'undefined' && window.Vue) {
117
117
  }
118
118
 
119
119
  export default {
120
- version: '0.4.47',
120
+ version: '0.4.48',
121
121
  install,
122
122
  Button,
123
123
  ButtonGroup,
package/src/utils/util.js CHANGED
@@ -56,7 +56,7 @@ function delPendingRequest(config) {
56
56
  }
57
57
  }
58
58
  const ajax = function ({
59
- headers = {},
59
+ headers,
60
60
  method,
61
61
  url,
62
62
  host = true,
@@ -67,6 +67,7 @@ const ajax = function ({
67
67
  defaults = false,
68
68
  loading
69
69
  }) {
70
+ let header = headers || {};
70
71
  if (!method) {
71
72
  if (format) {
72
73
  method = 'get';
@@ -296,9 +297,9 @@ const ajax = function ({
296
297
  if (!mix) {
297
298
  params = {};
298
299
  }
299
- if (format) {
300
+ if (format && !headers) {
300
301
  data = qs.stringify(data);
301
- headers['content-type'] = 'application/x-www-form-urlencoded';
302
+ header['content-type'] = 'application/x-www-form-urlencoded';
302
303
  }
303
304
  }
304
305
  return http({
@@ -306,7 +307,7 @@ const ajax = function ({
306
307
  url,
307
308
  data,
308
309
  params,
309
- headers
310
+ header
310
311
  });
311
312
  };
312
313
 
@@ -354,6 +355,109 @@ const browser = function () {
354
355
  }
355
356
  };
356
357
 
358
+ /**
359
+ * calcDateDayDiff
360
+ * @desc:时间计算-天数计算
361
+ * @author sutao
362
+ * @date 2023年11月10日
363
+ * @param {String/Object/Number} [date1] - 时间对象、字符串、时间戳
364
+ * @param {String/Object/Number} [date2] - 时间对象、字符串、时间戳
365
+ **/
366
+ const calcDateDayDiff = function (date1, date2) {
367
+ if (date1 && date2) {
368
+ try {
369
+ // 尝试将输入转换为 Date 对象
370
+ const d1 = new Date(date1);
371
+ const d2 = new Date(date2);
372
+
373
+ // 检查转换是否成功
374
+ if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
375
+ throw new Error('日期格式不正确');
376
+ }
377
+
378
+ // 将日期转换为毫秒数
379
+ const timeDiff = Math.abs(d2.getTime() - d1.getTime());
380
+
381
+ // 计算天数
382
+ const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
383
+
384
+ return days;
385
+ } catch (error) {
386
+ // 捕获错误并抛出
387
+ MessageBox.error(error, 5);
388
+ }
389
+ }
390
+
391
+ };
392
+
393
+ /**
394
+ * calcDateHourDiff
395
+ * @desc:时间计算-小时计算
396
+ * @author sutao
397
+ * @date 2023年11月10日
398
+ * @param {String/Object/Number} [date1] - 时间对象、字符串、时间戳
399
+ * @param {String/Object/Number} [date2] - 时间对象、字符串、时间戳
400
+ **/
401
+ const calcDateHourDiff = function (date1, date2) {
402
+ if (date1 && date2) {
403
+ try {
404
+ // 尝试将输入转换为 Date 对象
405
+ const d1 = new Date(date1);
406
+ const d2 = new Date(date2);
407
+
408
+ // 检查转换是否成功
409
+ if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
410
+ throw new Error('日期格式不正确');
411
+ }
412
+
413
+ // 将日期转换为毫秒数
414
+ const timeDiff = Math.abs(d2.getTime() - d1.getTime());
415
+
416
+ // 计算小时
417
+ const hours = Math.floor(timeDiff / (1000 * 60 * 60));
418
+
419
+ return hours;
420
+ } catch (error) {
421
+ // 使用 MessageBox.error 处理错误
422
+ MessageBox.error(error.message, 5);
423
+ }
424
+ }
425
+ };
426
+
427
+ /**
428
+ * calcDateMinuteDiff
429
+ * @desc:时间计算-分钟计算
430
+ * @author sutao
431
+ * @date 2023年11月10日
432
+ * @param {String/Object/Number} [date1] - 时间对象、字符串、时间戳
433
+ * @param {String/Object/Number} [date2] - 时间对象、字符串、时间戳
434
+ **/
435
+ const calcDateMinuteDiff = function (date1, date2) {
436
+ if (date1 && date2) {
437
+ try {
438
+ // 尝试将输入转换为 Date 对象
439
+ const d1 = new Date(date1);
440
+ const d2 = new Date(date2);
441
+
442
+ // 检查转换是否成功
443
+ if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
444
+ throw new Error('日期格式不正确');
445
+ }
446
+
447
+ // 将日期转换为毫秒数
448
+ const timeDiff = Math.abs(d2.getTime() - d1.getTime());
449
+
450
+ // 计算分钟
451
+ const minutes = Math.floor(timeDiff / (1000 * 60));
452
+
453
+ return minutes;
454
+ } catch (error) {
455
+ // 使用 MessageBox.error 处理错误
456
+ MessageBox.error(error.message, 5);
457
+ }
458
+ }
459
+ };
460
+
357
461
  /**
358
462
  * debounce
359
463
  * @desc:添加js内容
@@ -365,7 +469,7 @@ const browser = function () {
365
469
  **/
366
470
 
367
471
  const debounce = function (callback, delay) {
368
- var timeout = null;
472
+ let timeout = null;
369
473
  return function () {
370
474
  clearTimeout(timeout);
371
475
  timeout = setTimeout(callback, delay ? delay : 500);
@@ -557,7 +661,7 @@ const exportXls = function ({ thead = [], data = [], name, numbers, option }) {
557
661
  fields.push(td.property);
558
662
  aligns.push(td.align);
559
663
  if (td.labelKey && td.valueKey) {
560
- keys[td.property] = {labelKey: td.labelKey, valueKey: td.valueKey, multiple: !!(td.valueToString || td['value-to-string'])};
664
+ keys[td.property] = { labelKey: td.labelKey, valueKey: td.valueKey, multiple: !!(td.valueToString || td['value-to-string']) };
561
665
  }
562
666
  } else {
563
667
  others[String(col)] = [td.property, td.align];
@@ -587,13 +691,13 @@ const exportXls = function ({ thead = [], data = [], name, numbers, option }) {
587
691
  if (Array.isArray(data[i][fields[x]])) {
588
692
  field = [];
589
693
  data[i][fields[x]].forEach(ele => {
590
- option[fields[x]].forEach(item => {
591
- // eslint-disable-next-line eqeqeq
592
- if (item[valueKey] == ele) {
593
- field.push(item[labelKey]);
594
- return;
595
- }
596
- });
694
+ option[fields[x]].forEach(item => {
695
+ // eslint-disable-next-line eqeqeq
696
+ if (item[valueKey] == ele) {
697
+ field.push(item[labelKey]);
698
+ return;
699
+ }
700
+ });
597
701
  });
598
702
  field = field.join(' ');
599
703
  } else if (typeof data[i][fields[x]] === 'string' && keys[fields[x]] && keys[fields[x]].multiple) {
@@ -1455,11 +1559,11 @@ const isLogined = function ({
1455
1559
  case 'blank':
1456
1560
  win.open(href);
1457
1561
  break;
1458
- case 'top':
1459
- win.top.location.href = href;
1562
+ case 'top':
1563
+ win.top.location.href = href;
1460
1564
  break;
1461
- case 'parent':
1462
- win.parent.location.href = href;
1565
+ case 'parent':
1566
+ win.parent.location.href = href;
1463
1567
  break;
1464
1568
  }
1465
1569
  } else {
@@ -1470,32 +1574,32 @@ const isLogined = function ({
1470
1574
  }
1471
1575
  }
1472
1576
  break;
1473
- case 4:
1474
- this.$alert(
1475
- results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1476
- '提示',
1477
- {
1478
- confirmButtonText: '确定',
1479
- type: 'error'
1480
- }
1481
- )
1482
- .then(() => {
1483
- sessionStorage.setItem(
1484
- 'extUserBindHandleId',
1485
- results.extUserBindHandleId
1486
- );
1487
- window.location.href = delUrlParam({ key: 'code' });
1488
- if (loginPage) {
1489
- win.top.location.replace(loginPage);
1490
- } else if (document.referrer) {
1491
- win.top.location.replace(document.referrer);
1492
- } else if (win.top.location.href.indexOf('main.html') > -1) {
1493
- win.top.location.href = './login.html';
1494
- } else {
1495
- next('/login');
1496
- }
1497
- })
1498
- .catch((e) => {});
1577
+ case 4:
1578
+ this.$alert(
1579
+ results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1580
+ '提示',
1581
+ {
1582
+ confirmButtonText: '确定',
1583
+ type: 'error'
1584
+ }
1585
+ )
1586
+ .then(() => {
1587
+ sessionStorage.setItem(
1588
+ 'extUserBindHandleId',
1589
+ results.extUserBindHandleId
1590
+ );
1591
+ window.location.href = delUrlParam({ key: 'code' });
1592
+ if (loginPage) {
1593
+ win.top.location.replace(loginPage);
1594
+ } else if (document.referrer) {
1595
+ win.top.location.replace(document.referrer);
1596
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
1597
+ win.top.location.href = './login.html';
1598
+ } else {
1599
+ next('/login');
1600
+ }
1601
+ })
1602
+ .catch((e) => { });
1499
1603
  break;
1500
1604
  default:
1501
1605
  }
@@ -2138,10 +2242,14 @@ const watermark = function (option) {
2138
2242
  wrap.appendChild(docFrag);
2139
2243
  document.body.appendChild(wrap);
2140
2244
  };
2245
+
2141
2246
  export default {
2142
2247
  ajax,
2143
2248
  arrUnique,
2144
2249
  browser,
2250
+ calcDateDayDiff,
2251
+ calcDateHourDiff,
2252
+ calcDateMinuteDiff,
2145
2253
  debounce,
2146
2254
  delUrlParam,
2147
2255
  domEval,