This commit is contained in:
parent
3edcfcd3b0
commit
f003a0c4be
|
|
@ -216,22 +216,8 @@
|
||||||
delete item.dataset.edit
|
delete item.dataset.edit
|
||||||
let fileDom = '';
|
let fileDom = '';
|
||||||
|
|
||||||
// 只要有文件列表,并且文件列表数量大于0,添加文件信息
|
|
||||||
// if (item1.fileList && item1.fileList.length > 0) {
|
|
||||||
// // 根据文件列表的索引判断将哪个文件添加到相应的列
|
|
||||||
// fileDom = `<span>${item1.fileList[index - 3]}</span>`;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log('fileDomfileDomfileDomfileDom', fileDom)
|
|
||||||
|
|
||||||
// // 将fileDom添加到当前单元格
|
|
||||||
// $(this).append(fileDom);
|
|
||||||
|
|
||||||
let dataId = $(this).data('field')
|
let dataId = $(this).data('field')
|
||||||
|
|
||||||
console.log(dataId)
|
|
||||||
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-left:6px"></i> `)
|
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-left:6px"></i> `)
|
||||||
}
|
}
|
||||||
|
|
@ -310,8 +296,7 @@
|
||||||
multiple: false,
|
multiple: false,
|
||||||
done: function (res) {
|
done: function (res) {
|
||||||
// 上传完毕回调
|
// 上传完毕回调
|
||||||
console.log('文件上传成功');
|
if (res.res === 1) {
|
||||||
console.log(res);
|
|
||||||
var dataId = $(this.elem).data('id');
|
var dataId = $(this.elem).data('id');
|
||||||
var dataIndex = $(this.elem).data('index');
|
var dataIndex = $(this.elem).data('index');
|
||||||
tableRowList[rowIndex][`${dataId}-file`] = {
|
tableRowList[rowIndex][`${dataId}-file`] = {
|
||||||
|
|
@ -322,21 +307,25 @@
|
||||||
$(`#uploadBtn${dataIndex}`).hide()
|
$(`#uploadBtn${dataIndex}`).hide()
|
||||||
$(`#upload-success_${dataIndex}`).show()
|
$(`#upload-success_${dataIndex}`).show()
|
||||||
$(`#upload-success_${dataIndex}`).prepend(`<span class="prepend-content">${res.message}</span>`)
|
$(`#upload-success_${dataIndex}`).prepend(`<span class="prepend-content">${res.message}</span>`)
|
||||||
// 插入新的 DOM 元素,
|
|
||||||
// var newDom = $(`<div class="upload-success">${res.message}<i data-index="${dataIndex}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;"></i> </div>`);
|
let hasIcon = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-icon') > 0
|
||||||
// $(this.elem).parent().append(newDom);
|
|
||||||
|
if (!hasIcon) {
|
||||||
|
tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b" style="margin-left:6px"></i> `)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
layer.msg(res.resMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
// 请求异常回调
|
|
||||||
console.log('文件上传失败');
|
layer.msg('请求失败')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// $('.uploadBtn').on('click', function (event) {
|
|
||||||
// event.stopPropagation(); // 阻止事件冒泡
|
|
||||||
// event.preventDefault(); // 阻止默认行为
|
|
||||||
// console.log('上传附件按钮被点击了');
|
|
||||||
// });
|
|
||||||
|
|
||||||
},
|
},
|
||||||
yes: function (index) {
|
yes: function (index) {
|
||||||
|
|
@ -344,6 +333,8 @@
|
||||||
|
|
||||||
let formData = {};
|
let formData = {};
|
||||||
let fields = dialogLabelInfo.map((e) => e.field)
|
let fields = dialogLabelInfo.map((e) => e.field)
|
||||||
|
|
||||||
|
let isValidate = false
|
||||||
$('#uploadForm input').each(function () {
|
$('#uploadForm input').each(function () {
|
||||||
let inputValue = $(this).val();
|
let inputValue = $(this).val();
|
||||||
let maxValue = $(this).data('value')
|
let maxValue = $(this).data('value')
|
||||||
|
|
@ -356,10 +347,12 @@
|
||||||
|
|
||||||
if (!regex.test(parseFloat(inputValue))) {
|
if (!regex.test(parseFloat(inputValue))) {
|
||||||
layer.msg('请输入大于等于0的正整数')
|
layer.msg('请输入大于等于0的正整数')
|
||||||
|
isValidate = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (parseFloat(inputValue) > maxValue) {
|
if (parseFloat(inputValue) > maxValue) {
|
||||||
layer.msg(`不可当前最大分值是${maxValue}`)
|
layer.msg(`不可当前最大分值是${maxValue}`)
|
||||||
|
isValidate = true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,6 +362,8 @@
|
||||||
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
|
formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (isValidate) return
|
||||||
const currentRows = tableRowList[rowIndex]
|
const currentRows = tableRowList[rowIndex]
|
||||||
Object.assign(currentRows, formData)
|
Object.assign(currentRows, formData)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue