excel解析预览页面

This commit is contained in:
王思川 2024-06-17 21:16:36 +08:00
parent faa05ab94d
commit acd5196715
1 changed files with 29 additions and 3 deletions

View File

@ -17,7 +17,30 @@
<link rel="stylesheet" href="{% static 'plugins/animation/css/animate.min.css' %}"> <link rel="stylesheet" href="{% static 'plugins/animation/css/animate.min.css' %}">
<!-- vendor css --> <!-- vendor css -->
<link rel="stylesheet" href="{% static 'css/style.css' %}"> <link rel="stylesheet" href="{% static 'css/style.css' %}">
<style>
.table-container {
position: relative;
max-height: 80vh; /* 设置为占视口高度的80% */
overflow-y: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
thead th {
position: sticky;
top: 0;
background: white;
z-index: 1;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
</style>
</head> </head>
<body> <body>
@ -25,13 +48,15 @@
<form id="preview-form" method="post"> <form id="preview-form" method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}"> <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="excelPreviewModalTitle">上传文件预览</h5> <h3 class="modal-title" id="excelPreviewModalTitle">上传文件预览</h3>
<a href="javascript:history.back()" class="btn btn-primary btn-lg" data-bs-toggle="tooltip" data-bs-original-title="返回">返回列表</a>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div style="overflow-x: auto;"> <div class="table-container">
<table id="form-input-table" class="table table-striped table-bordered nowrap"> <table id="form-input-table" class="table table-striped table-bordered nowrap">
<thead> <thead>
<tr> <tr>
<th>序号</th>
{% for column in columns %} {% for column in columns %}
<th>{{ column }}</th> <th>{{ column }}</th>
{% endfor %} {% endfor %}
@ -40,6 +65,7 @@
<tbody> <tbody>
{% for row in table_data %} {% for row in table_data %}
<tr> <tr>
<td>{{ forloop.counter }}</td>
{% for cell in row %} {% for cell in row %}
<td> <td>
<input type="text" class="form-control" style="width: 180px;" name="cell_{{ forloop.parentloop.counter0 }}_{{ forloop.counter0 }}" value="{{ cell }}"> <input type="text" class="form-control" style="width: 180px;" name="cell_{{ forloop.parentloop.counter0 }}_{{ forloop.counter0 }}" value="{{ cell }}">