utils.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. !(function (t) {
  2. const e = {};function n(r) {
  3. if (e[r]) return e[r].exports;const c = e[r] = { i: r, l: !1, exports: {} };return t[r].call(c.exports, c, c.exports, n), c.l = !0, c.exports;
  4. }n.m = t, n.c = e, n.d = function (t, e, r) {
  5. n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r });
  6. }, n.r = function (t) {
  7. 'undefined' !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(t, '__esModule', { value: !0 });
  8. }, n.t = function (t, e) {
  9. if (1 & e && (t = n(t)), 8 & e) return t;if (4 & e && 'object' === typeof t && t && t.__esModule) return t;const r = Object.create(null);if (n.r(r), Object.defineProperty(r, 'default', { enumerable: !0, value: t }), 2 & e && 'string' !== typeof t) for (const c in t)n.d(r, c, (e => t[e]).bind(null, c));return r;
  10. }, n.n = function (t) {
  11. const e = t && t.__esModule ? function () {
  12. return t.default;
  13. } : function () {
  14. return t;
  15. };return n.d(e, 'a', e), e;
  16. }, n.o = function (t, e) {
  17. return Object.prototype.hasOwnProperty.call(t, e);
  18. }, n.p = '', n(n.s = 0);
  19. }([function (t, e, n) {
  20. 'use strict';function r(t) {
  21. return (function (t) {
  22. if (Array.isArray(t)) {
  23. for (var e = 0, n = new Array(t.length);e < t.length;e++)n[e] = t[e];return n;
  24. }
  25. }(t)) || (function (t) {
  26. if (Symbol.iterator in Object(t) || '[object Arguments]' === Object.prototype.toString.call(t)) return Array.from(t);
  27. }(t)) || (function () {
  28. throw new TypeError('Invalid attempt to spread non-iterable instance');
  29. }());
  30. } function c(t, e) {
  31. let n = Object.keys(t);return Object.getOwnPropertySymbols && n.push.apply(n, Object.getOwnPropertySymbols(t)), e && (n = n.filter(e => Object.getOwnPropertyDescriptor(t, e).enumerable)), n;
  32. } function o(t) {
  33. for (let e = 1;e < arguments.length;e++) {
  34. var n = null != arguments[e] ? arguments[e] : {};e % 2 ? c(n, !0).forEach((e) => {
  35. a(t, e, n[e]);
  36. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : c(n).forEach((e) => {
  37. Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
  38. });
  39. } return t;
  40. } function a(t, e, n) {
  41. return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
  42. } function u(t, e) {
  43. return (function (t) {
  44. if (Array.isArray(t)) return t;
  45. }(t)) || (function (t, e) {
  46. const n = []; let r = !0; let c = !1; let o = void 0;try {
  47. for (var a, u = t[Symbol.iterator]();!(r = (a = u.next()).done) && (n.push(a.value), !e || n.length !== e);r = !0);
  48. } catch (t) {
  49. c = !0, o = t;
  50. } finally {
  51. try {
  52. r || null == u.return || u.return();
  53. } finally {
  54. if (c) throw o;
  55. }
  56. } return n;
  57. }(t, e)) || (function () {
  58. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  59. }());
  60. }n.r(e);e.default = { arrayIsEmpty(t) {
  61. return !(!t || 0 !== t.length);
  62. }, timestampToTime(t, e) {
  63. const n = new Date(t); const r = n.getFullYear().toString(); const c = n.getMonth() + 1 < 10 ? '0'.concat(n.getMonth() + 1) : ''.concat(n.getMonth() + 1); const o = n.getDate() < 10 ? '0'.concat(n.getDate()) : ''.concat(n.getDate()); const a = n.getHours() < 10 ? '0'.concat(n.getHours()) : ''.concat(n.getHours()); const u = n.getMinutes() < 10 ? '0'.concat(n.getMinutes()) : ''.concat(n.getMinutes()); const i = n.getSeconds() < 10 ? '0'.concat(n.getSeconds()) : ''.concat(n.getSeconds()); let s = { value: { Y: r, M: c, D: o, h: a, m: u, s: i }, str: ''.concat(r, '-').concat(c, '-')
  64. .concat(o, ' ')
  65. .concat(a, ':')
  66. .concat(u, ':')
  67. .concat(i) };switch (e) {
  68. case 'YYYYMMDDHHMM':s = { value: { Y: r, M: c, D: o, h: a, m: u }, str: ''.concat(r, '-').concat(c, '-')
  69. .concat(o, ' ')
  70. .concat(a, ':')
  71. .concat(u) };break;case 'YYYYMMDD':s = { value: { Y: r, M: c, D: o }, str: ''.concat(r, '-').concat(c, '-')
  72. .concat(o) };break;case 'YYYYMM':s = { value: { Y: r, M: c }, str: ''.concat(r, '-').concat(c) };break;case 'HHMMSS':s = { value: { h: a, m: u, s: i }, str: ''.concat(a, ':').concat(u, ':')
  73. .concat(i) };break;case 'HHMM':s = { value: { h: a, m: u }, str: ''.concat(a, ':').concat(u) };
  74. } return s;
  75. }, timeToTimestamp(t) {
  76. return new Date(t.replace(/-/g, '/')).valueOf();
  77. }, pickerConfirmData(t, e) {
  78. const n = [];console.log(e);const r = 'number' === typeof e ? [e] : e;return t && t.map((t, e) => {
  79. n.push(t[r[e]]);
  80. }), console.log(n), { value: 1 === n.length ? n[0] : n, index: 1 === r.length ? r[0] : r };
  81. }, getCurrentMonthDay(t, e) {
  82. return new Date(t, e, 0).getDate();
  83. }, generateIntervalData(t, e) {
  84. for (var n = [], c = Number(t), o = Number(e), a = c;a <= o;a++) {
  85. const u = a < 10 ? '0'.concat(a) : ''.concat(a);n = [].concat(r(n), [u]);
  86. } return n;
  87. }, datePickerConfirmData(t, e) {
  88. let n = ''; let r = void 0; let c = void 0; let o = void 0; let a = void 0; let i = void 0; let s = void 0;switch (e) {
  89. case 'YYYYMMDDHHMM':var l = u(t, 5);r = l[0], c = l[1], o = l[2], a = l[3], i = l[4], n = ''.concat(r, '-').concat(c, '-')
  90. .concat(o, ' ')
  91. .concat(a, ':')
  92. .concat(i);break;case 'YYYYMMDD':var f = u(t, 3);r = f[0], c = f[1], o = f[2], n = ''.concat(r, '-').concat(c, '-')
  93. .concat(o);break;case 'YYYYMM':var d = u(t, 2);r = d[0], c = d[1], n = ''.concat(r, '-').concat(c);break;case 'HHMMSS':var M = u(t, 3);a = M[0], i = M[1], s = M[2], n = ''.concat(a, ':').concat(i, ':')
  94. .concat(s);break;case 'HHMM':var v = u(t, 2);a = v[0], i = v[1], n = ''.concat(a, ':').concat(i);break;default:var b = u(t, 6);r = b[0], c = b[1], o = b[2], a = b[3], i = b[4], s = b[5], n = ''.concat(r, '-').concat(c, '-')
  95. .concat(o, ' ')
  96. .concat(a, ':')
  97. .concat(i, ':')
  98. .concat(s);
  99. } return n;
  100. }, timeAbbreviationFormat(t) {
  101. return /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}\s[\d]{1,2}[:][\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'YYYYMMDDHHMMSS' : /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}\s[\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'YYYYMMDDHHMM' : /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}$/.test(t) ? 'YYYYMMDD' : /^(\d{4})-(\d{2})$/.test(t) ? 'YYYYMM' : /^[\d]{1,2}[:][\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'HHMMSS' : /^[\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'HHMM' : '';
  102. }, timeToFormatTimestamp(t) {
  103. const e = u(t.split(':'), 3); const n = e[0]; const c = e[1]; const a = e[2]; let i = {}; let s = [];return void 0 !== n && (i = o({}, i, { h: n }), s = [].concat(r(s), [n])), void 0 !== c && (i = o({}, i, { m: c }), s = [].concat(r(s), [c])), void 0 !== a && (i = o({}, i, { s: a }), s = [].concat(r(s), [a])), { value: i, str: s.join(':') };
  104. } };
  105. }]));