add.html 5.03 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
    <th:block th:include="include :: header" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-bomHeader-add">
        <div class="form-group">
            <label class="col-sm-3 control-label"> 物料编码:</label>
            <div class="col-sm-8">
                <select id="materialCode" name="materialCode" class="form-control"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数量:</label>
            <div class="col-sm-8">
                <input id="qty" name="qty" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">修正号码:</label>
            <div class="col-sm-8">
                <input id="revisionNum" name="revisionNum" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">加工说明:</label>
            <div class="col-sm-8">
                <input id="buildInstructions" name="buildInstructions" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">加工货位:</label>
            <div class="col-sm-8">
                <input id="buildLoc" name="buildLoc" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">有效起始日期:</label>
            <div class="col-sm-8">
                <input id="validFromDate" name="validFromDate" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">有效结束日期:</label>
            <div class="col-sm-8">
                <input id="validEndDate" name="validEndDate" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">优先级:</label>
            <div class="col-sm-8">
                <input id="priority" name="priority" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否有效:</label>
            <div class="col-sm-8">
                <select id="enable" name="enable" class="form-control" >
                    <option value="0">有效</option>
                    <option value="1">无效</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否虚拟商品:</label>
            <div class="col-sm-8">
                <select id="isVirtualBom" name="isVirtualBom" class="form-control">
                    <option value="0">不是</option>
                    <option value="1"></option>
                </select>
            </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>
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
    var prefix = ctx + "config/bomHeader";
    $("#form-bomHeader-add").validate({
        rules:{
            materialCode:"required"
        },
        messages:{
            materialCode:"请选择物料编码!"
        },
        submitHandler: function(form) {
            var tableValue = $("#form-bomHeader-add").serialize();
            tableValue = formValueReplace(tableValue, "enable", $("#enable option:selected").val());
            tableValue = formValueReplace(tableValue, "isVirtualBom", $("#isVirtualBom option:selected").val());
            $.operate.save(prefix + "/add", tableValue);
        }
    });
    $(function () {
        layui.use('laydate', function() {
            var laydate = layui.laydate;
            laydate.render({ elem: '#validFromDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' });
            laydate.render({ elem: '#validEndDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' });
        });
        $('#materialCode').select2({
            ajax: {
                url: ctx+'config/material/getData',
                dataType: 'json',
                type: 'post',
                delay: 250,
                data: function (params) {
                    let query = {
                        materialName: params.term,
                    }
                    return query;
                }
            }
        });
    });
</script>
</body>
</html>