' +
'
' + operData + ' ' +
diff --git a/js/car_application_audit/car_audit_list.js b/js/car_application_audit/car_audit_list.js
index 6f8d7ac..d95599f 100644
--- a/js/car_application_audit/car_audit_list.js
+++ b/js/car_application_audit/car_audit_list.js
@@ -121,20 +121,11 @@ function initTable() {
{
field: "planNum",
width: '10%',
- title: "车辆数量",
+ title: "计划数量",
unresize: true,
align: "center",
sort:true,
},
- {
- field: "ygMoney",
- width: '14%',
- title: "预估金额(元) ",
- unresize: true,
- align: "center",
- sort:true,
-
- },
{
field: "money",
width: '14%',
@@ -199,13 +190,13 @@ function initTable() {
let html = "";
let status = d.status;
if(status == -1){
- html += "
提交 |
"
+ html += "
提交 "
}
if(status == -1 || status == 2){
- html += "
修改 |
"
+ html += "
|
修改 "
html += "
|
删除 ";
}
- html += "
详情 ";
+ html += "
|
详情 ";
if ( status == 1 ) {
html += "
|
审核 ";
}
@@ -246,18 +237,18 @@ function getCheckStatus(auditType,status) {
}
let name = '分包商';
if(auditType == 1){
- name = "项目部"
+ name = "现场项目部"
}else if(auditType == 2){
- name = "防线部门"
+ name = "智联装备云控公司放线队"
}else if(auditType == 3){
- name = "分公司"
+ name = "项目部所属分公司"
}else if(auditType == 4){
- name = "经营部"
+ name = "智联装备云控经营部"
}else if(auditType == 5){
- name = "总公司"
+ name = "智联装备云控公司总经理"
}
if (status == 1) {
- return "
● "+ name+"待审核";
+ return "
● 待"+ name+"审核";
} else if (status == 2) {
return "
● 审核驳回";
} else if (status == -1) {
diff --git a/js/car_application_audit/car_audit_update.js b/js/car_application_audit/car_audit_update.js
index c1c79d3..3aa6a1d 100644
--- a/js/car_application_audit/car_audit_update.js
+++ b/js/car_application_audit/car_audit_update.js
@@ -1,61 +1,56 @@
-let idParam, objParam, fileList = new Array(), imgListUp = new Array();
-let form, laydate, layer, upload, table, util;
-let pageNum = 1, tableIns; // 定义分页
-let jjDataArr = []; // 清单数据
-let delIdArr = []; // 存储要删除的文件ID(关键:新增初始化)
-let planId = ''; // 计划ID
-let allDataList = [];
+// 全局变量
+let idParam, objParam;
+let fileList = []; // 附件列表
+let delIdArr = []; // 删除旧附件ID
+let jjDataArr = []; // 计划明细
+let allDataList = []; // 派车明细
+let planId = ''; // 当前选择计划ID
+let form, laydate, layer, upload, table, util;
+let pageNum = 1, tableIns;
+
+// ------------------- 初始化参数 -------------------
function setParams(obj) {
objParam = JSON.parse(obj);
- // 初始化删除文件ID数组(避免残留)
delIdArr = [];
- layui.use(['form', 'layer', 'laydate', 'upload', 'table'], function () {
+ layui.use(['form','layer','laydate','upload','table'], function(){
form = layui.form;
layer = layui.layer;
laydate = layui.laydate;
upload = layui.upload;
table = layui.table;
util = layui.util;
- laydate.render({
- elem: '#fkTime'
- });
+
+ laydate.render({elem:'#fkTime'});
form.verify();
- form.on('submit(formData)', function (data) {
- submitApply(data);
- });
+ form.on('submit(formData)', function(data){ submitApply(data); });
form.render();
+
+ // 初始化上传
let uploadObj = upload.render({
elem: '#test2',
multiple: true,
dataType: "json",
exts: 'jpg|png|jpeg|doc|docx|pdf|xlsx|xls',
acceptMime: 'image/jpg,image/png,image/jpeg,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- number: 5, //最大上传数量
- size: 1024 * 10, //最大文件大小,单位k
- auto: false, //是否自动上传 ,默认为true
- bindAction: '#hideUpload', //绑定的按钮
- choose: function (obj) {
- let length = $('.file-iteme').length;
- if (length >= 5) {
- return layer.msg('最多上传5个附件证明', {icon: 7});
- }
+ number: 5,
+ size: 10240,
+ auto: false,
+ bindAction: '#hideUpload',
+ choose: function(obj){
+ let existCount = fileList.length;
+ if(existCount >=5){ return layer.msg('最多上传5个附件证明',{icon:7}); }
uploadObj.config.elem.next()[0].value = '';
- let num = 0;
- obj.preview(function (index, file, result) {
- num++;
- if (num <= (5 - length)) {
- $('#uploader-list').append(
- '
' +
- '
' +
- handleFileType(index, file, result) +
- '
'
- );
- let map = new Map();//将选择的图片索引和图片写成对象存入集合
- map.index = index;
- map.file = file;
- fileList.push(map);
- }
+ obj.preview(function(index, file, result){
+ if(fileList.length >=5) return;
+ const uid = 'new_' + Date.now() + '_' + Math.random();
+ fileList.push({uid,name:file.name,file,isExist:false,fileId:null});
+ $('#uploader-list').append(`
+
+
x
+ ${handleFileType(index,file,result)}
+
+ `);
});
}
});
@@ -64,702 +59,309 @@ function setParams(obj) {
});
}
-// 获取数据详情
-function getBalanceDataDetails() {
+// ------------------- 获取数据详情 -------------------
+function getBalanceDataDetails(){
let encryptedData = {id: objParam.id};
- let url = dataUrl + 'backstage/carBalance/getBalanceDataDetails?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
- ajaxRequest(url, "GET", null, true, function () {
- }, function (result) {
- if (result.code === 200) {
-
- //基本信息回显
+ let url = dataUrl+'backstage/carBalance/getBalanceDataDetails?encryptedData='+encodeURIComponent(JSON.stringify(encryptedData));
+ ajaxRequest(url,"GET",null,true,null,function(result){
+ if(result.code===200){
let dataObj = result.data;
+
+ // 基本信息回显
$('#supId').val(dataObj.supId);
$('#supName').val(dataObj.supName);
- $('#fkTime').val(util.toDateString(dataObj.fkTime, 'yyyy-MM-dd'));
+ $('#fkTime').val(util.toDateString(dataObj.fkTime,'yyyy-MM-dd'));
$('#money').val(dataObj.money);
$('#remark').val(dataObj.remark);
- $('#planListNum').val(dataObj.planList.length)
+ $('#planListNum').val(dataObj.planList.length);
- // ========== 保留:附件回显+加入 ==========
- let cent = '';
- // 清空原有fileList和delIdArr(避免重复)
+ // 附件回显
fileList = [];
- delIdArr = []; // 重置删除文件ID数组
- if (dataObj.fileList.length > 0) {
- for (let i = 0; i < dataObj.fileList.length; i++) {
- let l = dataObj.fileList[i];
- let path = fileUrl + l.fileUrl + '?token=' + sessionStorage.getItem("gz-token");
- let file = { name: l.fileName, id: l.id, type: l.type };
- cent += '
' +
- '
' +
- handleFileType(i, file, path, l.type) +
- '
';
- // 回显附件加入fileList(标记为已存在的文件)
- fileList.push({
- index: i,
- file: file,
- isExist: true, // 标记为回显的旧文件
- fileId: l.id // 存储文件ID,用于删除
- });
- }
+ delIdArr = [];
+ $('#uploader-list').html('');
+ if(dataObj.fileList && dataObj.fileList.length>0){
+ dataObj.fileList.forEach((f,i)=>{
+ const uid = 'old_'+f.id;
+ const path = fileUrl+f.fileUrl+'?token='+sessionStorage.getItem("gz-token");
+ fileList.push({uid,name:f.fileName,isExist:true,fileId:f.id,file:null});
+ $('#uploader-list').append(`
+
+
x
+ ${handleFileType(i,{name:f.fileName,ext:f.type},path)}
+
+ `);
+ });
}
- console.log("aa==",fileList)
- $('#uploader-list').append(cent);
// 计划明细回显
- planDetail(dataObj.planList)
- // 用车明细回显
- carDetail(dataObj.detailsList)
+ planDetail(dataObj.planList);
- // ========== 保留:初始化allDataList和jjDataArr ==========
+ // 用车明细回显
+ carDetail(dataObj.detailsList);
+
+ // 初始化全局数据
allDataList = dataObj.detailsList || [];
jjDataArr = dataObj.planList || [];
}
- }, function (xhr, status, error) {
- errorFn(xhr, status, error)
- }, null);
+ },function(xhr,status,error){ errorFn(xhr,status,error); },null);
}
-function planDetail(list) {
+// ------------------- 计划明细 -------------------
+function planDetail(list){
$('#plan-detail-table tr:not(:first)').remove();
- if (list.length > 0) {
+ if(list.length>0){
let html = '';
- $.each(list, function (index, item) {
- html += '
' +
- '' + (index + 1) + ' ' +
- '' + item.proName + ' ' +
- '' + item.code + ' ' +
- '' + item.supName + ' ' +
- '' + item.carNum + ' ' +
- '' + item.money + ' ' +
- '' + item.ygMoney + ' ' +
- '' +
- '' +
- ' ' +
- ' ';
+ list.forEach((item,index)=>{
+ html+=`
+ ${index+1}
+ ${item.proName}
+ ${item.code}
+ ${item.supName}
+ ${item.carNum}
+ ${item.money}
+ ${item.ygMoney}
+
+ `;
});
$('#plan-detail-table').append(html);
}
}
-// ========== 保留:delPlanDetail删除关联用车明细+同步数据 ==========
-function delPlanDetail(index) {
+// ------------------- 删除计划明细 -------------------
+function delPlanDetail(index){
let planList = $('#plan-detail-table tr:not(:first)');
- if (planList.length <= 1) {
- return layer.msg('计划明细至少保留1条数据,无法删除!', {icon: 7});
- }
+ if(planList.length<=1){ return layer.msg('计划明细至少保留1条数据,无法删除!',{icon:7}); }
+
let currentTr = planList.eq(index);
let delCode = currentTr.find('td:eq(2)').text().trim();
- if (!delCode) {
- return layer.msg('未获取到需求计划编号,无法删除!', {icon: 2});
- }
+ if(!delCode) return layer.msg('未获取到需求计划编号,无法删除!',{icon:2});
- layer.confirm('确定删除该计划明细及对应的用车明细数据吗?', {icon: 3, title: '提示'}, function (layIndex) {
+ layer.confirm('确定删除该计划明细及对应的用车明细数据吗?',{icon:3,title:'提示'},function(layIndex){
currentTr.remove();
- $('#plan-detail-table tr:not(:first)').each(function(i) {
- $(this).find('td:eq(0)').text(i + 1);
- });
- //删除用车明细中code匹配的数据
+ $('#plan-detail-table tr:not(:first)').each(function(i){ $(this).find('td:eq(0)').text(i+1); });
deleteCarDetailByCode(delCode);
- // 同步更新jjDataArr和allDataList
- jjDataArr = jjDataArr.filter(item => item.code !== delCode);
- allDataList = allDataList.filter(item => item.planCode !== delCode);
+ jjDataArr = jjDataArr.filter(item=>item.code!==delCode);
+ allDataList = allDataList.filter(item=>item.planCode!==delCode);
layer.close(layIndex);
- })
+ });
}
-// ========== 保留:deleteCarDetailByCode精准删除用车明细 ==========
-function deleteCarDetailByCode(delCode) {
- // 1. 删除普通车辆表格中对应code的数据
- $('#dispatch-car-table tr:not(:first)').each(function() {
- let $tr = $(this);
- // 优先获取a标签文本,避免索引错误
- let carCode = $tr.find('td:last a').text().trim() || '';
- if (!carCode) {
- carCode = $tr.find('td:last').text().replace(/<.*?>/g, '').trim();
- }
- if (carCode === delCode) {
- $tr.remove();
- }
+// ------------------- 删除用车明细 -------------------
+function deleteCarDetailByCode(delCode){
+ ['#dispatch-car-table','#dispatch-car-table2'].forEach(tableId=>{
+ $(`${tableId} tr:not(:first)`).each(function(){
+ let $tr=$(this);
+ let code = $tr.find('td:last a').text().trim() || $tr.find('td:last').text().replace(/<.*?>/g,'').trim();
+ if(code===delCode) $tr.remove();
+ });
+ if($(`${tableId} tr:not(:first)`).length===0){ $(`${tableId}`).css('display','none'); }
});
-
- // 2. 删除吊车表格中对应code的数据
- $('#dispatch-car-table2 tr:not(:first)').each(function() {
- let $tr = $(this);
- // 优先获取a标签文本,避免索引错误
- let dcCode = $tr.find('td:last a').text().trim() || '';
- if (!dcCode) {
- dcCode = $tr.find('td:last').text().replace(/<.*?>/g, '').trim();
- }
- if (dcCode === delCode) {
- $tr.remove();
- }
- });
-
- // 3. 处理删除后无数据的情况
- if ($('#dispatch-car-table tr:not(:first)').length === 0) {
- $('#dispatch-car-table').css('display', 'none');
- }
- if ($('#dispatch-car-table2 tr:not(:first)').length === 0) {
- $('#dispatch-car-table2').css('display', 'none');
- }
}
-function carDetail(list) {
- // 派车明细
- let carList = list.filter(item => {
- return item.type === '车辆';
- })
- let dcList = list.filter(item => {
- return item.type === '吊车';
- })
+// ------------------- 用车明细 -------------------
+function carDetail(list){
+ const carList = list.filter(item=>item.type==='车辆');
+ const dcList = list.filter(item=>item.type==='吊车');
setDispatchCarTable(carList);
setDispatchCarTable2(dcList);
- // 派车明细-车辆
- function setDispatchCarTable(list) {
+ function setDispatchCarTable(list){
$('#dispatch-car-table tr:not(:first)').remove();
- if (list.length > 0) {
- let html = '';
- if (list && list.length > 0) {
- $.each(list, function (index, item) {
- let imgNum = 0;
- imgNum += item.carImage.filter(item => {
- return item.type !== '6'
- }).length;
- imgNum += item.driverUserImage.filter(item => {
- return item.type !== '6'
- }).length;
- imgNum += item.fileList.length;
-
- const actualGls = formatToTwoDecimals(item.exeGls) || 0.00; // 实际公里数初始=预估公里数
-
- html += "
" +
- "" + item.type + " " +
- "" + item.name + " " +
- "" + item.model + " " +
- "" + item.carNum + " " +
- "" + (item.ton + '吨') + " " +
- "" + item.goodsName + " " +
- "" + item.startAddress + " " +
- "" + item.endAddress + " " +
-
- " " +
-
- "" + item.glsPrice + " " +
- " ¥ " + (item.glsMoney ? item.glsMoney : 0) + " " +
- "" + imgNum + "查看附件>> " +
- "" + item.planCode + " " +
- " ";
- })
- } else {
- html = '
暂无数据 ';
- }
+ if(list.length>0){
+ let html='';
+ list.forEach(item=>{
+ const imgNum = (item.carImage.filter(i=>i.type!=='6').length)+(item.driverUserImage.filter(i=>i.type!=='6').length)+item.fileList.length;
+ const actualGls = formatToTwoDecimals(item.exeGls||0);
+ html+=`
+ ${item.type}
+ ${item.name}
+ ${item.model}
+ ${item.carNum}
+ ${item.ton}吨
+ ${item.goodsName}
+ ${item.startAddress}
+ ${item.endAddress}
+
+ ${item.glsPrice}
+ ¥ ${item.glsMoney||0}
+ ${imgNum}查看附件>>
+ ${item.planCode}
+ `;
+ });
$('#dispatch-car-table').removeAttr('style').append(html);
- } else {
- $('#dispatch-car-table').css('display', 'none');
- }
+ }else{ $('#dispatch-car-table').css('display','none'); }
}
- // 派车明细-吊车
- function setDispatchCarTable2(list) {
+ function setDispatchCarTable2(list){
$('#dispatch-car-table2 tr:not(:first)').remove();
- if (list.length > 0) {
- let html = '';
- if (list && list.length > 0) {
- $.each(list, function (index, item) {
- let imgNum = 0;
- imgNum += item.driverUserImage.filter(item => {
- return item.type === '2' || item.type === '3'
- }).length;
- imgNum += item.operaImage.filter(item => {
- return item.type === '2' || item.type === '3' || item.type === '6'
- }).length;
- imgNum += item.fileList.length;
-
- const actualPlanDay = item.exeDay || 0;
- const actualDcMoney = formatToTwoDecimals(item.money);
-
- html += '
' +
- '' + item.type + ' ' +
- '' + item.name + ' ' +
- '' + item.model + ' ' +
- '' + item.carNum + ' ' +
- '' + item.useAddress + ' ' +
- // '' + item.planDay + ' ' +
- " " +
- '' + setZlPrice(item) + ' ' +
- ' ¥ ' + item.dcMoney + ' ' +
-
- " " +
-
- "" + imgNum + "查看附件>> " +
- "" + item.planCode + " " +
- ' ';
- })
- } else {
- html = '
暂无数据 ';
- }
+ if(list.length>0){
+ let html='';
+ list.forEach(item=>{
+ const imgNum = item.driverUserImage.filter(i=>['2','3'].includes(i.type)).length + item.operaImage.filter(i=>['2','3','6'].includes(i.type)).length + item.fileList.length;
+ const actualPlanDay = item.exeDay||0;
+ const actualDcMoney = formatToTwoDecimals(item.money||0);
+ html+=`
+ ${item.type}
+ ${item.name}
+ ${item.model}
+ ${item.carNum}
+ ${item.useAddress}
+
+ ${item.dcUnit==='元/月/台'?item.monthPrice+'('+item.dcUnit+')':item.dayPrice+'('+item.dcUnit+')'}${item.isOutSet===1?' '+(item.jcMoney||0)+'(进出场费)':''}
+ ¥ ${item.dcMoney}
+
+ ${imgNum}查看附件>>
+ ${item.planCode}
+ `;
+ });
$('#dispatch-car-table2').removeAttr('style').append(html);
-
- // 设置租赁单价
- function setZlPrice(item) {
- let html = '';
- if (item.dcUnit === '元/月/台') {
- html += '
' + item.monthPrice + '(' + item.dcUnit + ')' + '
';
- } else {
- html += '
' + item.dayPrice + '(' + item.dcUnit + ')' + '
';
- }
- if (item.isOutSet === 1) {
- html += '
' + (item.jcMoney ? item.jcMoney : 0) + '(进出场费)
'
- }
- return html;
- }
- } else {
- $('#dispatch-car-table2').css('display', 'none');
- }
+ }else{ $('#dispatch-car-table2').css('display','none'); }
}
}
-// 设置文件类型
-function handleFileType(index, file, result) {
- let html = '', img = '';
- if (file.ext) {
- file.ext = file.ext.toLowerCase();
- }
- if (file.name) {
- file.name = file.name.toLowerCase();
- }
- if (file.ext === 'doc' || file.ext === 'docx') {
- img = '../../../images/docx.png';
- } else if (file.ext === 'xls' || file.ext === 'xlsx') {
- img = '../../../images/xlsx.png';
- } else if (file.ext === 'pdf') {
- img = '../../../images/pdf.png';
- } else {
- return '
';
- }
- html += '
' +
- '
' +
- '
' + file.name + '
' +
- '
';
+// ------------------- 安全序列化 -------------------
+function safeStringify(obj){
+ const cache = new Set();
+ return JSON.stringify(obj,(key,value)=>{
+ if(typeof value==='object' && value!==null){
+ if(cache.has(value)) return;
+ cache.add(value);
+ }
+ return value;
+ });
+}
+
+// ------------------- 文件类型显示 -------------------
+function handleFileType(index,file,result){
+ let html='', img='';
+ if(file.ext) file.ext=file.ext.toLowerCase();
+ if(file.name) file.name=file.name.toLowerCase();
+ if(file.ext==='doc'||file.ext==='docx'){ img='../../../images/docx.png'; }
+ else if(file.ext==='xls'||file.ext==='xlsx'){ img='../../../images/xlsx.png'; }
+ else if(file.ext==='pdf'){ img='../../../images/pdf.png'; }
+ else{ return `
`; }
+ html=`
+
+
${file.name}
+
`;
return html;
}
-// ========== 保留+优化:附件删除逻辑(兼容回显/新增,收集delIdArr) ==========
-$(document).on("click", ".file-iteme .handle", function (event) {
- event.stopPropagation();
- let $this = $(this);
- let $parent = $this.parent();
- let fileId = $parent.attr('data-file-id'); // 回显文件的ID
- let index = $this.next().attr('data-index'); // 新增文件的索引
+// ------------------- 删除附件 -------------------
+$(document).on("click",".file-iteme .handle",function(e){
+ e.stopPropagation();
+ const $item=$(this).closest('.file-iteme');
+ const uid = $item.attr('data-uid');
+ const fileId = $item.attr('data-file-id');
+ if(fileId && !delIdArr.includes(fileId)) delIdArr.push(fileId);
+ fileList = fileList.filter(f=>f.uid!==uid);
+ $item.remove();
+});
- // 1. 收集要删除的文件ID(用于后端删除)
- if (fileId) {
- delIdArr.push(fileId); // 存储要删除的旧文件ID
- }
+// ------------------- 获取编辑后的实际值 -------------------
+function getEditedActualValues(){
+ let actualValues={carActualList:[],craneActualList:[]};
+ $('#dispatch-car-table .actual-gls').each(function(){
+ const id=$(this).data('id');
+ const val=formatToTwoDecimals($(this).val());
+ actualValues.carActualList.push({outDetailId:id,exeGls:val,inMoney:0});
+ });
+ $('#dispatch-car-table2 tr:not(:first)').each(function(){
+ const id=$(this).find('.actual-dc-money').data('id');
+ if(!id) return;
+ const day=$(this).find('.actual-dc-planDay').val()||0;
+ const money=formatToTwoDecimals($(this).find('.actual-dc-money').val());
+ actualValues.craneActualList.push({outDetailId:id,exeDay:day,inMoney:money});
+ });
+ return actualValues;
+}
- // 2. 过滤fileList数组
- let newFileList = [];
- $.each(fileList, function (inx, ele) {
- // 排除要删除的文件(新增文件按index,回显文件按fileId)
- if ((index && index != ele.index) || (fileId && ele.fileId != fileId)) {
- newFileList.push(ele);
- }
+// ------------------- 格式化两位小数 -------------------
+function formatToTwoDecimals(num){ return isNaN(Number(num))? '0.00': Number(num).toFixed(2); }
+
+// ------------------- 正则校验输入框 -------------------
+$(document).on('input','.actual-gls,.actual-money,.actual-dc-money',function(){
+ this.value=this.value.replace(/[^0-9.]/g,'').replace(/\.{2,}/g,'.').replace(/^0+(?=\d)/,'');
+ if(this.value.indexOf('.')!==-1){ const parts=this.value.split('.'); this.value=parts[0]+'.'+parts[1].substring(0,2);}
+ const numValue=Number(this.value||0); if(numValue>100000000) this.value=(100000000).toFixed(2);
+});
+$(document).on('blur','.actual-gls,.actual-money,.actual-dc-money',function(){ this.value=formatToTwoDecimals(this.value); });
+
+// ------------------- 提交 -------------------
+function submitApply(data){
+ if(fileList.length===0) return layer.msg('请上传付款单',{icon:7});
+ if(jjDataArr.length===0) return layer.msg('请选择需求计划',{icon:7});
+ if(allDataList.length===0) return layer.msg('用车明细数据为空,无法提交',{icon:7});
+
+ data.field.supId=objParam.supId;
+ data.field.id=objParam.id;
+ data.field.delFileId=delIdArr.join(',');
+
+ let planList=[],detailsList=[];
+ jjDataArr.forEach(item=>{
+ planList.push({
+ id:item.id||'',
+ planId:item.planId||item.id,
+ supId:item.supId,
+ money:item.money,
+ type:item.type||'1',
+ proId:item.proId||'',
+ carNum:item.carNum||item.needNum||0
+ });
});
- // 3. 更新fileList
- fileList = newFileList;
- // 4. 删除DOM
- $parent.remove();
-});
+ const actualValues = getEditedActualValues();
+ allDataList.forEach(item=>{
+ const carActual = actualValues.carActualList.find(v=>v.outDetailId==item.id);
+ const craneActual = actualValues.craneActualList.find(v=>v.outDetailId==item.id);
+ detailsList.push({
+ id:item.id||'',
+ planId:item.planId||'',
+ type:item.type||'车辆',
+ supId:item.supId||objParam.supId,
+ proId:item.proId||'',
+ money:item.cost||item.money||0,
+ outId:item.outId||'',
+ exeGls:carActual?.exeGls||item.exeGls||'',
+ inMoney:carActual?.inMoney||craneActual?.inMoney||'',
+ exeDay:craneActual?.exeDay||item.exeDay||'',
+ outDetailId:item.outDetailId||'',
+ modelId:item.modelId||'',
+ ton:item.ton||0
+ });
+ });
+
+ data.field.planList=planList;
+ data.field.detailsList=detailsList;
+
+ let formData = new FormData();
+ fileList.forEach(item=>{ if(!item.isExist && item.file) formData.append("file[]",item.file); });
+ formData.append('params',JSON.stringify(data.field));
+
+ let loadingMsg = layer.msg('正在提交保存,请稍等...',{icon:16,shade:0.01,time:'0'});
+ let url = dataUrl+'backstage/carBalance/updateBalanceData';
+ ajaxRequestByUploadFile(url, formData, function(){
+ $('.save,.cancel').addClass("layui-btn-disabled").attr("disabled",true);
+ }, function(result){
+ layer.close(loadingMsg);
+ $('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled",false);
+ if(result.code===200){ parent.layer.msg(result.msg,{icon:1}); closePage(1);}
+ else layer.msg(result.msg,{icon:2});
+ }, function(xhr,status,error){
+ layer.close(loadingMsg);
+ layer.msg('服务异常,请稍后重试',{icon:16,scrollbar:false,time:2000});
+ $('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled",false);
+ errorFn(xhr,status,error);
+ }, null);
+}
function saveData2() {
$('#formSubmit').trigger('click')
}
-// ========== 保留+核心修改:submitApply(delFileId逗号分隔) ==========
-function submitApply(data) {
- // 校验附件证明是否上传(保留:兼容回显附件)
- console.log('fileList:', fileList)
- let totalFileCount = fileList.length;
- if (totalFileCount === 0) {
- return layer.msg('请上传付款单', {icon: 7});
- }
- if (jjDataArr.length === 0) {
- return layer.msg('请选择需求计划', {icon: 7});
- }
- if (allDataList.length === 0) {
- return layer.msg('用车明细数据为空,无法提交', {icon: 7});
- }
-
- data.field.supId = objParam.supId;
- data.field.id = objParam.id; // 修改操作必须传主键ID
- // ========== 核心修改:delFileId用逗号分隔 ==========
- data.field.delFileId = delIdArr.join(','); // 数组转逗号分隔字符串
- console.log('delFileId(逗号分隔):', data.field.delFileId); // 调试用
-
- let planList = [], detailsList = [];
- $.each(jjDataArr, function (index, item) {
- let obj = {
- id: item.id || '',
- planId: item.planId || item.id,
- supId: item.supId,
- money: item.money,
- type: item.type || '1',
- proId: item.proId || '',
- carNum: item.carNum || item.needNum || 0
- };
- planList.push(obj);
- })
-
- const actualValues = getEditedActualValues();
-
- $.each(allDataList, function (index, item) {
- const carActual = actualValues.carActualList.find(v => v.outDetailId == item.id); // 普通车辆
- const craneActual = actualValues.craneActualList.find(v => v.outDetailId == item.id); // 吊车
- let obj = {
- id: item.id || '',
- planId: item.planId || '',
- type: item.type || '车辆',
- supId: item.supId || objParam.supId,
- proId: item.proId || '',
- money: item.cost || item.money || 0,
- outId: item.outId || '',
- exeGls: carActual?.exeGls || item.exeGls || '',
- inMoney: carActual?.inMoney || craneActual?.inMoney || '',
- exeDay: craneActual?.exeDay || item.exeDay || '',
- outDetailId: item.outDetailId || '',
- modelId: item.modelId || '',
- ton: item.ton || 0
- };
- detailsList.push(obj);
- })
- data.field.planList = planList;
- data.field.detailsList = detailsList;
-
- let formData = new FormData();
- //遍历最终文件集合(仅上传新增文件)
- for (let i = 0; i < fileList.length; i++) {
- let fileItem = fileList[i];
- if (!fileItem.isExist && fileItem.file) {
- formData.append("file[]", fileItem.file)
- }
- }
- formData.append('params', JSON.stringify(data.field));
- console.log("提交参数:", data.field); // 调试用
-
- let loadingMsg = layer.msg('正在提交保存,请稍等...', {icon: 16, shade: 0.01, time: '0'});
- let url = dataUrl + 'backstage/carBalance/updateBalanceData';
- ajaxRequestByUploadFile(url, formData, function () {
- $('.save').addClass("layui-btn-disabled").attr("disabled", true);
- $('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
- }, function (result) {
- layer.close(loadingMsg);
- $('.save').removeClass("layui-btn-disabled").attr("disabled", false);
- $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
- if (result.code === 200) {
- parent.layer.msg(result.msg, {icon: 1});
- closePage(1);
- } else {
- layer.msg(result.msg, {icon: 2});
- }
- }, function (xhr, status, error) {
- layer.close(loadingMsg); // 关闭提示层
- layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
- $('.save').removeClass("layui-btn-disabled").attr("disabled", false);
- $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
- errorFn(xhr, status, error)
- }, null);
-}
-
-// 选择需求计划单据
-function chooseFitType() {
- let params = {
- contractId: objParam.contractId,
- supId: objParam.supId,
- planId: planId,
- jjDataArr: JSON.stringify(jjDataArr)
- };
- openIframeByParamObj("choose_plan_code_list", '选择需要付款的需求计划编号', "./choose_plan_code_list.html", '92%', '95%', params);
-}
-
-// 需求计划单据赋值
-function addFitDatas(data, planIdArr) {
- jjDataArr = JSON.parse(data);
- console.error(jjDataArr);
-
- let money = 0;
- $.each(jjDataArr, function (index, item) {
- const dataNum = item.money ? item.money : 0;
- const num = Number(dataNum);
- const cents = Math.round(num * 1000);
- money += cents;
- })
- $('#money').val(money / 1000);
- if (!planId) {
- $('#chooseValue').val('选择数据(已选择 ' + planIdArr.length + ' 条)');
- $('#no_data_title').css({'display': 'none'});
- $('#search-info').removeAttr('style');
- $('#table-box').removeAttr('style');
- planId = planIdArr.join('@');
- getPayCarDetails();
- } else {
- $('#chooseValue').val('选择数据(已选择 ' + planIdArr.length + ' 条)');
- planId = planIdArr.join('@');
- getPayCarDetails();
- }
-}
-
-// 派车录入详情明细-派车资料等明细
-function getPayCarDetails(id) {
- let encryptedData = {planId: planId};
- let url = dataUrl + 'backstage/carBalance/getPayCarDetails?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
- ajaxRequest(url, "GET", null, true, function () {
- }, function (result) {
- if (result.code === 200) {
- dataObj = result.data;
- setTableData(result.data);
- }
- }, function (xhr, status, error) {
- errorFn(xhr, status, error)
- }, null);
-
- function setTableData(list) {
- allDataList.splice(0, allDataList.length);
- allDataList = list;
- // 派车明细
- let carList = list.filter(item => {
- return item.type === '车辆';
- })
- let dcList = list.filter(item => {
- return item.type === '吊车';
- })
- setDispatchCarTable(carList);
- setDispatchCarTable2(dcList);
- }
-
- // 派车明细-车辆
- function setDispatchCarTable(list) {
- $('#dispatch-car-table tr:not(:first)').remove();
- if (list.length > 0) {
- let html = '';
- if (list && list.length > 0) {
- $.each(list, function (index, item) {
- let imgNum = 0;
- imgNum += item.carImage.filter(item => {
- return item.type !== '6'
- }).length;
- imgNum += item.driverUserImage.filter(item => {
- return item.type !== '6'
- }).length;
- imgNum += item.fileList.length;
-
- const actualGls = formatToTwoDecimals(item.gls) || 0.00; // 实际公里数初始=预估公里数
- // const actualMoney = formatToTwoDecimals(0); // 实际金额初始=预估金额
-
- html += "
" +
- "" + item.type + " " +
- "" + item.name + " " +
- "" + item.model + " " +
- "" + item.carNum + " " +
- "" + (item.ton + '吨') + " " +
- "" + item.goodsName + " " +
- "" + item.startAddress + " " +
- "" + item.endAddress + " " +
- "" + item.gls + " " +
-
- " " +
-
- "" + item.glsPrice + " " +
- " ¥ " + (item.glsMoney ? item.glsMoney : 0) + " " +
-
- // " " +
-
- "" + imgNum + "查看附件>> " +
- "" + item.planCode + " " +
- " ";
- })
- } else {
- html = '
暂无数据 ';
- }
- $('#dispatch-car-table').removeAttr('style').append(html);
- } else {
- $('#dispatch-car-table').css('display', 'none');
- }
- }
-
- // 派车明细-吊车
- function setDispatchCarTable2(list) {
- $('#dispatch-car-table2 tr:not(:first)').remove();
- if (list.length > 0) {
- let html = '';
- if (list && list.length > 0) {
- $.each(list, function (index, item) {
- let imgNum = 0;
- imgNum += item.driverUserImage.filter(item => {
- return item.type === '2' || item.type === '3'
- }).length;
- imgNum += item.operaImage.filter(item => {
- return item.type === '2' || item.type === '3' || item.type === '6'
- }).length;
- imgNum += item.fileList.length;
-
- const actualPlanDay = item.planDay || 0;
- const actualDcMoney = formatToTwoDecimals(0);
-
- html += '
' +
- '' + item.type + ' ' +
- '' + item.name + ' ' +
- '' + item.model + ' ' +
- '' + item.carNum + ' ' +
- '' + item.useAddress + ' ' +
- '' + item.planDay + ' ' +
- " " +
- '' + setZlPrice(item) + ' ' +
- ' ¥ ' + item.dcMoney + ' ' +
-
- " " +
-
- "" + imgNum + "查看附件>> " +
- "" + item.planCode + " " +
- ' ';
- })
- } else {
- html = '
暂无数据 ';
- }
- $('#dispatch-car-table2').removeAttr('style').append(html);
-
- // 设置租赁单价
- function setZlPrice(item) {
- let html = '';
- if (item.dcUnit === '元/月/台') {
- html += '
' + item.monthPrice + '(' + item.dcUnit + ')' + '
';
- } else {
- html += '
' + item.dayPrice + '(' + item.dcUnit + ')' + '
';
- }
- if (item.isOutSet === 1) {
- html += '
' + (item.jcMoney ? item.jcMoney : 0) + '(进出场费)
'
- }
- return html;
- }
- } else {
- $('#dispatch-car-table2').css('display', 'none');
- }
- }
-}
-
-// 需求计划详情
-function viewPlanDetail(obj) {
- obj.id = obj.planId;
- obj.code = obj.planCode;
- let content = '../car_demand_plan/child/apply_plan_detail.html';
- if (obj.code.indexOf('spec-') > -1) {
- content = '../car_demand_plan/child/emerg_internal_car_detail.html';
- }
- openIframeByParamObj2("viewPlanDetail", "车辆需求计划", content, "92%", "95%", obj);
-}
-
-// 查看附件
-function viewFileDetail(obj, type) {
- let title = '行驶证/挂靠协议驾驶证/身份证/导航图'
- if (type === 1) {
- title = '行驶证/挂靠协议驾驶证/身份证/导航图'
- } else if (type === 2) {
- title = '操作证/身份证/导航图'
- }
- obj.type = type;
- openIframeByParamObj("viewFileDetail", title, '../../car_demand_plan/child/view_file_detail.html', "92%", "95%", obj);
-}
-
-// ========== 保留:收集编辑后的实际值 ==========
-function getEditedActualValues() {
- // 存储最终收集的实际值
- let actualValues = {
- carActualList: [], // 普通车辆实际值(实际公里数、实际金额)
- craneActualList: [] // 吊车实际值(实际金额)
- };
-
- // 1. 收集普通车辆的实际公里数、实际金额
- $('#dispatch-car-table tr:not(:first)').each(function () {
- const $tr = $(this);
- const itemId = $tr.find('.actual-gls').data('id'); // 获取数据ID
- if (!itemId) return; // 无ID则跳过
-
- // 修复列索引:实际公里数输入框在td:eq(9),预估公里数在td:eq(8)
- const actualGls = $tr.find('.actual-gls').val().trim() || $tr.find('td:eq(8)').text().trim() || '0.00';
- // const actualMoney = $tr.find('.actual-money').val()?.trim() || '0.00';
-
- actualValues.carActualList.push({
- outDetailId: itemId,
- exeGls: formatToTwoDecimals(actualGls),
- inMoney: 0
- });
- });
-
- // 2. 收集吊车的实际金额
- $('#dispatch-car-table2 tr:not(:first)').each(function () {
- const $tr = $(this);
- const itemId = $tr.find('.actual-dc-money').data('id'); // 获取数据ID
- if (!itemId) return; // 无ID则跳过
-
- const actualPlanDay = $tr.find('.actual-dc-planDay').val().trim() || $tr.find('td:eq(5)').text().trim() || '0';
- const actualDcMoney = $tr.find('.actual-dc-money').val().trim() || '0.00';
-
- actualValues.craneActualList.push({
- outDetailId: itemId,
- inMoney: formatToTwoDecimals(actualDcMoney),
- exeDay: actualPlanDay
- });
- });
- return actualValues;
-}
-
-// 全局工具函数:格式化数字为两位小数(处理空值、非数字)
-function formatToTwoDecimals(num) {
- if (num === null || num === undefined || num === '' || isNaN(Number(num))) return '0.00';
- return Number(num).toFixed(2);
-}
-
-// 输入框正则校验(仅正数 + 最多两位小数 + 不超过1亿元)
-$(document).on('input', '.actual-gls, .actual-money, .actual-dc-money', function () {
- this.value = this.value
- .replace(/[^0-9.]/g, '') // 过滤非法字符
- .replace(/\.{2,}/g, '.') // 单个小数点
- .replace(/^0+(?=\d)/, ''); // 去除开头多余0
-
- if (this.value.indexOf('.') !== -1) {
- const parts = this.value.split('.');
- this.value = parts[0] + '.' + parts[1].substring(0, 2);
- }
-
- const numValue = Number(this.value || 0);
- const maxAmount = 100000000;
- if (numValue > maxAmount) {
- this.value = maxAmount.toFixed(2);
- }
-});
-
-// 失焦格式化
-$(document).on('blur', '.actual-gls, .actual-money, .actual-dc-money', function () {
- this.value = formatToTwoDecimals(this.value);
-});
-
-// 关闭页面
-function closePage(type) {
- let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
- if (type == 1) {
- window.parent.reloadData();
- }
- parent.layer.close(index); // 再执行关闭
+// ------------------- 关闭页面 -------------------
+function closePage(type){
+ let index = parent.layer.getFrameIndex(window.name);
+ if(type==1) window.parent.reloadData();
+ parent.layer.close(index);
}
diff --git a/js/car_basic/child/contract_supplier_list.js b/js/car_basic/child/contract_supplier_list.js
index 0e8611b..db9a5f8 100644
--- a/js/car_basic/child/contract_supplier_list.js
+++ b/js/car_basic/child/contract_supplier_list.js
@@ -106,7 +106,7 @@ function initTable() {
},
{
field: "expGls",
- width: '30%',
+ width: '20%',
title: "公里数",
unresize: true,
align: "center",
@@ -142,6 +142,14 @@ function initTable() {
align: "center",
sort:true,
},
+ {
+ field: "ton",
+ title: "吨位",
+ width: '10%',
+ unresize: true,
+ align: "center",
+ sort:true,
+ },
],
],
limits: [10, 15, 20, 25, 50, 100],
@@ -319,4 +327,4 @@ function exportExcel() {
}
url = dataUrl + "backstage/carContract/exportDetail";
exportExcelUtil(url, title, JSON.stringify(params));
-}
\ No newline at end of file
+}
diff --git a/page/car_application_audit/child/car_audit_update.html b/page/car_application_audit/child/car_audit_update.html
index 31c6fb5..49b8224 100644
--- a/page/car_application_audit/child/car_audit_update.html
+++ b/page/car_application_audit/child/car_audit_update.html
@@ -153,7 +153,7 @@