hz-zhhq-web/node_modules/.cache/babel-loader/88883745cf5ff816d9ac337fd90...

1 line
10 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js!E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\src\\utils\\index.js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\utils\\index.js","mtime":1737610069399},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.regexp.match\";\nimport \"core-js/modules/es6.set\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.to-string\";\nimport _typeof from \"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/esm/typeof.js\";\n/**\r\n * Created by PanJiaChen on 16/11/18.\r\n */\n\n/**\r\n * Parse the time to string\r\n * @param {(Object|string|number)} time\r\n * @param {string} cFormat\r\n * @returns {string}\r\n */\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return '';\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';\n var date;\n if (_typeof(time) === 'object') {\n date = time;\n } else {\n if (typeof time === 'string' && /^[0-9]+$/.test(time)) {\n time = parseInt(time);\n }\n if (typeof time === 'number' && time.toString().length === 10) {\n time = time * 1000;\n }\n date = new Date(time);\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {\n var value = formatObj[key];\n // Note: getDay() returns 0 on Sunday\n if (key === 'a') {\n return ['日', '一', '二', '三', '四', '五', '六'][value];\n }\n if (result.length > 0 && value < 10) {\n value = '0' + value;\n }\n return value || 0;\n });\n return time_str;\n}\n\n/**\r\n * @param {number} time\r\n * @param {string} option\r\n * @returns {string}\r\n */\nexport function formatTime(time, option) {\n if (('' + time).length === 10) {\n time = parseInt(time) * 1000;\n } else {\n time = +time;\n }\n var d = new Date(time);\n var now = Date.now();\n var diff = (now - d) / 1000;\n if (diff < 30) {\n return '刚刚';\n } else if (diff < 3600) {\n // less 1 hour\n return Math.ceil(diff / 60) + '分钟前';\n } else if (diff < 3600 * 24) {\n return Math.ceil(diff / 3600) + '小时前';\n } else if (diff < 3600 * 24 * 2) {\n return '1天前';\n }\n if (option) {\n return parseTime(time, option);\n } else {\n return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分';\n }\n}\n\n/**\r\n * @param {string} url\r\n * @returns {Object}\r\n */\nexport function getQueryObject(url) {\n url = url == \"\" ? window.location.href : url;\n var search = url.substring(url.lastIndexOf('?') + 1);\n var obj = {};\n var reg = /([^?&=]+)=([^?&=]*)/g;\n search.replace(reg, function (rs, $1, $2) {\n var name = decodeURIComponent($1);\n var val = decodeURIComponent($2);\n val = String(val);\n obj[name] = val;\n return rs;\n });\n return obj;\n}\n\n/**\r\n * @param {string} input value\r\n * @returns {number} output value\r\n */\nexport function byteLength(str) {\n // returns the byte length of an utf8 string\n var s = str.length;\n for (var i = str.length - 1; i >= 0; i--) {\n var code = str.charCodeAt(i);\n if (code > 0x7f && code <= 0x7ff) s++;else if (code > 0x7ff && code <= 0xffff) s += 2;\n if (code >= 0xDC00 && code <= 0xDFFF) i--;\n }\n return s;\n}\n\n/**\r\n * @param {Array} actual\r\n * @returns {Array}\r\n */\nexport function cleanArray(actual) {\n var newArray = [];\n for (var i = 0; i < actual.length; i++) {\n if (actual[i]) {\n newArray.push(actual[i]);\n }\n }\n return newArray;\n}\n\n/**\r\n * @param {Object} json\r\n * @returns {Array}\r\n */\nexport function param(json) {\n if (!json) return '';\n return cleanArray(Object.keys(json).map(function (key) {\n if (json[key] === undefined) return '';\n return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]);\n })).join('&');\n}\n\n/**\r\n * @param {string} url\r\n * @returns {Object}\r\n */\nexport function param2Obj(url) {\n var search = url.split('?')[1];\n if (!search) {\n return {};\n }\n return JSON.parse('{\"' + decodeURIComponent(search).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g, '\":\"').replace(/\\+/g, ' ') + '\"}');\n}\n\n/**\r\n * @param {string} val\r\n * @returns {string}\r\n */\nexport function html2Text(val) {\n var div = document.createElement('div');\n div.innerHTML = val;\n return div.textContent || div.innerText;\n}\n\n/**\r\n * Merges two objects, giving the last one precedence\r\n * @param {Object} target\r\n * @param {(Object|Array)} source\r\n * @returns {Object}\r\n */\nexport function objectMerge(target, source) {\n if (_typeof(target) !== 'object') {\n target = {};\n }\n if (Array.isArray(source)) {\n return source.slice();\n }\n Object.keys(source).forEach(function (property) {\n var sourceProperty = source[property];\n if (_typeof(sourceProperty) === 'object') {\n target[property] = objectMerge(target[property], sourceProperty);\n } else {\n target[property] = sourceProperty;\n }\n });\n return target;\n}\n\n/**\r\n * @param {HTMLElement} element\r\n * @param {string} className\r\n */\nexport function toggleClass(element, className) {\n if (!element || !className) {\n return;\n }\n var classString = element.className;\n var nameIndex = classString.indexOf(className);\n if (nameIndex === -1) {\n classString += '' + className;\n } else {\n classString = classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length);\n }\n element.className = classString;\n}\n\n/**\r\n * @param {string} type\r\n * @returns {Date}\r\n */\nexport function getTime(type) {\n if (type === 'start') {\n return new Date().getTime() - 3600 * 1000 * 24 * 90;\n } else {\n return new Date(new Date().toDateString());\n }\n}\n\n/**\r\n * @param {Function} func\r\n * @param {number} wait\r\n * @param {boolean} immediate\r\n * @return {*}\r\n */\nexport function debounce(func, wait, immediate) {\n var timeout, args, context, timestamp, result;\n var _later = function later() {\n // 据上一次触发时间间隔\n var last = +new Date() - timestamp;\n\n // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait\n if (last < wait && last > 0) {\n timeout = setTimeout(_later, wait - last);\n } else {\n timeout = null;\n // 如果设定为immediate===true因为开始边界已经调用过了此处无需调用\n if (!immediate) {\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n }\n }\n };\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n context = this;\n timestamp = +new Date();\n var callNow = immediate && !timeout;\n // 如果延时不存在,重新设定延时\n if (!timeout) timeout = setTimeout(_later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n return result;\n };\n}\n\n/**\r\n * This is just a simple version of deep copy\r\n * Has a lot of edge cases bug\r\n * If you want to use a perfect deep copy, use lodash's _.cloneDeep\r\n * @param {Object} source\r\n * @returns {Object}\r\n */\nexport function deepClone(source) {\n if (!source && _typeof(source) !== 'object') {\n throw new Error('error arguments', 'deepClone');\n }\n var targetObj = source.constructor === Array ? [] : {};\n Object.keys(source).forEach(function (keys) {\n if (source[keys] && _typeof(source[keys]) === 'object') {\n targetObj[keys] = deepClone(source[keys]);\n } else {\n targetObj[keys] = source[keys];\n }\n });\n return targetObj;\n}\n\n/**\r\n * @param {Array} arr\r\n * @returns {Array}\r\n */\nexport function uniqueArr(arr) {\n return Array.from(new Set(arr));\n}\n\n/**\r\n * @returns {string}\r\n */\n\n/**\r\n * Check if an element has a class\r\n * @param {HTMLElement} elm\r\n * @param {string} cls\r\n * @returns {boolean}\r\n */\nexport function hasClass(ele, cls) {\n return !!ele.className.match(new RegExp('(\\\\s|^)' + cls + '(\\\\s|$)'));\n}\n\n/**\r\n * Add class to element\r\n * @param {HTMLElement} elm\r\n * @param {string} cls\r\n */\nexport function addClass(ele, cls) {\n if (!hasClass(ele, cls)) ele.className += ' ' + cls;\n}\n\n/**\r\n * Remove class from element\r\n * @param {HTMLElement} elm\r\n * @param {string} cls\r\n */\nexport function removeClass(ele, cls) {\n if (hasClass(ele, cls)) {\n var reg = new RegExp('(\\\\s|^)' + cls + '(\\\\s|$)');\n ele.className = ele.className.replace(reg, ' ');\n }\n}\n\n/**\r\n * 树形数据转换\r\n * @param {*} data\r\n * @param {*} id\r\n * @param {*} pid\r\n */\n\nexport function outline(e) {\n if (e.target.scrollWidth > e.target.offsetWidth) {\n return e.target.setAttribute('class', 'cell-box span-overflow');\n }\n}\nexport function treeDataTranslate(data) {\n var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';\n var pid = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'parentId';\n var res = [];\n var temp = {};\n for (var i = 0; i < data.length; i++) {\n temp[data[i][id]] = data[i];\n }\n for (var k = 0; k < data.length; k++) {\n if (temp[data[k][pid]] && data[k][id] !== data[k][pid]) {\n if (!temp[data[k][pid]]['children']) {\n temp[data[k][pid]]['children'] = [];\n }\n if (!temp[data[k][pid]]['_level']) {\n temp[data[k][pid]]['_level'] = 1;\n }\n data[k]['_level'] = temp[data[k][pid]]._level + 1;\n temp[data[k][pid]]['children'].push(data[k]);\n } else {\n res.push(data[k]);\n }\n }\n console.log(res, 'treeDataTranslate');\n return res;\n}",null]}