project_property_display_view.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Created by Zhong on 2017/11/24.
  3. */
  4. let projDisplayView = {
  5. datas: null,//just for view
  6. init: function () {
  7. this.datas = projectObj.project.projectInfo.property.displaySetting;
  8. this.datas = this.datas === undefined ? {autoHeight: true, disPlayMainMaterial: true} : this.datas;
  9. //$("#autoHeight").prop("checked", this.datas.autoHeight);
  10. $("#billsAutoHeight").prop("checked", this.datas.billsAutoHeight);
  11. $("#rationAutoHeight").prop("checked", this.datas.rationAutoHeight);
  12. $("#disPlayMainMaterial").prop("checked", this.datas.disPlayMainMaterial);
  13. //$('#disPlayMainMateria').prop('checked')
  14. },
  15. needUpdate: function (autoHeight, disPlayMainMaterial) {
  16. if (this.datas == null) {
  17. return;
  18. }
  19. return autoHeight !== this.datas.autoHeight || disPlayMainMaterial !== this.datas.disPlayMainMaterial;
  20. },
  21. updateChecking: function (properties) {
  22. if (this.datas == null) {
  23. return;
  24. }
  25. let billsAutoHeight = $("#billsAutoHeight").prop("checked");
  26. let rationAutoHeight = $("#rationAutoHeight").prop("checked");
  27. if (this.datas.rationAutoHeight !== rationAutoHeight || this.datas.billsAutoHeight !== billsAutoHeight) {
  28. this.datas.billsAutoHeight = billsAutoHeight;
  29. this.datas.rationAutoHeight = rationAutoHeight;
  30. properties['property.displaySetting'] = this.datas;
  31. }
  32. }
  33. };
  34. let calcOptions = {
  35. datas: null,//just for view
  36. init: function () {
  37. this.datas = projectObj.project.projectInfo.property.calcOptions;
  38. $("#calc_main").prop("checked", this.datas.calc_main);
  39. $("#calc_add").prop("checked", this.datas.calc_add);
  40. $("#calc_est").prop("checked", this.datas.calc_est);
  41. },
  42. updateChecking: function (properties) {
  43. if (this.datas == null) {
  44. return false;
  45. }
  46. let calc_main = $('#calc_main').prop('checked');
  47. let calc_add = $('#calc_add').prop('checked');
  48. let calc_est = $('#calc_est').prop('checked');
  49. if (this.datas.calc_main !== calc_main || this.datas.calc_add !== calc_add||this.datas.calc_est !== calc_est) {
  50. this.datas.calc_main = calc_main;
  51. this.datas.calc_add = calc_add;
  52. this.datas.calc_est = calc_est;
  53. properties['property.calcOptions'] = this.datas;
  54. return true
  55. }
  56. return false
  57. }
  58. }
  59. /*
  60. $(document).ready(function () {
  61. $('#tab_display_setting').on('shown.bs.tab', function () {
  62. projDisplayView.init();
  63. });
  64. $('#about-calc').on('shown.bs.tab', function () {
  65. calcOptions.init();
  66. });
  67. });*/