gljComponent.js 27 KB

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