UnitDetailDetailView 创造

来源:互联网 发布:core python中文版豆瓣 编辑:程序博客网 时间:2024/04/29 08:41

$ns("unitDetail.views");

$import("mx.controls.ToolBar");
$import("mx.datacontainers.FormEntityContainer");
$import("mx.datacontrols.DataForm");


unitDetail.views.UnitDetailDetailView = function()
{
    var me = $extend(mx.views.View);
    var base = {};
   
    /**
     * 表单对象id
     */
    me.objID = null;
    /**
      * 表单对象
     */
    var _form = null;
    /**
     * 工具条
     */
    var _toolBar = null;
   

    /* 初始化单表单控件 */
    base.init = me.init;
    me.init = function()
    {
        base.init();
        _initControls();
    };

    me.load = function()
    {
     //加载表单信息
     _form.load(me.objID);
    }

    function _initControls()
    {
        _initToolBar();
     _initDataForm();
        me.on("activate", me.controller._onactivate);
    }
 
    function _initToolBar()
    {
     _toolBar = new mx.controls.ToolBar({
            alias:"unitDetailUnitDetailDetailViewToolBar",
            width: "100%"
        });
        var btnSave = _toolBar.appendItem("save", mx.msg("SAVE"));
        btnSave.alias = "unitDetailUnitDetailDetailViewBtnSave";
        btnSave.setImageKey("save");
        btnSave.on("click", me.controller._btnSave_onclick);
        me.addControl(_toolBar);
    }
 
    function _initDataForm()
    {
             var restUrl = "~/rest/projunitdetail/";
        /* 初始化 EntityContainer */       
        var formEntityContainer = new mx.datacontainers.FormEntityContainer({
            baseUrl : unitDetail.mappath(restUrl),
            iscID : "-1", // iscID 是数据元素的统一权限功能编码。默认值为  "-1" ,表示不应用权限设置。
            primaryKey: "id"
        });
       
        _form = new mx.datacontrols.DataForm({
   
   alias:"unitDetailUnitDetailDetailViewDataForm",
   displayPrimaryKey: false,
   fields: [
         { name: "operFile", caption: "投标文件", editorType: "FileEditor",
          type: "form", uploadMode: "blob",  tableName: "proj_unit_detail",  primaryKey: "id",  colName: "oper_file"
         }, 
         { name: "regTime", caption: "注册时间", editorType: "DateTimeEditor", formatString: "yyyy-MM-dd"},
         { name: "regMoney", caption: "注册资金", editorType: "NumberEditor"},
         { name: "leader", caption: "法人", editorType: "TextEditor"},
         { name: "compType", caption: "公司类型", editorType: "DropDownEditor"},
      { name: "id", caption: "ID", editorType: "TextEditor", visible:false}
      ],
            entityContainer: formEntityContainer
        });
       
        me.addControl(_form);
    }

    /**
     * 获取表单对象
     */
    me.getForm = function(){
  return _form;
    }
 
    /**
     * 获取工具条
     */
    me.getToolBar = function(){
  return _toolBar;
    }
   
 me.endOfClass(arguments)
    return me;
};

原创粉丝点击