<!DOCTYPE html>
< html >
< 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" >
< link rel = "stylesheet" href = "/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media = "all" >
< / head >
< body >
< style >
.clearfix:after, .clearfix:before {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
< / style >
< div class = "layui-bg-gray" >
< a id = "refresh" href = "javascript:" data-refresh = "刷新" > < i class = "fa fa-refresh" > < / i > < / a >
< fieldset class = "layui-elem-field layui-field-title" style = "padding: 10px;" >
< legend > 入库记录< / legend >
< ul id = "LAY_floor_in" class = "flow-default" style = "width: 100%" > < / ul >
< legend > 出库申请< / legend >
< ul id = "LAY_floor_out" class = "flow-default" style = "width: 100%" > < / ul >
< / fieldset >
< / 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 >
var data;
//先声明
function openDetailIn(data) {
};
function openDetailOut(data) {
};
function openDetailTaking(data){
};
layui.use(['flow', 'layer', 'flow', 'util'], function () {
var $ = layui.jquery,
layer = layui.layer,
flow = layui.flow,
util = layui.util;
let size = 8;
let inpre = 0;
let takingPre = 0;
let outpre = 0;
flow.load({
elem: '#LAY_floor_in' //流加载容器
, scrollElem: '#LAY_floor_in' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
$.get('/depositoryRecord/myApply?page=' + page + '& size=' + size, function (res) {
result = res.data;
applicationIn = result["applicationIn"];
InCount = result["InCount"];
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
lis.push("< div class = 'clearfix' > ")
for (let i = 0; i < applicationIn.length ; i + + ) {
lis.push('< li style = "width:' + Width + ';float:left;" > < div class = "layui-card my-shadow my-card flow1" onclick = "openDetailIn('
+ applicationIn[i].id + ')">< div class = "layui-card-header" > < h2 > '
+ applicationIn[i].applicantName + '的入库记录< / h2 > < / div > ')
lis.push('< div class = "layui-col-md4 my-time" style = "margin-left: 15px; color: #999;font-size: 12px;" > '
+ applicationIn[i].applicantTime + '< / div > < / div > < / li > ');
}
lis.push('< / div > ');
inpre += applicationIn.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), inpre < InCount ) ;
});
let lis1 = [];
$.get('/stockTaking/myApply?page=' + page + '& size=' + size, function (res) {
result = res.data;
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
for (let i=0;i< result.length ; i + + ) {
lis1.push('< li style = "width:'+ Width +';float:left;" > < div class = "layui-card my-shadow my-card flow1" onclick = "openDetailTaking('
+result[i].id+')">< div class = "layui-card-header" > < h2 > '
+result[i].originatorName+'的');
lis1.push('盘点记录< / h2 > < / div > ');
lis1.push('< div class = "layui-col-md4 my-time" style = "margin-left: 15px; color: #999;font-size: 12px;" > '
+result[i].createTime+'< / div > < / div > < / li > ');
}
lis1.push('< / div > ');
lis1.push('< hr class = "layui-border-black" > ')
takingPre+=result.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis1.join(''), takingPre < res.count ) ;
});
}
});
flow.load({
elem: '#LAY_floor_out' //流加载容器
, scrollElem: '#LAY_floor_out' //滚动条所在元素,一般不用填,此处只是演示需要。
, isAuto: false
, done: function (page, next) { //执行下一页的回调
let lis = [];
let result;
lis.push("< div class = 'clearfix' > ")
$.get('/depositoryRecord/myApply?page=' + page + '& size=' + size, function (res) {
result = res.data;
applicationOut = result["applicationOut"];
OutCount = result["OutCount"];
var Width = "25%";
if (isMobile()) {
Width = "50%";
}
lis.push("< div class = 'clearfix' > ")
for (let i = 0; i < applicationOut.length ; i + + ) {
lis.push('< li style = "width:' + Width + ';float:left;" > < div class = "layui-card my-shadow my-card flow1" onclick = "openDetailOut('
+ applicationOut[i].id + ')">< div class = "layui-card-header" > < h2 > '
+ applicationOut[i].applicantName + '的出库请求< / h2 > < / div > ')
lis.push('< div class = "layui-col-md4 my-time" style = "margin-left: 15px; color: #999;font-size: 12px;" > '
+ applicationOut[i].applicantTime + '< / div > < / div > < / li > ');
}
lis.push('< / div > ');
outpre += applicationOut.length;
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), outpre < OutCount ) ;
});
}
});
openDetailIn = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/form_step_look?id=' + item,
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailOut = function (item) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/ApplicationOutView?id=' + item,
});
$(window).on("resize", function () {
layer.full(index);
});
};
openDetailTaking = function (data) {
var index = layer.open({
title: '请求详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/StockTakingView?id='+data,
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
};
//定义一个函数判断是手机端还是pc端
function isMobile() {
if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
return true; // 移动端
} else {
return false; // PC端
}
}
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
});
< / script >
< / body >
< / html >
< / html >