Compare commits
13 Commits
cf301559de
...
main
Author | SHA1 | Date | |
---|---|---|---|
d514e82e9b | |||
0c602a8ccd | |||
559af65260 | |||
7e5eaa82e3 | |||
b1c336e43c | |||
1f2c23c157 | |||
b88b78a946 | |||
d0faf8b8b2 | |||
d663087c41 | |||
6d01222ce4 | |||
d2965c64e1 | |||
232c7da723 | |||
446210ea4c |
@ -44,3 +44,8 @@ function checknext() {
|
|||||||
.catch(error => console.error('Error:', error));
|
.catch(error => console.error('Error:', error));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function backtoroot(msg="已完成,返回") {
|
||||||
|
alert(msg);
|
||||||
|
location.href="/";
|
||||||
|
}
|
16
inventory_check/templates/after.html
Normal file
16
inventory_check/templates/after.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>盘库助手</title>
|
||||||
|
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" src="{{ url_for('static', filename='js/script.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
backtoroot( "{{ msg }}" );
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -23,6 +23,6 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='js/script.js') }}"></script>
|
<script type="text/javascript" src="{{ url_for('static', filename='js/script.js') }}"></script>
|
||||||
|
{% block scripts %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -7,8 +7,9 @@
|
|||||||
<a href="/"><button type="button">返回</button></a>
|
<a href="/"><button type="button">返回</button></a>
|
||||||
<div></div><div></div>
|
<div></div><div></div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<form method=post enctype=multipart/form-data action="/import">
|
<form method=post enctype=multipart/form-data action="/import">
|
||||||
<div><input style="width:300px;" type=file name=选择></div>
|
<div><input style="width:300px;" type=file name=file></div>
|
||||||
<div class="handler"><div></div><input style="width:100px;"type=submit value=上传></div>
|
<div class="handler"><div></div><input style="width:100px;"type=submit value=上传></div>
|
||||||
</form>
|
</form>
|
||||||
<div>
|
<div>
|
||||||
|
@ -22,15 +22,7 @@ def index():
|
|||||||
def check():
|
def check():
|
||||||
inventory = Inventory.query.filter_by(checked=False).first()
|
inventory = Inventory.query.filter_by(checked=False).first()
|
||||||
if not inventory:
|
if not inventory:
|
||||||
js_code = '''
|
return render_template('after.html',msg="未导入或已盘完")
|
||||||
<script>
|
|
||||||
alert("未导入Excel或已完成!");
|
|
||||||
location.href="https://a.yum2.cc";
|
|
||||||
</script>
|
|
||||||
'''
|
|
||||||
response = make_response(js_code)
|
|
||||||
response.headers['Content-Type'] = 'application/javascript'
|
|
||||||
return response
|
|
||||||
return render_template('check.html',inventory=inventory)
|
return render_template('check.html',inventory=inventory)
|
||||||
|
|
||||||
@app.route('/get_inventory', methods=['POST'])
|
@app.route('/get_inventory', methods=['POST'])
|
||||||
@ -97,15 +89,7 @@ def import_file():
|
|||||||
file_path = 'data.xlsx'
|
file_path = 'data.xlsx'
|
||||||
file.save(file_path)
|
file.save(file_path)
|
||||||
import_from_xlsx(file_path)
|
import_from_xlsx(file_path)
|
||||||
js_code = '''
|
return render_template('after.html',msg="成功")
|
||||||
<script>
|
|
||||||
alert("文件导入成功!");
|
|
||||||
location.href="https://a.yum2.cc";
|
|
||||||
</script>
|
|
||||||
'''
|
|
||||||
response = make_response(js_code)
|
|
||||||
response.headers['Content-Type'] = 'application/javascript'
|
|
||||||
return response
|
|
||||||
|
|
||||||
return redirect(url_for('upload_form'))
|
return redirect(url_for('upload_form'))
|
||||||
|
|
||||||
@ -113,7 +97,7 @@ def import_file():
|
|||||||
|
|
||||||
@app.route('/download-xlsx')
|
@app.route('/download-xlsx')
|
||||||
def download_xlsx():
|
def download_xlsx():
|
||||||
filename = time.strftime("%Y%m%d.xlsx", time.localtime())
|
filename = "PD-" + time.strftime("%Y%m%d", time.localtime()) + ".xlsx"
|
||||||
# 创建一个 Excel 工作簿
|
# 创建一个 Excel 工作簿
|
||||||
inventorys = Inventory.query.all() # 查询所有数据, and sort data by sort
|
inventorys = Inventory.query.all() # 查询所有数据, and sort data by sort
|
||||||
# 创建一个工作簿
|
# 创建一个工作簿
|
||||||
|
BIN
sheet.xlsx
Normal file
BIN
sheet.xlsx
Normal file
Binary file not shown.
BIN
游芯盘点表.xlsx
BIN
游芯盘点表.xlsx
Binary file not shown.
Reference in New Issue
Block a user