qinbo
2021-09-16 47e10b936ccf6f1cf54a6cf69362474a2ec238c1
widgetsTS/dataTime/widget.js
@@ -1,13 +1,5 @@
'use script' //开发环境建议开启严格模式
  ;
function getDefaultDateTime() {
  var now = new Date;
  now.setMinutes(now.getMinutes() - 60);
  return now.getFullYear + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' ' + now.getHours() + ':00:00';
}
(function (window, mars3d) {
;(function (window, mars3d) {
  //创建widget类,需要继承BaseWidget
  class MyWidget extends mars3d.widget.BaseWidget {
    //外部资源配置
@@ -16,42 +8,14 @@
    }
    //页面配置, append是添加DOM节点到html中的方式
    get view() {
      return { type: "append", url: "view.html", parent: "body" };
      return {
        type: 'append',
        url: 'view.html',
      }
    }
    //初始化[仅执行1次]
    create() {
      // 初始化 参数
      let request = haoutil.system.getRequest();
      if (window.top) {
        request = $.extend(request, haoutil.system.getRequest(window.top));
      }
      mars3d.globel_variables = {userid:request.userid || 2,queryDataType:'hour'};
      mars3d.globel_variables.queryDataTStart = getDefaultDateTime();
      mars3d.globel_variables.queryDataTEnd = getDefaultDateTime();
      $('input[type=radio][name=datatype]').change(function() {
        mars3d.globel_variables.queryDataType = this.value ;
        console.log( mars3d.globel_variables.queryDataType);
      });
      $('#current').val(mars3d.globel_variables.queryDataType=='hour'?'小时':'天'+mars3d.globel_variables.queryDataTStart);
      $('#current').val(mars3d.globel_variables.queryDataType=='hour'?'小时':'天'+mars3d.globel_variables.queryDataTStart);
      //$('#datatype_day').datepicker();
      jeDate("#datatype_day",{
        format:"YYYY-MM-DD",
        isTime:true,
        minDate:"2014-09-19 00:00:00"
    })
    }
    create() {}
    //每个窗口创建完成后调用
    winCreateOK(opt, result) {
      //此处可以绑定页面dom事件