参数组装

This commit is contained in:
BianLzhaoMin 2025-02-25 16:27:21 +08:00
parent 74a79431ef
commit d9d2ae687f
1 changed files with 14 additions and 2 deletions

View File

@ -241,7 +241,7 @@
<form id="uploadForm"> <form id="uploadForm">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center;">
<div style="margin-right: 10px;width: 200px";>${e.title}</div> <div style="margin-right: 10px;width: 200px";>${e.title}</div>
<input type="text" data-id="${dialogLabelInfo[index].field}" id="numberInput" name="numberInput" min="0.01" step="0.01" placeholder="请输入大于0的数字" style=";width:180px; padding:12px 5px;" value="${tableList[rowIndex][dialogLabelInfo[index].field]}"> <input type="text" data-id="${dialogLabelInfo[index].field}" id="numberInput" name="numberInput" min="0.01" step="0.01" placeholder="请输入大于0的数字" style=";width:180px; padding:5px;" value="${tableList[rowIndex][dialogLabelInfo[index].field]}">
<button type="button" id="uploadBtn" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;"> <button type="button" id="uploadBtn" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;">
+ 上传评分依据 + 上传评分依据
</button> </button>
@ -263,6 +263,8 @@
event.stopPropagation(); // 阻止事件冒泡 event.stopPropagation(); // 阻止事件冒泡
event.preventDefault(); // 阻止默认行为 event.preventDefault(); // 阻止默认行为
console.log('上传附件按钮被点击了'); console.log('上传附件按钮被点击了');
// 在这里可以添加附件上传的逻辑,例如打开文件选择器等 // 在这里可以添加附件上传的逻辑,例如打开文件选择器等
}); });
@ -279,15 +281,25 @@
// 点击"确定"按钮时的逻辑 // 点击"确定"按钮时的逻辑
let formData = {}; let formData = {};
let fields = dialogLabelInfo.map((e) => e.field)
$('#uploadForm input').each(function () { $('#uploadForm input').each(function () {
let inputValue = $(this).val(); let inputValue = $(this).val();
let dataId = $(this).data('id'); // 获取 data-id let dataId = $(this).data('id'); // 获取 data-id
if (dataId && inputValue) { if (dataId && inputValue) {
formData[dataId] = inputValue; // 将 data-id 作为键,输入框的值作为值 formData[dataId] = inputValue; // 将 data-id 作为键,输入框的值作为值
} }
const currentRows = tableList[rowIndex]
Object.assign(currentRows, formData)
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
id: getUrlParam('detailsId'),
jsonData: JSON.stringify([currentRows]),
titleFiled: fields.join(',')
}
}); });
console.log('formDat参数', formData) console.log('提交时的formDat参数', data)
// 这里可以执行你需要的操作 // 这里可以执行你需要的操作
// layer.close(index); // 关闭弹框 // layer.close(index); // 关闭弹框
}, },