gljUtil.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Created by zhang on 2018/6/7.
  3. */
  4. import fs from 'fs';
  5. let _= require('lodash');
  6. const scMathUtil = require('./scMathUtil').getUtil();
  7. let gljNodeUtil = null;
  8. let data = fs.readFileSync(__dirname + '/web/gljUtil.js', 'utf8', 'r');
  9. eval(data + ' ; gljNodeUtil = gljUtil; ');
  10. module.exports = {
  11. calcProjectGLJQuantity :calcProjectGLJQuantity,
  12. getGLJPrice:getGLJPrice,
  13. calcPriceDiff:calcPriceDiff,
  14. getMarketPrice:getMarketPrice,
  15. getBasePrice:getBasePrice,
  16. getAdjustPrice:getAdjustPrice,
  17. getMainType:getMainType,
  18. isConcreteType:isConcreteType,
  19. getIndex:getIndex,
  20. sortRationGLJ:sortRationGLJ
  21. };
  22. function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
  23. gljNodeUtil.calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil);
  24. }
  25. function getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  26. return gljNodeUtil.getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  27. }
  28. function getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  29. return gljNodeUtil.getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  30. }
  31. function getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  32. return gljNodeUtil.getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  33. }
  34. function getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false,_,scMathUtil) {
  35. return gljNodeUtil.getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  36. }
  37. function calcPriceDiff(glj,calcOptions) {
  38. gljNodeUtil.calcPriceDiff(glj,calcOptions);
  39. }
  40. function getMainType() {
  41. return gljNodeUtil.getMainType();
  42. }
  43. function getIndex(obj, pops) {
  44. return gljNodeUtil.getIndex(obj, pops);
  45. }
  46. function isConcreteType(type) {
  47. return gljNodeUtil.isConcreteType(type);
  48. }
  49. function sortRationGLJ(type) {
  50. return gljNodeUtil.sortRationGLJ(type);
  51. }