1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/.cache/babel-loader/f521f217905cd3ef4df5358c4a0...

1 line
15 KiB
JSON
Raw Normal View History

2023-12-18 13:12:25 +08:00
{"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\\mergeCell.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\mergeCell.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\";\n\n/**\n * \n * keyidvalue\n * @param\tdataList\t\n * @param\tlabel1\t\t1\n * @param label2\t\t2\n * @param label3\t\t3\n * @param label4\t\t4\n */\nexport function buildMerge(dataList) {\n var label1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'label1';\n var label2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label2';\n var label3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label3';\n var label4 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'label4';\n\n // 当列表数据没有主键时,添加主键\n if (dataList.length > 0 && (dataList[0].id !== 0 || dataList[0].id !== '0')) {\n dataList.forEach(function (item, index) {\n item.id = [index];\n });\n }\n\n var firstObj = {},\n secondObj = {},\n thirdObj = {},\n fourthObj = {};\n var firstObjKey = '',\n secondObjKey = '',\n thirdObjKey = '',\n fourthObjKey = ''; // 本示例合并的前四列对应的字段分别label1、label2、label3、label4\n // 如果你需要合并其他的字段,需修改此处字段名称\n\n for (var i = 0, len = dataList.length; i < len; i++) {\n firstObjKey = dataList[i][label1];\n secondObjKey = dataList[i][label2];\n thirdObjKey = dataList[i][label3];\n fourthObjKey = dataList[i][label4];\n if (!firstObj[firstObjKey]) firstObj[firstObjKey] = new Array(dataList[i].id);else {\n firstObj[firstObjKey].push(dataList[i].id);\n }\n if (!secondObj[secondObjKey]) secondObj[secondObjKey] = new Array(dataList[i].id);else {\n secondObj[secondObjKey].push(dataList[i].id);\n }\n if (!thirdObj[thirdObjKey]) thirdObj[thirdObjKey] = new Array(dataList[i].id);else {\n thirdObj[thirdObjKey].push(dataList[i].id);\n }\n if (!fourthObj[fourthObjKey]) fourthObj[fourthObjKey] = new Array(dataList[i].id);else {\n fourthObj[fourthObjKey].push(dataList[i].id);\n }\n }\n\n computeFirstSpan(dataList, firstObj, secondObj, thirdObj, fourthObj);\n} // 计算第一列合并总数\n\nfunction computeFirstSpan(dataList, firstObj, secondObj, thirdObj, fourthObj) {\n var _loop = function _loop(obj) {\n var fristData = dataList.filter(function (d) {\n return d.id === firstObj[obj][0];\n })[0]; // 获取第一条数据,对其添加 'firstSpan' 属性,并设置值\n\n if (fristData) fristData['firstSpan'] = firstObj[obj].length;\n computeSecondSpan(dataList, firstObj[obj], secondObj, thirdObj, fourthObj);\n };\n\n // 遍历计算第一列合并行数\n for (var obj in firstObj) {\n _loop(obj);\n }\n} // 计算第二列合并总数\n\n\nfunction computeSecondSpan(dataList, classList, secondObj, thirdObj, fourthObj) {\n var secondList = []; // 遍历计算第二列合并行数\n\n var _loop2 = function _loop2(obj) {\n // 判断两个id数组取其并集并集的长度就是合并列的行数\n var secondIds = secondObj[obj].filter(function (val) {\n return classList.indexOf(val) > -1;\n });\n var fristData = dataList.filter(function (d) {\n return d.id === secondIds[