47 changed files with 2504 additions and 641 deletions
@ -0,0 +1,13 @@ |
|||
package com.dreamchaser.depository_manage.config; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class PortConfig { |
|||
// 接口地址
|
|||
public static String external_url = "http://172.20.2.87:39168"; |
|||
// public static String external_url = "http://127.0.0.1:39168";
|
|||
public static String external_url_6666 = "http://172.20.2.87:6666"; |
|||
// public static String external_url_6666 = "http://127.0.0.1:6666";
|
|||
|
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
package com.dreamchaser.depository_manage.pojo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.math.BigInteger; |
|||
|
|||
/** |
|||
* 出去库申请模板 |
|||
*/ |
|||
@Data |
|||
public class ApplicationModel { |
|||
/** |
|||
* 仓库名称 |
|||
*/ |
|||
private String depositoryName; |
|||
|
|||
/** |
|||
* 材料型号 |
|||
*/ |
|||
private String version; |
|||
/** |
|||
* 仓库编号 |
|||
*/ |
|||
private Integer depositoryId; |
|||
/** |
|||
* 材料名称 |
|||
*/ |
|||
private String mname; |
|||
/** |
|||
* 材料编号 |
|||
*/ |
|||
private Integer mid; |
|||
/** |
|||
* 申请人编号 |
|||
*/ |
|||
private Integer applicant; |
|||
|
|||
/** |
|||
* 材料编码 |
|||
*/ |
|||
private BigInteger code; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Double quantity; |
|||
|
|||
/** |
|||
* 备注说明 |
|||
*/ |
|||
private String applyRemark; |
|||
} |
|||
@ -0,0 +1,202 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>分步表单</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
<script id="toolbarDemo" type="text/html"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add">添加</button> |
|||
|
|||
</div> |
|||
</script> |
|||
|
|||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|||
|
|||
<script id="currentTableBar" type="text/html"> |
|||
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-subclass" lay-event="applicationIn">入库申请</a> |
|||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> |
|||
</script> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|||
<script> |
|||
layui.use(['form', 'step'], function () { |
|||
var $ = layui.$, |
|||
form = layui.form, |
|||
step = layui.step; |
|||
|
|||
|
|||
$("#code").blur(function () { |
|||
var code = $(this).val(); |
|||
$.ajax({ |
|||
url: "/material/findMatrialByCode?code=" + code, |
|||
type: "get", |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var d = d.data; |
|||
if(d == null){ |
|||
layer.msg("没有该编码,请确认是否输入正确"); |
|||
$("#openSonByMaterial").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
}else{ |
|||
$("#openSonByMaterial").val(d.mname); |
|||
$("#mid").val(d.id); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
$("#openSonByMaterial").blur(function () { |
|||
var data = $(this).val(); |
|||
var req = {}; |
|||
req.mname = data; |
|||
$.ajax({ |
|||
url: "/material/findMaterialByCondition", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data:JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
if(d.count > 1){ |
|||
layer.msg("请点击右侧搜索确定物品"); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
return false; |
|||
}else if(d.count === 0){ |
|||
layer.msg("没有该物品,请确认输入是否正确"); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#openSonByMaterial").val(""); |
|||
return false; |
|||
} |
|||
else{ |
|||
var material = d.data[0]; |
|||
$("#openSonByMaterial").val(material.mname) |
|||
$("#mid").val(material.id); |
|||
$("#code").val(material.code); |
|||
} |
|||
} |
|||
}); |
|||
}) |
|||
|
|||
$('#openSonByDepository').on('click', function () { |
|||
layer.open({ |
|||
type: 2, |
|||
title: '弹窗内容', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层 |
|||
area: ['800px', '500px'], |
|||
content: '/selectDepository?type=1', |
|||
}); |
|||
}); |
|||
|
|||
|
|||
$('#selectMaterial').on('click', function () { |
|||
var mname = $("#openSonByMaterial").val(); |
|||
layer.open({ |
|||
type: 2, |
|||
title: '弹窗内容', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层 |
|||
area: ['800px', '500px'], |
|||
content: '/selectMaterial?mname='+mname+'&type=1', |
|||
end: function () { |
|||
var mid = $("#mid").val(); |
|||
$.ajax({ |
|||
url: "/material/findMatrialById?mid=" + mid, |
|||
type: "get", |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var code = d.data.code |
|||
$("#code").val(code) |
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
step.render({ |
|||
elem: '#stepForm', |
|||
filter: 'stepForm', |
|||
width: '100%', //设置容器宽度 |
|||
stepWidth: '750px', |
|||
height: '600px', |
|||
stepItems: [{ |
|||
title: '填写信息' |
|||
}, { |
|||
title: '提交成功' |
|||
}] |
|||
}); |
|||
|
|||
|
|||
form.on('submit(formStep)', function (data) { |
|||
data = data.field; |
|||
data.type = 1; |
|||
$.ajax({ |
|||
url: "/depositoryRecord/applicationIn", |
|||
type: 'post', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(data), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.detail);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请提交成功", { |
|||
icon: 6,//成功的表情 |
|||
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|||
}, function () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
} |
|||
}, |
|||
complete: function () { |
|||
layer.close(this.layerIndex); |
|||
} |
|||
}) |
|||
return false; |
|||
}); |
|||
|
|||
form.on('submit(formStep2)', function (data) { |
|||
step.next('#stepForm'); |
|||
return false; |
|||
}); |
|||
|
|||
|
|||
$('.pre').click(function () { |
|||
step.pre('#stepForm'); |
|||
}); |
|||
|
|||
$('.next').click(function () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
|
|||
}) |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,273 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
<script id="toolbarDemo" type="text/html"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="delete">删除</button> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationIn">入库申请</button> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationOut">出库申请</button> |
|||
</div> |
|||
</script> |
|||
|
|||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|||
<script id="currentTableBar" type="text/html"> |
|||
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-subclass" lay-event="applicationIn">入库申请</a> |
|||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> |
|||
</script> |
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
var data; |
|||
layui.use(['form', 'table'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
table = layui.table; |
|||
|
|||
|
|||
table.render({ |
|||
elem: "#currentTableId", |
|||
url: '/depositoryRecord/applicant_multi_create', |
|||
parseData: function (res) { //res 即为原始返回的数据 |
|||
return { |
|||
"status": res.status, //解析接口状态 |
|||
"message": res.statusInfo.message, //解析提示文本 |
|||
"count": res.count, //解析数据长度 |
|||
"data": res.data //解析数据列表 |
|||
}; |
|||
}, |
|||
request: { |
|||
pageName: 'page', //页码的参数名称,默认:page |
|||
limitName: 'size' //每页数据量的参数名,默认:limit |
|||
}, |
|||
response: { |
|||
statusName: 'status' //规定数据状态的字段名称,默认:code |
|||
,statusCode: 200 //规定成功的状态码,默认:0 |
|||
,msgName: 'message' //规定状态信息的字段名称,默认:msg |
|||
,countName: 'count' //规定数据总数的字段名称,默认:count |
|||
,dataName: 'data' //规定数据列表的字段名称,默认:data |
|||
}, |
|||
toolbar: '#toolbarDemo', |
|||
cols: [ |
|||
[ |
|||
{type: "checkbox", width: 50}, |
|||
{field: 'mname', width: '10%', title: '材料名称'}, |
|||
{field: 'version', width: '10%', title: '规格型号'}, |
|||
{field: 'code',width: 200,title: '存货编码',sort: true}, |
|||
{field: 'depositoryName', width: '12%', title: '仓库名称'}, |
|||
{field: 'quantity', width: '10%', title: '数量',edit:'quantity'}, |
|||
{field: 'depositoryId', width: '10%', title: '仓库编号',edit:'quantity'}, |
|||
{field: 'applyRemark', width: '10%', title: '备注说明',edit:'applyRemark'}, |
|||
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} |
|||
] |
|||
], |
|||
limits: [10, 15, 20, 25, 50], |
|||
limit: 10, |
|||
page: true, |
|||
skin: 'line', |
|||
done:function () { |
|||
$("[data-field='id']").css('display','none'); |
|||
$("[data-field='depositoryId']").css('display','none'); |
|||
} |
|||
}); |
|||
|
|||
//监听表格复选框选择 |
|||
table.on('checkbox(currentTableFilter)', function (obj) { |
|||
console.log(obj) |
|||
}); |
|||
|
|||
table.on('edit(currentTableFilter)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
|||
console.log(obj.data); //所在行的所有相关数据 |
|||
}); |
|||
|
|||
/** |
|||
* toolbar监听事件 |
|||
*/ |
|||
table.on('toolbar(currentTableFilter)', function (obj) { |
|||
|
|||
var checkStatus = table.checkStatus('currentTableId') |
|||
, data = checkStatus.data; |
|||
var req = {}; |
|||
req.mids = []; |
|||
req.depositoryIds = []; |
|||
req.quantitys = []; |
|||
req.applyRemarks = []; |
|||
for (i = 0, len = data.length; i < len; i++) { |
|||
req.mids[i] = data[i].mid; |
|||
req.depositoryIds[i] = data[i].depositoryId; |
|||
req.quantitys[i] = data[i].quantity; |
|||
req.applyRemarks[i] = data[i].applyRemark; |
|||
} |
|||
if(obj.event==='delete'){ |
|||
if(req.mids > 0) { |
|||
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|||
$.ajax({ |
|||
url: "/depositoryRecord/deleteApplicationToRedis", |
|||
type: "post", |
|||
data: JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("删除成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function () { |
|||
//do something |
|||
window.location = "/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
}else{ |
|||
layer.msg("未选中记录,请确认!"); |
|||
return false; |
|||
} |
|||
} |
|||
else if(obj.event === 'applicationIn'){ |
|||
req.type = 'in'; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplications", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
else if(obj.event === 'applicationOut'){ |
|||
req.type = 'out'; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplications", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
|
|||
}); |
|||
|
|||
table.on('tool(currentTableFilter)', function (obj) { |
|||
let data = obj.data; |
|||
if (obj.event === 'applicationIn') { |
|||
// 入库申请 |
|||
var req = data; |
|||
req.type = "in"; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplication", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
else if(obj.event === 'applicationOut'){ |
|||
// 出库申请 |
|||
var req = data; |
|||
req.type = "out"; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplication", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
|
|||
|
|||
} |
|||
else if(obj.event === 'selectDepository'){ |
|||
console.log(data) |
|||
} |
|||
}); |
|||
}); |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,202 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>分步表单</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
<script id="toolbarDemo" type="text/html"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add">添加</button> |
|||
|
|||
</div> |
|||
</script> |
|||
|
|||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|||
|
|||
<script id="currentTableBar" type="text/html"> |
|||
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-subclass" lay-event="applicationIn">入库申请</a> |
|||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> |
|||
</script> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|||
<script> |
|||
layui.use(['form', 'step'], function () { |
|||
var $ = layui.$, |
|||
form = layui.form, |
|||
step = layui.step; |
|||
|
|||
|
|||
$("#code").blur(function () { |
|||
var code = $(this).val(); |
|||
$.ajax({ |
|||
url: "/material/findMatrialByCode?code=" + code, |
|||
type: "get", |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var d = d.data; |
|||
if(d == null){ |
|||
layer.msg("没有该编码,请确认是否输入正确"); |
|||
$("#openSonByMaterial").val(""); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
}else{ |
|||
$("#openSonByMaterial").val(d.mname); |
|||
$("#mid").val(d.id); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
$("#openSonByMaterial").blur(function () { |
|||
var data = $(this).val(); |
|||
var req = {}; |
|||
req.mname = data; |
|||
$.ajax({ |
|||
url: "/material/findMaterialByCondition", |
|||
type: "post", |
|||
dataType: 'json', |
|||
data:JSON.stringify(req), |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
if(d.count > 1){ |
|||
layer.msg("请点击右侧搜索确定物品"); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
return false; |
|||
}else if(d.count === 0){ |
|||
layer.msg("没有该物品,请确认输入是否正确"); |
|||
$("#mid").val(""); |
|||
$("#code").val(""); |
|||
$("#openSonByMaterial").val(""); |
|||
return false; |
|||
} |
|||
else{ |
|||
var material = d.data[0]; |
|||
$("#openSonByMaterial").val(material.mname) |
|||
$("#mid").val(material.id); |
|||
$("#code").val(material.code); |
|||
} |
|||
} |
|||
}); |
|||
}) |
|||
|
|||
$('#openSonByDepository').on('click', function () { |
|||
layer.open({ |
|||
type: 2, |
|||
title: '弹窗内容', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层 |
|||
area: ['800px', '500px'], |
|||
content: '/selectDepository?type=1', |
|||
}); |
|||
}); |
|||
|
|||
|
|||
$('#selectMaterial').on('click', function () { |
|||
var mname = $("#openSonByMaterial").val(); |
|||
layer.open({ |
|||
type: 2, |
|||
title: '弹窗内容', |
|||
skin: 'layui-layer-rim', |
|||
maxmin: true, |
|||
shadeClose: true, //点击遮罩关闭层 |
|||
area: ['800px', '500px'], |
|||
content: '/selectMaterial?mname='+mname+'&type=1', |
|||
end: function () { |
|||
var mid = $("#mid").val(); |
|||
$.ajax({ |
|||
url: "/material/findMatrialById?mid=" + mid, |
|||
type: "get", |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
var code = d.data.code |
|||
$("#code").val(code) |
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
step.render({ |
|||
elem: '#stepForm', |
|||
filter: 'stepForm', |
|||
width: '100%', //设置容器宽度 |
|||
stepWidth: '750px', |
|||
height: '600px', |
|||
stepItems: [{ |
|||
title: '填写信息' |
|||
}, { |
|||
title: '提交成功' |
|||
}] |
|||
}); |
|||
|
|||
|
|||
form.on('submit(formStep)', function (data) { |
|||
data = data.field; |
|||
data.type = 1; |
|||
$.ajax({ |
|||
url: "/depositoryRecord/applicationIn", |
|||
type: 'post', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(data), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.detail);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请提交成功", { |
|||
icon: 6,//成功的表情 |
|||
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|||
}, function () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
} |
|||
}, |
|||
complete: function () { |
|||
layer.close(this.layerIndex); |
|||
} |
|||
}) |
|||
return false; |
|||
}); |
|||
|
|||
form.on('submit(formStep2)', function (data) { |
|||
step.next('#stepForm'); |
|||
return false; |
|||
}); |
|||
|
|||
|
|||
$('.pre').click(function () { |
|||
step.pre('#stepForm'); |
|||
}); |
|||
|
|||
$('.next').click(function () { |
|||
step.next('#stepForm'); |
|||
}); |
|||
|
|||
}) |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,273 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
<script id="toolbarDemo" type="text/html"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="delete">删除</button> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationIn">入库申请</button> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationOut">出库申请</button> |
|||
</div> |
|||
</script> |
|||
|
|||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|||
<script id="currentTableBar" type="text/html"> |
|||
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-subclass" lay-event="applicationIn">入库申请</a> |
|||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库申请</a> |
|||
</script> |
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
var data; |
|||
layui.use(['form', 'table'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
table = layui.table; |
|||
|
|||
|
|||
table.render({ |
|||
elem: "#currentTableId", |
|||
url: '/depositoryRecord/applicant_multi_create', |
|||
parseData: function (res) { //res 即为原始返回的数据 |
|||
return { |
|||
"status": res.status, //解析接口状态 |
|||
"message": res.statusInfo.message, //解析提示文本 |
|||
"count": res.count, //解析数据长度 |
|||
"data": res.data //解析数据列表 |
|||
}; |
|||
}, |
|||
request: { |
|||
pageName: 'page', //页码的参数名称,默认:page |
|||
limitName: 'size' //每页数据量的参数名,默认:limit |
|||
}, |
|||
response: { |
|||
statusName: 'status' //规定数据状态的字段名称,默认:code |
|||
,statusCode: 200 //规定成功的状态码,默认:0 |
|||
,msgName: 'message' //规定状态信息的字段名称,默认:msg |
|||
,countName: 'count' //规定数据总数的字段名称,默认:count |
|||
,dataName: 'data' //规定数据列表的字段名称,默认:data |
|||
}, |
|||
toolbar: '#toolbarDemo', |
|||
cols: [ |
|||
[ |
|||
{type: "checkbox", width: 50}, |
|||
{field: 'mname', width: '10%', title: '材料名称'}, |
|||
{field: 'version', width: '10%', title: '规格型号'}, |
|||
{field: 'code',width: 200,title: '存货编码',sort: true}, |
|||
{field: 'depositoryName', width: '12%', title: '仓库名称'}, |
|||
{field: 'quantity', width: '10%', title: '数量',edit:'quantity'}, |
|||
{field: 'depositoryId', width: '10%', title: '仓库编号',edit:'quantity'}, |
|||
{field: 'applyRemark', width: '10%', title: '备注说明',edit:'applyRemark'}, |
|||
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} |
|||
] |
|||
], |
|||
limits: [10, 15, 20, 25, 50], |
|||
limit: 10, |
|||
page: true, |
|||
skin: 'line', |
|||
done:function () { |
|||
$("[data-field='id']").css('display','none'); |
|||
$("[data-field='depositoryId']").css('display','none'); |
|||
} |
|||
}); |
|||
|
|||
//监听表格复选框选择 |
|||
table.on('checkbox(currentTableFilter)', function (obj) { |
|||
console.log(obj) |
|||
}); |
|||
|
|||
table.on('edit(currentTableFilter)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
|||
console.log(obj.data); //所在行的所有相关数据 |
|||
}); |
|||
|
|||
/** |
|||
* toolbar监听事件 |
|||
*/ |
|||
table.on('toolbar(currentTableFilter)', function (obj) { |
|||
|
|||
var checkStatus = table.checkStatus('currentTableId') |
|||
, data = checkStatus.data; |
|||
var req = {}; |
|||
req.mids = []; |
|||
req.depositoryIds = []; |
|||
req.quantitys = []; |
|||
req.applyRemarks = []; |
|||
for (i = 0, len = data.length; i < len; i++) { |
|||
req.mids[i] = data[i].mid; |
|||
req.depositoryIds[i] = data[i].depositoryId; |
|||
req.quantitys[i] = data[i].quantity; |
|||
req.applyRemarks[i] = data[i].applyRemark; |
|||
} |
|||
if(obj.event==='delete'){ |
|||
if(req.mids > 0) { |
|||
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|||
$.ajax({ |
|||
url: "/depositoryRecord/deleteApplicationToRedis", |
|||
type: "post", |
|||
data: JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("删除成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function () { |
|||
//do something |
|||
window.location = "/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
}else{ |
|||
layer.msg("未选中记录,请确认!"); |
|||
return false; |
|||
} |
|||
} |
|||
else if(obj.event === 'applicationIn'){ |
|||
req.type = 'in'; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplications", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
else if(obj.event === 'applicationOut'){ |
|||
req.type = 'out'; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplications", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
|
|||
}); |
|||
|
|||
table.on('tool(currentTableFilter)', function (obj) { |
|||
let data = obj.data; |
|||
if (obj.event === 'applicationIn') { |
|||
// 入库申请 |
|||
var req = data; |
|||
req.type = "in"; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplication", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
} |
|||
else if(obj.event === 'applicationOut'){ |
|||
// 出库申请 |
|||
var req = data; |
|||
req.type = "out"; |
|||
$.ajax({ |
|||
url:"/depositoryRecord/createMultiApplication", |
|||
type:"post", |
|||
data:JSON.stringify(req), |
|||
dataType: "json", |
|||
contentType: "application/json;charset=utf-8", |
|||
success: function (d) { |
|||
layer.close(this.layerIndex); |
|||
if (d.status >= 300) { |
|||
layer.msg(d.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("申请成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 |
|||
}, //1秒关闭(如果不配置,默认是3秒) |
|||
function(){ |
|||
//do something |
|||
window.location="/application_multi" |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return false; |
|||
|
|||
|
|||
} |
|||
else if(obj.event === 'selectDepository'){ |
|||
console.log(data) |
|||
} |
|||
}); |
|||
}); |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue