edit.html 4.41 KB
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<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-edit" th:object="${materialWarning}">
        <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">
                <select name="alarmType" class="form-control m-b" required th:with="alarmTypeList=${@alarmTypeService.getData()}" th:field="*{alarmType}">
                    <option th:each="alarmType : ${alarmTypeList}" th:text="${alarmType['type']}"
                            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()}" th:field="*{warehouseCode}">
					<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:field="*{companyCode}"
						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-8">
				<select id="materialCode" name="materialCode" class="form-control"></select>
			</div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">最大:</label>
            <div class="col-sm-8">
                <input name="max" th:field="*{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" th:field="*{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" th:field="*{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" th:field="*{lower}" 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="username" th:field="*{username}" class="form-control" type="text">
            </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 th:inline="javascript">
    var prefix = ctx + "config/materialWarning";
    $("#form-warning-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-warning-edit').serialize());
        }
    }

	$('#materialCode').select2({
		ajax: {
			url: ctx + 'config/material/getData',
			dataType: 'json',
			type: 'post',
			data: function (params) {
				let query = {
					materialName: params.term,
				}
				return query;
			}
		}
	});
</script>
</body>
</html>