<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改设备类型维护')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-base_type-edit" th:object="${baseType}">
        <input name="objId" th:field="*{objId}" type="hidden">
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">设备类型名称：</label>
                <div class="col-sm-8">
                    <input name="deviceTypeName" id="deviceTypeName" th:field="*{deviceTypeName}" class="form-control"
                           type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">默认计费价格(小时)：</label>
                <div class="col-sm-8">
                    <input name="defaultPrice" th:field="*{defaultPrice}" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">默认使用时间：</label>
                <div class="col-sm-8">
                    <input name="defaultTime" th:field="*{defaultTime}" class="form-control" type="text">
                </div>
            </div>
        </div>
          <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">注意事项：</label>
                <div class="col-sm-8">
                    <textarea class="form-control" name="remark" th:field="*{remark}" type="text"></textarea>
                </div>
            </div>
        </div>


    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "device/base_type";
    $("#form-base_type-edit").validate({
        onkeyup: false,
        rules: {
            deviceTypeName: {
                remote: {
                    url: prefix + "/checkDeviceTypeName",
                    type: "post",
                    dataType: "json",
                    data: {
                        "deviceTypeName": function () {
                            return $("input[name='deviceTypeName']").val();
                        },
                        "objId": function () {
                            return $("input[name='objId']").val();
                        },

                    }
                }
            },

        },
        messages: {
            "deviceTypeName": {
                remote: "名称已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-base_type-edit').serialize());
        }
    }
</script>
</body>
</html>