selectWarehouse.html 1.63 KB
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<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-receiptHeader-add">
        <div class="form-group">
            <label class="control-label col-sm-2">仓库:</label>
            <div class="col-sm-8" style="padding:0 5px;">
                <select name="warehouse" id="warehouse" class="form-control" style="color:#333;">
                </select>
            </div>
            <div class="col-sm-2">
                <button type="button" class="btn btn-primary" onclick="save()">确定</button>
            </div>
        </div>

        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
            </div>
        </div>
    </form>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    $(function () {
        $.ajax({
            url: ctx + "config/warehouse/list",
            type: 'post',
            dataType: "json",
            success: function (value) {
                $("#warehouse").contents().remove();
                if (value != null && value.data.length >= 1)
                    for (let i = 0; i < value.data.length; i++) {
                        $('<option value=' + value.data[i].code + '>' + value.data[i].name + '</option>').appendTo('#warehouse');
                    }
            }
        })
    });

    function save() {
        let data = $("#warehouse").val();
        window.location.href = ctx +"reservation/view/"+data;
    }
</script>
</body>
</html>