From 733286b090fa00800736495f3da568f8873590ae Mon Sep 17 00:00:00 2001 From: zhengxinonly Date: Thu, 9 Sep 2021 02:49:55 +0800 Subject: [PATCH] =?UTF-8?q?wip(semantic):=E8=B0=83=E6=95=B4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/api/rights/department.py | 1 + applications/api/system/passport.py | 2 +- applications/view/department.py | 6 +- applications/view/logs_view.py | 4 +- applications/view/roles.py | 6 +- templates/admin/department/add.html | 129 ---------------- .../admin/department/{main.html => dept.html} | 8 +- templates/admin/department/dept_add.html | 128 ++++++++++++++++ templates/admin/department/dept_edit.html | 129 ++++++++++++++++ templates/admin/department/edit.html | 128 ---------------- templates/admin/file/photo.html | 24 +-- templates/admin/file/photo_add.html | 7 +- templates/admin/logs_temp/main.html | 34 +---- templates/admin/rights/rights.html | 78 +++++----- templates/admin/rights/rights_add.html | 17 ++- templates/admin/rights/rights_edit.html | 127 ++++++++-------- templates/admin/roles/roles.html | 132 +++++----------- templates/admin/roles/roles_add.html | 61 ++++---- templates/admin/roles/roles_edit.html | 15 +- templates/admin/roles/roles_power.html | 7 +- templates/admin/users/profile.html | 7 +- templates/admin/users/profile_avatar.html | 6 +- templates/admin/users/users.html | 141 +++++++++--------- templates/admin/users/users_add.html | 6 +- templates/admin/users/users_edit.html | 9 +- 25 files changed, 567 insertions(+), 645 deletions(-) delete mode 100644 templates/admin/department/add.html rename templates/admin/department/{main.html => dept.html} (99%) create mode 100644 templates/admin/department/dept_add.html create mode 100644 templates/admin/department/dept_edit.html delete mode 100644 templates/admin/department/edit.html diff --git a/applications/api/rights/department.py b/applications/api/rights/department.py index 2864dff..59793c7 100644 --- a/applications/api/rights/department.py +++ b/applications/api/rights/department.py @@ -19,6 +19,7 @@ class Departments(Resource): "status": {"code": 200, "message": "默认"}, "data": marshal(dept_data, dept_fields) } + print(dept_data) return jsonify(res) @authorize("admin:dept:add", log=True) diff --git a/applications/api/system/passport.py b/applications/api/system/passport.py index 438c1b0..05e14dd 100644 --- a/applications/api/system/passport.py +++ b/applications/api/system/passport.py @@ -3,7 +3,7 @@ from flask import session, redirect, url_for, request from flask_login import current_user, login_user from flask_restful import Resource, reqparse -from applications.common.admin_log import login_log +from applications.common.admin_log import login_log, admin_log from applications.common.gen_captcha import add_auth_session from applications.common.utils.http import fail_api, success_api from applications.models import CompanyUser diff --git a/applications/view/department.py b/applications/view/department.py index ee7f756..15ebe65 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('admin/department/main.html') + return render_template('admin/department/dept.html') @index_bp.get('/dept/add') @authorize("admin:dept:add", log=True) def add(): - return render_template('admin/department/add.html') + return render_template('admin/department/dept_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('admin/department/edit.html', dept=dept) + return render_template('admin/department/dept_edit.html', dept=dept) diff --git a/applications/view/logs_view.py b/applications/view/logs_view.py index dac7113..1022e84 100644 --- a/applications/view/logs_view.py +++ b/applications/view/logs_view.py @@ -22,7 +22,7 @@ def login_log(): page = request.args.get('page', type=int) limit = request.args.get('limit', type=int) log_paginate = AdminLog.query.filter_by( - url='/passport/login').order_by( + url='/api/v1/passport/login').order_by( desc(AdminLog.create_at)).paginate( page=page, per_page=limit, error_out=False) data = marshal(log_paginate.items, log_fields) @@ -36,7 +36,7 @@ def operate_log(): page = request.args.get('page', type=int) limit = request.args.get('limit', type=int) log_paginate = AdminLog.query.filter( - AdminLog.url != '/passport/login').order_by( + AdminLog.url != '/api/v1/passport/login').order_by( desc(AdminLog.create_at)).paginate( page=page, per_page=limit, error_out=False) data = marshal(log_paginate.items, log_fields) diff --git a/applications/view/roles.py b/applications/view/roles.py index d9949dd..29f2384 100644 --- a/applications/view/roles.py +++ b/applications/view/roles.py @@ -15,10 +15,10 @@ def main(): # 角色授权操作 -@role_bp.get('/power/') +@role_bp.get('/power/') @authorize("admin:role:power", log=True) -def power(_id): - return render_template('admin/roles/roles_power.html', id=_id) +def power(role_id): + return render_template('admin/roles/roles_power.html', role_id=role_id) # 角色编辑 diff --git a/templates/admin/department/add.html b/templates/admin/department/add.html deleted file mode 100644 index 2bfd747..0000000 --- a/templates/admin/department/add.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - 部门管理 - {% include 'admin/common/header.html' %} - - -
-
-
-
-
- -
-
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -{% include 'admin/common/footer.html' %} - - - - \ No newline at end of file diff --git a/templates/admin/department/main.html b/templates/admin/department/dept.html similarity index 99% rename from templates/admin/department/main.html rename to templates/admin/department/dept.html index a2afe92..eabb70b 100644 --- a/templates/admin/department/main.html +++ b/templates/admin/department/dept.html @@ -30,7 +30,6 @@ -
    {#表格字段渲染#} @@ -38,6 +37,7 @@
    + {#表格工具栏,需要在表格中绑定,且需要自定义事件#} - {#操作字段,需要在表格中使用#} - {#表格内的切换按钮#} - {% include 'admin/common/footer.html' %} @@ -214,7 +211,7 @@ title: '新增', shade: 0.1, area: ['450px', '500px'], /*新增窗口的大小*/ - content: MODULE_PATH + 'add' /*新增窗口从那里来*/ + content: '/dept/add' /*新增窗口从那里来*/ }) } @@ -254,4 +251,5 @@ }) + \ No newline at end of file diff --git a/templates/admin/department/dept_add.html b/templates/admin/department/dept_add.html new file mode 100644 index 0000000..c61eaec --- /dev/null +++ b/templates/admin/department/dept_add.html @@ -0,0 +1,128 @@ + + + + 部门管理 + {% include 'admin/common/header.html' %} + + +
    +
    +
    +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      +
      +
      + + +
      +
      +
      + + +{% include 'admin/common/footer.html' %} + + + + \ No newline at end of file diff --git a/templates/admin/department/dept_edit.html b/templates/admin/department/dept_edit.html new file mode 100644 index 0000000..13bdb1b --- /dev/null +++ b/templates/admin/department/dept_edit.html @@ -0,0 +1,129 @@ + + + + 部门修改 + {% include 'admin/common/header.html' %} + + +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      +
      +
      + + +
      +
      +
      + + +{% include 'admin/common/footer.html' %} + + + + \ No newline at end of file diff --git a/templates/admin/department/edit.html b/templates/admin/department/edit.html deleted file mode 100644 index f326dab..0000000 --- a/templates/admin/department/edit.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - 部门修改 - {% include 'admin/common/header.html' %} - - -
      -
      -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - - - - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      -
      -
      -
      -
      - - -
      -
      -
      -{% include 'admin/common/footer.html' %} - - - - \ No newline at end of file diff --git a/templates/admin/file/photo.html b/templates/admin/file/photo.html index d03798f..fe8ed3d 100644 --- a/templates/admin/file/photo.html +++ b/templates/admin/file/photo.html @@ -10,25 +10,26 @@
      - + + +{% include 'admin/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 index 38940e9..0060c6d 100644 --- a/templates/admin/file/photo_add.html +++ b/templates/admin/file/photo_add.html @@ -3,10 +3,6 @@ {% include 'admin/common/header.html' %}