Merge branch 'main' of https://git.yum2.cc/luff/inventory_check
This commit is contained in:
@ -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="index.html";
|
||||||
|
}
|
4
inventory_check/templates/after.html
Normal file
4
inventory_check/templates/after.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
<script>
|
||||||
|
backtoroot( "{{ msg }}" );
|
||||||
|
</script>
|
@ -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'))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user