project_property_display_view.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 autoHeight = $('#autoHeight').prop('checked');
  26. let billsAutoHeight = $("#billsAutoHeight").prop("checked");
  27. let rationAutoHeight = $("#rationAutoHeight").prop("checked");
  28. let disPlayMainMaterial = $('#disPlayMainMaterial').prop('checked');
  29. if (this.datas.rationAutoHeight !== rationAutoHeight || this.datas.billsAutoHeight !== billsAutoHeight || this.datas.disPlayMainMaterial !== disPlayMainMaterial) {
  30. this.datas.billsAutoHeight = billsAutoHeight;
  31. this.datas.rationAutoHeight = rationAutoHeight;
  32. this.datas.disPlayMainMaterial = disPlayMainMaterial;
  33. // let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}};
  34. properties['property.displaySetting'] = this.datas;
  35. }
  36. }
  37. };
  38. let calcOptions = {
  39. datas: null,//just for view
  40. init: function () {
  41. this.datas = projectObj.project.projectInfo.property.calcOptions;
  42. $("#calc_main").prop("checked", this.datas.calc_main);
  43. $("#calc_add").prop("checked", this.datas.calc_add);
  44. $("#calc_est").prop("checked", this.datas.calc_est);
  45. },
  46. updateChecking: function (properties) {
  47. if (this.datas == null) {
  48. return false;
  49. }
  50. let calc_main = $('#calc_main').prop('checked');
  51. let calc_add = $('#calc_add').prop('checked');
  52. let calc_est = $('#calc_est').prop('checked');
  53. if (this.datas.calc_main !== calc_main || this.datas.calc_add !== calc_add||this.datas.calc_est !== calc_est) {
  54. this.datas.calc_main = calc_main;
  55. this.datas.calc_add = calc_add;
  56. this.datas.calc_est = calc_est;
  57. properties['property.calcOptions'] = this.datas;
  58. return true
  59. }
  60. return false
  61. }
  62. }
  63. /*
  64. $(document).ready(function () {
  65. $('#tab_display_setting').on('shown.bs.tab', function () {
  66. projDisplayView.init();
  67. });
  68. $('#about-calc').on('shown.bs.tab', function () {
  69. calcOptions.init();
  70. });
  71. });*/