schedule_plan.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /**
  2. * 进度台账相关js
  3. *
  4. * @author Ellisran
  5. * @date 2020/11/6
  6. * @version
  7. */
  8. function getTenderId() {
  9. return window.location.pathname.split('/')[2];
  10. }
  11. $(function () {
  12. autoFlashHeight();
  13. if(schedule && !schedule.mode) {
  14. $('#mode').modal('show');
  15. }
  16. // 初始化台账
  17. const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
  18. const treeSetting = {
  19. id: 'ledger_id',
  20. pid: 'ledger_pid',
  21. order: 'order',
  22. level: 'level',
  23. rootId: -1,
  24. fullPath: 'full_path',
  25. calcFun: function (node) {
  26. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  27. }
  28. //treeCacheKey: 'ledger_bills_fold' + '_' + getTenderId(),
  29. // markFoldKey: 'bills-fold',
  30. // markFoldSubKey: window.location.pathname.split('/')[2],
  31. };
  32. const static_cols = [
  33. {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
  34. {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true},
  35. {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
  36. {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
  37. {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  38. {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  39. ];
  40. const ledgerSpreadSetting = {
  41. emptyRows: 0,
  42. headRows: 2,
  43. headRowHeight: [25, 25],
  44. defaultRowHeight: 21,
  45. headerFont: '12px 微软雅黑',
  46. font: '12px 微软雅黑',
  47. // readOnly: true,
  48. localCache: {
  49. key: 'ledger-bills',
  50. colWidth: true,
  51. }
  52. };
  53. const monthsCols = [];
  54. const calcCols = ['total_price'];
  55. if(scheduleMonth.length > 0) {
  56. for (const sm of scheduleMonth) {
  57. const readOnly = sm.stage_gcl_used !== 0 || sm.stage_tp_used !== 0;
  58. const yearmonth = sm.yearmonth.split('-')[0] + '年' + parseInt(sm.yearmonth.split('-')[1]) + '月';
  59. const cols = {title: yearmonth + '|计划工程量', colSpan: '2|1', rowSpan: '1|1', field: sm.yearmonth+'_gcl', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.gcl'};
  60. const cols2 = {title: '|计划金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_tp', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.tp'};
  61. monthsCols.push(cols);
  62. monthsCols.push(cols2);
  63. // calcCols.push(sm.yearmonth+'_gcl');
  64. calcCols.push(sm.yearmonth+'_tp');
  65. }
  66. }
  67. treeSetting.calcFields = calcCols;
  68. const ledgerTree = createNewPathTree('filter', treeSetting);
  69. const spreadHeaderCols = static_cols.concat(monthsCols);
  70. ledgerSpreadSetting.cols = spreadHeaderCols;
  71. const ledgerCol = {
  72. readOnly: {
  73. tp: function (data) {
  74. let flag = data.is_leaf;
  75. if (data.is_leaf) {
  76. flag = schedule && schedule.mode === mode.tp;
  77. }
  78. return !flag;
  79. },
  80. gcl: function (data) {
  81. let flag = data.is_leaf;
  82. if (data.is_leaf) {
  83. flag = schedule && schedule.mode === mode.gcl;
  84. }
  85. return !flag;
  86. },
  87. },
  88. };
  89. sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
  90. if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
  91. SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
  92. SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
  93. SpreadJsObj.selChangedRefreshBackColor(ledgerSpread.getActiveSheet());
  94. postData('/tender/' + getTenderId() + '/schedule/ledger/load', {}, function (data) {
  95. // let treeData = [];
  96. // for(const sl of selectedLedgerList) {
  97. // const one = _.find(data, { 'ledger_id' : sl });
  98. // treeData.push(one);
  99. // }
  100. // treeData = setLeafData(treeData);
  101. // console.log(treeData);
  102. // let treeData = data;
  103. const calcList = ['total_price'];
  104. const showList = ['ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
  105. 'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'dgn_price', 'quantity', 'total_price'];
  106. for (const m of monthList) {
  107. showList.push(m + '_tp');
  108. showList.push(m + '_gcl');
  109. // calcList.push(m + '_tp');
  110. // calcList.push(m + '_gcl');
  111. }
  112. console.log(showList);
  113. const baseLedgerTree = createNewPathTree('base', {
  114. id: 'ledger_id',
  115. pid: 'ledger_pid',
  116. order: 'order',
  117. level: 'level',
  118. rootId: -1,
  119. fullPath: 'full_path',
  120. calcFields: calcList,
  121. calcFun: function (node) {
  122. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  123. }
  124. });
  125. const newLedgerList = setMonthToLedger(data.bills, data.slm);
  126. baseLedgerTree.loadDatas(newLedgerList);
  127. treeCalc.calculateAll(baseLedgerTree);
  128. console.log(baseLedgerTree);
  129. for (const d of baseLedgerTree.nodes) {
  130. if (!d.b_code) {
  131. const one = _.find(selectedLedgerList, function (item) {
  132. return item === d.ledger_id;
  133. });
  134. if(one) {
  135. ledgerTree.addData(d, showList);
  136. }
  137. }
  138. }
  139. // console.log(ledgerTree);
  140. ledgerTree.sortTreeNode(true);
  141. treeCalc.calculateAll(ledgerTree);
  142. console.log(ledgerTree);
  143. SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
  144. }, null, true);
  145. const ledgerSpreadObj = {
  146. refreshTree: function (sheet, data) {
  147. SpreadJsObj.massOperationSheet(sheet, function () {
  148. const tree = sheet.zh_tree;
  149. // 处理删除
  150. if (data.delete) {
  151. data.delete.sort(function (x, y) {
  152. return y.deleteIndex - x.deleteIndex;
  153. });
  154. for (const d of data.delete) {
  155. sheet.deleteRows(d.deleteIndex, 1);
  156. }
  157. }
  158. // 处理新增
  159. if (data.create) {
  160. const newNodes = data.create;
  161. if (newNodes) {
  162. newNodes.sort(function (a, b) {
  163. return a.index - b.index;
  164. });
  165. for (const node of newNodes) {
  166. sheet.addRows(node.index, 1);
  167. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  168. }
  169. }
  170. }
  171. // 处理更新
  172. if (data.update) {
  173. const rows = [];
  174. for (const u of data.update) {
  175. rows.push(tree.nodes.indexOf(u));
  176. }
  177. SpreadJsObj.reLoadRowsData(sheet, rows);
  178. }
  179. // 处理展开
  180. if (data.expand) {
  181. const expanded = [];
  182. for (const e of data.expand) {
  183. if (expanded.indexOf(e) === -1) {
  184. const posterity = tree.getPosterity(e);
  185. for (const p of posterity) {
  186. sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
  187. expanded.push(p);
  188. }
  189. }
  190. }
  191. }
  192. });
  193. },
  194. editEnded: function (e, info) {
  195. if (info.sheet.zh_setting) {
  196. const select = SpreadJsObj.getSelectObject(info.sheet);
  197. const col = info.sheet.zh_setting.cols[info.col];
  198. const validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
  199. const orgValue = select[col.field];
  200. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  201. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  202. return;
  203. }
  204. if (isNaN(validText)) {
  205. toastr.error('不能输入其它非数字类型字符');
  206. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  207. return;
  208. }
  209. const yearmonth = col.field.split('_')[0];
  210. const mode = col.field.split('_')[1];
  211. let plan_gcl = 0;
  212. let plan_tp = 0;
  213. // 判断输入位数,提示
  214. if (mode === 'tp') {
  215. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.tp) +'})?$');
  216. if (validText !== null && (!reg.test(validText))) {
  217. toastr.error('输入金额小数位数不能大于' + tenderInfo.decimal.tp + '位');
  218. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  219. return;
  220. }
  221. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), tenderInfo.decimal.up) : 0;
  222. plan_tp = validText;
  223. } else {
  224. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.up) +'})?$');
  225. if (validText !== null && (!reg.test(validText))) {
  226. toastr.error('输入工程量小数位数不能大于' + tenderInfo.decimal.up + '位');
  227. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  228. return;
  229. }
  230. plan_gcl = validText;
  231. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), tenderInfo.decimal.tp) : 0;
  232. }
  233. select[col.field] = validText;
  234. const updateData = {
  235. lid: select.ledger_id,
  236. yearmonth,
  237. plan_gcl,
  238. plan_tp,
  239. };
  240. console.log(updateData);
  241. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  242. if (mode === 'tp') {
  243. select[yearmonth + '_gcl'] = plan_gcl;
  244. } else {
  245. select[yearmonth + '_tp'] = plan_tp;
  246. }
  247. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  248. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  249. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  250. },function () {
  251. select[col.field] = orgValue;
  252. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  253. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  254. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  255. })
  256. }
  257. },
  258. deletePress: function (sheet) {
  259. return;
  260. },
  261. clipboardPasted(e, info) {
  262. const hint = {
  263. cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
  264. numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
  265. };
  266. const range = info.cellRange;
  267. if (range.rowCount > 1 || range.colCount > 1) {
  268. toastMessageUniq(hint.cellError);
  269. SpreadJsObj.reLoadSheetHeader(ledgerSpread.getActiveSheet());
  270. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  271. return;
  272. }
  273. const select = SpreadJsObj.getSelectObject(info.sheet);
  274. const col = info.sheet.zh_setting.cols[range.col];
  275. const validText = is_numeric(info.pasteData.text) ? parseFloat(info.pasteData.text) : (info.pasteData.text ? trimInvalidChar(info.pasteData.text) : null);
  276. const orgValue = select[col.field];
  277. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  278. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  279. return;
  280. }
  281. if (isNaN(validText)) {
  282. toastr.error('不能粘贴其它非数字类型字符');
  283. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  284. return;
  285. }
  286. const yearmonth = col.field.split('_')[0];
  287. const mode = col.field.split('_')[1];
  288. let plan_gcl = 0;
  289. let plan_tp = 0;
  290. // 判断输入位数,提示
  291. if (mode === 'tp') {
  292. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.tp) +'})?$');
  293. if (validText !== null && (!reg.test(validText))) {
  294. toastr.error('粘贴的金额小数位数不能大于' + tenderInfo.decimal.tp + '位');
  295. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  296. return;
  297. }
  298. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), tenderInfo.decimal.up) : 0;
  299. plan_tp = validText;
  300. } else {
  301. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.up) +'})?$');
  302. if (validText !== null && (!reg.test(validText))) {
  303. toastr.error('粘贴的工程量小数位数不能大于' + tenderInfo.decimal.up + '位');
  304. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  305. return;
  306. }
  307. plan_gcl = validText;
  308. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), tenderInfo.decimal.tp) : 0;
  309. }
  310. select[col.field] = validText;
  311. const updateData = {
  312. lid: select.ledger_id,
  313. yearmonth,
  314. plan_gcl,
  315. plan_tp,
  316. };
  317. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  318. if (mode === 'tp') {
  319. select[yearmonth + '_gcl'] = plan_gcl;
  320. } else {
  321. select[yearmonth + '_tp'] = plan_tp;
  322. }
  323. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  324. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  325. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  326. },function () {
  327. select[col.field] = orgValue;
  328. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  329. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  330. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  331. })
  332. },
  333. };
  334. ledgerSpread.bind(spreadNS.Events.EditEnded, ledgerSpreadObj.editEnded);
  335. SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
  336. ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
  337. // 进度计算方式选择
  338. $('.mode-select').on('click', function () {
  339. const _self = $(this);
  340. postData(window.location.pathname + '/save', {type: 'mode', postData: $(this).data('mode')}, function (result) {
  341. _self.addClass('disabled').attr('disabled', true);
  342. _self.parents('.col-6').siblings('.col-6').find('button').removeClass('disabled').removeAttr('disabled');
  343. $('#mode-tips').show();
  344. $('#mode-cancel').show();
  345. $('#mode').modal('hide');
  346. schedule.mode = _self.data('mode');
  347. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  348. })
  349. });
  350. // 月份添加
  351. $('#add-month').click(function () {
  352. const range = $('#month-range').val();
  353. if(range === '') {
  354. toastr.error('请选择计划周期时间');
  355. return;
  356. }
  357. const addMonthList = [];
  358. const cycle = range.split(' ~ ');
  359. if(cycle.length === 1) {
  360. addMonthList.push(cycle[0]);
  361. } else {
  362. // 多个月份
  363. const back_year = parseInt(cycle[1].split('-')[0]);
  364. const back_month = parseInt(cycle[1].split('-')[1]);
  365. const front_year = parseInt(cycle[0].split('-')[0]);
  366. const front_month = parseInt(cycle[0].split('-')[1]);
  367. if(back_year > front_year) {
  368. const num = getDistanceMonth(cycle[0], cycle[1]);
  369. let j = 1;
  370. for (let i = 0; i <= num; i++) {
  371. if(front_month + i > 12*j) {
  372. j = j + 1;
  373. }
  374. const m = (front_month + i)%12 === 0 ? 12 : (front_month + i)%12;
  375. addMonthList.push((front_year + (j-1)) + '-' + (m < 10 ? '0' + m : m));
  376. }
  377. } else if (back_year === front_year) {
  378. // 小于1年并没有跨年
  379. for (let i = front_month; i <= back_month; i++) {
  380. addMonthList.push(back_year + '-' + (i < 10 ? '0' + i : i));
  381. }
  382. }
  383. }
  384. // 判断是否已添加本月份
  385. if (addMonthList.length > 0) {
  386. const hadmonth = [];
  387. for (const m of addMonthList) {
  388. const one = _.find(scheduleMonth, { yearmonth: m });
  389. console.log(one, m);
  390. if (one) {
  391. hadmonth.push(m);
  392. }
  393. }
  394. if (hadmonth.length > 0) {
  395. let html = '';
  396. for (const hm of hadmonth) {
  397. html += `<div class="alert alert-danger">${hm} 已创建</div>`;
  398. }
  399. $('#add-month-error-list').html(html);
  400. $('#add-month-error-list').show();
  401. return;
  402. }
  403. } else {
  404. toastr.error('请选择计划周期时间');
  405. return;
  406. }
  407. $('#add-month-error-list').html('');
  408. $('#add-month-error-list').hide();
  409. const _self = $(this);
  410. postData(window.location.pathname + '/save', {type: 'addmonth', postData: addMonthList}, function (result) {
  411. _self.addClass('disabled').attr('disabled', true);
  412. toastr.success('新增成功');
  413. setTimeout(function () {
  414. window.location.reload();
  415. }, 500)
  416. })
  417. });
  418. $('#month-table input[type="checkbox"]').click(function () {
  419. const selectedMonth = [];
  420. $('#month-table input:checkbox:checked').each(function () {
  421. selectedMonth.push('「' + $(this).parents('td').siblings('td').text() + '」');
  422. });
  423. if(selectedMonth.length > 0) {
  424. $('#del-month-list').text(selectedMonth.join(''));
  425. $('#del-month-list').parent().show();
  426. $('#del-month').removeAttr('disabled');
  427. } else {
  428. $('#del-month-list').parent().hide();
  429. $('#del-month').attr('disabled', true);
  430. }
  431. });
  432. $('#del-month').click(function () {
  433. const selectedMonth = [];
  434. $('#month-table input:checkbox:checked').each(function () {
  435. selectedMonth.push($(this).parents('td').siblings().text());
  436. });
  437. if (selectedMonth.length === 0) {
  438. toastr.error('请选择删除的计划周期');
  439. return;
  440. }
  441. const _self = $(this);
  442. postData(window.location.pathname + '/save', {type: 'delmonth', postData: selectedMonth}, function (result) {
  443. _self.addClass('disabled').attr('disabled', true);
  444. toastr.success('删除成功');
  445. setTimeout(function () {
  446. window.location.reload();
  447. }, 500)
  448. })
  449. });
  450. $.subMenu({
  451. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  452. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  453. key: 'menu.1.0.0',
  454. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  455. callback: function (info) {
  456. if (info.mini) {
  457. $('.panel-title').addClass('fluid');
  458. $('#sub-menu').removeClass('panel-sidebar');
  459. } else {
  460. $('.panel-title').removeClass('fluid');
  461. $('#sub-menu').addClass('panel-sidebar');
  462. }
  463. ledgerSpread.refresh();
  464. autoFlashHeight();
  465. }
  466. });
  467. });
  468. // 月份间隔
  469. function getDistanceMonth(startTime,endTime){
  470. startTime = new Date(startTime);
  471. endTime = new Date(endTime);
  472. var dateToMonth = 0;
  473. var startDate=startTime.getDate() + startTime.getHours()/24 + startTime.getMinutes()/24/60;
  474. var endDate=endTime.getDate() +endTime.getHours()/24 + endTime.getMinutes()/24/60;
  475. if(endDate >= startDate){
  476. dateToMonth = 0;
  477. }else{
  478. dateToMonth = -1;
  479. }
  480. let yearToMonth = (endTime.getYear() - startTime.getYear()) * 12;
  481. let monthToMonth = endTime.getMonth() - startTime.getMonth();
  482. return yearToMonth + monthToMonth + dateToMonth;
  483. }
  484. function setLeafData(tree) {
  485. const newtree = [];
  486. for (const t of tree) {
  487. const child = _.find(tree, { 'ledger_pid': t.ledger_id });
  488. if (!child && !t.is_leaf) {
  489. t.is_leaf = true;
  490. }
  491. newtree.push(t);
  492. }
  493. return newtree;
  494. }
  495. function setMonthToLedger(ledgerList, slm) {
  496. if (slm.length > 0) {
  497. for(const s of slm) {
  498. const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
  499. if (index && index !== -1) {
  500. ledgerList[index][s.yearmonth + '_tp'] = s.plan_tp;
  501. ledgerList[index][s.yearmonth + '_gcl'] = s.plan_gcl;
  502. }
  503. }
  504. }
  505. return ledgerList;
  506. }
  507. const is_numeric = (value) => {
  508. if (typeof(value) === 'object') {
  509. return false;
  510. } else {
  511. return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
  512. }
  513. };