project_property_display_view.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 = projectInfoObj.projectInfo.property.displaySetting;
  8. this.datas = this.datas === undefined ? {autoHeight: true, disPlayMainMaterial: true} : this.datas;
  9. $("#autoHeight").attr("checked", this.datas.autoHeight);
  10. $("#disPlayMainMaterial").attr("checked", this.datas.disPlayMainMaterial);
  11. //$('#disPlayMainMateria').prop('checked')
  12. },
  13. needUpdate: function (autoHeight, disPlayMainMaterial) {
  14. if (this.datas == null) {
  15. return;
  16. }
  17. return autoHeight !== this.datas.autoHeight || disPlayMainMaterial !== this.datas.disPlayMainMaterial;
  18. },
  19. updateChecking: function (properties) {
  20. if (this.datas == null) {
  21. return;
  22. }
  23. let autoHeight = $('#autoHeight').prop('checked');
  24. let disPlayMainMaterial = $('#disPlayMainMaterial').prop('checked');
  25. if (this.datas.autoHeight !== autoHeight || this.datas.disPlayMainMaterial !== disPlayMainMaterial) {
  26. this.datas.autoHeight = autoHeight;
  27. this.datas.disPlayMainMaterial = disPlayMainMaterial;
  28. // let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}};
  29. properties['property.displaySetting'] = this.datas;
  30. }
  31. }
  32. };
  33. let calcOptions = {
  34. datas: null,//just for view
  35. init: function () {
  36. this.datas = projectInfoObj.projectInfo.property.calcOptions;
  37. $("#calc_main").attr("checked", this.datas.calc_main);
  38. $("#calc_add").attr("checked", this.datas.calc_add);
  39. $("#calc_est").attr("checked", this.datas.calc_est);
  40. },
  41. updateChecking: function (properties) {
  42. if (this.datas == null) {
  43. return false;
  44. }
  45. let calc_main = $('#calc_main').prop('checked');
  46. let calc_add = $('#calc_add').prop('checked');
  47. let calc_est = $('#calc_est').prop('checked');
  48. if (this.datas.calc_main !== calc_main || this.datas.calc_add !== calc_add||this.datas.calc_est !== calc_est) {
  49. this.datas.calc_main = calc_main;
  50. this.datas.calc_add = calc_add;
  51. this.datas.calc_est = calc_est;
  52. properties['property.calcOptions'] = this.datas;
  53. return true
  54. }
  55. return false
  56. }
  57. }
  58. $(document).ready(function () {
  59. $('#tab_display_setting').on('shown.bs.tab', function () {
  60. projDisplayView.init();
  61. });
  62. $('#about-calc').on('shown.bs.tab', function () {
  63. calcOptions.init();
  64. });
  65. });