车辆需求计划修改

This commit is contained in:
syruan 2025-05-07 11:44:13 +08:00
parent 37d082780e
commit 403b41b288
7 changed files with 96 additions and 121 deletions

View File

@ -145,10 +145,10 @@ function checkValue2(that, type) {
}
}
} else if (type === 4) { // 投标下浮率
const regex = /^(?:[0-9]|[1-9][0-9]|(?:0|[1-9][0-9])(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value) {
const regex = /^(?:0(?:\.[0-9]{1,3})?|[1-9]\d?(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value || parseFloat(value) >= 100) {
$(that).val('');
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 })
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 });
}
if (!value) {
$(that).parents('td').next().html('0');
@ -486,10 +486,10 @@ function checkValue3(that, type) {
}
}
} else if (type === 3) { // 投标下浮率
const regex = /^(?:[0-9]|[1-9][0-9]|(?:0|[1-9][0-9])(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value) {
const regex = /^(?:0(?:\.[0-9]{1,3})?|[1-9]\d?(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value || parseFloat(value) >= 100) {
$(that).val('');
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 })
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 });
}
if (!value) {
$(that).parents('td').next().html('0');

View File

@ -140,10 +140,10 @@ function checkValue2(that, type) {
}
}
} else if (type === 4) { // 投标下浮率
const regex = /^(?:[0-9]|[1-9][0-9]|(?:0|[1-9][0-9])(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value) {
const regex = /^(?:0(?:\.[0-9]{1,3})?|[1-9]\d?(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value || parseFloat(value) >= 100) {
$(that).val('');
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 })
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 });
}
if (!value) {
$(that).parents('td').next().html('0');
@ -475,10 +475,10 @@ function checkValue3(that, type) {
}
}
} else if (type === 3) { // 投标下浮率
const regex = /^(?:[0-9]|[1-9][0-9]|(?:0|[1-9][0-9])(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value) {
const regex = /^(?:0(?:\.[0-9]{1,3})?|[1-9]\d?(?:\.[0-9]{1,3})?)$/;
if (!regex.test(value) && value || parseFloat(value) >= 100) {
$(that).val('');
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 })
return layer.msg('投标下浮率填写范围在0-99.999),请重新输入!', { icon: 5 });
}
if (!value) {
$(that).parents('td').next().html('0');

View File

@ -253,7 +253,7 @@ function initTable() {
cols: [
[
{
width: '9.8%',
width: '8%',
title: "序号",
align: "center",
templet: function (d) {
@ -262,7 +262,7 @@ function initTable() {
},
{
field: "type",
width: '15%',
width: '10%',
title: "类型",
unresize: true,
align: "center",
@ -270,7 +270,7 @@ function initTable() {
},
{
field: "name",
width: '15%',
width: '10%',
title: "名称",
unresize: true,
align: "center",
@ -295,6 +295,13 @@ function initTable() {
return setNullValue(d.unit);
},
},
{
field: "carSpec",
width: '14%',
title: "所需规格",
unresize: true,
align: "center",
},
{
field: "needNum",
width: '10%',
@ -308,8 +315,8 @@ function initTable() {
},
{
field: "backDate",
width: '10%',
title: "预计使用时间",
width: '12%',
title: "预计使用时间(天)",
unresize: true,
align: "center",
sort: true,
@ -320,7 +327,7 @@ function initTable() {
},
{
field: "remark",
width: '15%',
width: '10%',
title: "备注",
sort: true,
unresize: true,
@ -350,8 +357,12 @@ function initTable() {
}
// 数量颜色
function setNumColor(value) {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</span>";
function setNumColor(value, isNeedNum) {
if (isNeedNum) {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</span>";
} else {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</span>";
}
}
// 导出

View File

@ -118,11 +118,10 @@ function submitApply(data) {
return layer.msg('未添加申请明细数据', { icon: 7 });
}
// 校验附件是否上传
if (fileList.length === 0) {
return layer.msg('请上传附件', { icon: 7 });
}
// 校验附件是否上传 - 移除必填校验
// if (fileList.length === 0) {
// return layer.msg('请上传附件', { icon: 7 });
// }
for (let i = 0; i < list.length; i++) {
if (parseInt(list[i].needNum) === 0) {
@ -133,12 +132,13 @@ function submitApply(data) {
// }
}
let routePointStr = ""; //
$('input[name="routePoint"]').each(function (index, item) {
let routePoint = $('input[name="routePoint"]').eq(index).val();
// 拼接字符串
routePointStr += routePoint + "routePoint;";
if(routePoint) {
routePointStr += routePoint + "routePoint;";
}
})
console.log("routePointStr",routePointStr)
@ -182,18 +182,21 @@ function submitApply(data) {
function getBaseTableData() {
let tableData = [];
$('#baseTable tbody tr').each(function (index, item) {
let times = $(this).find('td').eq(7).find('input[name="times"]').val();
let needNum = $(this).find('td').eq(6).find('input[name="needNum"]').val();
let times = $(this).find('td').eq(8).find('input[name="times"]').val();
let needNum = $(this).find('td').eq(7).find('input[name="needNum"]').val();
let carSpec = $(this).find('td').eq(6).find('input[name="carSpec"]').val();
tableData.push({
modelId: $(this).attr('id'),
type: $(this).find('td').eq(2).html(),
name: $(this).find('td').eq(3).html(),
model: $(this).find('td').eq(4).html(),
unit: $(this).find('td').eq(5).html(),
carSpec: carSpec ? carSpec : '',
needNum: needNum ? needNum : 0,
// needDay: times ? times : 0,
backDate: times ? times : 0,
remark: $(this).find('td').eq(8).find('input[name="remarks"]').val(),
remark: $(this).find('td').eq(9).find('input[name="remarks"]').val(),
})
})
return tableData;
@ -287,23 +290,27 @@ function setTableData(results) {
html += "<td>" + l.name + "</td>";
html += "<td>" + l.model + "</td>";
html += "<td>" + l.unit + "</td>";
// 添加所需规格字段
html += "<td>" + setFormInput(l.carSpec || '', 4) + "</td>";
html += "<td>" + setFormInput(l.needNum, 1) + "</td>";
html += "<td>" + setFormInput(l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.remarks, 3) + "</td>";
html += "</tr>";
}
} else {
html += "<tr><td colspan='9' class='center'>没有相关数据</td></tr>";
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
}
$("#baseTable tbody").empty().append(html);
// 渲染日期选择器
$('.refund-date').each(function(){
laydate.render({
elem: this, // 指定元素
type: 'date' // 可选,指定为日期类型,默认即是'date'
});
});
// 不再需要渲染日期选择器
// $('.refund-date').each(function(){
// laydate.render({
// elem: this, // 指定元素
// type: 'date' // 可选,指定为日期类型,默认即是'date'
// });
// });
layui.form.render();
}
@ -312,14 +319,15 @@ function setFormInput(value, type) {
if (type === 1) { // 需用量
html += '<input class="layui-input" name="needNum" onblur="checkValue(this,1,\'需用量\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
} else if (type === 2) { // 需用天数
html += '<input class="layui-input refund-date" readonly name="times" id="refundDate" value="' + setNullValue(value) + '" autocomplete="off">';
// html += '<input class="layui-input" name="times" onblur="checkValue(this,2,\'需用天数\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
// 修改为普通输入框,不再使用日期选择器
html += '<input class="layui-input" name="times" onblur="checkValue(this,2,\'预计使用天数\')" value="' + setNullValue(value) + '" autocomplete="off" maxlength="9">';
} else if (type === 3) { // 备注
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="60" lay-affix="clear"></input>';
} else if (type === 4) { // 所需规格
html += '<input class="layui-input" name="carSpec" value="' + setNullValue(value) + '" autocomplete="off" maxlength="50">';
}
html += '</div></form>';
return html;
}
// 复选框全选
@ -409,15 +417,19 @@ function goOnAddData() {
$('#baseTable tbody tr').each(function () {
let id = $(this).attr('id');
if (parseInt(id) === parseInt(item.id)) {
let times = $(this).find('td').eq(7).find('input[name="times"]').val(),
needNum = $(this).find('td').eq(6).find('input[name="needNum"]').val(),
remarks = $(this).find('td').eq(8).find('input[name="remarks"]').val();
let times = $(this).find('td').eq(8).find('input[name="times"]').val(),
needNum = $(this).find('td').eq(7).find('input[name="needNum"]').val(),
carSpec = $(this).find('td').eq(6).find('input[name="carSpec"]').val(),
remarks = $(this).find('td').eq(9).find('input[name="remarks"]').val();
if (!item.times || parseInt(item.times) === 0) {
item.times = times;
}
if (!item.needNum || parseInt(item.needNum) === 0) {
item.needNum = needNum;
}
if (!item.carSpec) {
item.carSpec = carSpec;
}
if (!item.remarks) {
item.remarks = remarks;
}
@ -447,6 +459,14 @@ function checkValue(that, type, name) {
$(that).val(0);
}
}
// 天数不需要特殊限制,使用通用的数字验证即可
if (type === 7) { // 车长、车宽、车高
const regex = /^(0|[1-9]\d{0,6}(\.\d{1,2})?)$/;
if (!regex.test(value) && value) {
layer.msg('' + name + '输入有误,请重新输入!', { icon: 5 })
$(that).val(0);
}
}
}
// 删除文件
@ -506,9 +526,9 @@ function addTjd() {
}
let html = '<div class="layui-form-item addTjd">' +
'<div class="layui-inline">' +
'<label class="layui-form-label required" style="width: 110px !important;">途径点</label>' +
'<label class="layui-form-label" style="width: 110px !important;">途径点</label>' +
'<div class="layui-input-inline">' +
'<input class="layui-input" name="routePoint" autocomplete="off" lay-verify="required" maxlength="30" lay-affix="clear">' +
'<input class="layui-input" name="routePoint" autocomplete="off" maxlength="30" lay-affix="clear">' +
'</div>' +
'</div>' +
'<img style="cursor: pointer;" onclick="delTjd(this,' + addNum + ')" src="../../../images/del_icon2.png">' +

View File

@ -56,28 +56,16 @@
</tr>
<tr>
<th>所需运输车辆车长(米)</th>
<th>所需运输车辆车宽(米)</th>
<th>所需运输车辆车高(米)</th>
<th>预计运输物品重量(吨)</th>
</tr>
<tr>
<td id="carLength"></td>
<td id="carWidth"></td>
<td id="carHeight"></td>
<td id="carWeight"></td>
</tr>
<tr>
<th>运输起点</th>
<th>运输终点</th>
<th></th>
<th></th>
</tr>
<tr>
<td id="carWeight"></td>
<td id="carStart"></td>
<td id="carEnd"></td>
<td ></td>
<td ></td>
<td></td>
</tr>
</table>
<div id="routePoint"></div>
@ -123,7 +111,7 @@
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i class="layui-icon"></i>
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i class="layui-icon"></i>
</button>
<button class="layui-btn layui-btn-primary" onclick="queryTable(2)"><i

View File

@ -222,7 +222,7 @@
<th style="width: 10%" class="center">规格</th>
<th style="width: 10%" class="center">单位</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用量</th>
<th style="width: 15%" class="center">预计使用时间</th>
<th style="width: 15%" class="center">预计使用时间(天)</th>
<th style="width: 15%" class="center">备注</th>
</tr>
</thead>

View File

@ -68,56 +68,12 @@
<button type="submit" id="formSubmit" class="layui-btn" lay-submit="" lay-filter="formData"
style="display: none;"></button>
<div class="layui-form-item" style="display: flex;">
<div class="layui-inline" style="display: flex;">
<label class="layui-form-label required" style="width: 120px !important;">所需运输车辆车长</label>
<div class="layui-input-inline" style="width: 800px !important;">
<input type="radio" name="carLength" value="10" title="10米及以下" checked>
<input type="radio" name="carLength" value="12" title="12米">
<input type="radio" name="carLength" value="14" title="14米">
<input type="radio" name="carLength" value="16" title="16米">
<input type="radio" name="carLength" value="18" title="18米">
<input type="radio" name="carLength" value="20" title="20米及以上">
</div>
</div>
</div>
<div class="layui-form-item" style="display: flex;">
<div class="layui-inline" style="display: flex;">
<label class="layui-form-label required" style="width: 120px !important;">所需运输车辆车宽</label>
<div class="layui-input-inline" style="width: 800px !important;">
<input type="radio" name="carWidth" value="2" title="2米以内" checked>
<input type="radio" name="carWidth" value="2.3" title="2.3米">
<input type="radio" name="carWidth" value="2.5" title="2.5米">
<input type="radio" name="carWidth" value="3.0" title="3.0米">
<input type="radio" name="carWidth" value="3.2" title="3.2米">
<input type="radio" name="carWidth" value="3.5" title="3.5米及以上">
</div>
</div>
</div>
<div class="layui-form-item" style="display: flex;">
<div class="layui-inline" style="display: flex;">
<label class="layui-form-label required" style="width: 120px !important;">所需运输车辆车高</label>
<div class="layui-input-inline" style="width: 800px !important;">
<input type="radio" name="carHeight" value="1.0" title="1米及以下" checked>
<input type="radio" name="carHeight" value="1.5" title="1.5米">
<input type="radio" name="carHeight" value="2.0" title="2.0米">
<input type="radio" name="carHeight" value="2.5" title="2.5米">
<input type="radio" name="carHeight" value="3.0" title="3.0米">
<input type="radio" name="carHeight" value="4.0" title="4.0米">
<input type="radio" name="carHeight" value="5.0" title="5.0米及以上">
</div>
</div>
</div>
<div class="layui-form-item" style="display: flex;">
<div class="layui-inline" style="display: flex;">
<label class="layui-form-label required" style="width: 120px !important;">预计运输物品重量</label>
<label class="layui-form-label" style="width: 120px !important;">预计运输物品重量</label>
<div class="layui-input-inline" style="display: flex;">
<input class="layui-input" name="carWeight" id="carWeight" autocomplete="off"
lay-verify="required" maxlength="50" lay-affix="clear" style="width: 150px;" type="number">
maxlength="50" lay-affix="clear" style="width: 150px;" type="number">
<span style="margin-left: 5px;margin-top:10px"></span>
</div>
</div>
@ -137,12 +93,11 @@
</div>
</div>
<div class="layui-form-item" id="tjd">
<div class="layui-inline">
<label class="layui-form-label required" style="width: 110px !important;">途径点</label>
<label class="layui-form-label" style="width: 110px !important;">途径点</label>
<div class="layui-input-inline">
<input class="layui-input" name="routePoint" autocomplete="off" lay-verify="required"
<input class="layui-input" name="routePoint" autocomplete="off"
maxlength="30" lay-affix="clear">
</div>
</div>
@ -157,7 +112,7 @@
<div class="layui-upload" style="padding: 0 39px;">
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;width: auto;border: none;">
<p>上传附件<span class="required">*</span></p>
<p>上传附件</p>
<div class="layui-upload-list uploader-list" style="overflow: auto;" id="uploader-list"></div>
<div id="test2" style="margin-left: 10px;">
<img src="../../../images/add.png">
@ -214,17 +169,18 @@
<table id="baseTable" class="classTable table-hover">
<thead>
<tr>
<th style="width: 5%" class="center">
<th style="width: 4%" class="center">
<input id="allCheck" onclick="selectAll(this.checked)" type="checkbox">
</th>
<th style="width: 5%" class="center">序号</th>
<th style="width: 10%" class="center">类型</th>
<th style="width: 15%" class="center">名称</th>
<th style="width: 10%" class="center">规格</th>
<th style="width: 10%" class="center">单位</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用量</th>
<th style="width: 15%" class="center">预计使用时间</th>
<th style="width: 15%" class="center">备注</th>
<th style="width: 4%" class="center">序号</th>
<th style="width: 8%" class="center">类型</th>
<th style="width: 10%" class="center">名称</th>
<th style="width: 8%" class="center">规格</th>
<th style="width: 6%" class="center">单位</th>
<th style="width: 20%" class="center">所需规格</th>
<th style="width: 10%" class="center"><span style="color: red;">*</span>需用量</th>
<th style="width: 8%" class="center">预计使用天数</th>
<th style="width: 9%" class="center">备注</th>
</tr>
</thead>
<tbody></tbody>