This commit is contained in:
parent
01de3538d0
commit
bc16bf5632
|
|
@ -7,7 +7,7 @@ layui.use(["form", "table", 'laydate'], function () {
|
|||
laydate = layui.laydate;
|
||||
laydate.render({
|
||||
elem: '#ID-laydate-rangeLinked',
|
||||
range: ['#startDate', '#endDate'],
|
||||
range: ['#startDay', '#endDay'],
|
||||
rangeLinked: true
|
||||
});
|
||||
initTable();
|
||||
|
|
@ -19,8 +19,8 @@ function queryTable(type) {
|
|||
reloadTable(1);
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('');
|
||||
$('#startDate').val('');
|
||||
$('#endDate').val('');
|
||||
$('#startDay').val('');
|
||||
$('#endDay').val('');
|
||||
layui.form.render();
|
||||
reloadTable(1);
|
||||
}
|
||||
|
|
@ -40,8 +40,8 @@ function reloadTable(pageNum) {
|
|||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'startDate': $('#startDate').val(),
|
||||
'endDate': $('#endDate').val()
|
||||
'startDay': $('#startDay').val(),
|
||||
'endDay': $('#endDay').val()
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
|
@ -61,8 +61,8 @@ function initTable() {
|
|||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'startDate': $('#startDate').val(),
|
||||
'endDate': $('#endDate').val()
|
||||
'startDay': $('#startDay').val(),
|
||||
'endDay': $('#endDay').val()
|
||||
}),
|
||||
},
|
||||
request: {
|
||||
|
|
@ -148,11 +148,12 @@ function initTable() {
|
|||
// 导出
|
||||
function exportExcel() {
|
||||
let params = {
|
||||
'proName': $('#proName').val(),
|
||||
'status': $('#status').val()
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'startDay': $('#startDay').val(),
|
||||
'endDay': $('#endDay').val()
|
||||
}
|
||||
let url = dataUrl + "backstage/export/exportFhList";
|
||||
exportExcelUtil(url, '配件入库数据', JSON.stringify(params));
|
||||
let url = dataUrl + "backstage/partScrap/export";
|
||||
exportExcelUtil(url, '报废记录', JSON.stringify(params));
|
||||
}
|
||||
|
||||
// 详情 配件报废
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function setParams(obj) {
|
|||
table = layui.table;
|
||||
util = layui.util;
|
||||
laydate.render({
|
||||
elem: '#inputDay'
|
||||
elem: '#scrapDay'
|
||||
});
|
||||
form.verify();
|
||||
form.on('submit(formData)', function (data) {
|
||||
|
|
@ -32,7 +32,7 @@ function setParams(obj) {
|
|||
bindAction: '#hideUpload', //绑定的按钮
|
||||
choose: function (obj) {
|
||||
let length = $('.file-iteme').length;
|
||||
if(length >= 5){
|
||||
if (length >= 5) {
|
||||
return layer.msg('最多上传5个附件证明', { icon: 7 });
|
||||
}
|
||||
uploadObj.config.elem.next()[0].value = '';
|
||||
|
|
@ -279,6 +279,8 @@ function setTableData(results) {
|
|||
if (results && results.length > 0) {
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var l = results[i];
|
||||
let scrapNum = l.scrapNum ? l.scrapNum : 0;
|
||||
let price = l.price ? parseFloat(l.price) : 0;
|
||||
html += "<tr id='" + l.id + "'>";
|
||||
html += '<td><input onclick="sel(this.checked,this,' + l.id + ')" name="check" type="checkbox"></td>';
|
||||
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||
|
|
@ -287,10 +289,10 @@ function setTableData(results) {
|
|||
html += "<td>" + l.name + "</td>";
|
||||
html += "<td>" + l.model + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
html += "<td>" + setFormInput(l.num, 1) + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
html += "<td>" + l.price + "</td>";
|
||||
html += "<td>" + l.num + "</td>";
|
||||
html += "<td>" + setFormInput(l.scrapNum, 1) + "</td>";
|
||||
html += "<td>" + scrapNum * price + "</td>";
|
||||
html += "<td>" + setFormInput(l.remarks, 2) + "</td>";
|
||||
html += "</tr>";
|
||||
}
|
||||
|
|
@ -304,8 +306,8 @@ function setTableData(results) {
|
|||
function setFormInput(value, type) {
|
||||
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
|
||||
if (type === 1) { // 报废数量
|
||||
html += '<input class="layui-input" name="num" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
||||
}else if (type === 2) { // 备注
|
||||
html += '<input class="layui-input" name="scrapNum" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
||||
} else if (type === 2) { // 备注
|
||||
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
||||
}
|
||||
html += '</div></form>';
|
||||
|
|
@ -390,11 +392,11 @@ function delFitType() {
|
|||
// 校验数据
|
||||
function checkValue(that, type) {
|
||||
let value = $(that).val();
|
||||
if (type === 1) { // 入库量
|
||||
if (type === 1) { // 报废数量
|
||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value) && value) {
|
||||
layer.msg('入库量输入不合法,请重新输入!', { icon: 5 })
|
||||
$(that).val('');
|
||||
$(that).val(0);
|
||||
return layer.msg('报废数量输入不合法,请重新输入!', { icon: 5 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,10 +76,8 @@ function initTable() {
|
|||
$.each(res.list, function (index, item) {
|
||||
$.each(jjDetailArr, function (index2, item2) {
|
||||
if (item.id === item2.id) {
|
||||
item.num = item2.num;
|
||||
item.price = item2.price;
|
||||
item.scrapNum = item2.scrapNum;
|
||||
item.remarks = item2.remarks;
|
||||
item.manufacturer = item2.manufacturer;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -104,21 +102,21 @@ function initTable() {
|
|||
},
|
||||
{
|
||||
field: "type",
|
||||
width: '8%',
|
||||
width: '9.9%',
|
||||
title: "配件类型",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "name",
|
||||
width: '9%',
|
||||
width: '13%',
|
||||
title: "配件名称",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "model",
|
||||
width: '8%',
|
||||
width: '12%',
|
||||
title: "规格型号",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
|
|
@ -131,21 +129,21 @@ function initTable() {
|
|||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "unit",
|
||||
field: "price",
|
||||
title: "平均单价(元)",
|
||||
width: '10%',
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "unit",
|
||||
field: "num",
|
||||
title: "库存量",
|
||||
width: '10%',
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "num",
|
||||
field: "scrapNum",
|
||||
width: '10%',
|
||||
title: "报废数量",
|
||||
unresize: true,
|
||||
|
|
@ -153,15 +151,6 @@ function initTable() {
|
|||
edit: 'text',
|
||||
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
||||
},
|
||||
{
|
||||
field: "price",
|
||||
width: '10%',
|
||||
title: "金额 (元)",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
edit: 'text',
|
||||
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
||||
},
|
||||
{
|
||||
field: "remarks",
|
||||
width: '15%',
|
||||
|
|
@ -207,7 +196,7 @@ function initTable() {
|
|||
table.on('edit(currentTableId2)', function (obj) {
|
||||
var field = obj.field; // 得到修改的字段
|
||||
var value = obj.value // 得到修改后的值
|
||||
if (field === 'num') { // 本次入库量
|
||||
if (field === 'scrapNum') { // 报废量
|
||||
if (value) {
|
||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value)) {
|
||||
|
|
@ -215,12 +204,6 @@ function initTable() {
|
|||
return layer.msg('格式不正确,最大输入6位数,且为正整数!', { icon: 7 })
|
||||
}
|
||||
}
|
||||
} else if (field === 'price') {
|
||||
const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/;
|
||||
if (!regex.test(value)) {
|
||||
obj.reedit();
|
||||
return layer.msg('单价格式不正确!', { icon: 7 })
|
||||
}
|
||||
} else if (field === 'remarks') { // 备注
|
||||
if (value) {
|
||||
if (value.length > 255) {
|
||||
|
|
|
|||
|
|
@ -404,6 +404,8 @@ function checkValue(that, type) {
|
|||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value) && value) {
|
||||
$(that).val(0);
|
||||
$(that).parents('td').next().html(0);
|
||||
$(that).parents('td').next().next().html(0);
|
||||
let list = getBaseTableData();
|
||||
setNumAndPrice(list);
|
||||
return layer.msg('本次盘点量输入不合法,最大输入6位数,且为正整数,请重新输入!', { icon: 5 })
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@
|
|||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 300px;">
|
||||
<input type="text" name="proName" id="keyWord" autocomplete="off"
|
||||
<input type="text" name="keyWord" id="keyWord" autocomplete="off"
|
||||
class="layui-input" lay-affix="clear" placeholder="请输入关键字" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" style="margin-bottom: 0;">
|
||||
<div class="layui-inline" id="ID-laydate-rangeLinked">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" autocomplete="off" id="startDate" class="layui-input"
|
||||
<input type="text" autocomplete="off" id="startDay" class="layui-input"
|
||||
placeholder="开始日期">
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" autocomplete="off" id="endDate" class="layui-input"
|
||||
<input type="text" autocomplete="off" id="endDay" class="layui-input"
|
||||
placeholder="结束日期">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<div class="layui-inline">
|
||||
<label class="layui-form-label required" style="width: 100px !important;">报废人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" name="inputUser" id="inputUser" autocomplete="off" lay-verify="required" maxlength="30" lay-affix="clear">
|
||||
<input class="layui-input" name="userName" id="userName" autocomplete="off" lay-verify="required" maxlength="30" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-date"></i>
|
||||
</div>
|
||||
<input class="layui-input" id="inputDay" autocomplete="off" name="inputDay"
|
||||
<input class="layui-input" id="scrapDay" autocomplete="off" name="scrapDay"
|
||||
lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue