diff --git a/applications/api/department.py b/applications/api/department.py index 34119cb..faf1252 100644 --- a/applications/api/department.py +++ b/applications/api/department.py @@ -12,7 +12,7 @@ dept_api = Api(api_bp, prefix='/dept') @dept_api.resource('/departments') -class AddDepartment(Resource): +class Department(Resource): @authorize("admin:dept:main", log=True) def get(self): diff --git a/applications/configs/config.py b/applications/configs/config.py index 242017a..53b8b6f 100644 --- a/applications/configs/config.py +++ b/applications/configs/config.py @@ -31,7 +31,7 @@ class TestingConfig(BaseConfig): class DevelopmentConfig(BaseConfig): """ 开发配置 """ - SQLALCHEMY_DATABASE_URI = r'sqlite:///../sql_pear_admin.db' + SQLALCHEMY_DATABASE_URI = r'sqlite:///sql_pear_admin.db' SQLALCHEMY_TRACK_MODIFICATIONS = True SQLALCHEMY_ECHO = False diff --git a/applications/view/department.py b/applications/view/department.py index bb3b004..aa4b6ba 100644 --- a/applications/view/department.py +++ b/applications/view/department.py @@ -1,6 +1,7 @@ -from flask import render_template +from flask import render_template, request from applications.common.utils.rights import authorize +from applications.models import Dept from applications.view import index_bp @@ -8,3 +9,17 @@ from applications.view import index_bp @authorize("admin:dept:main", log=True) def dept_index(): return render_template('department/main.html') + + +@index_bp.get('/dept/add') +@authorize("admin:dept:add", log=True) +def add(): + return render_template('department/add.html') + + +@index_bp.get('/dept/edit') +@authorize("admin:dept:edit", log=True) +def edit(): + dept_id = request.args.get("deptId", type=int) + dept = Dept.query.get(dept_id) + return render_template('department/edit.html', dept=dept) diff --git a/templates/department/add.html b/templates/department/add.html new file mode 100644 index 0000000..f5bd255 --- /dev/null +++ b/templates/department/add.html @@ -0,0 +1,129 @@ + + + + 部门管理 + {% include 'common/header.html' %} + + +
+
+
+
+
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +{% include 'common/footer.html' %} + + + + \ No newline at end of file diff --git a/templates/department/edit.html b/templates/department/edit.html new file mode 100644 index 0000000..b30c257 --- /dev/null +++ b/templates/department/edit.html @@ -0,0 +1,128 @@ + + + + 部门修改 + {% include 'common/header.html' %} + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +{% include 'common/footer.html' %} + + + + \ No newline at end of file diff --git a/templates/department/main.html b/templates/department/main.html index 5af4e84..6895d48 100644 --- a/templates/department/main.html +++ b/templates/department/main.html @@ -17,7 +17,7 @@ {#查询按钮--需要触发layui事件#} - @@ -34,12 +34,12 @@
    {#表格字段渲染#} -
    +
    {#表格工具栏,需要在表格中绑定,且需要自定义事件#} - {#操作字段,需要在表格中使用#} - @@ -79,181 +79,18 @@ {% include 'common/footer.html' %} -{#添加数据表单#} - -{#编辑表单数据#} - \ No newline at end of file