代码调试

This commit is contained in:
BianLzhaoMin 2025-02-26 09:42:45 +08:00
parent 33e9bbf239
commit fedd8da196
1 changed files with 10 additions and 21 deletions

View File

@ -229,15 +229,11 @@
// 将自定义元素插入到最后一个单元格 // 将自定义元素插入到最后一个单元格
div.append(customElement); div.append(customElement);
customElement.on('click', function (event) { customElement.on('click', function (event) {
event.stopPropagation(); // 阻止事件冒泡 event.stopPropagation()
event.preventDefault() event.preventDefault()
console.log('按钮被点击了');
let rowIndex = $(this).closest('tr').data('index') let rowIndex = $(this).closest('tr').data('index')
const tableList = JSON.parse(msg) const tableList = JSON.parse(msg)
let fileList = []
console.log('rowIndex当前行的索引', rowIndex)
// 在这里添加按钮点击后的逻辑
// 组装dom // 组装dom
let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>` let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>`
@ -278,27 +274,22 @@
accept: 'file', // 选择文件类型 accept: 'file', // 选择文件类型
multiple: false, // 支持多文件上传 multiple: false, // 支持多文件上传
auto: true, // 禁用自动上传,点击确定按钮后上传 auto: true, // 禁用自动上传,点击确定按钮后上传
bindAction: '#uploadConfirm', // 确定按钮触发上传
choose: function (obj) { choose: function (obj) {
// 当选择文件时会触发这个方法 // 当选择文件时会触发这个方法
var files = obj.pushFile(); // 获取文件列表 var files = obj.pushFile(); // 获取文件列表
console.log(files); console.log(files);
obj.pushFile([])
}, },
done: function (res) { done: function (res) {
// 上传完毕回调 // 上传完毕回调
console.log('文件上传成功'); console.log('文件上传成功');
console.log(res); console.log(res);
var dataIndex = $(this.elem).data('index'); var dataIndex = $(this.elem).data('index');
console.log('当前按钮的 data-index:', dataIndex); fileList[dataIndex] = res.obj
// 隐藏当前上传按钮 // 隐藏当前上传按钮
// $(this.elem).hide();
$(`#uploadBtn${dataIndex}`).hide() $(`#uploadBtn${dataIndex}`).hide()
// 插入新的 DOM 元素,例如:显示上传成功的消息或其他操作 // 插入新的 DOM 元素,
var newDom = $(`<div class="upload-success">${res.message}<i data-index="${dataIndex}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>`); var newDom = $(`<div class="upload-success">${res.message}<i data-index="${dataIndex}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>`);
$(this.elem).parent().append(newDom); $(this.elem).parent().append(newDom);
}, },
@ -315,7 +306,7 @@
// }); // });
}, },
yes: function (index, layero) { yes: function (index) {
// 点击"确定"按钮时的逻辑 // 点击"确定"按钮时的逻辑
let formData = {}; let formData = {};
@ -339,7 +330,8 @@
evaluateId: getUrlParam('id'), evaluateId: getUrlParam('id'),
id: getUrlParam('detailsId'), id: getUrlParam('detailsId'),
jsonData: JSON.stringify([currentRows]), jsonData: JSON.stringify([currentRows]),
titleFiled: fields.join(',') titleFiled: fields.join(','),
fileList
} }
console.log('提交时的formDat参数', dataForm) console.log('提交时的formDat参数', dataForm)
@ -363,12 +355,9 @@
// 这里可以执行你需要的操作 // 这里可以执行你需要的操作
}, },
btn2: function (index, layero) { btn2: function (index) {
// 点击"取消"按钮时的逻辑 layer.close(index) // 关闭弹框
console.log('取消按钮被点击了'); return false
// 这里可以执行你需要的操作,通常是关闭弹框
layer.close(index); // 关闭弹框
return false; // 防止关闭弹框后执行默认的按钮行为
} }
}) })
}); });