<!DOCTYPE html>
|
<html>
|
|
<head>
|
<meta charset="UTF-8" />
|
<meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
|
<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> -->
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
<title>Boxline PDA</title>
|
|
<link rel="stylesheet" href="/layui/css/layui.css" />
|
<link rel="stylesheet" href="/css/style.css" />
|
<script src="/js/adaptive.js"></script>
|
|
<link rel="stylesheet" href="/css/my.css" />
|
<style type="text/css">
|
.layout-bill-info {
|
height: auto;
|
/* background-color: #009E94; */
|
}
|
|
.layout-tbl-submit {
|
margin-top: 10px;
|
}
|
|
/* .out-scatter-num {
|
background-color: #009688;
|
|
} */
|
.out-scatter-num .local-input {
|
width: 40%;
|
height: 25px;
|
float: left;
|
}
|
|
.out-scatter-num .local-ok button {
|
height: 25px;
|
border: 0;
|
color: #FFFFFF;
|
background-color: #0a93e3;
|
border-radius: 3px;
|
padding: 2px;
|
margin-left: 10px;
|
width: 100%;
|
}
|
|
.out-scatter-num .layui-input-block {
|
width: 100%;
|
/* background-color: #009E94; */
|
margin-left: 0;
|
}
|
|
.out-scatter-num .local-ok {
|
width: 20%;
|
height: 25px;
|
float: left;
|
}
|
|
.btn-ok-blue {
|
border: none;
|
color: #FFFFFF;
|
background-color: #0a93e3;
|
width: 48%;
|
height: 36px;
|
border-radius: 5px;
|
}
|
|
.btn-ok-red {
|
border: none;
|
color: #FFFFFF;
|
background-color: #9f1707;
|
width: 48%;
|
height: 36px;
|
border-radius: 5px;
|
}
|
|
.btn-ok-blue:active {
|
opacity: 0.8;
|
}
|
|
.btn-ok-red:active {
|
opacity: 0.8;
|
}
|
|
.layout-tbl-paging {
|
margin-top: 20px;
|
}
|
|
.foot-container {
|
text-align: center;
|
}
|
|
.layout-tab-page {
|
height: auto;
|
}
|
|
.layui-form-checkbox {
|
margin: auto;
|
/* padding-left: 2px; */
|
/* padding-right: 2px; */
|
}
|
|
.div-tbl-title {
|
width: 98%;
|
margin: auto;
|
/* background-color: #4476A7; */
|
height: 30px;
|
}
|
|
.div-tbl-title table {
|
width: 100%;
|
height: 30px;
|
}
|
|
td {
|
word-break: break-all;
|
word-wrap: break-word;
|
}
|
|
.layui-input-block .layui-input,
|
.layui-input-block .layui-textarea {
|
padding-left: 0rem;
|
font-size: 13px;
|
}
|
|
.lableWidth {
|
width: 17%;
|
}
|
|
.layui-input-block {
|
width: 83%;
|
margin-left: 17%;
|
}
|
|
.layui-form-switch {
|
margin-top: 0;
|
}
|
</style>
|
<link rel="stylesheet" href="/css/adapter.css" />
|
</head>
|
|
<body>
|
<div id="" class="main-content">
|
<div id="" class="layout-title">
|
<table border="" cellspacing="" cellpadding="">
|
<tr>
|
<td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td>
|
<td class="title-text">拣货出库</td>
|
<td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td>
|
</tr>
|
</table>
|
</div>
|
<div id="" class="layout-sub-content">
|
<div id="menuList" class="menu">
|
<ul class="" style="text-align: center;">
|
<li><a href="../index.html">主页</a></li>
|
<li><a href="../login.html">重新登录</a></li>
|
</ul>
|
</div>
|
|
<div id="" class="layout-bill-info">
|
<form class="layui-form" action="" style="height: auto;">
|
|
<div id="layout-bill" class="layui-form-item layout-dropdownlist">
|
<label class="layui-form-label lableWidth">出库单:</label>
|
<div class="layui-input-block" id="selectDiv">
|
<select id="bar" lay-filter="getbar" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="/assets/down_arraw.png">
|
</div>
|
</div>
|
<div id="layout-skuLotNo" class="layui-form-item layout-dropdownlist">
|
<label class="layui-form-label lableWidth">物料 - 批次:</label>
|
<div class="layui-input-block">
|
<select id="skuLotNo" lay-filter="getSkuLotNo" lay-search>
|
<option value=""></option>
|
</select>
|
<img src="/assets/down_arraw.png">
|
</div>
|
</div>
|
<div id="" class="layout-tab-page">
|
<table class="tbl-box-sim-info" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 50%;">计划数量:</label>
|
<div class="layui-input-block" style="width: 50%;margin-left:50%;">
|
<input id="planQty" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 50%">完成数量:</label>
|
<div class="layui-input-block" style="width: 50%;margin-left:50%;">
|
<input id="finishQty" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
|
</td>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 34%;">出库口:</label>
|
<div class="layui-input-block" style="width: 66%;margin-left:34%;">
|
<input id="outModel" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<tr>
|
<td colspan="3">
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 17%;">规格:</label>
|
<div class="layui-input-block" style="width: 83%;margin-left:17%;">
|
<input id="standard" type="text" lay-verify="" disabled placeholder=""
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
|
</tr>
|
</table>
|
</div>
|
|
<div id="layout-pallet" class="layui-form-item layout-input">
|
<label class="layui-form-label lableWidth">托盘条码:</label>
|
<div class="layui-input-block">
|
<input id="palletNo" type="text" lay-verify="stock" placeholder="请扫描托盘条码" autocomplete="off"
|
class="layui-input" style="height:24px">
|
</div>
|
</div>
|
<div id="" class="layui-form-item layout-input">
|
<label class="layui-form-label" lang>是否整托出库:</label>
|
<div class="layui-input-block">
|
<input type="checkbox" name="IsZhengTuo" id="IsZhengTuo" lay-skin="switch" lay-text="是|否"
|
lay-filter="IsZhengTuo">
|
</div>
|
</div>
|
<div id="BoxDIv" class="layout-tab-page">
|
<table class="layout-tab-content" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<div class="layui-form-item layout-input">
|
<label class="layui-form-label lableWidth">外箱条码:</label>
|
<div class="layui-input-block">
|
<input id="boxNo" type="text" placeholder="请扫描外箱条码" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
<!-- <tr>
|
<td>
|
<div class="layui-form-item layout-input" style="margin-top: 6px;">
|
<label class="layui-form-label lableWidth">内箱条码:</label>
|
<div class="layui-input-block">
|
<input id="boxNo2" type="text" placeholder="请扫描外箱条码" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr> -->
|
<tr>
|
<td>
|
<div class="layui-form-item layout-input" style="margin-top: 6px;">
|
<label class="layui-form-label lableWidth">追溯条码:</label>
|
<div class="layui-input-block">
|
<input id="boxNo3" type="text" lang langholder placeholder="请扫描追溯条码"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
</td>
|
</tr>
|
</table>
|
</div>
|
<div id="" class="layout-tab-page">
|
<table class="layout-tab-content" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<table class="tbl-box-sim-info" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label lableWidth">待拣数量:</label>
|
<div class="layui-input-block">
|
<input id="pickQty" type="text" lay-verify="" disabled
|
placeholder="" class="layui-input">
|
</div>
|
</div>
|
</td>
|
<td>
|
<div class="layui-form-item">
|
<label class="layui-form-label lableWidth">已拣数量:</label>
|
<div class="layui-input-block">
|
<input id="pickedQty" type="text" lay-verify="" disabled
|
placeholder="" class="layui-input">
|
</div>
|
</div>
|
</td>
|
<!-- <td>
|
<div class="layui-form-item ">
|
<label class="layui-form-label lableWidth">箱内数量:</label>
|
<div class="layui-input-block">
|
<input id="boxQty" class="layui-input" style="border: 0;"
|
type="text" lay-verify="" disabled placeholder="">
|
</div>
|
</div>
|
</td> -->
|
</tr>
|
</table>
|
</td>
|
</tr>
|
</table>
|
<table class="layout-tab-content">
|
<tr>
|
<td style="width: 33%;"></td>
|
<td>
|
<button class="layout-btn layout-btn-red" lang type="button" lay-submit
|
lay-filter="formPickScatter">拣货</button>
|
</td>
|
<td style="width: 33%;"></td>
|
<!-- <td>
|
<div id="layout-qty" class="layui-form-item out-scatter-num" style="margin-top: 15px;">
|
<label class="layui-form-label lableWidth" >拣货数量:</label>
|
<div id="" class="local-input">
|
<div class="layui-input-block">
|
<input id="qty" type="number" placeholder="请输入拣货数量"
|
autocomplete="off" class="layui-input" style="padding-left:0.1rem;"
|
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
|
</div>
|
</div>
|
<div id="" class="local-ok">
|
<button type="button" lay-submit lay-filter="formPickScatter">确认</button>
|
</div>
|
</div>
|
</td> -->
|
</tr>
|
</table>
|
<div id="" style="text-align: right;margin-top: 10px;">
|
<div id="" class="cut-line">
|
<img src="/assets/fengexian.png">
|
</div>
|
</div>
|
</div>
|
|
</form>
|
</div>
|
|
<div class="layout-tbl-paging" id="">
|
<table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
|
<tr id="tableHead">
|
<th style="width: 54%;">容器编码</th>
|
<th style="width: 20%;">箱内<br>数量</th>
|
<th style="width: 20%;">已拣<br>数量</th>
|
<!-- <th style="width: 14%;">已拣<br>数量</th> -->
|
<!-- <th style="width: 8%;">拣货</th> -->
|
</tr>
|
<tr id="boxCell" style="display: none;">
|
<td name="boxNo">AG000001</td>
|
<td name="qty">30</td>
|
<td name="pickedQty">30</td>
|
</tr>
|
</table>
|
|
<!-- 分页 -->
|
<table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
|
<tr>
|
<td class="page-prev">上一页</td>
|
<td class="page-num page-num-select">1</td>
|
<td class="page-num">2</td>
|
<td class="page-num">3</td>
|
<td class="page-num">4</td>
|
<td class="page-num">5</td>
|
<td class="page-next">下一页</td>
|
</tr>
|
</table>
|
</div>
|
</div>
|
|
</div>
|
|
|
<script src="/js/jquery-3.5.1.min.js"></script>
|
<script src="/layui/layui.js"></script>
|
<script src="/js/jquery.cookie.js"></script>
|
<script src="/js/public.js"></script>
|
|
<script>
|
layui.use(['form', 'jquery'], function () {
|
var form = layui.form;
|
|
//当前分页
|
var curPageIndex = 1
|
//是否整托拣货
|
var isContinue = "0";
|
var tableData = null
|
var canPickBox = true
|
$("#palletNo").focus();//光标默认选中
|
|
function clear1() {
|
$('#outModel').val("");//出库口
|
$('#standard').val("");//规格
|
|
$('#pickQty').val("");//待拣数量
|
$('#pickedQty').val("");//已拣数量
|
}
|
function clear2() {
|
//物料批次
|
$("#skuLotNo").empty()
|
$("#skuLotNo").append('<option value =>' + '</option>');
|
form.render('select');
|
}
|
function clear3() {
|
$("#planQty").val(""); //计划数量
|
$("#finishQty").val("");//完成数量
|
}
|
function clear4() {
|
$('#boxNo').val("");//箱码
|
$('#boxQty').val("");//箱内数量
|
}
|
//当托盘条码输入框文本改变时,检查一下托盘状态
|
$("#palletNo").on('input', function () {
|
|
if ($("#palletNo").val() == "" || $("#palletNo").val().length < 8) {
|
return
|
}
|
if ($("#palletNo").val().length >= 8) {
|
$("#palletNo").val($("#palletNo").val().substr(-8))
|
}
|
checkPalletState()
|
})
|
|
form.on('switch(IsZhengTuo)', function (obj) {
|
if (obj.elem.checked) {
|
$('#BoxDIv').attr("style", "display:none")
|
isContinue="1";
|
} else {
|
$('#BoxDIv').attr("style", "display:block")
|
isContinue="0";
|
}
|
$('#boxNo').val("");
|
$('#boxNo3').val("");
|
});
|
|
//箱码文本框回车事件
|
$("#boxNo").blur(function () {
|
GetBoxInfo();
|
|
});
|
// $("#boxNo2").blur(function () {
|
// GetBoxInfo();
|
// });
|
$("#boxNo3").blur(function () {
|
|
GetBoxInfo();
|
});
|
|
//检查托盘状态
|
function checkPalletState() {
|
|
var param = {
|
"PalletNo": $("#palletNo").val()
|
}
|
synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) {
|
|
if (res.code == 0) { //成功
|
updateBillList();
|
if ($('#bar').val() == "") {
|
clear1();
|
return;
|
} else {
|
updateSkuLotNoList();
|
updateQtyList();
|
getBar();
|
GetBoxInfo();
|
}
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
//下拉单据选中后事件
|
form.on('select(getbar)', function (data) {
|
if ($('#palletNo').val() == "") {
|
layer.msg("请输入托盘条码", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
//回调
|
});
|
return
|
}
|
if ($('#bar').val() == "") {
|
clear1();
|
clear2();
|
clear3();
|
return
|
}
|
updateSkuLotNoList();
|
updateQtyList();
|
getBar();
|
GetBoxInfo();
|
});
|
//下拉物料批次选中后事件
|
form.on('select(getSkuLotNo)', function (data) {
|
if ($('#palletNo').val() == "") {
|
layer.msg("请输入托盘条码", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
clear1();
|
clear3();
|
});
|
return
|
}
|
if ($('#skuLotNo').val() == "") {
|
clear1();
|
clear3();
|
return
|
}
|
updateQtyList();
|
getBar();
|
GetBoxInfo();
|
});
|
|
//初始化渲染 出库单
|
function updateBillList() {
|
|
$("#bar").empty()
|
$("#bar").append('<option value =>' + '</option>');
|
form.render('select');
|
|
var param = {
|
PalletNo: $("#palletNo").val(),
|
};
|
synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
console.log(res.data);
|
for (var i = 0; i < res.data.length; i++) {
|
if (i == 0) {
|
$("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>');
|
} else {
|
$("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
|
}
|
}
|
form.render('select');
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
}
|
});
|
}
|
|
//初始化渲染 物料-批次
|
function updateSkuLotNoList() {
|
clear2();
|
|
var param = {
|
PalletNo: $("#palletNo").val(),
|
SoNo: $("#bar").val(),
|
};
|
synData(IP + "/PdaSo/GetSoSkuLotNoListByPallet", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
if (i == 0) {
|
$("#skuLotNo").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>');
|
|
} else {
|
$("#skuLotNo").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>');
|
}
|
}
|
form.render('select');
|
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
|
//初始化渲单据的计划数量和完成数量
|
function updateQtyList() {
|
clear3();
|
var param = {
|
SoDetailId: $("#skuLotNo").val(),
|
};
|
synData(IP + "/PdaSo/GetPlanAndFinishQty", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
console.log(res.data);
|
$("#planQty").val(res.data.PlanQty)
|
$("#finishQty").val(res.data.FinishQty)
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
|
//根据单据获取出库口
|
function getBar() {
|
clear1();
|
|
var param = {
|
PalletNo: $("#palletNo").val(),
|
SoDetailId: $("#skuLotNo").val(),
|
}
|
synData(IP + "/PdaSo/GetOutlets", param, 'post', function (res) {
|
if (res.code == 0) { //成功
|
let data = res.data
|
console.log(res.data);
|
$('#outModel').val(res.data.OutModel);
|
$('#standard').val(res.data.Standard);
|
|
$('#pickQty').val(res.data.PickQty);
|
$('#pickedQty').val(res.data.PickedQty);
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
|
}
|
|
//渲染表格数据
|
function refreshTable(list) {
|
//先清空一下信息列表
|
let trs = $("#tableBoxList tr")
|
let len = trs.length
|
//console.log("tr 数量 + " + trs.length)
|
for (i = len - 1; i >= 2; i--) {
|
trs[i].remove();
|
}
|
|
console.log(list != null);
|
console.log(list);
|
if (list != null && list.length > 0) { //成功
|
|
var arrTrs = new Array()
|
let idx = 0
|
for (var i in list) {
|
// list[i].BoxCode
|
var tr = $("#boxCell").eq(0).clone();
|
tr.appendTo("#tableBoxList");
|
// tr.attr('id', list[i].BoxCode)
|
idx++;
|
tr.attr('index', idx)
|
// tr.find("td[name='skuNo']").attr('style', 'max-width:90px;');
|
// tr.find("td[name='skuName']").attr('style', 'max-width:120px;');
|
tr.find("td[name='boxNo']").html(list[i].BoxNo);
|
tr.find("td[name='qty']").html(list[i].Qty);
|
tr.find("td[name='pickedQty']").html(list[i].PickedQty);
|
|
tr.show();
|
arrTrs[i] = tr
|
}
|
setPages(1, list.length)
|
canPickBox = true
|
|
} else { //不成功
|
layer.msg("无数据", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
// $("#boxNum").val(0)
|
setPages(1, 0)
|
}
|
}
|
|
//获取托盘物料名细
|
function GetBoxInfo() {
|
let param2 = {
|
"SoDetailId": $("#skuLotNo").val(),
|
"PalletNo": $("#palletNo").val(),
|
"BoxNo": $("#boxNo").val(),
|
"BoxNo3": $("#boxNo3").val(),
|
}
|
synData(IP + "/PdaSo/GetDataComBoxInfo", param2, 'post', function (res) {
|
if (res.code == 0) {
|
tableData = deepCopy(res.data)
|
|
refreshTable(tableData)
|
} else {
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
}
|
|
//单拣货(确认按钮)
|
form.on('submit(formPickScatter)', function (data) {
|
|
if ($('#bar').val() == "") {
|
layer.msg("请选择出库单", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}); return;
|
}
|
if ($('#bar').val() == "") {
|
layer.msg("请选择物料-批次", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}); return;
|
}
|
if ($('#palletNo').val() == "") {
|
layer.msg("请输入托盘码", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}); return;
|
}
|
if(isContinue=="0"){
|
if ($('#boxNo').val() == "") {
|
layer.msg("请输入箱码", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}); return;
|
}
|
if ($('#boxQty').val() == "") {
|
layer.msg("箱内数量为空,不能拣货", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
}
|
// let boxQty = parseInt($('#boxQty').val())
|
// let qty = parseInt($('#qty').val())
|
// if (qty <= 0 || qty > boxQty) {
|
// layer.msg("拣货数量需大于0,并且不能超过待拣箱内数量", {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// });
|
// return;
|
// }
|
|
if (canPickBox == false) {
|
|
layer.msg("请求未完成,不要重复请求", {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
});
|
return;
|
}
|
|
reqPickScatter()
|
|
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
});
|
|
//确认拣货
|
function reqPickScatter() {
|
var param = {
|
"SoNo": $("#bar").val(),
|
"SoDetailId": $("#skuLotNo").val(),
|
"PalletNo": $('#palletNo').val(),
|
"BoxNo": $('#boxNo').val(),
|
"BoxNo3": $('#boxNo3').val(),
|
}
|
sendData(IP + "/PdaSo/SoSetPick", param, 'post', function (res) {
|
//console.log(res);
|
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
canPickBox = true//回调
|
$("#boxNo").val('');
|
$("#boxNo3").val('');
|
updateQtyList();
|
getBar();
|
GetBoxInfo();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
canPickBox = true;//回调
|
});
|
}
|
});
|
}
|
|
//----------------------------------------------------------------------------------
|
//主页及重新登录
|
$("#menuImg").click(function (e) {
|
//console.log("menuImg")
|
e.stopPropagation()
|
|
if ($("#menuList").is(":hidden")) {
|
$("#menuList").show()
|
} else {
|
$("#menuList").hide()
|
}
|
})
|
$('body').click(function () {
|
// //console.log("body")
|
$("#menuList").hide()
|
})
|
|
//设置分页
|
function setPages(pageIndex, boxNum){
|
if(boxNum <= 0){
|
//列表为空,隐藏分页页码
|
$("#tableBoxPages").hide()
|
return
|
}
|
|
let pageNum = Math.floor(boxNum / 10);
|
if(boxNum % 10 > 0){
|
pageNum += 1;
|
}
|
//console.log("pageNum is " + pageNum)
|
|
$("#tableBoxPages").find("tr").remove()
|
let table = $("#tableBoxPages")
|
$("<tr></tr>").appendTo("#tableBoxPages")
|
|
// let newTr = table.append("<tr></tr>")
|
// newTr.append("<td class='page-prev'>上一页</td>")
|
$("<td id='prevPage' class='page-prev'>上一页</td>").appendTo("#tableBoxPages tr")
|
$("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){
|
onClickPrevPage()
|
})
|
for(i=1; i < pageNum + 1; i++){
|
// newTr.append("<td class='page-num'>"+ i +"</td>")
|
$("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr")
|
}
|
// newTr.append("<td class='page-next'>下一页</td>")
|
$("<td id='nextPage' class='page-next'>下一页</td>").appendTo("#tableBoxPages tr")
|
$("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){
|
onClickNextPage()
|
})
|
// pages.show()
|
$("#tableBoxPages").show()
|
|
setCurPage(1)
|
}
|
|
//设置当前分页
|
function setCurPage(pageIndex){
|
let totalTrNum = $("#tableBoxList tr").length
|
if(totalTrNum <= 2 ){
|
//console.log("tableBoxList 为空 totalTrNum: " + totalTrNum)
|
//curPageIndex = 1
|
return
|
}
|
|
let pageNum = getBoxPageNum()
|
if(pageIndex > pageNum){
|
//console.log("设置的页码超出页数, pageIndex : " + pageIndex)
|
//curPageIndex = 1
|
return
|
}
|
|
let startIndex = (pageIndex - 1) * 10 + 1
|
let n = totalTrNum - startIndex
|
let endIndex = 0
|
if(n > 9){
|
endIndex = startIndex + 9
|
}else{
|
endIndex = startIndex + n
|
}
|
//console.log("startIndex is "+startIndex)
|
//console.log("endIndex is "+endIndex)
|
//startIndex =2
|
//endIndex = 2
|
let trs = $("#tableBoxList tr")
|
//console.log("行数 "+trs.length)
|
let d = 0
|
for(let i = 2; i < trs.length; i++){
|
//console.log("行索引 " + trs.eq(i).attr('index'))
|
let t = trs.eq(i)
|
d = t.attr('index')
|
if(d >= startIndex && d <= endIndex){
|
//console.log("需要显示")
|
//显示行
|
t.show()
|
}else{
|
//隐藏行
|
t.hide()
|
}
|
}
|
|
curPageIndex = pageIndex
|
|
let ptr = $("#tableBoxPages tr")
|
for(let i = 1; i < pageNum+1; i++){
|
ptr.eq(0).find("td").eq(i).removeClass("page-num-select")
|
if(i == curPageIndex){
|
ptr.eq(0).find("td").eq(i).addClass("page-num-select")
|
}
|
}
|
//console.log("totalTrNum is " + totalTrNum)
|
}
|
|
function onClickPrevPage(){
|
//console.log("上一页按钮被点击")
|
if(curPageIndex == 1){
|
return
|
}
|
setCurPage(curPageIndex - 1)
|
}
|
|
function onClickNextPage(){
|
//console.log("下一页按钮被点击")
|
let n = getBoxPageNum()
|
if(curPageIndex == n){
|
return
|
}
|
setCurPage(curPageIndex + 1)
|
}
|
|
function getBoxPageNum()
|
{
|
let num = $("#tableBoxList tr").length
|
if(num <= 2 ){
|
return 0
|
}
|
|
let pageNum = Math.floor(num / 10);
|
if(num % 10 > 0){
|
pageNum += 1;
|
}
|
|
return pageNum
|
}
|
|
})
|
</script>
|
</body>
|
|
</html>
|