新建excel_parser应用

This commit is contained in:
王思川 2024-06-17 15:52:01 +08:00
parent b9c546e203
commit dcb553c53f
10 changed files with 111 additions and 0 deletions

View File

@ -24,6 +24,7 @@ urlpatterns = [
path("admin/", admin.site.urls),
path("", user_homepage_view, name="index"),
path("common/", include("common.urls")),
path("excel_parser/", include("excel_parser.urls")),
path("accounts/", include("application.accounts.urls")),
path("basic_data/om/", include("application.org_mgnt.urls")),

0
excel_parser/__init__.py Normal file
View File

3
excel_parser/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
excel_parser/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class ExcelParserConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "excel_parser"

View File

3
excel_parser/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<title>Excel解析工具</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Favicon icon -->
<link rel="icon" href="{% static 'images/favicon.svg' %}" type="image/x-icon">
<!-- fontawesome icon -->
<link rel="stylesheet" href="{% static 'fonts/fontawesome/css/fontawesome-all.min.css' %}">
<!-- animation css -->
<link rel="stylesheet" href="{% static 'plugins/animation/css/animate.min.css' %}">
<!-- vendor css -->
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<div class="page-wrapper">
<form id="preview-form" method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="sNsa35OBeT7kQBrftJ8RaPHpICVfRsUgxshXt37Zc18ERTa4Ku4LQR3VJNTFGiSu">
<div class="modal-header">
<h5 class="modal-title" id="excelPreviewModalTitle">上传文件预览</h5>
</div>
<div class="modal-body">
<div style="overflow-x: auto;">
<table id="form-input-table" class="table table-striped table-bordered nowrap">
<thead>
<tr>
<th>序号</th>
<th>车牌</th>
<th>借出时间</th>
<th>借用人</th>
<th>同行人员</th>
<th>事由</th>
<th>目的地</th>
<th>用车天数</th>
<th>还车时间</th></tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>
<input style="width: 180px" type="text" class="form-control" id="license_plate" name="license_plate" value="川A77889"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="checkout_time" name="checkout_time" value="2024-01-31"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="borrower" name="borrower" value="张三"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="accompanying_personnel" name="accompanying_personnel" value="李四"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="reason" name="reason" value="外出见客户"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="destination" name="destination" value="金融麦田"></td>
<td>
<input style="width: 180px" type="number" class="form-control" id="days_of_use" name="days_of_use" value="1"></td>
<td>
<input style="width: 180px" type="text" class="form-control" id="return_time" name="return_time" value="2024-02-01"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<div id="pagination">
<span id="totalData" class="mx-2">数据总数: 1</span>
<span id="pageInfo" class="mx-2">第 1 页, 共 1 页</span>
<button id="prevPage" class="btn btn-secondary" type="button">上一页</button>
<button id="nextPage" class="btn btn-secondary" type="button">下一页</button></div>
<div id="actions">
<button id="saveButton" type="button" class="btn btn-primary">保存</button></div>
</div>
</form>
</div>
<script src="{% static 'js/vendor-all.min.js' %}"></script>
<script src="{% static 'plugins/bootstrap/js/bootstrap.min.js' %}"></script>
</html>

3
excel_parser/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
excel_parser/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from excel_parser.views import *
urlpatterns = [
path('common_parse/', common_parse, name="common_parse")
]

5
excel_parser/views.py Normal file
View File

@ -0,0 +1,5 @@
from django.shortcuts import render
def common_parse(request):
return render(request, 'excel_preview_table.html')