付款单申请
This commit is contained in:
parent
c28e3f72d5
commit
37a4b2fa71
|
|
@ -131,7 +131,12 @@ function submitApply(data) {
|
|||
};
|
||||
planList.push(obj);
|
||||
})
|
||||
|
||||
const actualValues = getEditedActualValues();
|
||||
data.field.actualValues = actualValues;
|
||||
$.each(allDataList, function (index, item) {
|
||||
const carActual = actualValues.carActualList.find(v => v.id === item.id); // 普通车辆
|
||||
const craneActual = actualValues.craneActualList.find(v => v.id === item.id); // 吊车
|
||||
let obj = {
|
||||
// id: item.id,
|
||||
planId: item.planId,
|
||||
|
|
@ -139,12 +144,18 @@ function submitApply(data) {
|
|||
supId: item.supId,
|
||||
proId: item.proId,
|
||||
money: item.cost,
|
||||
outId: item.outId
|
||||
outId: item.outId,
|
||||
exeGls: carActual?.exeGls || '',
|
||||
inMoney: carActual?.actualMoney || craneActual?.actualDcMoney || '',
|
||||
exeDay: craneActual?.exeDay || '',
|
||||
};
|
||||
detailsList.push(obj);
|
||||
})
|
||||
data.field.planList = planList;
|
||||
data.field.detailsList = detailsList;
|
||||
|
||||
|
||||
|
||||
let formData = new FormData();
|
||||
//遍历最终文件集合
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
|
|
@ -249,6 +260,10 @@ function getPayCarDetails(id) {
|
|||
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 = item.gls || 0; // 实际公里数初始=预估公里数
|
||||
const actualMoney = item.glsMoney || 0; // 实际金额初始=预估金额
|
||||
|
||||
html += "<tr>" +
|
||||
"<td>" + item.type + "</td>" +
|
||||
"<td>" + item.name + "</td>" +
|
||||
|
|
@ -259,8 +274,16 @@ function getPayCarDetails(id) {
|
|||
"<td>" + item.startAddress + "</td>" +
|
||||
"<td>" + item.endAddress + "</td>" +
|
||||
"<td>" + item.gls + "</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 ? item.glsMoney : 0) + "</td>" +
|
||||
|
||||
"<td><input type='number' class='form-control actual-money' value='" + actualMoney +
|
||||
"' 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(" + JSON.stringify(item) + ",1)'>查看附件>></a></td>" +
|
||||
"<td><a style='color:#409eff;margin:0 5px;cursor: pointer;' onclick='viewPlanDetail(" + JSON.stringify(item) + ")'>" + item.planCode + "</a></td>" +
|
||||
"</tr>";
|
||||
|
|
@ -285,6 +308,10 @@ function getPayCarDetails(id) {
|
|||
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 = item.dcMoney || 0;
|
||||
|
||||
html += '<tr>' +
|
||||
'<td>' + item.type + '</td>' +
|
||||
'<td>' + item.name + '</td>' +
|
||||
|
|
@ -292,8 +319,14 @@ function getPayCarDetails(id) {
|
|||
'<td>' + item.carNum + '</td>' +
|
||||
'<td>' + item.useAddress + '</td>' +
|
||||
'<td>' + item.planDay + '</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>' + setZlPrice(item) + '</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(" + JSON.stringify(item) + ",2)'>查看附件>></a></td>" +
|
||||
"<td><a style='color:#409eff;margin:0 5px;cursor: pointer;' onclick='viewPlanDetail(" + JSON.stringify(item) + ")'>" + item.planCode + "</a></td>" +
|
||||
'</tr>';
|
||||
|
|
@ -346,6 +379,51 @@ function viewFileDetail(obj, type) {
|
|||
}
|
||||
|
||||
|
||||
// 收集表格中编辑后的实际值(核心新增函数)
|
||||
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则跳过
|
||||
|
||||
// 获取输入框中的实际值(为空则用原值)
|
||||
const actualGls = $tr.find('.actual-gls').val() || $tr.find('td:eq(8)').text(); // 实际公里数,为空取预估公里数
|
||||
const actualMoney = $tr.find('.actual-money').val() || $tr.find('td:eq(11)').text().replace('¥ ', ''); // 实际金额,为空取预估金额
|
||||
|
||||
actualValues.carActualList.push({
|
||||
outDetailId: itemId,
|
||||
exeGls: actualGls,
|
||||
inMoney: actualMoney
|
||||
});
|
||||
});
|
||||
|
||||
// 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() || $tr.find('td:eq(5)').text().replace('¥ ', '');
|
||||
const actualDcMoney = $tr.find('.actual-dc-money').val() || $tr.find('td:eq(8)').text().replace('¥ ', '');
|
||||
|
||||
actualValues.craneActualList.push({
|
||||
outDetailId: itemId,
|
||||
inMoney: actualDcMoney,
|
||||
exeDay:actualPlanDay
|
||||
});
|
||||
});
|
||||
return actualValues;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 关闭页面
|
||||
function closePage(type) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue