edit.html 4.57 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head 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-material-add" th:object="${material}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">编码:</label>
            <div class="col-sm-8">
                <input id="code" name="code" class="form-control" readonly="readonly" type="text" th:field="*{code}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">名称:</label>
            <div class="col-sm-8">
                <input id="name" name="name" class="form-control" type="text" th:field="*{name}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">规格:</label>
            <div class="col-sm-8">
                <input id="spec" name="spec" class="form-control" type="text" th:field="*{spec}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">单位:</label>
            <div class="col-sm-8">
                <input id="unit" name="unit" class="form-control" type="text" th:field="*{unit}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料类别:</label>
            <div class="col-sm-8">
                <select id="type" name="type" class="form-control" th:with="materialType=${@materialType.queryType()}" th:field="*{type}">
                    <option th:each="item : ${materialType}" th:text="${item['name']}" th:value="${item['code']}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否检验:</label>
            <div class="col-sm-8">
                <select id="qcFlag" name="qcFlag" class="form-control" th:with="qcFlag=${@dict.getType('qcFlag')}" th:field="*{qcFlag}">
                    <option value="">请选择</option>
                    <option th:each="item : ${qcFlag}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">状态:</label>
            <div class="col-sm-8">
                <div class="onoffswitch">
                    <input type="checkbox"  th:checked="*{enable}"  class="onoffswitch-checkbox" id="enable" name="enable" >
                    <label class="onoffswitch-label" for="enable" >
                        <span class="onoffswitch-inner"></span>
                        <span class="onoffswitch-switch"></span>
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "config/material";
    $("#form-material-add").validate({
        rules:{
            code:{
                required:true,
            },
            name:{
                required:true,
            },
            daysToExpire:{
                digits:true
            },
            trackSerialNum:{
                digits:true
            },
            autoGenSerialNum:{
                digits:true
            },
            expiringDays:{
                digits:true
            },
            minShelfLifeDays:{
                digits:true
            }
        },
        submitHandler: function(form) {
            // $.operate.save(prefix + "/add", $('#form-material-add').serialize());
            // var tableValue = $.common.getTableValue("#form-material-add");
            // $.operate.save(prefix + "/add", tableValue);
            var tableValue = $("#form-material-add").serialize();
            tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked'));
            tableValue = formValueReplace(tableValue, "id", $("input[name='id']").is(':checked'));
            $.operate.save(prefix + "/edit", tableValue);
        }
    });

</script>
</body>
</html>