/**
 * Created by zhang on 2020/1/2.
 */
$(document).ready(function () {
    $("#system_save").click(function () {
        for (let ele of $("input")) {
            if (ele.name == "ID") continue;
            if ($(ele).attr('type') === 'number' && !isNum($(ele).val())) return alert($(ele).parent().prevAll("legend").text() + $(ele).prev().text() + "输入的数据类型有误，请重新输入！");
        }
        $("form").submit();
    });

    function isNum(thisValue) {
        var regPos = /^\d+(\.\d+)?$/; //非负浮点数
        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
        return (regPos.test(thisValue) || regNeg.test(thisValue));
    }

});

