diff --git a/applications/view/department.py b/applications/view/department.py index cdd6f14..ee7f756 100644 --- a/applications/view/department.py +++ b/applications/view/department.py @@ -8,13 +8,13 @@ from applications.view import index_bp @index_bp.get('/dept') @authorize("admin:dept:main", log=True) def dept_index(): - return render_template('department/main.html') + return render_template('admin/department/main.html') @index_bp.get('/dept/add') @authorize("admin:dept:add", log=True) def add(): - return render_template('department/add.html') + return render_template('admin/department/add.html') @index_bp.get('/dept/edit') @@ -22,4 +22,4 @@ def add(): def edit(): dept_id = request.args.get("deptId", type=int) dept = CompanyDepartment.query.get(dept_id) - return render_template('department/edit.html', dept=dept) + return render_template('admin/department/edit.html', dept=dept) diff --git a/applications/view/file.py b/applications/view/file.py index d58c146..6a9b1d4 100644 --- a/applications/view/file.py +++ b/applications/view/file.py @@ -8,4 +8,11 @@ from applications.common.utils.rights import authorize @index_bp.get('/file') @authorize("admin:file:main", log=True) def file_index(): - return render_template('file/photo.html') + return render_template('admin/file/photo.html') + + +# 图片管理 +@index_bp.get('/file/photo/add') +@authorize("admin:file:main", log=True) +def file_photo_add(): + return render_template('admin/file/photo_add.html') diff --git a/applications/view/logs_view.py b/applications/view/logs_view.py index aa33de6..dac7113 100644 --- a/applications/view/logs_view.py +++ b/applications/view/logs_view.py @@ -13,7 +13,7 @@ logs_bp = Blueprint('logs', __name__, url_prefix='/logs') @logs_bp.get('/') @authorize("admin:log:main") def index(): - return render_template('logs_temp/main.html') + return render_template('admin/logs_temp/main.html') @logs_bp.get('/login_log') @@ -40,4 +40,4 @@ def operate_log(): desc(AdminLog.create_at)).paginate( page=page, per_page=limit, error_out=False) data = marshal(log_paginate.items, log_fields) - return table_api(data=data, count=log_paginate.total) + return table_api(data=data, count=log_paginate.total, code=0) diff --git a/applications/view/rights.py b/applications/view/rights.py index 2007ad2..c7c2dab 100644 --- a/applications/view/rights.py +++ b/applications/view/rights.py @@ -8,16 +8,22 @@ from applications.view import index_bp @index_bp.get('/rights/') @authorize("admin:power:main", log=True) def rights_index(): - return render_template('rights/main.html') + return render_template('admin/rights/rights.html') @index_bp.get('/rights/power/') @authorize("admin:power:edit", log=True) -def get(power_id): +def rights_edit(power_id): power = RightsPower.query.filter_by(id=power_id).first() icon = str(power.icon).split() if len(icon) == 2: icon = icon[1] else: icon = None - return render_template('rights/edit.html', power=power, icon=icon) + return render_template('admin/rights/rights_edit.html', power=power, icon=icon) + + +@index_bp.get('/rights/add') +@authorize("admin:power:main", log=True) +def rights_add(): + return render_template('admin/rights/rights_add.html') diff --git a/applications/view/roles.py b/applications/view/roles.py index e04b193..d9949dd 100644 --- a/applications/view/roles.py +++ b/applications/view/roles.py @@ -11,14 +11,14 @@ role_bp = Blueprint('role', __name__, url_prefix='/admin/role') @role_bp.get('/') @authorize("admin:role:main", log=True) def main(): - return render_template('roles/main.html') + return render_template('admin/roles/roles.html') # 角色授权操作 @role_bp.get('/power/') @authorize("admin:role:power", log=True) def power(_id): - return render_template('roles/power.html', id=_id) + return render_template('admin/roles/roles_power.html', id=_id) # 角色编辑 @@ -26,4 +26,10 @@ def power(_id): @role_bp.get('/edit/') def role_editor(role_id): role = RightsRole.query.filter_by(id=role_id).first() - return render_template('roles/edit.html', role=role) + return render_template('admin/roles/roles_edit.html', role=role) + + +@authorize("admin:role:edit", log=True) +@role_bp.get('/add') +def role_add(): + return render_template('admin/roles/roles_add.html') diff --git a/applications/view/users.py b/applications/view/users.py index a5f87fd..7bb6e8d 100644 --- a/applications/view/users.py +++ b/applications/view/users.py @@ -4,7 +4,6 @@ from sqlalchemy import desc from applications.common.utils.rights import authorize from applications.models import AdminLog, RightsRole, CompanyUser - from . import index_bp @@ -12,7 +11,7 @@ from . import index_bp @index_bp.get('/users/') @authorize("admin:user:main", log=True) def users_main(): - return render_template('users/main.html') + return render_template('admin/users/users.html') @index_bp.get('/users/center') @@ -20,7 +19,7 @@ def users_main(): def users_center(): user_logs = AdminLog.query.filter_by(url='/passport/login').filter_by(uid=current_user.id).order_by( desc(AdminLog.create_at)).limit(10) - return render_template('users/profile.html', user_info=current_user, user_logs=user_logs) + return render_template('admin/users/profile.html', user_info=current_user, user_logs=user_logs) @index_bp.get('/users/') @@ -32,9 +31,15 @@ def users_user_id_view(user_id): checked_roles = [] for r in user.role: checked_roles.append(r.id) - return render_template('users/edit_users.html', user=user, roles=roles, checked_roles=checked_roles) + return render_template('admin/users/users_edit.html', user=user, roles=roles, checked_roles=checked_roles) @index_bp.get('/users/avatar') def users_avatar_view(): - return render_template('users/avatar.html') + return render_template('admin/users/profile_avatar.html') + + +@index_bp.get('/users/add') +def users_add_view(): + roles = RightsRole.query.all() + return render_template('admin/users/users_add.html', roles=roles) diff --git a/templates/common/footer.html b/templates/admin/common/footer.html similarity index 100% rename from templates/common/footer.html rename to templates/admin/common/footer.html diff --git a/templates/common/header.html b/templates/admin/common/header.html similarity index 100% rename from templates/common/header.html rename to templates/admin/common/header.html diff --git a/templates/department/add.html b/templates/admin/department/add.html similarity index 98% rename from templates/department/add.html rename to templates/admin/department/add.html index f5bd255..2bfd747 100644 --- a/templates/department/add.html +++ b/templates/admin/department/add.html @@ -2,7 +2,7 @@ 部门管理 - {% include 'common/header.html' %} + {% include 'admin/common/header.html' %}
@@ -79,7 +79,7 @@
-{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} \ No newline at end of file diff --git a/templates/admin/file/photo_add.html b/templates/admin/file/photo_add.html new file mode 100644 index 0000000..38940e9 --- /dev/null +++ b/templates/admin/file/photo_add.html @@ -0,0 +1,67 @@ + + + + {% include 'admin/common/header.html' %} + + + +
+
+
+
+
+ 新增图片 +
+
+
+ + + +
+
+
+
+
+
+{% include 'admin/common/footer.html' %} + + + \ No newline at end of file diff --git a/templates/logs_temp/main.html b/templates/admin/logs_temp/main.html similarity index 94% rename from templates/logs_temp/main.html rename to templates/admin/logs_temp/main.html index 1ffffeb..c1965e2 100644 --- a/templates/logs_temp/main.html +++ b/templates/admin/logs_temp/main.html @@ -2,7 +2,7 @@ 日志 - {% include 'common/header.html' %} + {% include 'admin/common/header.html' %} @@ -38,7 +38,7 @@ 失败 {{# } }}'|safe }} -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} - - - -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} diff --git a/templates/admin/rights/rights_add.html b/templates/admin/rights/rights_add.html new file mode 100644 index 0000000..a69015a --- /dev/null +++ b/templates/admin/rights/rights_add.html @@ -0,0 +1,171 @@ + + + + 权限 + {% include 'admin/common/header.html' %} + + +
+
+
+
+
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +{% include 'admin/common/footer.html' %} + + + + \ No newline at end of file diff --git a/templates/rights/edit.html b/templates/admin/rights/rights_edit.html similarity index 98% rename from templates/rights/edit.html rename to templates/admin/rights/rights_edit.html index 3fd51b2..cc1abe1 100644 --- a/templates/rights/edit.html +++ b/templates/admin/rights/rights_edit.html @@ -2,7 +2,7 @@ 权限编辑 - {% include 'common/header.html' %} + {% include 'admin/common/header.html' %}
    @@ -95,7 +95,7 @@
    -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} \ No newline at end of file diff --git a/templates/admin/roles/roles_add.html b/templates/admin/roles/roles_add.html new file mode 100644 index 0000000..04b1456 --- /dev/null +++ b/templates/admin/roles/roles_add.html @@ -0,0 +1,92 @@ + + + + 角色新增 + {% include 'admin/common/header.html' %} + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +{% include 'admin/common/footer.html' %} + + + \ No newline at end of file diff --git a/templates/roles/edit.html b/templates/admin/roles/roles_edit.html similarity index 97% rename from templates/roles/edit.html rename to templates/admin/roles/roles_edit.html index a6f2d0b..bf4ed45 100644 --- a/templates/roles/edit.html +++ b/templates/admin/roles/roles_edit.html @@ -2,7 +2,7 @@ 角色编辑 - {% include 'common/header.html' %} + {% include 'admin/common/header.html' %}
    @@ -70,7 +70,7 @@
    -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %} -{% include 'common/footer.html' %} - - +{% include 'admin/common/footer.html' %} + + + \ No newline at end of file diff --git a/templates/users/edit_users.html b/templates/admin/users/users_edit.html similarity index 97% rename from templates/users/edit_users.html rename to templates/admin/users/users_edit.html index 11bd920..6800855 100644 --- a/templates/users/edit_users.html +++ b/templates/admin/users/users_edit.html @@ -3,7 +3,7 @@ 用户编辑 - {% include 'common/header.html' %} + {% include 'admin/common/header.html' %}
    @@ -68,7 +68,7 @@
    -{% include 'common/footer.html' %} +{% include 'admin/common/footer.html' %}