配件入库取消单价限制

This commit is contained in:
syruan 2025-05-23 10:04:21 +08:00
parent 097e31fa60
commit f1e189622d
3 changed files with 98 additions and 46 deletions

View File

@ -62,9 +62,30 @@ document.getElementById('internalCode').addEventListener('click', function () {
// 打开弹框并渲染表格 // 打开弹框并渲染表格
layer.open({ layer.open({
type: 1, // 类型1表示页面层 type: 1, // 类型1表示页面层
area: ['800px', '525px'], // 宽高 area: ['900px', '600px'], // 增加高度以适应搜索框
content: ` content: `
<div style="padding: 20px;"> <div style="padding: 20px;">
<!-- 添加搜索区域 -->
<div class="layui-form layui-form-pane" style="margin-bottom: 15px;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">内部编号</label>
<div class="layui-input-inline">
<input type="text" id="searchDeviceCode" placeholder="请输入内部编号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">备注</label>
<div class="layui-input-inline">
<input type="text" id="searchRemark" placeholder="请输入备注" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button id="searchBtn" class="layui-btn layui-btn-normal">搜索</button>
<button id="resetBtn" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</div>
<table id="dataTable" lay-filter="dataTable"></table> <table id="dataTable" lay-filter="dataTable"></table>
<div style="text-align: right; margin-top: 10px;"> <div style="text-align: right; margin-top: 10px;">
<button id="confirmBtn" class="layui-btn layui-btn-normal">确定</button> <button id="confirmBtn" class="layui-btn layui-btn-normal">确定</button>
@ -72,46 +93,77 @@ document.getElementById('internalCode').addEventListener('click', function () {
</div> </div>
`, `,
success: function (layero, index) { success: function (layero, index) {
// 在弹框成功打开后初始化表格 // 定义搜索参数对象
table.render({ var searchParams = {
elem: '#dataTable', // 指定原始表格元素选择器推荐id选择器 deviceCode: '',
headers: { remark: ''
authorization: sessionStorage.getItem("gz-token"), };
},
height: 400, // 初始化表格渲染函数
url: dataUrl + 'base/partApply/getDevList',// 数据接口这里假设你有一个数据接口返回JSON数据 function renderTable() {
page: true, // 开启分页 table.render({
request: { elem: '#dataTable', // 指定原始表格元素选择器推荐id选择器
pageName: 'pageNum', headers: {
limitName: 'pageSize' authorization: sessionStorage.getItem("gz-token"),
},
parseData: function (res) { // res 即为原始返回的数据
if (res.code === 401) {
closeWindowOpen();
}
return {
"code": 0, // 解析接口状态
"msg": '获取成功', // 解析提示文本
"count": res.total, // 解析数据长度
"data": res.list // 解析数据列表
};
},
cols: [[ // 表头
{type: 'radio'}, // 单选框列
{
width: '20%',
title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
},
}, },
{field: 'deviceCode', title: '内部编号', width: '40%'}, height: 400,
{field: 'module', title: '机型', width: '40%'} url: dataUrl + 'base/partApply/getDevList',// 数据接口
]] page: true, // 开启分页
}); where: searchParams, // 传递搜索参数
request: {
pageName: 'pageNum',
limitName: 'pageSize'
},
parseData: function (res) { // res 即为原始返回的数据
if (res.code === 401) {
closeWindowOpen();
}
return {
"code": 0, // 解析接口状态
"msg": '获取成功', // 解析提示文本
"count": res.total, // 解析数据长度
"data": res.list // 解析数据列表
};
},
cols: [[ // 表头
{type: 'radio'}, // 单选框列
{
width: '10%',
title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
},
},
{field: 'deviceCode', title: '内部编号', width: '25%'},
{field: 'remark', title: '备注', width: '30%'},
{field: 'module', title: '机型', width: '35%'}
]]
});
}
// 初始渲染表格
renderTable();
// 搜索按钮点击事件
document.getElementById('searchBtn').onclick = function() {
searchParams.deviceCode = document.getElementById('searchDeviceCode').value;
searchParams.remark = document.getElementById('searchRemark').value;
renderTable(); // 重新渲染表格
};
// 重置按钮点击事件
document.getElementById('resetBtn').onclick = function() {
document.getElementById('searchDeviceCode').value = '';
document.getElementById('searchRemark').value = '';
searchParams.deviceCode = '';
searchParams.remark = '';
renderTable(); // 重新渲染表格
};
// 确定按钮点击事件 // 确定按钮点击事件
document.getElementById('confirmBtn').onclick = function () { document.getElementById('confirmBtn').onclick = function () {
// ... 现有代码保持不变 ...
var checkStatus = table.checkStatus('dataTable'); // 获取选中行的状态 var checkStatus = table.checkStatus('dataTable'); // 获取选中行的状态
var data = checkStatus.data; // 获取选中的行数据 var data = checkStatus.data; // 获取选中的行数据
if (data.length > 0) { if (data.length > 0) {

View File

@ -188,11 +188,11 @@ function submitApply(data) {
if (length === 0) { if (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].partPrice === 0 || list[i].partPrice === '0') { // if (list[i].partPrice === 0 || list[i].partPrice === '0') {
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 }); // return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
} // }
} // }
data.field.details = list; data.field.details = list;
data.field.id = objParam.id; data.field.id = objParam.id;
let delId = ''; let delId = '';

View File

@ -136,9 +136,9 @@ function submitApply(data) {
if (list[i].inputNum === 0 || list[i].inputNum === '0') { if (list[i].inputNum === 0 || list[i].inputNum === '0') {
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写本次入库量', { icon: 7 }); return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写本次入库量', { icon: 7 });
} }
if (list[i].partPrice === 0 || list[i].partPrice === '0') { // if (list[i].partPrice === 0 || list[i].partPrice === '0') {
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 }); // return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写单价', { icon: 7 });
} // }
} }
data.field.details = list; data.field.details = list;
let formData = new FormData(); let formData = new FormData();