forked from zhurui/management
1 line
16 KiB
JSON
1 line
16 KiB
JSON
|
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\index.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\index.js","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.to-string\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.array.find\";\nimport Cookies from 'js-cookie';\nimport store from '@/store';\nimport http from '@/utils/request';\n/**\n * 权限\n * @param {*} key\n */\n\nexport function hasPermission(key) {\n return window.SITE_CONFIG['permissions'].indexOf(key) !== -1 || false;\n}\n/**\n * 获取字典数据列表\n * @param dictType 字典类型\n */\n\nexport function getDictDataList(dictType) {\n var type = store.state.dictType.find(function (element) {\n return element.dictType === dictType;\n });\n\n if (type) {\n return type.dataList;\n } else {\n return [];\n }\n}\nexport function getDictDataListAll() {\n http.get('/sys/dict/type/all').then(function (_ref) {\n var res = _ref.data;\n\n if (res.code !== 0) {\n return;\n }\n\n window.SITE_CONFIG['dictList'] = res.data;\n store.commit(\"setDictList\", res.data);\n });\n}\n/**\n * 获取字典名称\n * @param dictType 字典类型\n * @param dictValue 字典值\n */\n\nexport function getDictLabel(dictType, dictValue) {\n var type = window.SITE_CONFIG['dictList'].find(function (element) {\n return element.dictType === dictType;\n });\n\n if (type) {\n var val = type.dataList.find(function (element) {\n return element.dictValue === dictValue + '';\n });\n\n if (val) {\n return val.dictLabel;\n } else {\n return dictValue;\n }\n } else {\n return dictValue;\n }\n}\n/**\n * 清除登录信息\n */\n\nexport function clearLoginInfo() {\n store.commit('resetStore');\n Cookies.remove('access_token');\n Cookies.remove('token');\n window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false;\n}\n/**\n * 获取uuid\n */\n\nexport function getUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n return (c === 'x' ? Math.random() * 16 | 0 : 'r&0x3' | '0x8').toString(16);\n });\n}\n/**\n * 获取svg图标(id)列表\n */\n\nexport function getIconList() {\n var res = [];\n document.querySelectorAll('svg symbol').forEach(function (item) {\n res.push(item.id);\n });\n return res;\n}\n/**\n * 树形数据转换 temp[data[k][pid]]['disabled']=true\n * @param {*} data\n * @param {*} id\n * @param {*} pid\n */\n\nexport function treeDataTranslateDis(data) {\n var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';\n var pid = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'pid';\n var res = [];\n var temp = {};\n\n for (var i = 0; i < data.length; i++) {\n temp[data[i][id]] = data[i];\n }\n\n for (var k = 0; k < data.length; k++) {\n if (!temp[data[k][pid]] || data[k][id] === data[k][pid]) {\n res.push(data[k]);\n continue;\n }\n\n if (!temp[data[k][pid]]['children']) {\n temp[data[k][pid]]['children'] = [];\n temp[data[k][pid]]['disabled'] = true;\n }\n\n temp[data[k][pid]]['children'].push(data[k]);\n data[k]['_level'] = (temp[data[k][pid]]._level || 0) + 1;\n }\n\n return res;\n}\n/**\n * 树形数据转换 \n * @param {*} data\n * @param {*} id\n * @param {*} pid\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] : 'pid';\n var res
|