zhongrj
2023-06-27 d74b495736f0c04522ec54274b70fed0ded2878d
public/map/core/BaseWidget.js
New file
@@ -0,0 +1,71 @@
/**
 * widget基类
 * @author Wenyb
 * @date 2015/6/30
 */
define([
  "dojo/_base/declare",
  "base/BaseControl",
  "base/ConfigData",
  "base/AppEvent",
  "dojo/domReady!",
], function (
  declare,
  BaseControl,
  ConfigData,
  AppEvent
  ){
   var Widget = declare("BaseWidget",[BaseControl],
      {
         widgetName:"BaseWidget",
         label:"widget基类",
         moudleId:"0",
         /**
          * 部件的布局类型:top:顶部布局、sider:侧面布局、cover:浮动在地图显示区域的布局
          */
         widgetLayoutType:"",
         _isOpen:false,
         constructor:function(options)
         {
            declare.safeMixin(this, options);
         },
         startup:function()
         {
            this.inherited(arguments);
            AppEvent.dispatchAppEvent(AppEvent.WIDGET_LOADED,{name:this.id,instance:this});
         },
         /**
          * Widget打开
          * @return boolean
          */
         open:function()
         {
            this.show();
            this._isOpen=true;
            AppEvent.dispatchAppEvent(AppEvent.WIDGET_OPENED,{name:this.id,instance:this});
         },
         /**
          * Widget关闭
          * @return boolean
          */
         close:function()
         {
            if(ConfigData.selectLayer!=null){
               this.map.removeLayer(ConfigData.selectLayer);
            }
            ConfigData.selectLayer==null;
            this.hide();
            this._isOpen=false;
            AppEvent.dispatchAppEvent(AppEvent.WIDGET_CLOSED,{name:this.id,instance:this});
         },
         /**
          * 是否需要验证用户权限
          * @return boolean
          */
         confirmUserRight:function()
         {
            return false;
         }
      });
   return Widget;
});