gljComponent.js 27 KB

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