/** * Created by Zhong on 2017/11/24. */ let projDisplayView = { datas: null,//just for view init: function () { this.datas = projectInfoObj.projectInfo.property.displaySetting; this.datas = this.datas === undefined ? {autoHeight: true, disPlayMainMaterial: true} : this.datas; $("#autoHeight").attr("checked", this.datas.autoHeight); $("#disPlayMainMaterial").attr("checked", this.datas.disPlayMainMaterial); //$('#disPlayMainMateria').prop('checked') }, needUpdate: function (autoHeight, disPlayMainMaterial) { if (this.datas == null) { return; } return autoHeight !== this.datas.autoHeight || disPlayMainMaterial !== this.datas.disPlayMainMaterial; }, updateChecking: function (properties) { if (this.datas == null) { return; } let autoHeight = $('#autoHeight').prop('checked'); let disPlayMainMaterial = $('#disPlayMainMaterial').prop('checked'); if (this.datas.autoHeight !== autoHeight || this.datas.disPlayMainMaterial !== disPlayMainMaterial) { this.datas.autoHeight = autoHeight; this.datas.disPlayMainMaterial = disPlayMainMaterial; // let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}}; properties['property.displaySetting'] = this.datas; } } }; let calcOptions = { datas: null,//just for view init: function () { this.datas = projectInfoObj.projectInfo.property.calcOptions; $("#calc_main").attr("checked", this.datas.calc_main); $("#calc_add").attr("checked", this.datas.calc_add); $("#calc_est").attr("checked", this.datas.calc_est); }, updateChecking: function (properties) { if (this.datas == null) { return false; } let calc_main = $('#calc_main').prop('checked'); let calc_add = $('#calc_add').prop('checked'); let calc_est = $('#calc_est').prop('checked'); if (this.datas.calc_main !== calc_main || this.datas.calc_add !== calc_add||this.datas.calc_est !== calc_est) { this.datas.calc_main = calc_main; this.datas.calc_add = calc_add; this.datas.calc_est = calc_est; properties['property.calcOptions'] = this.datas; return true } return false } } $(document).ready(function () { $('#tab_display_setting').on('shown.bs.tab', function () { projDisplayView.init(); }); $('#about-calc').on('shown.bs.tab', function () { calcOptions.init(); }); });