refactor(api):分离部分模板页面

This commit is contained in:
zhengxinonly
2021-07-23 01:22:28 +08:00
parent 86f07817b1
commit aa86bbe372
13 changed files with 618 additions and 615 deletions
+15 -4
View File
@@ -30,9 +30,9 @@ def data():
@dept_api.resource('/add')
class AddDepartment(Resource):
@authorize("admin:dept:add", log=True)
def get(self):
return make_response(render_template('department/add.html'))
# @authorize("admin:dept:add", log=True)
# def get(self):
# return make_response(render_template('department/add.html'))
@authorize("admin:dept:add", log=True)
def post(self):
@@ -98,7 +98,18 @@ class DeptURD(Resource):
@authorize("admin:dept:edit", log=True)
def get(self, dept_id):
dept = Dept.query.filter_by(id=dept_id).first()
return make_response(render_template('department/edit.html', dept=dept))
dept_data = {
'id': dept.id,
'dept_name': dept.dept_name,
'leader': dept.leader,
'email': dept.email,
'phone': dept.phone,
'status': dept.status,
'sort': dept.sort,
'address': dept.address,
}
# return make_response(render_template('department/edit.html', dept=dept))
return jsonify(success=True, msg='ok', dept=dept_data)
@authorize("admin:dept:edit", log=True)
def put(self, dept_id):