checkWarehouse.html 3.51 KB
<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<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-taskDetail-add" th:object="${srmDetail}">
		<input id="companyName" name="companyName" th:field="*{companyName}"  type="hidden">
		<input id="headerId" name="headerId" th:field="*{headerId}"  type="hidden">
		<div class="form-group">
			<label class="col-sm-3 control-label">账套:</label>
			<div class="col-sm-8">
				<input id="companyCode" name="companyCode" class="form-control"  th:field="*{companyCode}" readonly="true">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">u8仓库:</label>
			<div class="col-sm-8">
				<select name="uWarehouseCode" id="uWarehouseCode"  class="form-control" >
					<option value="">所有</option>
					<option th:each="e : ${warehouse}" th:text="${e['uWarehouseName']}" th:value="${e['uWarehouseCode']}"></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>
<th:block th:include="include :: footer" />
<script type="text/javascript">
	var prefix = ctx + "srm/srmDetailNone"
	$("#form-taskDetail-add").validate({
		rules:{
			qualifiedQty:{
				required:true,
				min:0
			},
			unqualifiedQty:{
				required:true,
				min:0
			},
		},
		submitHandler: function(form) {
			$.ajax({
				cache: true,
				type: "POST",
				url: prefix + "/checkWarehouse",
				data: {
					"ids": $("input[name='companyName']").val(),
					"companyCode": $("input[name='companyCode']").val(),
					"uWarehouseCode":$("#uWarehouseCode option:selected").val(),
				},
				async : false,
				error : function(request) {
					$.modal.alertError("请求失败!");
				},
				success : function(data) {
					// $.operate.saveSuccess(data);
					ajaxSuccess(data);
				}
			});
		}
	});
	function ajaxSuccess(result) {
		if (result.code == web_status.SUCCESS) {
			$.modal.msgSuccess(result.msg);
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
			window.parent.$.table.search();
			$(parent.$("#detail2")).click();
		} else {
			$.modal.alertError(result.msg);
		}
		// $.modal.msgSuccess(result.msg);
		$.modal.closeLoading();
		window.parent.detail2(headerId)
	}

	var headerId=$("input[name='headerId']").val();

	$(function () {
		layui.use('laydate', function() {
			var laydate = layui.laydate;
			laydate.render({ elem: '#manufactureDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' });
			laydate.render({ elem: '#expirationDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' });
		});
	});


	$(function () {
		let companyCode=$("input[name='companyCode']").val();
		$.ajax({
			url: ctx + "srm/srmHeader/getwarehouse",
			type:'post',
			data:{code:companyCode},
			success:function (response) {
				if(response.code===200){
					$("select[name='uWarehouseCode']").children().remove();
					$("select[name='uWarehouseCode']").append(`<option value="">所有</option>`);
					for (let item of response.data) {
						let option=`<option value="${item.uWarehouseCode}">${item.uWarehouseName}</option>`;
						$("select[name='uWarehouseCode']").append(option);
					}
				}
				else {$.modal.msgError(response.msg)}
			}
		})
	})
</script>
</body>
</html>