gljUtil.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. isCommercialConcreteType:isCommercialConcreteType,
  20. getIndex:getIndex,
  21. sortRationGLJ:sortRationGLJ
  22. };
  23. function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
  24. gljNodeUtil.calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil);
  25. }
  26. function getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  27. return gljNodeUtil.getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  28. }
  29. function getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  30. return gljNodeUtil.getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  31. }
  32. function getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
  33. return gljNodeUtil.getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  34. }
  35. function getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false,_,scMathUtil) {
  36. return gljNodeUtil.getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
  37. }
  38. function calcPriceDiff(glj,calcOptions) {
  39. gljNodeUtil.calcPriceDiff(glj,calcOptions);
  40. }
  41. function getMainType() {
  42. return gljNodeUtil.getMainType();
  43. }
  44. function getIndex(obj, pops) {
  45. return gljNodeUtil.getIndex(obj, pops);
  46. }
  47. function isConcreteType(type) {
  48. return gljNodeUtil.isConcreteType(type);
  49. }
  50. function isCommercialConcreteType(type){
  51. return gljNodeUtil.isCommercialConcreteType(type);
  52. }
  53. function sortRationGLJ(type) {
  54. return gljNodeUtil.sortRationGLJ(type);
  55. }