gljComponent.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. /**
  2. * Created by Zhong on 2017/8/15.
  3. */
  4. let gljComponentOprObj = {
  5. workBook: null,
  6. processDecimal: -6,
  7. setting: {
  8. owner: "gljComponent",
  9. header:[
  10. {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
  11. {headerName:"名称",headerWidth:90,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
  12. {headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
  13. {headerName:"单价",headerWidth:60,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
  14. {headerName:"消耗量",headerWidth:70,dataCode:"consumeAmt", dataType: "Number", formatter: "0.000", hAlign: "right", vAlign: "center"}
  15. ],
  16. view: {
  17. lockedCols:[0, 1, 2, 3]
  18. }
  19. },
  20. buildSheet: function(container) {
  21. let me = gljComponentOprObj;
  22. me.workBook = sheetOpr.buildSheet(container, me.setting, 30);
  23. me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
  24. me.workBook.getSheet(0).setFormatter(-1, 0, "@", GC.Spread.Sheets.SheetArea.viewport);
  25. sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
  26. me.onContextmenuOpr();//右键菜单
  27. me.gljComponentDelOpr();
  28. me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
  29. me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
  30. me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
  31. me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
  32. },
  33. getRowData: function (sheet, row, setting) {
  34. let rst = {};
  35. for(let i = 0; i < setting.header.length; i++){
  36. rst[setting.header[i].dataCode] = sheet.getValue(row, i);
  37. }
  38. return rst;
  39. },
  40. getComponent: function (sheet, rowCount) {
  41. let component = [];
  42. for(let row = 0; row < rowCount; row++){
  43. let obj = {};
  44. obj.consumeAmt = sheet.getValue(row, 4);
  45. obj.ID = sheet.getTag(row, 0);
  46. component.push(obj);
  47. }
  48. return component;
  49. },
  50. onContextmenuOpr: function () {
  51. let me = gljComponentOprObj, that = repositoryGljObj, co = componentOprObj;
  52. $.contextMenu({
  53. selector: '#gljComponentSheet',
  54. build: function($triggerElement, e){
  55. //控制允许右键菜单在哪个位置出现
  56. let sheet = me.workBook.getSheet(0);
  57. let offset = $("#gljComponentSheet").offset(),
  58. x = e.pageX - offset.left,
  59. y = e.pageY - offset.top;
  60. let target = sheet.hitTest(x, y);
  61. if(target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){//在表格内
  62. sheet.setActiveCell(target.row, target.col);
  63. //getCurrentGlj
  64. let thatRow = that.workBook.getSheet(0).getSelections()[0].row
  65. that.currentGlj = thatRow < that.currentCache.length ? that.currentCache[thatRow] : null;
  66. that.currentComponent = that.currentGlj ? that.getCurrentComponent(that.currentGlj.component) : [];
  67. //控制按钮是否可用
  68. let insertDis = false,
  69. delDis = false;
  70. if(!(that.currentGlj && that.allowComponent.indexOf(that.currentGlj.gljType) !== -1) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList)))){
  71. insertDis = true;
  72. }
  73. if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
  74. delDis = true;
  75. }
  76. return {
  77. callback: function(){},
  78. items: {
  79. "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
  80. //默认radio所有工料机
  81. co.initRadio();
  82. co.gljCurTypeId = null;
  83. //默认点击树根节点
  84. if(co.rootNode){
  85. co.treeObj.selectNode(co.rootNode);
  86. componentTypeTreeOprObj.onClick(null, 'componentTree', co.rootNode);
  87. }
  88. //弹出窗口
  89. $('#componentBtn').click();
  90. }},
  91. "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
  92. //删除
  93. let deleteObj = that.currentComponent[target.row];
  94. let gljComponent = that.currentGlj.component;
  95. let updateArr = [];
  96. //更新当前工料机的组成物列表
  97. for(let i = 0, len = gljComponent.length; i < len; i++){
  98. if(gljComponent[i].ID === deleteObj.ID){
  99. gljComponent.splice(i, 1);
  100. break;
  101. }
  102. }
  103. //重新计算工料机
  104. let gljBasePrc = me.reCalGljBasePrc(that.getCurrentComponent(gljComponent));
  105. if(gljBasePrc !== that.currentGlj.basePrice){
  106. that.currentGlj.basePrice = gljBasePrc;
  107. that.reshowGljBasePrc(that.currentGlj);
  108. //updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  109. }
  110. updateArr.push(that.currentGlj);
  111. me.updateComponent(updateArr);
  112. }}
  113. }
  114. };
  115. }
  116. else{
  117. return false;
  118. }
  119. }
  120. });
  121. },
  122. gljComponentDelOpr: function () {
  123. let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [], removeArr = [], isUpdate = false, updateBasePrc= [];
  124. me.workBook.commandManager().register('gljComponentDel', function () {
  125. let sels = me.workBook.getSheet(0).getSelections();
  126. if(sels.length > 0 && that.currentComponent.length > 0){
  127. let component = that.currentGlj.component;
  128. for(let i = 0; i < sels.length > 0; i++){
  129. if(sels[i].colCount === me.setting.header.length){//可删除
  130. for(let j = 0; j < sels[i].rowCount; j++){
  131. if(sels[i].row + j < that.currentComponent.length){
  132. removeArr.push(that.currentComponent[sels[i].row + j].ID);
  133. }
  134. }
  135. }
  136. else if(sels[i].col === 0){
  137. //编码不可为空
  138. alert("编码不可为空!");
  139. }
  140. else if(sels[i].col === 4){//消耗量修改为0
  141. if(sels[i].row === -1){//全修改
  142. for(let j = 0; j < that.currentComponent.length; j++){
  143. isUpdate = true;
  144. that.currentComponent[j].consumeAmt = 0;
  145. for(let k = 0; k < component.length; k++){
  146. if(component[k].ID === that.currentComponent[j].ID){
  147. component[k].consumeAmt = 0;
  148. break;
  149. }
  150. }
  151. }
  152. }
  153. else{//部分修改
  154. for(let j = 0; j < sels[i].rowCount; j++){
  155. if(sels[i].row + j < that.currentComponent.length){
  156. isUpdate = true;
  157. that.currentComponent[sels[i].row + j].consumeAmt = 0;
  158. for(let k = 0; k < component.length; k++){
  159. if(component[k].ID === that.currentComponent[sels[i].row + j].ID){
  160. component[k].consumeAmt = 0;
  161. break;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. if(removeArr.length > 0 || isUpdate){
  170. for(let i = 0; i < removeArr.length; i++){
  171. for(let j = 0; j < that.currentComponent.length; j++){
  172. if(that.currentComponent[j].ID === removeArr[i]){
  173. that.currentComponent.splice(j--, 1);
  174. }
  175. }
  176. for(let j = 0; j < component.length; j++){
  177. if(component[j].ID === removeArr[i]){
  178. component.splice(j--, 1);
  179. }
  180. }
  181. }
  182. //重新计算工料机
  183. let gljBasePrc = me.reCalGljBasePrc(that.currentComponent);
  184. if(gljBasePrc !== that.currentGlj.basePrice){
  185. that.currentGlj.basePrice = gljBasePrc;
  186. that.reshowGljBasePrc(that.currentGlj);
  187. updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  188. }
  189. updateArr.push(that.currentGlj);
  190. me.updateComponent(updateArr);
  191. if(updateBasePrc.length > 0){
  192. that.updateRationBasePrcRq(updateBasePrc);
  193. }
  194. }
  195. }
  196. });
  197. me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
  198. //me.workBook.commandManager().setShortcutKey('gljComponentDel', GC.Spread.Commands.Key.del, false, false, false, false);
  199. },
  200. onCellEditStart: function(sender, args) {
  201. let me = gljComponentOprObj, that = repositoryGljObj;
  202. let rObj = me.getRowData(args.sheet, args.row, me.setting);
  203. me.currentEditingComponent = rObj;
  204. let thatRow = that.workBook.getSheet(0).getSelections()[0].row;
  205. if(thatRow < that.currentCache.length){
  206. that.currentGlj = that.currentCache[thatRow];
  207. if(me.setting.view.lockedCols.indexOf(args.col) !== -1 || that.allowComponent.indexOf(that.currentGlj.gljType) === -1 ||
  208. (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList))) ||
  209. (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
  210. args.cancel = true;
  211. }
  212. }
  213. else {
  214. args.cancel = true;
  215. }
  216. },
  217. onCellEditEnd: function (sender, args) {
  218. let me = gljComponentOprObj, that = repositoryGljObj, updateBasePrc = [];
  219. let gljList = that.gljList, updateArr = [], materialComponent = [202, 203, 204], machineComponent = [302, 303];
  220. // if(args.editingText !== me.currentEditingComponent.code){
  221. //编码
  222. /* if(args.col === 0 && args.editingText && args.editingText.trim().length > 0 &&args.editingText !== me.currentEditingComponent.code){
  223. let component = that.currentGlj.component, hasCode = false;
  224. for(let i = 0; i < gljList.length; i++){
  225. if(gljList[i].code === args.editingText){//有效的组成物
  226. hasCode = true;
  227. if((materialComponent.indexOf(that.currentGlj.gljType) !== -1 && gljList[i].gljType === 201)
  228. || (that.currentGlj.gljType === 301 && machineComponent.indexOf(gljList[i].gljType) !== -1 )){//普通材料
  229. //是否与原有组成物不同
  230. let isExist = false;
  231. for(let j = 0; j < component.length; j++){
  232. if(component[j].ID === gljList[i].ID){
  233. isExist = true;
  234. break;
  235. }
  236. }
  237. if(!isExist){
  238. let rObj = {};
  239. rObj.ID = gljList[i].ID;
  240. //rObj.basePrice = gljList[i].basePrice;
  241. if(typeof that.currentComponent[args.row] !== 'undefined'){
  242. rObj.consumeAmt = that.currentComponent[args.row].consumeAmt;
  243. let index;
  244. for(let j = 0; j < component.length; j++){
  245. if(component[j].ID === that.currentComponent[args.row].ID){
  246. index = j;
  247. break;
  248. }
  249. }
  250. component.splice(index, 1);
  251. component.splice(index, 0, rObj);
  252. //计算工料机单价
  253. let gljBasePrc = me.reCalGljBasePrc(that.getCurrentComponent(component));
  254. if(gljBasePrc !== that.currentGlj.basePrice){
  255. that.currentGlj.basePrice = gljBasePrc;
  256. that.reshowGljBasePrc(that.currentGlj);
  257. //工料机单价改变,重算引用了该工料机的定额单价
  258. updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  259. }
  260. updateArr.push(that.currentGlj);
  261. }
  262. else{
  263. rObj.consumeAmt = 0;
  264. component.push(rObj);
  265. //计算工料机单价
  266. let gljBasePrc = me.reCalGljBasePrc(that.getCurrentComponent(component));
  267. if(gljBasePrc !== that.currentGlj.basePrice){
  268. that.currentGlj.basePrice = gljBasePrc;
  269. that.reshowGljBasePrc(that.currentGlj);
  270. //工料机单价改变,重算引用了该工料机的定额单价
  271. updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  272. }
  273. updateArr.push(that.currentGlj);
  274. }
  275. break;
  276. }
  277. else{
  278. //已存在
  279. alert("已存在!");
  280. args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
  281. me.currentEditingComponent[me.setting.header[args.col].dataCode]: '');
  282. }
  283. }
  284. else{
  285. if(materialComponent.indexOf(that.currentGlj.gljType) === 1){
  286. alert("该组成物只能是普通材料!");
  287. }
  288. else if(that.currentGlj.gljType === 301){
  289. alert("该组成物只能是机械组成物或机上人工!")
  290. }
  291. args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
  292. me.currentEditingComponent[me.setting.header[args.col].dataCode]: '');
  293. //无效
  294. }
  295. }
  296. }
  297. if(!hasCode){
  298. alert("不存在此工料机,请先添加!");
  299. args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
  300. me.currentEditingComponent[me.setting.header[args.col].dataCode] : '');
  301. //不存在
  302. }
  303. }*/
  304. if(args.col === 4 && me.currentEditingComponent.code && args.editingText && args.editingText.trim().length > 0){//消耗量
  305. let consumeAmt = parseFloat(args.editingText);
  306. if(!isNaN(consumeAmt) && consumeAmt !== me.currentEditingComponent.consumeAmt){
  307. let roundCons = scMathUtil.roundTo(parseFloat(consumeAmt), -3);
  308. let component = that.currentGlj.component;
  309. for(let i = 0; i < component.length; i++){
  310. if(component[i].ID === that.currentComponent[args.row].ID){
  311. component[i].consumeAmt = roundCons;
  312. }
  313. }
  314. that.currentComponent[args.row].consumeAmt = roundCons;
  315. //计算工料机单价
  316. let gljBasePrc = me.reCalGljBasePrc(that.currentComponent);
  317. if(gljBasePrc !== that.currentGlj.basePrice){
  318. that.currentGlj.basePrice = gljBasePrc;
  319. that.reshowGljBasePrc(that.currentGlj);
  320. //工料机单价改变,重算引用了该工料机的定额单价
  321. //updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  322. }
  323. updateArr.push(that.currentGlj);
  324. }
  325. else{
  326. //只能输入数值
  327. args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
  328. me.currentEditingComponent[me.setting.header[args.col].dataCode]: 0);
  329. }
  330. }
  331. else{
  332. args.sheet.setValue(args.row, args.col, me.currentEditingComponent.consumeAmt);
  333. }
  334. if(updateArr.length > 0){
  335. me.updateComponent(updateArr);
  336. /*if(updateBasePrc.length > 0){
  337. that.updateRationBasePrcRq(updateBasePrc)
  338. }*/
  339. }
  340. },
  341. onClipboardPasting: function (sender, info) {
  342. let me = gljComponentOprObj, that = repositoryGljObj;
  343. let maxCol = info.cellRange.col + info.cellRange.colCount - 1;
  344. //复制的列数超过正确的列数,不可复制
  345. if(info.cellRange.col !== 4 && info.cellRange.colCount > 1 || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList)))){
  346. args.cancel = true;
  347. }
  348. },
  349. onClipboardPasted: function (sender, info) {
  350. let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [] ,materialComponent = [202, 203, 204], machineComponent = [302, 303],
  351. component = that.currentGlj.component, newComponent = [], concatComponent = [], isChange = false, updateBasePrc = [];
  352. let items = sheetOpr.analyzePasteData(me.setting, info);
  353. let gljCache = that.gljList;
  354. //编码
  355. /* if(info.cellRange.col === 0){
  356. for(let i = 0; i < items.length; i++){
  357. for(let j = 0; j < gljCache.length; j++){
  358. if(items[i].code === gljCache[j].code){
  359. if((materialComponent.indexOf(that.currentGlj.gljType) !== -1 && gljCache[j].gljType === 201)
  360. || (that.currentGlj.gljType === 301 && machineComponent.indexOf(gljCache[j].gljType) !== -1 )){
  361. //是否与原有组成物不同
  362. let isExist = false;
  363. for(let k = 0; k < component.length; k++){
  364. if(component[k].ID === gljCache[j].ID){
  365. isExist = true;
  366. me.workBook.getSheet(0).setValue(info.cellRange.row + i, info.cellRange.col,
  367. typeof that.currentComponent[info.cellRange.row + i] !== 'undefined'? that.currentComponent[info.cellRange.row + i].code : '');
  368. break;
  369. }
  370. }
  371. if(!isExist){
  372. isChange = true;
  373. let obj = {};
  374. obj.ID = gljCache[j].ID;
  375. if(typeof that.currentComponent[info.cellRange.row + i] !== 'undefined'){//更新
  376. obj.consumeAmt = that.currentComponent[info.cellRange.row + i].consumeAmt;
  377. let index;
  378. for(let k = 0; k < component.length; k++){
  379. if(that.currentComponent[info.cellRange.row + i].ID === component[k].ID){
  380. index = k;
  381. break;
  382. }
  383. }
  384. component.splice(index, 1);
  385. component.splice(index, 0, obj);
  386. }
  387. else{//新增
  388. obj.consumeAmt = 0;
  389. component.push(obj);
  390. }
  391. break;
  392. }
  393. }
  394. else{
  395. me.workBook.getSheet(0).setValue(info.cellRange.row + i, info.cellRange.col,
  396. typeof that.currentComponent[info.cellRange.row + i] !== 'undefined'? that.currentComponent[info.cellRange.row + i].code : '');
  397. }
  398. }
  399. else{
  400. me.workBook.getSheet(0).setValue(info.cellRange.row + i, info.cellRange.col,
  401. typeof that.currentComponent[info.cellRange.row + i] !== 'undefined'? that.currentComponent[info.cellRange.row + i].code : '');
  402. }
  403. }
  404. }
  405. if(isChange){
  406. //计算工料机单价
  407. let gljBasePrc = me.reCalGljBasePrc(that.getCurrentComponent(component));
  408. if(gljBasePrc !== that.currentGlj.basePrice){
  409. that.currentGlj.basePrice = gljBasePrc;
  410. that.reshowGljBasePrc(that.currentGlj);
  411. updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  412. }
  413. updateArr.push(that.currentGlj);
  414. }
  415. }*/
  416. //消耗量
  417. if(info.cellRange.col === 4){
  418. let items = sheetOpr.analyzePasteData(me.setting, info);
  419. let row = info.cellRange.row;
  420. for(let i = 0; i < items.length; i++){
  421. if(row + i < that.currentComponent.length){
  422. let currentObj = that.currentComponent[row + i];
  423. if(items[i].consumeAmt.trim().length > 0 && items[i].consumeAmt !== currentObj.consumeAmt){
  424. let roundCons = scMathUtil.roundTo(parseFloat(items[i].consumeAmt), 3);
  425. isChange = true;
  426. currentObj.consumeAmt = roundCons;
  427. for(let j = 0; j < component.length; j++){
  428. if(component[j].ID === currentObj.ID){
  429. component[j].consumeAmt = currentObj.consumeAmt;
  430. break;
  431. }
  432. }
  433. }
  434. else{
  435. me.workBook.getSheet(0).setValue(row + i, info.cellRange.col, currentObj.consumeAmt);
  436. }
  437. }
  438. else{
  439. me.workBook.getSheet(0).setValue(row + i, info.cellRange.col, '');
  440. }
  441. }
  442. if(isChange){
  443. //计算工料机单价
  444. let gljBasePrc = me.reCalGljBasePrc(that.currentComponent);
  445. if(gljBasePrc !== that.currentGlj.basePrice){
  446. that.currentGlj.basePrice = gljBasePrc;
  447. that.reshowGljBasePrc(that.currentGlj);
  448. //updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
  449. }
  450. updateArr.push(that.currentGlj);
  451. }
  452. }
  453. if(updateArr.length > 0){
  454. me.updateComponent(updateArr);
  455. /* if(updateBasePrc.length > 0){
  456. that.updateRationBasePrcRq(updateBasePrc);
  457. }*/
  458. }
  459. },
  460. updateComponent: function (updateArr) {
  461. let me = gljComponentOprObj, that = repositoryGljObj;
  462. that.saveInString(updateArr);
  463. $.ajax({
  464. type: 'post',
  465. url: 'complementartGlj/api/updateComponent',
  466. data: {"userId": pageOprObj.userId, "updateArr": JSON.stringify(updateArr)},
  467. dataType: 'json',
  468. success: function (result) {
  469. if(!result.error){
  470. that.currentComponent = that.getCurrentComponent(result.data[0].component);
  471. sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
  472. sheetOpr.showData(me.workBook.getSheet(0), me.setting, that.currentComponent);
  473. }
  474. else{
  475. sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
  476. }
  477. $('#componentsCacnel').click();
  478. }
  479. })
  480. },
  481. round: function (v, e) {
  482. let t=1;
  483. for(;e>0;t*=10,e--);
  484. for(;e<0;t/=10,e++);
  485. return Math.round(v*t)/t;
  486. },
  487. reCalGljBasePrc: function (component) {
  488. let me = gljComponentOprObj, gljBasePrc = 0;
  489. for(let i = 0; i < component.length; i++){
  490. let roundBasePrc = scMathUtil.roundTo(parseFloat(component[i].basePrice), -2);
  491. let roundConsumeAmt = scMathUtil.roundTo(parseFloat(component[i].consumeAmt), -3);
  492. gljBasePrc = scMathUtil.roundTo(scMathUtil.roundTo(roundBasePrc * roundConsumeAmt, me.processDecimal) + gljBasePrc, me.processDecimal);
  493. }
  494. return gljBasePrc;
  495. }
  496. };