GZMachinesWeb/WebContent/WEB-INF/views/ma/toFixedAssets.jsp

160 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.bonus.core.DateTimeHelper"%>
<!DOCTYPE html >
<html lang="en">
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<link rel="stylesheet" href="${bonuspath}/static/plugins/zTree/3.5/zTreeStyle.css" />
<link rel="stylesheet" href="${bonuspath}/static/plugins/jedate/skin/gray.css" />
<script src="${bonuspath}/static/plugins/zTree/3.5/jquery.ztree.core-3.5.min.js"></script>
<script type="text/javascript" src="${bonuspath}/static/plugins/jedate/jedate.js"></script>
<script type="text/javascript" src="${bonuspath}/static/plugins/jquery.jqprint-0.3.js"></script>
<title>Insert title here</title>
</head>
<style>
html,body{
width:100%;
height:100%;
margin: 0;
padding: 0;
}
</style>
<body>
<form id="form" class="form-inline" method="POST" onsubmit="return false;">
<table cellspacing="0" cellpadding="0" border="0" class="customTable">
<tbody id="mainDiv">
<!-- <tr style="display:none">
<td colspan="2" class="ui-state-error"><input type="hidden" name="batchId" ></td>
</tr>
<tr class="FormData">
<td class="CaptionTD">固资编号:</td>
<td class="DataTD">&nbsp;
<input type="text" name="fixedAssetsNum" id="fixedAssetsNum" class="FormElement ui-widget-content ui-corner-all">
</td>
</tr>
<tr class="FormData">
<td class="CaptionTD"></font>ERP编号</td>
<td class="DataTD">&nbsp;
<input type="text" name="erpNum" id="erpNum" class="FormElement ui-widget-content ui-corner-all">
</td>
</tr> -->
</tbody>
</table>
<input class="btn btn-info" style="width: 120px;margin-left: 35%;" type="button" value="保存" onclick="writeInfo()" />
</form>
<script type="text/javascript">
var batchId = localStorage.getItem("fixedId");
var bonuspath = localStorage.getItem("bonuspath");
var assetNum = localStorage.getItem("assetNum");
var erpNum = localStorage.getItem("erpNum");
index();
function index(){
$("#fixedAssetsNum").val(assetNum);
$("#erpNum").val(erpNum);
$("#mainDiv").html("");
$("#mainDiv").empty();
var html = "";
html+="<tr style='display:none'>";
html+="<td colspan='2' class='ui-state-error'><input type='hidden' name='batchId' ></td>";
html+="</tr> ";
html+="<tr class='FormData'> ";
html+="<td class='CaptionTD'>固资编号:</td> ";
html+="<td class='DataTD'>&nbsp; ";
html+="<input type='text' name='fixedAssetsNum' value='"+ assetNum +"' id='fixedAssetsNum' class='FormElement ui-widget-content ui-corner-all'> ";
html+="</td> ";
html+="</tr> ";
html+="<tr class='FormData'> ";
html+="<td class='CaptionTD'></font>ERP编号</td> ";
html+="<td class='DataTD'>&nbsp; ";
html+="<input type='text' name='erpNum' id='erpNum' value='"+ erpNum +"' class='FormElement ui-widget-content ui-corner-all'> ";
html+="</td> ";
html+="</tr>";
$("#mainDiv").append(html);
}
function writeInfo(){
$.ajax({
type: "POST",
url: bonuspath + "/backstage/machine/update",
data: {
id : batchId,
isFixedAssets : 1,
assetNum : $("#fixedAssetsNum").val(),
erpNum: $("#erpNum").val()
},
dataType : "json",
success: function(data){
var res = JSON.stringify(data.res);
if(res == 1 || res == '1'){
layer.alert('资料填写完成', {
skin: 'layui-layer-lan'
,closeBtn: 0
,anim: 4 //动画类型
});
var index=parent.layer.getFrameIndex(window.name);
parent.layer.close(index); //疯狂模式,关闭所有层
window.parent.setLoad();
/* var batchId = data.obj.id;
var isFixedAssets = data.obj.isFixedAssets;
var assetsNum = data.obj.fixedAssetsNum;
var erpNum = data.obj.erpNum;
findDeviceNum(batchId,isFixedAssets,fixedAssetsNum,erpNum); */
}
}
});
}
function findDeviceNum(batchId,isFixedAssets,fixedAssetsNum,erpNum){
$.ajax({
type: "POST",
url: bonuspath + "/backstage/machine/findDeviceByBatchId",
data: {
batchId : batchId
},
dataType : "json",
success: function(data){
var res = data.obj.list;
var deviceNum;
if(res != null || res.length>0){
for(var i = 0;i<res.length;i++){
deviceNum = res[i].deviceNum;
updateMachinesByFixed(deviceNum,isFixedAssets,fixedAssetsNum,erpNum)
}
}
}
});
}
function updateMachinesByFixed(deviceNum,isFixedAssets,fixedAssetsNum,erpNum){
$.ajax({
type: "POST",
url: bonuspath + "/backstage/machines/updByFixed",
data: {
deviceNum : deviceNum,
isFixedAssets : isFixedAssets,
fixedAssetsNum : fixedAssetsNum,
erpNum: erpNum
},
dataType : "json",
success: function(data){
var index=parent.layer.getFrameIndex(window.name);
parent.layer.close(index); //疯狂模式,关闭所有层
window.parent.setLoad();
}
});
}
</script>
</body>
</html>