add.html 5.69 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-warning-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">预警类别代码:</label>
            <div class="col-sm-8">
                <select name="alarmType" class="form-control m-b" required
                        th:with="alarmTypeList=${@alarmTypeService.getData()}">
                    <option th:each="alarmType : ${alarmTypeList}" th:text="${alarmType['name']}"
                            th:value="${alarmType['type']}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">仓库编码:</label>
            <div class="col-sm-8">
                <select name="warehouseCode" id="warehouse" class="form-control"
                        th:with="warehouseList=${@WarehouseService.getWarehouse()}">
                    <option th:each="warehouse : ${warehouseList}" th:text="${warehouse['name']}"
                            th:value="${warehouse['code']}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">货主编码 :</label>
            <div class="col-sm-8">
                <select name="companyCode" id="companyCode" class="form-control"
                        th:with="companyList=${@companyService.selectCompanyByUserId(0)}">
                    <option th:each="company : ${companyList}" th:text="${company['name']}"
                            th:value="${company['code']}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料编码:</label>

            <div class="col-sm-6">
                <input id="materialCode" name="materialCode" class="form-control" type="text" readonly="readonly">

            </div>
            <a class="btn  btn-primary btn-rounded " onclick="selectMaterial()">
                选择物料
            </a>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">最大:</label>
            <div class="col-sm-8">
                <input name="max" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">最小 :</label>
            <div class="col-sm-8">
                <input name="min" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">上限预警值
</label>
            <div class="col-sm-8">
                <input name="upper" class="form-control" type="number">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">下限预警值
</label>
            <div class="col-sm-8">
                <input name="lower" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">备注:</label>
            <div class="col-sm-8">
                <input name="remark" 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="user" name="userId" class="form-control" multiple></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>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    let prefix = ctx + "config/materialWarning";
    var prefix_material = ctx + "config/material";
    $("#form-warning-add").validate({
        focusCleanup: true,
        submitHandler: function () {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-warning-add').serializeArray());
            }
        }
    });

    $(function () {
        // $('#materialCode').select2({
        //     ajax: {
        //         url: ctx + 'config/material/getData',
        //         dataType: 'json',
        //         type: 'post',
        //         data: function (params) {
        //             let query = {
        //                 materialName: params.term,
        //             }
        //             return query;
        //         }
        //     },
        // });
        // let data = {
        //     "text" : "绘图纸,A0/880MM*50M/80G",
        //     "id": 10310100129
        // }
        // var newOption = new Option(data.text, data.id, false, false);
        // $('#materialCode').append(newOption).trigger('change');
    });

    /* 选择物料 */
    function selectMaterial() {
        var url = prefix_material + '/materialSelect';
        $.modal.open("选择物料", url);
    }

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