mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2025-01-16 20:29:00 +08:00
其他入库修改
This commit is contained in:
parent
9ca2258257
commit
00bbbcf357
2 changed files with 10 additions and 114 deletions
|
@ -1,5 +1,3 @@
|
|||
var enclosureList = new Array(); //附件
|
||||
|
||||
var assetArticles = new Array(); //用品集合
|
||||
|
||||
layui.config({
|
||||
|
@ -7,7 +5,7 @@ layui.config({
|
|||
version: skyeyeVersion
|
||||
}).extend({ //指定js别名
|
||||
window: 'js/winui.window'
|
||||
}).define(['window', 'jquery', 'winui', 'fileUpload'], function(exports) {
|
||||
}).define(['window', 'jquery', 'winui'], function(exports) {
|
||||
winui.renderColor();
|
||||
layui.use(['form'], function(form) {
|
||||
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
||||
|
@ -139,14 +137,6 @@ layui.config({
|
|||
remark: $("#remark").val(),
|
||||
assetArticlesStr: JSON.stringify(tableData)
|
||||
};
|
||||
if(enclosureList.length == 0 || isNull($('#enclosureUploadBtn'))) {
|
||||
params.enclosureInfo = "";
|
||||
} else {
|
||||
$.each(enclosureList, function(i, item) {
|
||||
enclosureInfo += item.id + ',';
|
||||
});
|
||||
params.enclosureInfo = enclosureInfo;
|
||||
}
|
||||
//表单类型为保存为草稿
|
||||
params.subType = '1';
|
||||
AjaxPostUtil.request({url: reqBasePath + "assetarticles019", params: params, type: 'json', callback: function(json) {
|
||||
|
@ -161,78 +151,6 @@ layui.config({
|
|||
return false;
|
||||
});
|
||||
|
||||
form.on('submit(formSubBean)', function(data) {
|
||||
//表单验证
|
||||
if(winui.verifyForm(data.elem)) {
|
||||
//获取已选用品数据
|
||||
var rowTr = $("#useTable tr");
|
||||
if(rowTr.length == 0) {
|
||||
winui.window.msg('请选择需要领用的用品~', {icon: 2, time: 2000});
|
||||
return false;
|
||||
}
|
||||
var tableData = new Array();
|
||||
var noError = false; //循环遍历表格数据时,是否有其他错误信息
|
||||
$.each(rowTr, function(i, item) {
|
||||
var rowNum = $(item).attr("trcusid").replace("tr", "");
|
||||
var residualNum = parseInt($("#residualNum" + rowNum).html());
|
||||
if(parseInt($("#useNum" + rowNum).val()) == 0) {
|
||||
$("#useNum" + rowNum).addClass("layui-form-danger");
|
||||
$("#useNum" + rowNum).focus();
|
||||
winui.window.msg('领用数量不能为0', {icon: 2, time: 2000});
|
||||
noError = true;
|
||||
return false;
|
||||
}
|
||||
if(parseInt($("#useNum" + rowNum).val()) > residualNum) {
|
||||
$("#useNum" + rowNum).addClass("layui-form-danger");
|
||||
$("#useNum" + rowNum).focus();
|
||||
winui.window.msg('领用数量不能超过库存数量', {icon: 2, time: 2000});
|
||||
noError = true;
|
||||
return false;
|
||||
}
|
||||
if(inTableDataArrayByAssetarId($("#assetarId" + rowNum).val(), tableData)){
|
||||
winui.window.msg('领用单存在相同的用品', {icon: 2, time: 2000});
|
||||
noError = true;
|
||||
return false;
|
||||
}
|
||||
var row = {
|
||||
typeId: $("#typeId" + rowNum).val(),
|
||||
assetarId: $("#assetarId" + rowNum).val(),
|
||||
useNum: $("#useNum" + rowNum).val(),
|
||||
remark: $("#remark" + rowNum).val()
|
||||
};
|
||||
tableData.push(row);
|
||||
});
|
||||
if(noError) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var params = {
|
||||
title: $("#useTitle").html(),
|
||||
remark: $("#remark").val(),
|
||||
assetArticlesStr: JSON.stringify(tableData)
|
||||
};
|
||||
if(enclosureList.length == 0 || isNull($('#enclosureUploadBtn'))) {
|
||||
params.enclosureInfo = "";
|
||||
} else {
|
||||
$.each(enclosureList, function(i, item) {
|
||||
enclosureInfo += item.id + ',';
|
||||
});
|
||||
params.enclosureInfo = enclosureInfo;
|
||||
}
|
||||
//表单类型为提交审批
|
||||
params.subType = '2';
|
||||
AjaxPostUtil.request({url: reqBasePath + "assetarticles019", params: params, type: 'json', callback: function(json) {
|
||||
if(json.returnCode == 0) {
|
||||
parent.layer.close(index);
|
||||
parent.refreshCode = '0';
|
||||
} else {
|
||||
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
|
||||
}
|
||||
}});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//判断选中的用品是否也在数组中
|
||||
function inTableDataArrayByAssetarId(str, array) {
|
||||
var isIn = false;
|
||||
|
@ -287,23 +205,6 @@ layui.config({
|
|||
}
|
||||
}
|
||||
|
||||
//附件上传
|
||||
$("body").on("click", "#enclosureUploadBtn", function() {
|
||||
_openNewWindows({
|
||||
url: "../../tpl/common/enclosureupload.html",
|
||||
title: "上传附件",
|
||||
pageId: "enclosureuploadpage",
|
||||
area: ['420px', '420px'],
|
||||
callBack: function(refreshCode) {
|
||||
var str = "";
|
||||
$.each([].concat(enclosureList), function(i, item) {
|
||||
str += '<br><a rowid="' + item.id + '" class="enclosureItem" rowpath="' + item.fileAddress + '" href="javascript:;" style="color:blue;">' + item.name + '</a>';
|
||||
});
|
||||
$("#enclosureUploadBtn").parent().html('<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" id="enclosureUploadBtn">附件上传</button>' + str);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//根据类型重置用户列表
|
||||
function resetAssetList(thisRowNum, list) {
|
||||
var sHtml = getDataUseHandlebars(selOption, {
|
||||
|
|
|
@ -41,11 +41,13 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>用品类别</th>
|
||||
<th>用品名称</th>
|
||||
<th style="min-width: 100px;">规格(单位)</th>
|
||||
<th style="min-width: 50px;">库存</th>
|
||||
<th style="min-width: 50px;">领用数量</th>
|
||||
<th>仓库</th>
|
||||
<th>产品(型号)</th>
|
||||
<th>单位</th>
|
||||
<th style="width: 50px;">库存</th>
|
||||
<th style="width: 50px;">数量</th>
|
||||
<th style="width: 50px;">单价</th>
|
||||
<th style="width: 50px;">金额</th>
|
||||
<th>备注</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -60,17 +62,10 @@
|
|||
<textarea id="remark" name="remark" placeholder="请输入相关描述" class="layui-textarea" style="height: 100px;" maxlength="200"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-col-xs12">
|
||||
<label class="layui-form-label">相关附件</label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" id="enclosureUploadBtn">附件上传</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-col-xs12">
|
||||
<div class="layui-input-block">
|
||||
<button class="winui-btn" id="cancle">取消</button>
|
||||
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存为草稿</button>
|
||||
<button class="winui-btn" lay-submit lay-filter="formSubBean">提交审批</button>
|
||||
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -92,7 +87,7 @@
|
|||
<script src="../../assets/lib/layui/layui.js"></script>
|
||||
<script src="../../assets/lib/layui/custom.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({base: '../../js/assetarticles/'}).use('assetarticlesuseadd');
|
||||
layui.config({base: '../../js/otherwarehous/'}).use('otherwarehousadd');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue