This commit is contained in:
cwchen 2024-11-15 17:23:40 +08:00
parent 74024b4c19
commit 199940b40e
4 changed files with 28 additions and 21 deletions

View File

@ -59,7 +59,7 @@ function initTable() {
headers: { headers: {
authorization: sessionStorage.getItem("gz-token"), authorization: sessionStorage.getItem("gz-token"),
}, },
url: dataUrl + "backstage/paType/findByPage", url: dataUrl + "backstage/paType/findByPageList",
where: { where: {
encryptedData: JSON.stringify({ encryptedData: JSON.stringify({
'type': $('#type').val(), 'type': $('#type').val(),
@ -76,10 +76,10 @@ function initTable() {
$.each(res.list, function (index, item) { $.each(res.list, function (index, item) {
$.each(jjDetailArr, function (index2, item2) { $.each(jjDetailArr, function (index2, item2) {
if (item.id === item2.id) { if (item.id === item2.id) {
item.num = item2.num; item.checkNum = item2.checkNum;
item.price = item2.price; item.addNum = item2.addNum;
item.subNum = item2.subNum;
item.remarks = item2.remarks; item.remarks = item2.remarks;
item.manufacturer = item2.manufacturer;
} }
}); });
}); });
@ -138,17 +138,17 @@ function initTable() {
align: "center", align: "center",
}, },
{ {
field: "unit", field: "num",
title: "库存量", title: "库存量",
width: '8%', width: '8%',
unresize: true, unresize: true,
align: "center", align: "center",
templet: function (d) { templet: function (d) {
return '<span style="color:#19BE6B;font-weight:bold;">1</span>'; return '<span style="color:#19BE6B;font-weight:bold;">' + d.num + '</span>';
}, },
}, },
{ {
field: "num", field: "checkNum",
width: '10%', width: '10%',
title: "<span style='color:red'> * </span>本次盘点量", title: "<span style='color:red'> * </span>本次盘点量",
unresize: true, unresize: true,
@ -157,21 +157,21 @@ function initTable() {
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;' style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;'
}, },
{ {
field: "price", field: "addNum",
width: '10%', width: '10%',
title: "<span style='color:red'> * </span>盘盈量", title: "<span style='color:red'> * </span>盘盈量",
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: "price", field: "subNum",
width: '10%', width: '10%',
title: "<span style='color:red'> * </span>盘亏量", title: "<span style='color:red'> * </span>盘亏量",
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;'
}, },
{ {
@ -235,19 +235,26 @@ function initTable() {
table.on('edit(currentTableId2)', function (obj) { table.on('edit(currentTableId2)', function (obj) {
var field = obj.field; // 得到修改的字段 var field = obj.field; // 得到修改的字段
var value = obj.value // 得到修改后的值 var value = obj.value // 得到修改后的值
if (field === 'num') { // 本次入库 if (field === 'checkNum') { // 本次盘点
if (value) { if (value) {
const regex = /^(0|[1-9]\d{0,6})$/; const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value)) { if (!regex.test(value)) {
obj.reedit(); obj.reedit();
return layer.msg('格式不正确最大输入6位数且为正整数', { icon: 7 }) return layer.msg('格式不正确最大输入6位数且为正整数', { icon: 7 })
} }
} let num = obj.data.num; // 库存量
} else if (field === 'price') { let addNum = 0, subNum = 0; //
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)?))$/; let syNum = num - value;
if (!regex.test(value)) { if (syNum > 0) {
obj.reedit(); subNum = syNum;
return layer.msg('单价格式不正确!', { icon: 7 }) } else {
addNum = Math.abs(syNum);
}
var update = { addNum: addNum, subNum: subNum };
obj.update(update);
}else{
var update = { addNum: '', subNum: '' };
obj.update(update);
} }
} else if (field === 'remarks') { // 备注 } else if (field === 'remarks') { // 备注
if (value) { if (value) {

View File

@ -59,7 +59,7 @@ function initTable() {
headers: { headers: {
authorization: sessionStorage.getItem("gz-token"), authorization: sessionStorage.getItem("gz-token"),
}, },
url: dataUrl + "backstage/paType/findByPage", url: dataUrl + "backstage/paType/findByPageList",
where: { where: {
encryptedData: JSON.stringify({ encryptedData: JSON.stringify({
'type': $('#type').val(), 'type': $('#type').val(),

View File

@ -176,5 +176,5 @@ function exportExcel() {
// 需求计划编号 // 需求计划编号
function plan_detail(obj) { function plan_detail(obj) {
openIframeByParamObj2("plan_detail", "机具需求计划", "../../../page/demandPlan/child/apply_plan_detail.html", "92%", "95%", obj); openIframeByParamObj("plan_detail", "机具需求计划", "./apply_plan_detail.html", "92%", "95%", obj);
} }

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>需求计划</title> <title>选择盘点配件类型</title>
<link rel="stylesheet" href="../../../lib/layui-v2.9.18/layui/css/layui.css" media="all"> <link rel="stylesheet" href="../../../lib/layui-v2.9.18/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../css/font.css" media="all"> <link rel="stylesheet" href="../../../css/font.css" media="all">
<link rel="stylesheet" href="../../../css/public.css" media="all"> <link rel="stylesheet" href="../../../css/public.css" media="all">