From 403b41b288bc573f850621ea5e2f60f6d631aa04 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Wed, 7 May 2025 11:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E9=9C=80=E6=B1=82=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../child/framework_contract_edit_oper.js | 12 +-- js/car_basic/child/framework_contract_oper.js | 12 +-- js/car_demand_plan/child/apply_plan_detail.js | 27 +++++-- js/car_demand_plan/child/apply_plan_form.js | 72 +++++++++++------- .../child/apply_plan_detail.html | 18 +---- .../child/apply_plan_edit_form.html | 2 +- .../child/apply_plan_form.html | 74 ++++--------------- 7 files changed, 96 insertions(+), 121 deletions(-) diff --git a/js/car_basic/child/framework_contract_edit_oper.js b/js/car_basic/child/framework_contract_edit_oper.js index 5b9a280..b70defa 100644 --- a/js/car_basic/child/framework_contract_edit_oper.js +++ b/js/car_basic/child/framework_contract_edit_oper.js @@ -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'); diff --git a/js/car_basic/child/framework_contract_oper.js b/js/car_basic/child/framework_contract_oper.js index c08cecf..f3913dd 100644 --- a/js/car_basic/child/framework_contract_oper.js +++ b/js/car_basic/child/framework_contract_oper.js @@ -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'); diff --git a/js/car_demand_plan/child/apply_plan_detail.js b/js/car_demand_plan/child/apply_plan_detail.js index 386d35a..340b948 100644 --- a/js/car_demand_plan/child/apply_plan_detail.js +++ b/js/car_demand_plan/child/apply_plan_detail.js @@ -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 '' + value + ""; +function setNumColor(value, isNeedNum) { + if (isNeedNum) { + return '' + value + ""; + } else { + return '' + value + ""; + } } // 导出 diff --git a/js/car_demand_plan/child/apply_plan_form.js b/js/car_demand_plan/child/apply_plan_form.js index 21084e3..04745bd 100644 --- a/js/car_demand_plan/child/apply_plan_form.js +++ b/js/car_demand_plan/child/apply_plan_form.js @@ -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 += "" + l.name + ""; html += "" + l.model + ""; html += "" + l.unit + ""; + + // 添加所需规格字段 + html += "" + setFormInput(l.carSpec || '', 4) + ""; + html += "" + setFormInput(l.needNum, 1) + ""; html += "" + setFormInput(l.times, 2) + ""; html += "" + setFormInput(l.remarks, 3) + ""; html += ""; } } else { - html += "没有相关数据"; + html += "没有相关数据"; } $("#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 += ''; } else if (type === 2) { // 需用天数 - html += ''; - // html += ''; + // 修改为普通输入框,不再使用日期选择器 + html += ''; } else if (type === 3) { // 备注 html += ''; + } else if (type === 4) { // 所需规格 + html += ''; } html += ''; 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 = '
' + '
' + - '' + + '' + '
' + - '' + + '' + '
' + '
' + '' + diff --git a/page/car_demand_plan/child/apply_plan_detail.html b/page/car_demand_plan/child/apply_plan_detail.html index a48a46c..9e2a185 100644 --- a/page/car_demand_plan/child/apply_plan_detail.html +++ b/page/car_demand_plan/child/apply_plan_detail.html @@ -56,28 +56,16 @@ - 所需运输车辆车长(米) - 所需运输车辆车宽(米) - 所需运输车辆车高(米) 预计运输物品重量(吨) - - - - - - - - 运输起点 运输终点 - + - - +
@@ -123,7 +111,7 @@
- - -
-
- -
- - - - - - -
-
-
- -
-
- -
- - - - - - -
-
-
- -
-
- -
- - - - - - - -
-
-
-
- +
+ maxlength="50" lay-affix="clear" style="width: 150px;" type="number">
@@ -137,12 +93,11 @@
-
- +
-
@@ -157,7 +112,7 @@
-

上传附件*

+

上传附件

@@ -214,17 +169,18 @@ - - - - - - - - - + + + + + + + + +
+ 序号类型名称规格单位*需用量预计使用时间备注序号类型名称规格单位所需规格*需用量预计使用天数备注