mix_ratio.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * 配合比相关
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/10
  6. * @version
  7. */
  8. let mixRatioHeader = [];
  9. let mixRatioSheet = null;
  10. let mixRatioSpread = null;
  11. $(document).ready(function() {
  12. mixRatioHeader = [
  13. {name: '编码', field: 'code', visible: true},
  14. {name: '名称', field: 'name', visible: true},
  15. {name: '单位', field: 'unit_price.unit', visible: true},
  16. {name: 'ID', field: 'id', visible: false},
  17. {name: '类型', field: 'unit_price.type', visible: false},
  18. {name: '基价单价', field: "unit_price.base_price", visible: true},
  19. {name: '调整基价', field: 'adjust_price', visible: true},
  20. {name: '市场单价', field: "unit_price.market_price", visible: true, validator: 'number'},
  21. {name: '总消耗量', field: 'quantity', visible: true},
  22. ];
  23. let setting = {
  24. header: []
  25. };
  26. for(let tmp of mixRatioHeader) {
  27. setting.header.push({headerName: tmp.name, headerWidth: 120});
  28. }
  29. mixRatioSpread = sheetCommonObj.buildSheet(document.getElementById("mix-ratio"), setting, 3);
  30. mixRatioSpread.options.scrollbarShowMax = true;
  31. mixRatioSpread.options.scrollbarMaxAlign = true;
  32. mixRatioSpread.options.showHorizontalScrollbar = true;
  33. mixRatioSheet = mixRatioSpread.getActiveSheet();
  34. // 设置表单不可编辑
  35. mixRatioSheet.options.isProtected = true;
  36. // 切换tab触发refresh
  37. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  38. let tagString = $(e.target).text();
  39. if (tagString === "配合比表" && mixRatioSpread !== null) {
  40. // 筛选数据显示(显示混凝土、砂浆、配合比)
  41. filterDataByType([GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR, GLJTypeConst.MIX_RATIO]);
  42. // 获取工料机当前选中的行号
  43. console.log(gljSheet.getActiveRowIndex());
  44. mixRatioSpread.refresh();
  45. }
  46. });
  47. });
  48. /**
  49. * 根据id获取对应的配合比数据
  50. *
  51. * @param {Number} id
  52. * @return {void}
  53. */
  54. function getMixRatioData(id) {
  55. }