This commit is contained in:
parent
56a1da65d2
commit
3edcfcd3b0
|
|
@ -52,6 +52,7 @@
|
||||||
// 定义一个列表的数据源 作为提交时参数
|
// 定义一个列表的数据源 作为提交时参数
|
||||||
let tableRowList = []
|
let tableRowList = []
|
||||||
let tableFieldList = []
|
let tableFieldList = []
|
||||||
|
let tableFieldValueList = []
|
||||||
$(function () {
|
$(function () {
|
||||||
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
||||||
layer = layui.layer;
|
layer = layui.layer;
|
||||||
|
|
@ -135,6 +136,7 @@
|
||||||
const dialogLabelList = headerRows[1]
|
const dialogLabelList = headerRows[1]
|
||||||
const dialogLabelInfo = headerRows[2]
|
const dialogLabelInfo = headerRows[2]
|
||||||
tableFieldList = dialogLabelInfo
|
tableFieldList = dialogLabelInfo
|
||||||
|
tableFieldValueList = dialogLabelList
|
||||||
|
|
||||||
// Clear existing headers
|
// Clear existing headers
|
||||||
const thead = document.querySelector('#baseTable thead');
|
const thead = document.querySelector('#baseTable thead');
|
||||||
|
|
@ -231,7 +233,7 @@
|
||||||
console.log(item1[`${dataId}-file`])
|
console.log(item1[`${dataId}-file`])
|
||||||
|
|
||||||
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName']) {
|
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName']) {
|
||||||
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-right:6px"></i> `)
|
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-left:6px"></i> `)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,11 +275,11 @@
|
||||||
uploadDom.push('#uploadBtn' + index)
|
uploadDom.push('#uploadBtn' + index)
|
||||||
innerHtml += `<div style="padding:6px 0;display: flex; align-items: center;">
|
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="${curRows[dialogLabelInfo[index].field]}">
|
<input type="text" data-value="${tableFieldValueList[index]['standardScore']}" data-id="${dialogLabelInfo[index].field}" id="numberInput" name="numberInput" min="0.01" step="0.01" placeholder="请输入大于0的数字" style=";width:180px; padding:1px 5px;" value="${curRows[dialogLabelInfo[index].field]}">
|
||||||
<button type="button" data-index="${index}" data-id="${dialogLabelInfo[index].field}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;display:${isFile ? 'none' : 'block'}">
|
<button type="button" data-index="${index}" data-id="${dialogLabelInfo[index].field}" id="uploadBtn${index}" style="color: #4CAF50; border: none; margin-left: 10px; cursor: pointer;display:${isFile ? 'none' : 'block'}">
|
||||||
+ 上传评分依据
|
+ 上传评分依据
|
||||||
</button>
|
</button>
|
||||||
<div class="upload-success" id="upload-success_${index}" style="display:${isFile ? 'block' : 'none'}">${isFile ? isFile.fileName : ''}<i data-index="${rowIndex}" data-id="${dialogLabelInfo[index].field}" data-idx="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;"></i> </div>
|
<div class="upload-success" id="upload-success_${index}" style="display:${isFile ? 'block' : 'none'}"><span class="prepend-content">${isFile ? isFile.fileName : ''}</span><i data-index="${rowIndex}" data-id="${dialogLabelInfo[index].field}" data-idx="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;"></i> </div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -344,11 +346,24 @@
|
||||||
let fields = dialogLabelInfo.map((e) => e.field)
|
let fields = dialogLabelInfo.map((e) => e.field)
|
||||||
$('#uploadForm input').each(function () {
|
$('#uploadForm input').each(function () {
|
||||||
let inputValue = $(this).val();
|
let inputValue = $(this).val();
|
||||||
|
let maxValue = $(this).data('value')
|
||||||
|
// if (parseFloat(inputValue) < 0) {
|
||||||
|
// layer.msg('请输入大于0的数字')
|
||||||
|
// return false
|
||||||
|
// }
|
||||||
|
|
||||||
if (parseFloat(inputValue) < 0) {
|
const regex = /^\d+$/
|
||||||
layer.msg('请输入大于0的数字')
|
|
||||||
|
if (!regex.test(parseFloat(inputValue))) {
|
||||||
|
layer.msg('请输入大于等于0的正整数')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (parseFloat(inputValue) > maxValue) {
|
||||||
|
layer.msg(`不可当前最大分值是${maxValue}`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let dataId = $(this).data('id') // 获取 data-id
|
let dataId = $(this).data('id') // 获取 data-id
|
||||||
if (dataId && inputValue) {
|
if (dataId && inputValue) {
|
||||||
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
|
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue