付款单加备注
This commit is contained in:
parent
adc378a86d
commit
c1bc45744a
|
|
@ -512,7 +512,7 @@ function setOperRecordInfo(list, obj) {
|
||||||
let imgUrl = '../../../images/user_head_icon.png';
|
let imgUrl = '../../../images/user_head_icon.png';
|
||||||
let imgUrl2 = '../../../images/time_icon.png';
|
let imgUrl2 = '../../../images/time_icon.png';
|
||||||
$.each(list, function (index, item) {
|
$.each(list, function (index, item) {
|
||||||
const creator = item.userName;
|
const creator = item.auditUser;
|
||||||
// 1. 容错处理(统一处理空值、类型转换)
|
// 1. 容错处理(统一处理空值、类型转换)
|
||||||
const remark = setNullValue(item.auditReason); // 已有空值处理,保留
|
const remark = setNullValue(item.auditReason); // 已有空值处理,保留
|
||||||
const auditType = item.auditType + ''; // 确保为字符串(匹配原条件的字符串判断)
|
const auditType = item.auditType + ''; // 确保为字符串(匹配原条件的字符串判断)
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ function initTable() {
|
||||||
let html = "";
|
let html = "";
|
||||||
let status = d.status;
|
let status = d.status;
|
||||||
html += "<a onclick='checkAuditDetail(" + JSON.stringify(d) + ")'>详情</a> ";
|
html += "<a onclick='checkAuditDetail(" + JSON.stringify(d) + ")'>详情</a> ";
|
||||||
if(status == -1){
|
if(status == -1 || status == 2){
|
||||||
html += "<div class='splitLine'>|</div><a onclick='checkSubmit(" + JSON.stringify(d) + ")'>提交</a>"
|
html += "<div class='splitLine'>|</div><a onclick='checkSubmit(" + JSON.stringify(d) + ")'>提交</a>"
|
||||||
}
|
}
|
||||||
if(status == -1 || status == 2){
|
if(status == -1 || status == 2){
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ let pageNum = 1, tableIns;
|
||||||
function setParams(obj) {
|
function setParams(obj) {
|
||||||
objParam = JSON.parse(obj);
|
objParam = JSON.parse(obj);
|
||||||
delIdArr = [];
|
delIdArr = [];
|
||||||
layui.use(['form','layer','laydate','upload','table'], function(){
|
layui.use(['form', 'layer', 'laydate', 'upload', 'table'], function () {
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
layer = layui.layer;
|
layer = layui.layer;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
|
|
@ -21,9 +21,11 @@ function setParams(obj) {
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
util = layui.util;
|
util = layui.util;
|
||||||
|
|
||||||
laydate.render({elem:'#fkTime'});
|
laydate.render({elem: '#fkTime'});
|
||||||
form.verify();
|
form.verify();
|
||||||
form.on('submit(formData)', function(data){ submitApply(data); });
|
form.on('submit(formData)', function (data) {
|
||||||
|
submitApply(data);
|
||||||
|
});
|
||||||
form.render();
|
form.render();
|
||||||
|
|
||||||
// 初始化上传
|
// 初始化上传
|
||||||
|
|
@ -37,18 +39,20 @@ function setParams(obj) {
|
||||||
size: 10240,
|
size: 10240,
|
||||||
auto: false,
|
auto: false,
|
||||||
bindAction: '#hideUpload',
|
bindAction: '#hideUpload',
|
||||||
choose: function(obj){
|
choose: function (obj) {
|
||||||
let existCount = fileList.length;
|
let existCount = fileList.length;
|
||||||
if(existCount >=5){ return layer.msg('最多上传5个附件证明',{icon:7}); }
|
if (existCount >= 5) {
|
||||||
|
return layer.msg('最多上传5个附件证明', {icon: 7});
|
||||||
|
}
|
||||||
uploadObj.config.elem.next()[0].value = '';
|
uploadObj.config.elem.next()[0].value = '';
|
||||||
obj.preview(function(index, file, result){
|
obj.preview(function (index, file, result) {
|
||||||
if(fileList.length >=5) return;
|
if (fileList.length >= 5) return;
|
||||||
const uid = 'new_' + Date.now() + '_' + Math.random();
|
const uid = 'new_' + Date.now() + '_' + Math.random();
|
||||||
fileList.push({uid,name:file.name,file,isExist:false,fileId:null});
|
fileList.push({uid, name: file.name, file, isExist: false, fileId: null});
|
||||||
$('#uploader-list').append(`
|
$('#uploader-list').append(`
|
||||||
<div class="file-iteme" data-uid="${uid}">
|
<div class="file-iteme" data-uid="${uid}">
|
||||||
<div class="handle">x</div>
|
<div class="handle">x</div>
|
||||||
${handleFileType(index,file,result)}
|
${handleFileType(index, file, result)}
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -60,17 +64,17 @@ function setParams(obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 获取数据详情 -------------------
|
// ------------------- 获取数据详情 -------------------
|
||||||
function getBalanceDataDetails(){
|
function getBalanceDataDetails() {
|
||||||
let encryptedData = {id: objParam.id};
|
let encryptedData = {id: objParam.id};
|
||||||
let url = dataUrl+'backstage/carBalance/getBalanceDataDetails?encryptedData='+encodeURIComponent(JSON.stringify(encryptedData));
|
let url = dataUrl + 'backstage/carBalance/getBalanceDataDetails?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
|
||||||
ajaxRequest(url,"GET",null,true,null,function(result){
|
ajaxRequest(url, "GET", null, true, null, function (result) {
|
||||||
if(result.code===200){
|
if (result.code === 200) {
|
||||||
let dataObj = result.data;
|
let dataObj = result.data;
|
||||||
|
|
||||||
// 基本信息回显
|
// 基本信息回显
|
||||||
$('#supId').val(dataObj.supId);
|
$('#supId').val(dataObj.supId);
|
||||||
$('#supName').val(dataObj.supName);
|
$('#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);
|
$('#money').val(dataObj.money);
|
||||||
$('#remark').val(dataObj.remark);
|
$('#remark').val(dataObj.remark);
|
||||||
$('#planListNum').val(dataObj.planList.length);
|
$('#planListNum').val(dataObj.planList.length);
|
||||||
|
|
@ -79,15 +83,17 @@ function getBalanceDataDetails(){
|
||||||
fileList = [];
|
fileList = [];
|
||||||
delIdArr = [];
|
delIdArr = [];
|
||||||
$('#uploader-list').html('');
|
$('#uploader-list').html('');
|
||||||
if(dataObj.fileList && dataObj.fileList.length>0){
|
if (dataObj.fileList && dataObj.fileList.length > 0) {
|
||||||
dataObj.fileList.forEach((f,i)=>{
|
dataObj.fileList.forEach((f, i) => {
|
||||||
const uid = 'old_'+f.id;
|
const uid = 'old_' + f.id;
|
||||||
const path = fileUrl+f.fileUrl+'?token='+sessionStorage.getItem("gz-token");
|
const path = fileUrl + f.fileUrl + '?token=' + sessionStorage.getItem("gz-token");
|
||||||
fileList.push({uid,name:f.fileName,isExist:true,fileId:f.id,file:null});
|
// 从 suffix 取文件后缀
|
||||||
|
const ext = f.suffix ? f.suffix.replace('.', '').toLowerCase() : '';
|
||||||
|
fileList.push({uid, name: f.fileName, isExist: true, fileId: f.id, file: null});
|
||||||
$('#uploader-list').append(`
|
$('#uploader-list').append(`
|
||||||
<div class="file-iteme" data-uid="${uid}" data-file-id="${f.id}">
|
<div class="file-iteme" data-uid="${uid}" data-file-id="${f.id}">
|
||||||
<div class="handle">x</div>
|
<div class="handle">x</div>
|
||||||
${handleFileType(i,{name:f.fileName,ext:f.type},path)}
|
${handleFileType(i, {name: f.fileName, ext: ext}, path)}
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -103,17 +109,19 @@ function getBalanceDataDetails(){
|
||||||
allDataList = dataObj.detailsList || [];
|
allDataList = dataObj.detailsList || [];
|
||||||
jjDataArr = dataObj.planList || [];
|
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();
|
$('#plan-detail-table tr:not(:first)').remove();
|
||||||
if(list.length>0){
|
if (list.length > 0) {
|
||||||
let html = '';
|
let html = '';
|
||||||
list.forEach((item,index)=>{
|
list.forEach((item, index) => {
|
||||||
html+=`<tr>
|
html += `<tr>
|
||||||
<td>${index+1}</td>
|
<td>${index + 1}</td>
|
||||||
<td>${item.proName}</td>
|
<td>${item.proName}</td>
|
||||||
<td>${item.code}</td>
|
<td>${item.code}</td>
|
||||||
<td>${item.supName}</td>
|
<td>${item.supName}</td>
|
||||||
|
|
@ -128,51 +136,57 @@ function planDetail(list){
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 删除计划明细 -------------------
|
// ------------------- 删除计划明细 -------------------
|
||||||
function delPlanDetail(index){
|
function delPlanDetail(index) {
|
||||||
let planList = $('#plan-detail-table tr:not(:first)');
|
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 currentTr = planList.eq(index);
|
||||||
let delCode = currentTr.find('td:eq(2)').text().trim();
|
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();
|
currentTr.remove();
|
||||||
$('#plan-detail-table tr:not(:first)').each(function(i){ $(this).find('td:eq(0)').text(i+1); });
|
$('#plan-detail-table tr:not(:first)').each(function (i) {
|
||||||
|
$(this).find('td:eq(0)').text(i + 1);
|
||||||
|
});
|
||||||
deleteCarDetailByCode(delCode);
|
deleteCarDetailByCode(delCode);
|
||||||
jjDataArr = jjDataArr.filter(item=>item.code!==delCode);
|
jjDataArr = jjDataArr.filter(item => item.code !== delCode);
|
||||||
allDataList = allDataList.filter(item=>item.planCode!==delCode);
|
allDataList = allDataList.filter(item => item.planCode !== delCode);
|
||||||
layer.close(layIndex);
|
layer.close(layIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 删除用车明细 -------------------
|
// ------------------- 删除用车明细 -------------------
|
||||||
function deleteCarDetailByCode(delCode){
|
function deleteCarDetailByCode(delCode) {
|
||||||
['#dispatch-car-table','#dispatch-car-table2'].forEach(tableId=>{
|
['#dispatch-car-table', '#dispatch-car-table2'].forEach(tableId => {
|
||||||
$(`${tableId} tr:not(:first)`).each(function(){
|
$(`${tableId} tr:not(:first)`).each(function () {
|
||||||
let $tr=$(this);
|
let $tr = $(this);
|
||||||
let code = $tr.find('td:last a').text().trim() || $tr.find('td:last').text().replace(/<.*?>/g,'').trim();
|
let code = $tr.find('td:last a').text().trim() || $tr.find('td:last').text().replace(/<.*?>/g, '').trim();
|
||||||
if(code===delCode) $tr.remove();
|
if (code === delCode) $tr.remove();
|
||||||
});
|
});
|
||||||
if($(`${tableId} tr:not(:first)`).length===0){ $(`${tableId}`).css('display','none'); }
|
if ($(`${tableId} tr:not(:first)`).length === 0) {
|
||||||
|
$(`${tableId}`).css('display', 'none');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 用车明细 -------------------
|
// ------------------- 用车明细 -------------------
|
||||||
function carDetail(list){
|
function carDetail(list) {
|
||||||
const carList = list.filter(item=>item.type==='车辆');
|
const carList = list.filter(item => item.type === '车辆');
|
||||||
const dcList = list.filter(item=>item.type==='吊车');
|
const dcList = list.filter(item => item.type === '吊车');
|
||||||
setDispatchCarTable(carList);
|
setDispatchCarTable(carList);
|
||||||
setDispatchCarTable2(dcList);
|
setDispatchCarTable2(dcList);
|
||||||
|
|
||||||
function setDispatchCarTable(list){
|
function setDispatchCarTable(list) {
|
||||||
$('#dispatch-car-table tr:not(:first)').remove();
|
$('#dispatch-car-table tr:not(:first)').remove();
|
||||||
if(list.length>0){
|
if (list.length > 0) {
|
||||||
let html='';
|
let html = '';
|
||||||
list.forEach(item=>{
|
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 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);
|
const actualGls = formatToTwoDecimals(item.exeGls || 0);
|
||||||
html+=`<tr>
|
html += `<tr>
|
||||||
<td>${item.type}</td>
|
<td>${item.type}</td>
|
||||||
<td>${item.name}</td>
|
<td>${item.name}</td>
|
||||||
<td>${item.model}</td>
|
<td>${item.model}</td>
|
||||||
|
|
@ -183,32 +197,34 @@ function carDetail(list){
|
||||||
<td>${item.endAddress}</td>
|
<td>${item.endAddress}</td>
|
||||||
<td><input type='number' class='form-control actual-gls' value='${actualGls}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
<td><input type='number' class='form-control actual-gls' value='${actualGls}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
||||||
<td>${item.glsPrice}</td>
|
<td>${item.glsPrice}</td>
|
||||||
<td>¥ ${item.glsMoney||0}</td>
|
<td>¥ ${item.glsMoney || 0}</td>
|
||||||
<td style='color:#409eff'>${imgNum}<a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewFileDetail(${safeStringify(item)},1)'>查看附件>></a></td>
|
<td style='color:#409eff'>${imgNum}<a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewFileDetail(${safeStringify(item)},1)'>查看附件>></a></td>
|
||||||
<td><a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewPlanDetail(${safeStringify(item)})'>${item.planCode}</a></td>
|
<td><a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewPlanDetail(${safeStringify(item)})'>${item.planCode}</a></td>
|
||||||
<td>${item.remark}</td>
|
<td>${item.remark}</td>
|
||||||
</tr>`;
|
</tr>`;
|
||||||
});
|
});
|
||||||
$('#dispatch-car-table').removeAttr('style').append(html);
|
$('#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();
|
$('#dispatch-car-table2 tr:not(:first)').remove();
|
||||||
if(list.length>0){
|
if (list.length > 0) {
|
||||||
let html='';
|
let html = '';
|
||||||
list.forEach(item=>{
|
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 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 actualPlanDay = item.exeDay || 0;
|
||||||
const actualDcMoney = formatToTwoDecimals(item.money||0);
|
const actualDcMoney = formatToTwoDecimals(item.money || 0);
|
||||||
html+=`<tr>
|
html += `<tr>
|
||||||
<td>${item.type}</td>
|
<td>${item.type}</td>
|
||||||
<td>${item.name}</td>
|
<td>${item.name}</td>
|
||||||
<td>${item.model}</td>
|
<td>${item.model}</td>
|
||||||
<td>${item.carNum}</td>
|
<td>${item.carNum}</td>
|
||||||
<td>${item.useAddress}</td>
|
<td>${item.useAddress}</td>
|
||||||
<td><input type='number' class='form-control actual-dc-planDay' value='${actualPlanDay}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
<td><input type='number' class='form-control actual-dc-planDay' value='${actualPlanDay}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
||||||
<td>${item.dcUnit==='元/月/台'?item.monthPrice+'('+item.dcUnit+')':item.dayPrice+'('+item.dcUnit+')'}${item.isOutSet===1?'<br/>'+(item.jcMoney||0)+'(进出场费)':''}</td>
|
<td>${item.dcUnit === '元/月/台' ? item.monthPrice + '(' + item.dcUnit + ')' : item.dayPrice + '(' + item.dcUnit + ')'}${item.isOutSet === 1 ? '<br/>' + (item.jcMoney || 0) + '(进出场费)' : ''}</td>
|
||||||
<td>¥ ${item.dcMoney}</td>
|
<td>¥ ${item.dcMoney}</td>
|
||||||
<td><input type='number' class='form-control actual-dc-money' value='${actualDcMoney}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
<td><input type='number' class='form-control actual-dc-money' value='${actualDcMoney}' style='width:100%;padding:2px;border:1px solid #ddd;' data-id='${item.id}'></td>
|
||||||
<td style='color:#409eff'>${imgNum}<a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewFileDetail(${safeStringify(item)},2)'>查看附件>></a></td>
|
<td style='color:#409eff'>${imgNum}<a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewFileDetail(${safeStringify(item)},2)'>查看附件>></a></td>
|
||||||
|
|
@ -217,16 +233,18 @@ function carDetail(list){
|
||||||
</tr>`;
|
</tr>`;
|
||||||
});
|
});
|
||||||
$('#dispatch-car-table2').removeAttr('style').append(html);
|
$('#dispatch-car-table2').removeAttr('style').append(html);
|
||||||
}else{ $('#dispatch-car-table2').css('display','none'); }
|
} else {
|
||||||
|
$('#dispatch-car-table2').css('display', 'none');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 安全序列化 -------------------
|
// ------------------- 安全序列化 -------------------
|
||||||
function safeStringify(obj){
|
function safeStringify(obj) {
|
||||||
const cache = new Set();
|
const cache = new Set();
|
||||||
return JSON.stringify(obj,(key,value)=>{
|
return JSON.stringify(obj, (key, value) => {
|
||||||
if(typeof value==='object' && value!==null){
|
if (typeof value === 'object' && value !== null) {
|
||||||
if(cache.has(value)) return;
|
if (cache.has(value)) return;
|
||||||
cache.add(value);
|
cache.add(value);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
@ -234,15 +252,20 @@ function safeStringify(obj){
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 文件类型显示 -------------------
|
// ------------------- 文件类型显示 -------------------
|
||||||
function handleFileType(index,file,result){
|
function handleFileType(index, file, result) {
|
||||||
let html='', img='';
|
let html = '', img = '';
|
||||||
if(file.ext) file.ext=file.ext.toLowerCase();
|
if (file.ext) file.ext = file.ext.toLowerCase();
|
||||||
if(file.name) file.name=file.name.toLowerCase();
|
if (file.name) file.name = file.name.toLowerCase();
|
||||||
if(file.ext==='doc'||file.ext==='docx'){ img='../../../images/docx.png'; }
|
if (file.ext === 'doc' || file.ext === 'docx') {
|
||||||
else if(file.ext==='xls'||file.ext==='xlsx'){ img='../../../images/xlsx.png'; }
|
img = '../../../images/docx.png';
|
||||||
else if(file.ext==='pdf'){ img='../../../images/pdf.png'; }
|
} else if (file.ext === 'xls' || file.ext === 'xlsx') {
|
||||||
else{ return `<img class="img" style="width:130px;height:120px;" data-index=${index} data-name=${file.name} src=${result}>`; }
|
img = '../../../images/xlsx.png';
|
||||||
html=`<div class="layout upload-file" data-index=${index}>
|
} else if (file.ext === 'pdf') {
|
||||||
|
img = '../../../images/pdf.png';
|
||||||
|
} else {
|
||||||
|
return `<img class="img" style="width:130px;height:120px;" data-index=${index} data-name=${file.name} src=${result}>`;
|
||||||
|
}
|
||||||
|
html = `<div class="layout upload-file" data-index=${index}>
|
||||||
<img src="${img}">
|
<img src="${img}">
|
||||||
<p style="text-align:center;font-size:12px;">${file.name}</p>
|
<p style="text-align:center;font-size:12px;">${file.name}</p>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
@ -250,110 +273,122 @@ function handleFileType(index,file,result){
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 删除附件 -------------------
|
// ------------------- 删除附件 -------------------
|
||||||
$(document).on("click",".file-iteme .handle",function(e){
|
$(document).on("click", ".file-iteme .handle", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const $item=$(this).closest('.file-iteme');
|
const $item = $(this).closest('.file-iteme');
|
||||||
const uid = $item.attr('data-uid');
|
const uid = $item.attr('data-uid');
|
||||||
const fileId = $item.attr('data-file-id');
|
const fileId = $item.attr('data-file-id');
|
||||||
if(fileId && !delIdArr.includes(fileId)) delIdArr.push(fileId);
|
if (fileId && !delIdArr.includes(fileId)) delIdArr.push(fileId);
|
||||||
fileList = fileList.filter(f=>f.uid!==uid);
|
fileList = fileList.filter(f => f.uid !== uid);
|
||||||
$item.remove();
|
$item.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------- 获取编辑后的实际值 -------------------
|
// ------------------- 获取编辑后的实际值 -------------------
|
||||||
function getEditedActualValues(){
|
function getEditedActualValues() {
|
||||||
let actualValues={carActualList:[],craneActualList:[]};
|
let actualValues = {carActualList: [], craneActualList: []};
|
||||||
$('#dispatch-car-table .actual-gls').each(function(){
|
$('#dispatch-car-table .actual-gls').each(function () {
|
||||||
const id=$(this).data('id');
|
const id = $(this).data('id');
|
||||||
const val=formatToTwoDecimals($(this).val());
|
const val = formatToTwoDecimals($(this).val());
|
||||||
actualValues.carActualList.push({outDetailId:id,exeGls:val,inMoney:0});
|
actualValues.carActualList.push({outDetailId: id, exeGls: val, inMoney: 0});
|
||||||
});
|
});
|
||||||
$('#dispatch-car-table2 tr:not(:first)').each(function(){
|
$('#dispatch-car-table2 tr:not(:first)').each(function () {
|
||||||
const id=$(this).find('.actual-dc-money').data('id');
|
const id = $(this).find('.actual-dc-money').data('id');
|
||||||
if(!id) return;
|
if (!id) return;
|
||||||
const day=$(this).find('.actual-dc-planDay').val()||0;
|
const day = $(this).find('.actual-dc-planDay').val() || 0;
|
||||||
const money=formatToTwoDecimals($(this).find('.actual-dc-money').val());
|
const money = formatToTwoDecimals($(this).find('.actual-dc-money').val());
|
||||||
actualValues.craneActualList.push({outDetailId:id,exeDay:day,inMoney:money});
|
actualValues.craneActualList.push({outDetailId: id, exeDay: day, inMoney: money});
|
||||||
});
|
});
|
||||||
return actualValues;
|
return actualValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 格式化两位小数 -------------------
|
// ------------------- 格式化两位小数 -------------------
|
||||||
function formatToTwoDecimals(num){ return isNaN(Number(num))? '0.00': Number(num).toFixed(2); }
|
function formatToTwoDecimals(num) {
|
||||||
|
return isNaN(Number(num)) ? '0.00' : Number(num).toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------- 正则校验输入框 -------------------
|
// ------------------- 正则校验输入框 -------------------
|
||||||
$(document).on('input','.actual-gls,.actual-money,.actual-dc-money',function(){
|
$(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)/,'');
|
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);}
|
if (this.value.indexOf('.') !== -1) {
|
||||||
const numValue=Number(this.value||0); if(numValue>100000) this.value=(100000).toFixed(2);
|
const parts = this.value.split('.');
|
||||||
|
this.value = parts[0] + '.' + parts[1].substring(0, 2);
|
||||||
|
}
|
||||||
|
const numValue = Number(this.value || 0);
|
||||||
|
if (numValue > 100000) this.value = (100000).toFixed(2);
|
||||||
|
});
|
||||||
|
$(document).on('blur', '.actual-gls,.actual-money,.actual-dc-money', function () {
|
||||||
|
this.value = formatToTwoDecimals(this.value);
|
||||||
});
|
});
|
||||||
$(document).on('blur','.actual-gls,.actual-money,.actual-dc-money',function(){ this.value=formatToTwoDecimals(this.value); });
|
|
||||||
|
|
||||||
// ------------------- 提交 -------------------
|
// ------------------- 提交 -------------------
|
||||||
function submitApply(data){
|
function submitApply(data) {
|
||||||
if(fileList.length===0) return layer.msg('请上传付款单',{icon:7});
|
if (fileList.length === 0) return layer.msg('请上传付款单', {icon: 7});
|
||||||
if(jjDataArr.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});
|
if (allDataList.length === 0) return layer.msg('用车明细数据为空,无法提交', {icon: 7});
|
||||||
|
|
||||||
data.field.supId=objParam.supId;
|
data.field.supId = objParam.supId;
|
||||||
data.field.id=objParam.id;
|
data.field.id = objParam.id;
|
||||||
data.field.delFileId=delIdArr.join(',');
|
data.field.delFileId = delIdArr.join(',');
|
||||||
|
|
||||||
let planList=[],detailsList=[];
|
let planList = [], detailsList = [];
|
||||||
jjDataArr.forEach(item=>{
|
jjDataArr.forEach(item => {
|
||||||
planList.push({
|
planList.push({
|
||||||
id:item.id||'',
|
id: item.id || '',
|
||||||
planId:item.planId||item.id,
|
planId: item.planId || item.id,
|
||||||
supId:item.supId,
|
supId: item.supId,
|
||||||
money:item.money,
|
money: item.money,
|
||||||
type:item.type||'1',
|
type: item.type || '1',
|
||||||
proId:item.proId||'',
|
proId: item.proId || '',
|
||||||
carNum:item.carNum||item.needNum||0
|
carNum: item.carNum || item.needNum || 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const actualValues = getEditedActualValues();
|
const actualValues = getEditedActualValues();
|
||||||
allDataList.forEach(item=>{
|
allDataList.forEach(item => {
|
||||||
const carActual = actualValues.carActualList.find(v=>v.outDetailId==item.id);
|
const carActual = actualValues.carActualList.find(v => v.outDetailId == item.id);
|
||||||
const craneActual = actualValues.craneActualList.find(v=>v.outDetailId==item.id);
|
const craneActual = actualValues.craneActualList.find(v => v.outDetailId == item.id);
|
||||||
detailsList.push({
|
detailsList.push({
|
||||||
id:item.id||'',
|
id: item.id || '',
|
||||||
planId:item.planId||'',
|
planId: item.planId || '',
|
||||||
type:item.type||'车辆',
|
type: item.type || '车辆',
|
||||||
supId:item.supId||objParam.supId,
|
supId: item.supId || objParam.supId,
|
||||||
proId:item.proId||'',
|
proId: item.proId || '',
|
||||||
money:item.cost||item.money||0,
|
money: item.cost || item.money || 0,
|
||||||
outId:item.outId||'',
|
outId: item.outId || '',
|
||||||
exeGls:carActual?.exeGls||item.exeGls||'',
|
exeGls: carActual?.exeGls || item.exeGls || '',
|
||||||
inMoney:carActual?.inMoney||craneActual?.inMoney||'',
|
inMoney: carActual?.inMoney || craneActual?.inMoney || '',
|
||||||
exeDay:craneActual?.exeDay||item.exeDay||'',
|
exeDay: craneActual?.exeDay || item.exeDay || '',
|
||||||
outDetailId:item.outDetailId||'',
|
outDetailId: item.outDetailId || '',
|
||||||
modelId:item.modelId||'',
|
modelId: item.modelId || '',
|
||||||
ton:item.ton||0
|
ton: item.ton || 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
data.field.planList=planList;
|
data.field.planList = planList;
|
||||||
data.field.detailsList=detailsList;
|
data.field.detailsList = detailsList;
|
||||||
|
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
fileList.forEach(item=>{ if(!item.isExist && item.file) formData.append("file[]",item.file); });
|
fileList.forEach(item => {
|
||||||
formData.append('params',JSON.stringify(data.field));
|
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 loadingMsg = layer.msg('正在提交保存,请稍等...', {icon: 16, shade: 0.01, time: '0'});
|
||||||
let url = dataUrl+'backstage/carBalance/updateBalanceData';
|
let url = dataUrl + 'backstage/carBalance/updateBalanceData';
|
||||||
ajaxRequestByUploadFile(url, formData, function(){
|
ajaxRequestByUploadFile(url, formData, function () {
|
||||||
$('.save,.cancel').addClass("layui-btn-disabled").attr("disabled",true);
|
$('.save,.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||||
}, function(result){
|
}, function (result) {
|
||||||
layer.close(loadingMsg);
|
layer.close(loadingMsg);
|
||||||
$('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled",false);
|
$('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
if(result.code===200){ parent.layer.msg(result.msg,{icon:1}); closePage(1);}
|
if (result.code === 200) {
|
||||||
else layer.msg(result.msg,{icon:2});
|
parent.layer.msg(result.msg, {icon: 1});
|
||||||
}, function(xhr,status,error){
|
closePage(1);
|
||||||
|
} else layer.msg(result.msg, {icon: 2});
|
||||||
|
}, function (xhr, status, error) {
|
||||||
layer.close(loadingMsg);
|
layer.close(loadingMsg);
|
||||||
layer.msg('服务异常,请稍后重试',{icon:16,scrollbar:false,time:2000});
|
layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
||||||
$('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled",false);
|
$('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||||
errorFn(xhr,status,error);
|
errorFn(xhr, status, error);
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -362,8 +397,8 @@ function saveData2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------- 关闭页面 -------------------
|
// ------------------- 关闭页面 -------------------
|
||||||
function closePage(type){
|
function closePage(type) {
|
||||||
let index = parent.layer.getFrameIndex(window.name);
|
let index = parent.layer.getFrameIndex(window.name);
|
||||||
if(type==1) window.parent.reloadData();
|
if (type == 1) window.parent.reloadData();
|
||||||
parent.layer.close(index);
|
parent.layer.close(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue