您当前的位置: 首页 > 

wespten

暂无认证

  • 1浏览

    0关注

    899博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

js的方法重构

wespten 发布时间:2018-10-19 11:49:19 ,浏览量:1

相当于java中方法的重写,会覆盖以前的方法

定义js的基元

var EditView = function(){
    var _this = null;
    var $id = null;
    var key = null;
    var $submit_form = $("#submit_form");
    var $url = "notification/notificationtype";
    var type = null;
    var $add = null;
    var $getById = null;
    var $upd = null;
    this.url = null;
    this.dicurl = "system/dic/getDicByCode/";
    this.uploadUrl = getUploadUrl();
    this.createCusView = null;
    this.getMainData = null;
    this.init = function(){
        key = $.util.request[$id];
        type = $.util.request["type"];
        _this = this;
        $Core.OnPageLoad(function () {
            $Core.Loading.HidePageLoading();
        });
        if (key&&key!="") {
            var url = $url+"/getById/" + key;
            if($getById != null && $getById != "" && $getById != "null"){
                url = $getById+"/"+key;
            }
            $.get(url, function (data) {
                _this.getMainData = data;
                $submit_form.form("load", data.data);
                if(type=="red"){
                    $submit_form.form("load", data.data);
                    $("input").attr("readonly", "readonly");
                    $(".easyui-combobox").combo('readonly', true);
                    $(".easyui-combotree").combotree('readonly', true);
                    $('.easyui-textbox').textbox('readonly');
                    $(".easyui-my97").my97('disable');
                    $("#btnSave").hide();
                    $("button").hide();
                    /*$("input",$submit_form).each(function(i,n) {
                        $(n).textbox('disable');
                    });*/
                }
                if(type != "add" && _this.renderSelectors){
                	for(var i=0,len=_this.renderSelectors.length; i            
关注
打赏
1665965058
查看更多评论
0.0431s