This commit is contained in:
parent
199940b40e
commit
192da2a5b0
|
|
@ -176,7 +176,8 @@
|
||||||
let login_url = dataUrl + 'login/userLogin'
|
let login_url = dataUrl + 'login/userLogin'
|
||||||
const params = {
|
const params = {
|
||||||
"username": 'bns',
|
"username": 'bns',
|
||||||
"password": '3NBzZK7qxhMhrmvi63FnuQ==',
|
// "password": '3NBzZK7qxhMhrmvi63FnuQ==',
|
||||||
|
"password": '1769fb2837e10e9d22c1c25add76355a',
|
||||||
}
|
}
|
||||||
ajaxRequest(login_url, "POST", params, true, function () {
|
ajaxRequest(login_url, "POST", params, true, function () {
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ function sel(selectStatus, that, id) {
|
||||||
$(that).prop('checked', false);
|
$(that).prop('checked', false);
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
for (let i = 0; i < delIdArr.length; i++) {
|
||||||
if (delIdArr[i] == id) {
|
if (delIdArr[i] == id) {
|
||||||
arr.splice(i, 1);
|
delIdArr.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ function sel(selectStatus, that, id) {
|
||||||
$(that).prop('checked', false);
|
$(that).prop('checked', false);
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
for (let i = 0; i < delIdArr.length; i++) {
|
||||||
if (delIdArr[i] == id) {
|
if (delIdArr[i] == id) {
|
||||||
arr.splice(i, 1);
|
delIdArr.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ function sel(selectStatus, that, id) {
|
||||||
$(that).prop('checked', false);
|
$(that).prop('checked', false);
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
for (let i = 0; i < delIdArr.length; i++) {
|
||||||
if (delIdArr[i] == id) {
|
if (delIdArr[i] == id) {
|
||||||
arr.splice(i, 1);
|
delIdArr.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ function initTable() {
|
||||||
align: "center",
|
align: "center",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "unit",
|
field: "price",
|
||||||
title: "平均单价(元)",
|
title: "平均单价(元)",
|
||||||
width: '9%',
|
width: '9%',
|
||||||
unresize: true,
|
unresize: true,
|
||||||
|
|
@ -163,7 +163,7 @@ function initTable() {
|
||||||
unresize: true,
|
unresize: true,
|
||||||
align: "center",
|
align: "center",
|
||||||
// edit: 'text',
|
// edit: 'text',
|
||||||
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
// style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "subNum",
|
field: "subNum",
|
||||||
|
|
@ -172,7 +172,7 @@ function initTable() {
|
||||||
unresize: true,
|
unresize: true,
|
||||||
align: "center",
|
align: "center",
|
||||||
// edit: 'text',
|
// edit: 'text',
|
||||||
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
// style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "remarks",
|
field: "remarks",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ function setParams(obj) {
|
||||||
util = layui.util;
|
util = layui.util;
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#ID-laydate-rangeLinked',
|
elem: '#ID-laydate-rangeLinked',
|
||||||
range: ['#startDay', '#endDay'],
|
range: ['#startTime', '#endTime'],
|
||||||
rangeLinked: true
|
rangeLinked: true
|
||||||
});
|
});
|
||||||
form.verify();
|
form.verify();
|
||||||
|
|
@ -119,15 +119,14 @@ function submitApply(data) {
|
||||||
}
|
}
|
||||||
// 校验配件入库数量
|
// 校验配件入库数量
|
||||||
if (list.length === 0) {
|
if (list.length === 0) {
|
||||||
return layer.msg('未填写配件入库数量', { icon: 7 });
|
return layer.msg('未添加盘点明细数据', { icon: 7 });
|
||||||
}
|
}
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].checkNum === 0) {
|
||||||
if (!list[i].inputNum || list[i].inputNum === '0') {
|
return layer.msg('盘点明细,第' + (i + 1) + '行,未填写本次盘点量', { icon: 7 });
|
||||||
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写配件入库数量', { icon: 7 });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.field.details = list;
|
data.field.detailList = list;
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
//遍历最终文件集合
|
//遍历最终文件集合
|
||||||
for (let i = 0; i < fileList.length; i++) {
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
|
|
@ -137,7 +136,7 @@ function submitApply(data) {
|
||||||
console.log(JSON.stringify(data.field));
|
console.log(JSON.stringify(data.field));
|
||||||
let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
|
let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
|
||||||
console.log(JSON.stringify(data.field));
|
console.log(JSON.stringify(data.field));
|
||||||
let url = dataUrl + 'backstage/partInput/addInputData';
|
let url = dataUrl + 'backstage/partCheck/insertCheckData';
|
||||||
ajaxRequestByUploadFile(url, formData, function () {
|
ajaxRequestByUploadFile(url, formData, function () {
|
||||||
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
|
|
@ -165,19 +164,19 @@ function submitApply(data) {
|
||||||
function getBaseTableData() {
|
function getBaseTableData() {
|
||||||
let tableData = [];
|
let tableData = [];
|
||||||
$('#baseTable tbody tr').each(function (index, item) {
|
$('#baseTable tbody tr').each(function (index, item) {
|
||||||
let price = $(this).find('td').eq(7).find('input[name="price"]').val();
|
let checkNum = $(this).find('td').eq(8).find('input[name="checkNum"]').val();
|
||||||
let num = $(this).find('td').eq(6).find('input[name="num"]').val();
|
|
||||||
tableData.push({
|
tableData.push({
|
||||||
partId: $(this).attr('id'),
|
partId: $(this).attr('id'),
|
||||||
partType: $(this).find('td').eq(2).html(),
|
partType: $(this).find('td').eq(2).html(),
|
||||||
partName: $(this).find('td').eq(3).html(),
|
partName: $(this).find('td').eq(3).html(),
|
||||||
partModel: $(this).find('td').eq(4).html(),
|
partModel: $(this).find('td').eq(4).html(),
|
||||||
partUnit: $(this).find('td').eq(5).html(),
|
price: $(this).find('td').eq(5).html(),
|
||||||
inputNum: num ? num : 0,
|
partUnit: $(this).find('td').eq(6).html(),
|
||||||
partPrice: price ? price : 0,
|
num: $(this).find('td').eq(7).html(),
|
||||||
vendId: $(this).find('td').eq(8).find('select[name="manufacturer"]').val(),
|
checkNum: checkNum ? checkNum : 0,
|
||||||
vendName: $(this).find('td').eq(8).find('select[name="manufacturer"]').find('option:checked').text(),
|
addNum: $(this).find('td').eq(9).html(),
|
||||||
remark: $(this).find('td').eq(9).find('input[name="remarks"]').val(),
|
subNum: $(this).find('td').eq(10).html(),
|
||||||
|
remark: $(this).find('td').eq(11).find('input[name="remarks"]').val(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return tableData;
|
return tableData;
|
||||||
|
|
@ -288,31 +287,46 @@ function setTableData(results) {
|
||||||
html += "<td>" + l.type + "</td>";
|
html += "<td>" + l.type + "</td>";
|
||||||
html += "<td>" + l.name + "</td>";
|
html += "<td>" + l.name + "</td>";
|
||||||
html += "<td>" + l.model + "</td>";
|
html += "<td>" + l.model + "</td>";
|
||||||
html += "<td>" + l.model + "</td>";
|
html += "<td>" + l.price + "</td>";
|
||||||
html += "<td>" + l.unit + "</td>";
|
html += "<td>" + l.unit + "</td>";
|
||||||
html += "<td style='color:#19BE6B;font-weight:bold;'>" + l.unit + "</td>";
|
html += "<td style='color:#19BE6B;font-weight:bold;'>" + l.num + "</td>";
|
||||||
html += "<td>" + setFormInput(l.num, 1) + "</td>";
|
html += "<td>" + setFormInput(l.checkNum, 1) + "</td>";
|
||||||
html += "<td>" + setFormInput(l.price, 2) + "</td>";
|
html += "<td>" + l.addNum + "</td>";
|
||||||
html += "<td>" + setFormInput(l.manufacturer, 3) + "</td>";
|
html += "<td>" + l.subNum + "</td>";
|
||||||
html += "<td>" + setFormInput(l.remarks, 4) + "</td>";
|
html += "<td>" + setFormInput(l.remarks, 2) + "</td>";
|
||||||
html += "</tr>";
|
html += "</tr>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
|
html += "<tr><td colspan='12' class='center'>没有相关数据</td></tr>";
|
||||||
}
|
}
|
||||||
$("#baseTable tbody").empty().append(html);
|
$("#baseTable tbody").empty().append(html);
|
||||||
|
setNumAndPrice(jjDataArr);
|
||||||
layui.form.render();
|
layui.form.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 盘盈 、盘亏数量和金额
|
||||||
|
function setNumAndPrice(list) {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
let addNum = 0, subNum = 0, addPrice = 0; subPrice = 0;
|
||||||
|
$.each(list, function (index, item) {
|
||||||
|
let price = item.price ? 2 : 2;
|
||||||
|
addNum += parseInt(item.addNum);
|
||||||
|
subNum += parseInt(item.subNum);
|
||||||
|
addPrice += parseInt(item.addNum) * parseFloat(price);
|
||||||
|
subPrice += parseInt(item.subNum) * parseFloat(price);
|
||||||
|
});
|
||||||
|
$('#addNum').html(addNum);;
|
||||||
|
$('#subNum').html(subNum);;
|
||||||
|
$('#addPrice').html(addPrice);;
|
||||||
|
$('#subPrice').html(subPrice);;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setFormInput(value, type) {
|
function setFormInput(value, type) {
|
||||||
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
|
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
|
||||||
if (type === 1) { // 入库量
|
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">';
|
html += '<input class="layui-input" name="checkNum" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
|
||||||
} else if (type === 2) { // 单价
|
} else if (type === 2) { // 备注
|
||||||
html += '<input class="layui-input" name="price" onblur="checkValue(this,2)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
|
||||||
} else if (type === 3) { // 厂家
|
|
||||||
html += '<input class="layui-input" name="price" onblur="checkValue(this,2)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
|
||||||
} else if (type === 4) { // 备注
|
|
||||||
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
||||||
}
|
}
|
||||||
html += '</div></form>';
|
html += '</div></form>';
|
||||||
|
|
@ -346,7 +360,7 @@ function sel(selectStatus, that, id) {
|
||||||
$(that).prop('checked', false);
|
$(that).prop('checked', false);
|
||||||
for (let i = 0; i < delIdArr.length; i++) {
|
for (let i = 0; i < delIdArr.length; i++) {
|
||||||
if (delIdArr[i] == id) {
|
if (delIdArr[i] == id) {
|
||||||
arr.splice(i, 1);
|
delIdArr.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -379,22 +393,33 @@ function delFitType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
let list = getBaseTableData();
|
||||||
|
setNumAndPrice(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验数据
|
// 校验数据
|
||||||
function checkValue(that, type) {
|
function checkValue(that, type) {
|
||||||
let value = $(that).val();
|
let value = $(that).val();
|
||||||
if (type === 1) { // 入库量
|
if (type === 1) { // 本次盘点量
|
||||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||||
if (!regex.test(value) && value) {
|
if (!regex.test(value) && value) {
|
||||||
layer.msg('入库量输入不合法,请重新输入!', { icon: 5 })
|
$(that).val(0);
|
||||||
$(that).val('');
|
let list = getBaseTableData();
|
||||||
|
setNumAndPrice(list);
|
||||||
|
return layer.msg('本次盘点量输入不合法,最大输入6位数,且为正整数,请重新输入!', { icon: 5 })
|
||||||
|
} else if (value) {
|
||||||
|
let num = $(that).parents('td').prev().html(); // 库存量
|
||||||
|
let addNum = 0, subNum = 0; // 盘盈量、盘亏量
|
||||||
|
let syNum = num - value;
|
||||||
|
if (syNum > 0) {
|
||||||
|
subNum = syNum;
|
||||||
|
} else {
|
||||||
|
addNum = Math.abs(syNum);
|
||||||
}
|
}
|
||||||
} else if (type === 2) { // 单价
|
$(that).parents('td').next().html(addNum);
|
||||||
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)?))$/;
|
$(that).parents('td').next().next().html(subNum);
|
||||||
if (!regex.test(value) && value) {
|
let list = getBaseTableData();
|
||||||
layer.msg('单价输入不合法,请重新输入!', { icon: 5 })
|
setNumAndPrice(list);
|
||||||
$(that).val('');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,5 +176,5 @@ function exportExcel() {
|
||||||
|
|
||||||
// 需求计划编号
|
// 需求计划编号
|
||||||
function plan_detail(obj) {
|
function plan_detail(obj) {
|
||||||
openIframeByParamObj("plan_detail", "机具需求计划", "./apply_plan_detail.html", "92%", "95%", obj);
|
openIframeByParamObj2("plan_detail", "机具需求计划", "/page/demandPlan/child/apply_plan_detail.html", "92%", "95%", obj);
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label required" style="width: 100px !important;">盘点人</label>
|
<label class="layui-form-label required" style="width: 100px !important;">盘点人</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input" name="inputUser" id="inputUser" autocomplete="off"
|
<input class="layui-input" name="creator" id="creator" autocomplete="off"
|
||||||
lay-verify="required" maxlength="30" lay-affix="clear">
|
lay-verify="required" maxlength="30" lay-affix="clear">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -27,12 +27,12 @@
|
||||||
<label class="layui-form-label required" style="width: 110px !important;">盘点日期</label>
|
<label class="layui-form-label required" style="width: 110px !important;">盘点日期</label>
|
||||||
<div class="layui-inline" id="ID-laydate-rangeLinked">
|
<div class="layui-inline" id="ID-laydate-rangeLinked">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" autocomplete="off" id="startDay" class="layui-input"
|
<input type="text" autocomplete="off" name="startTime" id="startTime" class="layui-input"
|
||||||
placeholder="盘点开始日期" lay-verify="required" readonly style="cursor: pointer;">
|
placeholder="盘点开始日期" lay-verify="required" readonly style="cursor: pointer;">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid">-</div>
|
<div class="layui-form-mid">-</div>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" autocomplete="off" id="endDay" class="layui-input"
|
<input type="text" autocomplete="off" name="endTime" id="endTime" class="layui-input"
|
||||||
placeholder="盘点结束日期:" lay-verify="required" readonly style="cursor: pointer;">
|
placeholder="盘点结束日期:" lay-verify="required" readonly style="cursor: pointer;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -101,13 +101,13 @@
|
||||||
<button class="layui-btn layui-bg-red" onclick="delFitType()">删除选中</button>
|
<button class="layui-btn layui-bg-red" onclick="delFitType()">删除选中</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<div style="color: #19BE6B;" class="layout">
|
<div style="color: #19BE6B;width: 300px;justify-content: start;" class="layout">
|
||||||
<p>盘盈:<span style="font-weight: bold;">653</span></p>
|
<p>盘盈:<span style="font-weight: bold;" id="addNum">653</span></p>
|
||||||
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;">15,653</span></p>
|
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;" id="addPrice">0</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div style="color:#f56c6c ;" class="layout">
|
<div style="color:#f56c6c ;width: 300px;justify-content: start;" class="layout">
|
||||||
<p>盘亏:<span style="font-weight: bold;">120</span></p>
|
<p>盘亏:<span style="font-weight: bold;" id="subNum">120</span></p>
|
||||||
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;">12,120</span></p>
|
<p style="margin-left: 20px;">¥ <span style="font-weight: bold;" id="subPrice">0</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -129,9 +129,9 @@
|
||||||
<th style="width: 8%" class="center">单位</th>
|
<th style="width: 8%" class="center">单位</th>
|
||||||
<th style="width: 8%" class="center">库存量</th>
|
<th style="width: 8%" class="center">库存量</th>
|
||||||
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次盘点量</th>
|
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次盘点量</th>
|
||||||
<th style="width: 10%" class="center"><span style="color: red;">*</span>盘盈量</th>
|
<th style="width: 8%" class="center"><span style="color: red;">*</span>盘盈量</th>
|
||||||
<th style="width: 10%" class="center"><span style="color: red;">*</span>盘亏量</th>
|
<th style="width: 8%" class="center"><span style="color: red;">*</span>盘亏量</th>
|
||||||
<th style="width: 10%" class="center">备注</th>
|
<th style="width: 14%" class="center">备注</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue