/**
 * 描述：组织绩效与个人绩效分布对应关系表 表单校验
 */
shr.defineClass("shr.custom.PersonRelationOrgEdit", shr.framework.Edit, {

    /**
     * 描述:初始化操作
     * 
     * @action
     */
    initalizeDOM: function () {
        var _self = this;
        shr.custom.PersonRelationOrgEdit.superClass.initalizeDOM.call(this);
    },

    /**
     * 保存
     */
    saveAction: function (event) {
        $("#name").val($("#score").val());
        //校验保存数据是否完整
        var meritA = $("#meritA").val();
        var meritBplus = $("#meritBplus").val();
        var meritB = $("#meritB").val();
        var meritBminus = $("#meritBminus").val();
        var meritC = $("#meritC").val();
        var meritD = $("#meritD").val();
        var sum = meritA * 1 + meritBplus * 1 + meritB * 1 + meritBminus * 1 + meritC * 1 + meritD * 1
        if (sum == 0 || sum == 100) {
             //个人绩效比例保存数据
        var ratioPerformance = "";
        if (meritA != 0) {
            ratioPerformance += "A：" + meritA + "%；"
        }
        if (meritBplus != 0) {
            ratioPerformance += "B+：" + meritBplus + "%；"
        }
        if (meritB != 0) {
            ratioPerformance += "B：" + meritB + "%；"
        }
        
        if (meritBminus != 0 ||meritC != 0 ||meritD != 0) {
            meritBminus = meritBminus*1+meritC*1+meritD*1
            ratioPerformance += "B-/C/D：" + meritBminus + "%；"
        }
        // if (meritC != 0) {
        //     ratioPerformance += "C:" + meritC + "%;"
        // }
        // if (meritD != 0) {
        //     ratioPerformance += "D:" + meritD + "%;"
        // }
        $("#ratioPerformance").val(ratioPerformance);
            shr.custom.PersonRelationOrgEdit.superClass.saveAction.call(this);
        } else if (sum > 100) {
            shr.showWarning({
                'message': "比例的和不大于100"
            });
        } else {
            shr.showWarning({
                'message': "比例的和不小于100"
            });
        }

  
       

    }
});