付款单加备注
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 imgUrl2 = '../../../images/time_icon.png';
|
||||
$.each(list, function (index, item) {
|
||||
const creator = item.userName;
|
||||
const creator = item.auditUser;
|
||||
// 1. 容错处理(统一处理空值、类型转换)
|
||||
const remark = setNullValue(item.auditReason); // 已有空值处理,保留
|
||||
const auditType = item.auditType + ''; // 确保为字符串(匹配原条件的字符串判断)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ function initTable() {
|
|||
let html = "";
|
||||
let status = d.status;
|
||||
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>"
|
||||
}
|
||||
if(status == -1 || status == 2){
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ let pageNum = 1, tableIns;
|
|||
function setParams(obj) {
|
||||
objParam = JSON.parse(obj);
|
||||
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;
|
||||
|
|
@ -21,9 +21,11 @@ function setParams(obj) {
|
|||
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();
|
||||
|
||||
// 初始化上传
|
||||
|
|
@ -37,18 +39,20 @@ function setParams(obj) {
|
|||
size: 10240,
|
||||
auto: false,
|
||||
bindAction: '#hideUpload',
|
||||
choose: function(obj){
|
||||
choose: function (obj) {
|
||||
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 = '';
|
||||
obj.preview(function(index, file, result){
|
||||
if(fileList.length >=5) return;
|
||||
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});
|
||||
fileList.push({uid, name: file.name, file, isExist: false, fileId: null});
|
||||
$('#uploader-list').append(`
|
||||
<div class="file-iteme" data-uid="${uid}">
|
||||
<div class="handle">x</div>
|
||||
${handleFileType(index,file,result)}
|
||||
${handleFileType(index, file, result)}
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
|
|
@ -60,17 +64,17 @@ 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,null,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);
|
||||
|
|
@ -79,15 +83,17 @@ function getBalanceDataDetails(){
|
|||
fileList = [];
|
||||
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});
|
||||
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");
|
||||
// 从 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(`
|
||||
<div class="file-iteme" data-uid="${uid}" data-file-id="${f.id}">
|
||||
<div class="handle">x</div>
|
||||
${handleFileType(i,{name:f.fileName,ext:f.type},path)}
|
||||
${handleFileType(i, {name: f.fileName, ext: ext}, path)}
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
|
|
@ -103,17 +109,19 @@ function getBalanceDataDetails(){
|
|||
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 = '';
|
||||
list.forEach((item,index)=>{
|
||||
html+=`<tr>
|
||||
<td>${index+1}</td>
|
||||
list.forEach((item, index) => {
|
||||
html += `<tr>
|
||||
<td>${index + 1}</td>
|
||||
<td>${item.proName}</td>
|
||||
<td>${item.code}</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)');
|
||||
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); });
|
||||
$('#plan-detail-table tr:not(:first)').each(function (i) {
|
||||
$(this).find('td:eq(0)').text(i + 1);
|
||||
});
|
||||
deleteCarDetailByCode(delCode);
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
// ------------------- 删除用车明细 -------------------
|
||||
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();
|
||||
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'); }
|
||||
if ($(`${tableId} tr:not(:first)`).length === 0) {
|
||||
$(`${tableId}`).css('display', 'none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ------------------- 用车明细 -------------------
|
||||
function carDetail(list){
|
||||
const carList = list.filter(item=>item.type==='车辆');
|
||||
const dcList = list.filter(item=>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='';
|
||||
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+=`<tr>
|
||||
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 += `<tr>
|
||||
<td>${item.type}</td>
|
||||
<td>${item.name}</td>
|
||||
<td>${item.model}</td>
|
||||
|
|
@ -183,32 +197,34 @@ function carDetail(list){
|
|||
<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>${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><a style='color:#409eff;margin:0 5px;cursor:pointer;' onclick='viewPlanDetail(${safeStringify(item)})'>${item.planCode}</a></td>
|
||||
<td>${item.remark}</td>
|
||||
</tr>`;
|
||||
});
|
||||
$('#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='';
|
||||
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+=`<tr>
|
||||
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 += `<tr>
|
||||
<td>${item.type}</td>
|
||||
<td>${item.name}</td>
|
||||
<td>${item.model}</td>
|
||||
<td>${item.carNum}</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>${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><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>
|
||||
|
|
@ -217,16 +233,18 @@ function carDetail(list){
|
|||
</tr>`;
|
||||
});
|
||||
$('#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();
|
||||
return JSON.stringify(obj,(key,value)=>{
|
||||
if(typeof value==='object' && value!==null){
|
||||
if(cache.has(value)) return;
|
||||
return JSON.stringify(obj, (key, value) => {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (cache.has(value)) return;
|
||||
cache.add(value);
|
||||
}
|
||||
return value;
|
||||
|
|
@ -234,15 +252,20 @@ function safeStringify(obj){
|
|||
}
|
||||
|
||||
// ------------------- 文件类型显示 -------------------
|
||||
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 `<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}>
|
||||
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 `<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}">
|
||||
<p style="text-align:center;font-size:12px;">${file.name}</p>
|
||||
</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();
|
||||
const $item=$(this).closest('.file-iteme');
|
||||
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);
|
||||
if (fileId && !delIdArr.includes(fileId)) delIdArr.push(fileId);
|
||||
fileList = fileList.filter(f => f.uid !== uid);
|
||||
$item.remove();
|
||||
});
|
||||
|
||||
// ------------------- 获取编辑后的实际值 -------------------
|
||||
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});
|
||||
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});
|
||||
$('#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;
|
||||
}
|
||||
|
||||
// ------------------- 格式化两位小数 -------------------
|
||||
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(){
|
||||
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>100000) this.value=(100000).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 > 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){
|
||||
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});
|
||||
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(',');
|
||||
data.field.supId = objParam.supId;
|
||||
data.field.id = objParam.id;
|
||||
data.field.delFileId = delIdArr.join(',');
|
||||
|
||||
let planList=[],detailsList=[];
|
||||
jjDataArr.forEach(item=>{
|
||||
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
|
||||
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
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
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
|
||||
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;
|
||||
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));
|
||||
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){
|
||||
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){
|
||||
$('.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);
|
||||
layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
||||
$('.save,.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
|
||||
errorFn(xhr, status, error);
|
||||
}, null);
|
||||
}
|
||||
|
||||
|
|
@ -362,8 +397,8 @@ function saveData2() {
|
|||
}
|
||||
|
||||
// ------------------- 关闭页面 -------------------
|
||||
function closePage(type){
|
||||
function closePage(type) {
|
||||
let index = parent.layer.getFrameIndex(window.name);
|
||||
if(type==1) window.parent.reloadData();
|
||||
if (type == 1) window.parent.reloadData();
|
||||
parent.layer.close(index);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue