This commit is contained in:
BianLzhaoMin 2025-02-26 16:31:20 +08:00
parent aa7c645293
commit 494e8be871
1 changed files with 64 additions and 13 deletions

View File

@ -24,6 +24,12 @@
.layui-layer-iframe .layui-layer-btn0 { .layui-layer-iframe .layui-layer-btn0 {
display: none; display: none;
} }
.td-container {
display: flex;
align-items: center;
justify-content: space-around;
}
</style> </style>
</head> </head>
@ -203,7 +209,8 @@
if (index > 2 && index != cols.length - 1) { if (index > 2 && index != cols.length - 1) {
$(this).data('edit', 'false'); $(this).data('edit', 'false');
$(this).removeAttr('data-edit'); $(this).removeAttr('data-edit');
$(this).addClass('layui-disabled'); // $(this).addClass('layui-disabled');
$(this).addClass('td-container');
//将td元素的contentEditable属性设置为false禁止编辑 //将td元素的contentEditable属性设置为false禁止编辑
$(this).attr('contentEditable', 'false'); $(this).attr('contentEditable', 'false');
//将td元素的style属性设置为pointer-events: none禁止点击 //将td元素的style属性设置为pointer-events: none禁止点击
@ -212,15 +219,15 @@
let fileDom = ''; let fileDom = '';
// 只要有文件列表并且文件列表数量大于0添加文件信息 // 只要有文件列表并且文件列表数量大于0添加文件信息
// if (item1.fileList && item1.fileList.length > 0) { if (item1.fileList && item1.fileList.length > 0) {
// // 根据文件列表的索引判断将哪个文件添加到相应的列 // 根据文件列表的索引判断将哪个文件添加到相应的列
// fileDom = `<span>${item1.fileList[index - 3]}</span>`; fileDom = `<span>${item1.fileList[index - 3].name}</span>`;
// } }
// console.log('fileDomfileDomfileDomfileDom', fileDom) console.log('fileDomfileDomfileDomfileDom', fileDom)
// // 将fileDom添加到当前单元格 // 将fileDom添加到当前单元格
// $(this).append(fileDom); $(this).append(fileDom);
} }
}); });
@ -257,9 +264,48 @@
let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>` let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>`
let innerHtml = '' let innerHtml = ''
dialogLabelList.forEach((e, index) => { dialogLabelList.forEach((e, index) => {
fileList.push('')
uploadDom.push('#uploadBtn' + index) if (tableList[rowIndex].tableList && tableList[rowIndex].tableList.length > 0) {
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
if (tableList[rowIndex].tableList[index].name && tableList[rowIndex].tableList[index].path) {
fileList.push({
name: tableList[rowIndex].tableList[index].name,
path: tableList[rowIndex].tableList[index].path,
})
uploadDom.push('#uploadBtn' + index)
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
<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:1px 5px;" value="${tableList[rowIndex][dialogLabelInfo[index].field]}">
<button type="button" data-index="${index}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;display:none">
+ 上传评分依据
</button>
<div class="upload-success" id="upload-success_${index}" style="display:block">${tableList[rowIndex].tableList[index].name}<i data-index="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>
</div>`
} else {
fileList.push({
name: '',
path: '',
})
uploadDom.push('#uploadBtn' + index)
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
<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:1px 5px;" value="${tableList[rowIndex][dialogLabelInfo[index].field]}">
<button type="button" data-index="${index}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;>
+ 上传评分依据
</button>
<div class="upload-success" id="upload-success_${index}" style="display:none"><i data-index="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>
</div>`
}
} else {
fileList.push({
name: '',
path: '',
})
uploadDom.push('#uploadBtn' + index)
innerHtml += `<div style="padding:6px 0;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:1px 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:1px 5px;" value="${tableList[rowIndex][dialogLabelInfo[index].field]}">
<button type="button" data-index="${index}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;"> <button type="button" data-index="${index}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;">
@ -267,6 +313,8 @@
</button> </button>
<div class="upload-success" id="upload-success_${index}" style="display:none"><i data-index="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div> <div class="upload-success" id="upload-success_${index}" style="display:none"><i data-index="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;">&#xe640;</i> </div>
</div>` </div>`
}
}) })
@ -298,7 +346,8 @@
console.log('文件上传成功'); console.log('文件上传成功');
console.log(res); console.log(res);
var dataIndex = $(this.elem).data('index'); var dataIndex = $(this.elem).data('index');
fileList[dataIndex] = res.obj fileList[dataIndex].path = res.obj
fileList[dataIndex].name = res.message
// 隐藏当前上传按钮 // 隐藏当前上传按钮
$(`#uploadBtn${dataIndex}`).hide() $(`#uploadBtn${dataIndex}`).hide()
@ -382,7 +431,9 @@
var dataIndex = $(this).data('index'); var dataIndex = $(this).data('index');
console.log('删除图标被点击data-index:', dataIndex); console.log('删除图标被点击data-index:', dataIndex);
fileList[dataIndex] = '' fileList[dataIndex].path = ''
fileList[dataIndex].name = ''
// 执行删除操作 // 执行删除操作
// $(this).parent().remove() // $(this).parent().remove()
$(`#upload-success_${dataIndex}`).hide(function () { $(`#upload-success_${dataIndex}`).hide(function () {