Compare commits
No commits in common. "47a08bbf6b4b6b3d8fa02760bb432c5551bd645d" and "09813ecbc0e3c6e4e03b8b4c6773b2cf873f56da" have entirely different histories.
47a08bbf6b
...
09813ecbc0
|
|
@ -48,9 +48,6 @@
|
||||||
let headerRows;
|
let headerRows;
|
||||||
let layer, laydate, table, form;
|
let layer, laydate, table, form;
|
||||||
let tableLoading, tableIns;
|
let tableLoading, tableIns;
|
||||||
|
|
||||||
// 定义一个列表的数据源 作为提交时参数
|
|
||||||
let tableRowList = []
|
|
||||||
$(function () {
|
$(function () {
|
||||||
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
layui.use(['layer', 'laydate', 'table', 'form'], function () {
|
||||||
layer = layui.layer;
|
layer = layui.layer;
|
||||||
|
|
@ -128,8 +125,6 @@
|
||||||
headerRows = [];
|
headerRows = [];
|
||||||
headerRows = JSON.parse(data);
|
headerRows = JSON.parse(data);
|
||||||
|
|
||||||
tableRowList = JSON.parse(msg)
|
|
||||||
|
|
||||||
// 定义弹框内需要的label
|
// 定义弹框内需要的label
|
||||||
const dialogLabelList = headerRows[1]
|
const dialogLabelList = headerRows[1]
|
||||||
const dialogLabelInfo = headerRows[2]
|
const dialogLabelInfo = headerRows[2]
|
||||||
|
|
@ -237,8 +232,8 @@
|
||||||
text: '评价',
|
text: '评价',
|
||||||
type: 'button'
|
type: 'button'
|
||||||
});
|
});
|
||||||
// let fileList = []
|
let fileList = []
|
||||||
let uploadDom = {}
|
let uploadDom = []
|
||||||
|
|
||||||
// 将自定义元素插入到最后一个单元格
|
// 将自定义元素插入到最后一个单元格
|
||||||
div.append(customElement);
|
div.append(customElement);
|
||||||
|
|
@ -246,22 +241,23 @@
|
||||||
customElement.on('click', function (event) {
|
customElement.on('click', function (event) {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
let rowIndex = $(this).closest('tr').data('index')
|
||||||
|
const tableList = JSON.parse(msg)
|
||||||
|
|
||||||
|
|
||||||
// 组装dom
|
// 组装dom
|
||||||
let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>`
|
let formHtml = `<div class="dialog-title">${tableList[rowIndex].proName}</div>`
|
||||||
let innerHtml = ''
|
let innerHtml = ''
|
||||||
let rowIndex = $(this).closest('tr').data('index')
|
|
||||||
const curRows = tableRowList[rowIndex]
|
|
||||||
dialogLabelList.forEach((e, index) => {
|
dialogLabelList.forEach((e, index) => {
|
||||||
// fileList.push('')
|
fileList.push('')
|
||||||
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-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}" data-id="${dialogLabelInfo[index].field}" 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;">
|
||||||
+ 上传评分依据
|
+ 上传评分依据
|
||||||
</button>
|
</button>
|
||||||
<div class="upload-success" id="upload-success_${index}" style="display:none"><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:none"><i data-index="${index}" class="layui-icon" style="font-size: 18px; color: red; cursor: pointer;"></i> </div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -273,7 +269,6 @@
|
||||||
</form>
|
</form>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
|
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
area: ['auto', 'auto'], // 宽高
|
area: ['auto', 'auto'], // 宽高
|
||||||
|
|
@ -294,14 +289,9 @@
|
||||||
// 上传完毕回调
|
// 上传完毕回调
|
||||||
console.log('文件上传成功');
|
console.log('文件上传成功');
|
||||||
console.log(res);
|
console.log(res);
|
||||||
var dataId = $(this.elem).data('id');
|
var dataIndex = $(this.elem).data('index');
|
||||||
|
fileList[dataIndex] = res.obj
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tableRowList[rowIndex][`${dataId}-file`] = {
|
|
||||||
fileName: res.message,
|
|
||||||
filePath: res.obj,
|
|
||||||
}
|
|
||||||
// 隐藏当前上传按钮
|
// 隐藏当前上传按钮
|
||||||
$(`#uploadBtn${dataIndex}`).hide()
|
$(`#uploadBtn${dataIndex}`).hide()
|
||||||
$(`#upload-success_${dataIndex}`).show()
|
$(`#upload-success_${dataIndex}`).show()
|
||||||
|
|
@ -419,23 +409,16 @@
|
||||||
|
|
||||||
$(document).on('click', '.upload-success i', function () {
|
$(document).on('click', '.upload-success i', function () {
|
||||||
var dataIndex = $(this).data('index');
|
var dataIndex = $(this).data('index');
|
||||||
var Index = $(this).data('idx');
|
console.log('删除图标被点击,data-index:', dataIndex);
|
||||||
var dataId = $(this).data('id');
|
|
||||||
// console.log('删除图标被点击,data-index:', dataIndex);
|
|
||||||
|
|
||||||
// fileList[dataIndex] = ''
|
fileList[dataIndex] = ''
|
||||||
// 执行删除操作
|
// 执行删除操作
|
||||||
|
|
||||||
tableRowList[dataIndex][`${dataId}-file`] = {
|
|
||||||
fileName: '',
|
|
||||||
filePath: '',
|
|
||||||
}
|
|
||||||
// $(this).parent().remove()
|
// $(this).parent().remove()
|
||||||
$(`#upload-success_${Index}`).hide(function () {
|
$(`#upload-success_${dataIndex}`).hide(function () {
|
||||||
// 当隐藏完之后,移除插入的内容
|
// 当隐藏完之后,移除插入的内容
|
||||||
$(`#upload-success_${Index} .prepend-content`).remove();
|
$(`#upload-success_${dataIndex} .prepend-content`).remove();
|
||||||
})
|
})
|
||||||
$(`#uploadBtn${Index}`).show()
|
$(`#uploadBtn${dataIndex}`).show()
|
||||||
});
|
});
|
||||||
tableLoading && layer.close(tableLoading);
|
tableLoading && layer.close(tableLoading);
|
||||||
}
|
}
|
||||||
|
|
@ -521,9 +504,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTableData() {
|
function getTableData() {
|
||||||
|
|
||||||
console.log('tableRowList上传了', tableRowList)
|
|
||||||
if (true) return
|
|
||||||
//获取表格填写的数据
|
//获取表格填写的数据
|
||||||
var tableData = table.cache.baseTable;
|
var tableData = table.cache.baseTable;
|
||||||
//校验所有单元格是否填写
|
//校验所有单元格是否填写
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue