shr.defineClass("shr.cmpdesign.SalaryAdjustQuerySchemeEdit", shr.framework.Edit, {
    initalizeDOM : function() {
        shr.cmpdesign.SalaryAdjustQuerySchemeEdit.superClass.initalizeDOM.call(this);
        this.monitorEntry();
    },


    monitorEntry : function (){
        var _self = this;
        var $grid = waf("#entrys");
        if("VIEW" == _self.operateState)
            return;
        var $table = waf("table[id^='entry']");
        var hrOrgUnit = $("#hrOrgUnit").shrPromptBox("getValue");
        $table.delegate(".ui-promptBox-layout","keyup.shrPromptGrid click",function(){
            //$("input[id$='_person']").shrPromptBox("setFilter", " hrOrgUnit.id = '" + $("#hrOrgUnit").shrPromptBox("getValue").id + "'");
            //薪酬项目改变，薪酬标准等要清空
            $("input[id$='_cmpItem']").shrPromptBox('option', {
                onchange: function(e, val){
                    var rowid = $($(e.target).parents('tr')[0]).attr('id');
                    //清空标准
                    $grid.wafGrid("setCell",rowid,"cmpItemNumber",val.current.number);
                    $grid.wafGrid("setCell",rowid,"cmpItemName",val.current.name);
                    $grid.wafGrid("setCell",rowid,"cmpItemIndex",val.current.dataType.value);
                }
            });
        });
    },


    /**
     * 保存
     */
    saveAction: function(event) {
        var _self = this;
        var schemeName = $('#schemeName').shrTextField('getValue');
        var flag = false;
        var operateState = _self.getOperateState();
        var number='';
        if('EDIT'==operateState){
            //编辑方法
            number= $('#number').shrTextField('getValue');

            shr.callHandler(
                {
                    handler: "com.kingdee.shr.cmpdesign.web.handler.SalaryAdjustQuerySchemeEditHandler",
                    action: "checkIsHasSchemeNameByEdit",
                    param: {
                        schemeName:schemeName,
                        number:number
                    },
                    async: false,
                    success : function(res) {
                        if(res.result) {
                            flag = res.result;
                        }
                    }
                });

        }else {
            //新增方法
            shr.callHandler(
                {
                    handler: "com.kingdee.shr.cmpdesign.web.handler.SalaryAdjustQuerySchemeEditHandler",
                    action: "checkIsHasSchemeName",
                    param: {
                        schemeName:schemeName
                    },
                    async: false,
                    success : function(res) {
                        if(res.result) {
                            flag = res.result;
                        }
                    }
                });
        }
        if(flag){
            shr.showWarning({
                message: "方案名称已存在，请修改方案名称"
            });
            return;
        }

        if (_self.validate() && _self.verify()) {
            _self.doSave(event, 'save');
        }else{
            if(_self != top){// in iframe
                shr.setIframeHeight(window.name);
            }

        }
    },

});