<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block 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-materialtypeinfo-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">物料类型ID：</label>
                <div class="col-sm-8">
                    <input name="materialTypeId" id="materialTypeId" 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 name="materialTypeName" id="materialTypeName" 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 name="workingProcedureId" id="workingProcedureId" class="form-control ">
                        <option value="">--请选择工序--</option>
                        <option name="cbWorkingProcedureInfo" th:each="workingProcedureId:${cbWorkingProcedureInfo}" th:value="${workingProcedureId.workingProcedureId}" th:text="${workingProcedureId.workingProcedureName}" th:disabled="${workingProcedureId.status == '1'}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" id="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "baseinfo/materialtypeinfo"
        $("#form-materialtypeinfo-add").validate({
            focusCleanup: true
        });

        function savematerialtypeinfo() {
            var formData = new FormData();
            formData.append('materialTypeId', $("#materialTypeId").val());
            formData.append('materialTypeName', $("#materialTypeName").val());
            formData.append('workingProcedureId', $.form.selectSelects("workingProcedureId"));
            formData.append('remark', $("#remark").val());
            $.ajax({
                url: prefix + "/add",
                type: 'post',
                cache: false,
                data: formData,
                processData: false,
                contentType: false,
                dataType: "json",
                success: function(result) {
                    $.operate.successCallback(result);
                }
            });
        };

        function submitHandler() {
            if ($.validate.form()) {
                savematerialtypeinfo();
                // $.operate.save(prefix + "/add", $('#form-materialtypeinfo-add').serialize());
            }
        }
    </script>
</body>
</html>