wangzhibo
2021-09-15 7bd57c68259f3e47cf4b396fefb1abb3d12a71f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'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) {
  //创建widget类,需要继承BaseWidget
  class MyWidget extends mars3d.widget.BaseWidget {
    //外部资源配置
    get resources() {
      return ['view.css']
    }
    //页面配置, append是添加DOM节点到html中的方式
    get view() {
      return { type: "append", url: "view.html", parent: "body" };
    }
 
    //初始化[仅执行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"
    })
 
      
 
 
    }
    //每个窗口创建完成后调用
    winCreateOK(opt, result) {
      //此处可以绑定页面dom事件
    }
    //激活插件
    activate() {
      toastr.info('激活插件_example_append')
    }
    //释放插件
    disable() {
      toastr.info('释放插件_example_append')
    }
  }
 
  //注册到widget管理器中。
  mars3d.widget.bindClass(MyWidget)
 
  //每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。
})(window, mars3d)