This commit is contained in:
BianLzhaoMin 2025-07-28 13:21:49 +08:00
parent acacc5f98e
commit 1cee686c16
2 changed files with 733 additions and 705 deletions

View File

@ -1,11 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo</title>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
</head>
<body>
<div class="layui-btn-group" style="margin-top: 10px" id="btnGroup" hidden="hidden">
<button class="layui-btn layui-btn-sm" onclick="initTable(-1)">事业部评价审批</button>
@ -39,6 +41,7 @@
let alter = true;
let layer, laydate, table, form;
let tableLoading;
let tableRowList = []
$(function () {
let use1 = layui.use(['layer', 'laydate', 'table', 'form'], function () {
layer = layui.layer;
@ -82,6 +85,7 @@
}
function setCols(data, msg) {
tableRowList = JSON.parse(msg)
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
@ -160,6 +164,14 @@
var columsIndex = [1];//需要合并的列索引值 [2,3,5,6,14,15];
merge(res, columsName, columsIndex);
tableLoading && layer.close(tableLoading);
cols.each(function (index, item) {
if (index > 2 && index != cols.length - 1) {
let dataId = $(this).data('field')
if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName'] != '') {
$(this).find('.layui-table-cell').append(`<i class="layui-icon layui-icon-file-b file-icon" data-index="${i}" data-id="${dataId}" style="margin-left:6px;cursor:pointer"></i> `)
}
}
})
}
});
table.on('tool(test)', function (obj) {
@ -188,6 +200,22 @@
});
}
$(document).on('click', '.layui-table-cell', function (e) {
console.log('点击了单元格')
// 判断是否有文件图标
if ($(this).find('.file-icon').length > 0) {
var dataId = $(this).find('.file-icon').data('id');
var dataIndex = $(this).find('.file-icon').data('index');
console.log('File icon clicked', {
dataIndex: dataIndex,
dataId: dataId,
rowData: tableRowList[dataIndex]
});
window.open(ctxPath + "/statics/" + tableRowList[dataIndex][`${dataId}-file`].filePath.split('/upload/')[1])
}
});
function allAudit(type) {
let title = type === 1 ? '全部通过' : '全部驳回';
layer.confirm('确定' + title + '吗?', function (index) {