diff --git a/templates/admin/base.html b/templates/admin/base.html new file mode 100644 index 0000000..310472c --- /dev/null +++ b/templates/admin/base.html @@ -0,0 +1,35 @@ + + + + + {#页面标题#} + {% block title %} + Pear Admin Flask + {% endblock %} + + + + + {# 头部导入的 Script,主要为样式 #} + {% block header_script %} + + {% endblock %} + +{#pear 后台边框#} + + +{#页面的主题内容,用于页面进行改写#} +{% block body %} + +{% endblock %} + +{# 当前页面需要依赖的 JavaScript #} +{% block footer_script %} + + +{% endblock %} +{# 当前页面自己编写的 JavaScript #} +{% block models_script %} +{% endblock %} + + \ No newline at end of file diff --git a/templates/admin/common/footer.html b/templates/admin/common/footer.html deleted file mode 100644 index 95923d4..0000000 --- a/templates/admin/common/footer.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/templates/admin/common/header.html b/templates/admin/common/header.html deleted file mode 100644 index b717e72..0000000 --- a/templates/admin/common/header.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/templates/admin/department/dept.html b/templates/admin/department/dept.html index d889c3d..6bba93a 100644 --- a/templates/admin/department/dept.html +++ b/templates/admin/department/dept.html @@ -1,256 +1,252 @@ - - - +{% extends 'admin/base.html' %} +{% block title %} 部门新增 - {% include 'admin/common/header.html' %} - -{#pear 后台边框#} - -{#搜索框布局#} -
-
-
-
- -
- {#部门信息搜索字段#} - +{% endblock %} + + +{% block body %} + {#搜索框布局#} +
+
+ +
+ +
+ {#部门信息搜索字段#} + +
+ {#查询按钮--需要触发layui事件#} + + {#重置按钮#} +
- {#查询按钮--需要触发layui事件#} - - {#重置按钮#} - -
- + +
-
-
-
- {#表格字段渲染#} -
+
+
+ {#表格字段渲染#} +
+
-
+{% endblock %} -{#表格工具栏,需要在表格中绑定,且需要自定义事件#} - + {#操作字段,需要在表格中使用#} + -{#操作字段,需要在表格中使用#} - -{#表格内的切换按钮#} - + + {#表格内的切换按钮#} + + - - \ No newline at end of file + render() + + /*表格的操作栏*/ + table.on('tool(tables)', function (obj) { + if (obj.event === 'tool_remove') { + /*移出事件*/ + window.tool_remove(obj) + } else if (obj.event === 'tool_edit') { + /*编辑事件*/ + window.tool_edit(obj) + } + }) + + /*表格的工具栏*/ + table.on('toolbar(tables)', function (obj) { + {#console.log(obj)#} + if (obj.event === 'toolbar-add') { + window.toolbar_add() + } else if (obj.event === 'refresh') { + window.refresh() + } else if (obj.event === 'toolbar-remove') { + {#window.toolbar_remove(obj)#} + layer.msg('禁止批量删除') + return false + {#console.log(table.checkStatus(obj.config.id).data)#} + } + }) + + /*切换选择状态*/ + form.on('switch(dept_enable)', function (obj) { + let operate + if (obj.elem.checked) { + operate = 1 + } else { + operate = 0 + } + let loading = layer.load() + $.ajax({ + url: DEPARTMENT_API.DEPARTMENT_STATUS(this.value), + data: JSON.stringify({ deptId: this.value, operate: operate }), + dataType: 'json', + contentType: 'application/json', + type: 'put', + success: function (result) { + layer.close(loading) + if (result.success) { + popup.success(result.message) + } else { + popup.failure(result.message) + } + }, + }) + }) + + window.toolbar_add = function () { + layer.open({ + type: 2, + title: '新增', + shade: 0.1, + area: ['450px', '500px'], /*新增窗口的大小*/ + content: '/dept/add', /*新增窗口从那里来*/ + }) + } + + window.tool_edit = function (obj) { + layer.open({ + type: 2, + title: '修改', + shade: 0.1, + area: ['450px', '500px'], + content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId'], /*编辑修改窗口从那里来*/ + }) + + } + + window.tool_remove = function (obj) { + layer.confirm('确定要删除该部门', { icon: 3, title: '提示' }, function (index) { + layer.close(index) + let loading = layer.load() + $.ajax({ + url: DEPARTMENT_API.DEPARTMENT(obj.data['deptId']), + dataType: 'json', + type: 'delete', + success: function (result) { + layer.close(loading) + if (result.success) { + popup.success(result.message, function () { + obj.del() + }) + } else { + popup.failure(result.message) + } + }, + }) + }) + } + + }) + +{% endblock %} diff --git a/templates/admin/department/dept_add.html b/templates/admin/department/dept_add.html index 7feaf6d..bc49a9e 100644 --- a/templates/admin/department/dept_add.html +++ b/templates/admin/department/dept_add.html @@ -1,128 +1,129 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 部门管理 - {% include 'admin/common/header.html' %} - - -
-
-
-
- -
-
    +{% endblock %} + + +{% block body %} + +
    +
    +
    + +
    +
      +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      - - +
      + +
      + + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      -
      - - +
      +
      + + +
      -
      - + +{% endblock %} +{% block models_script %} + - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/department/dept_edit.html b/templates/admin/department/dept_edit.html index b921f88..6e97e2b 100644 --- a/templates/admin/department/dept_edit.html +++ b/templates/admin/department/dept_edit.html @@ -1,129 +1,129 @@ - - - - 部门修改 - {% include 'admin/common/header.html' %} - - -
      -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - +{% extends 'admin/base.html' %} - +{% block title %} + 部门修改 +{% endblock %} + + +{% block body %} + +
      +
      +
      + +
      + +
      -
      -
      - -
      - +
      + +
      + +
      -
      -
      - -
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      -
      -
      -
      - - +
      +
      + + +
      -
      - + +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + +{% endblock %} diff --git a/templates/admin/file/photo.html b/templates/admin/file/photo.html index 84ae0b3..d388af5 100644 --- a/templates/admin/file/photo.html +++ b/templates/admin/file/photo.html @@ -1,270 +1,268 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 图片上传 - {% include 'admin/common/header.html' %} - - -
      -
      -
      +{% endblock %} + +{% block body %} +
      +
      +
      +
      -
      +{% endblock %} +{% block models_script %} + + -{% include 'admin/common/footer.html' %} + - + layui.use(['table', 'form', 'jquery', 'element', 'form', 'upload'], function () { + let table = layui.table + let form = layui.form + let $ = layui.jquery + let upload = layui.upload - - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/file/photo_add.html b/templates/admin/file/photo_add.html index aff3ecf..75c7ea6 100644 --- a/templates/admin/file/photo_add.html +++ b/templates/admin/file/photo_add.html @@ -1,66 +1,61 @@ - - - - {% include 'admin/common/header.html' %} - - - -
      -
      -
      -
      -
      - 新增图片 -
      -
      -
      - - - -
      -
      +{% extends 'admin/base.html' %} + +{% block title %} + 新增图片 +{% endblock %} + +{% block body %} +
      +
      +
      +
      +
      + 新增图片 +
      +
      +
      + + + +
      +
      +
      -
      +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + layui.use(['jquery', 'element', 'form', 'upload'], function () { + var $ = layui.jquery + var element = layui.element + var form = layui.form + var upload = layui.upload + //选完文件后不自动上传 + upload.render({ + elem: '#select-img' + , url: FILE_API.PHOTOS() + , auto: false + , exts: 'jpg|png|gif|bmp|jpeg' + , size: 1000 + , bindAction: '#logo-upload-button' + , done: function (res) { + if (res.success) { + layer.msg(res.message, { icon: 1, time: 500 }, function () { + parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页 + window.parent.location.reload() + }) + } else { + layer.msg(res.message, { icon: 2 }) + } + }, + }) + }) + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/logs_temp/main.html b/templates/admin/logs_temp/main.html index e1af787..61c6a7c 100644 --- a/templates/admin/logs_temp/main.html +++ b/templates/admin/logs_temp/main.html @@ -1,87 +1,86 @@ - - - - 日志 - {% include 'admin/common/header.html' %} - - - +{% extends 'admin/base.html' %} -
      -
      -
      -
        -
      • 登录日志
      • -
      • 访问日志
      • -
      -
      -
      -
      -
      -
      -
      +{% block title %} + 日志 + +{% endblock %} + + +{% block body %} +
      +
      +
      +
        +
      • 登录日志
      • +
      • 访问日志
      • +
      +
      +
      +
      +
      +
      +
      +
      -
      - +{% endblock %} -{% include 'admin/common/footer.html' %} - - - + + - - \ No newline at end of file + table.render({ + parseData, + elem: '#log-login-table', + url: MODULE_PATH + 'login_log', + page: true, + cols: get_columns(), + skin: 'line', + toolbar: false, + }) + }) + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/rights/rights.html b/templates/admin/rights/rights.html index d8a8a35..785bc69 100644 --- a/templates/admin/rights/rights.html +++ b/templates/admin/rights/rights.html @@ -1,286 +1,285 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 权限 - {% include 'admin/common/header.html' %} - - -
      -
      -
      -
      - -
      - +{% endblock %} + + +{% block body %} +
      +
      + +
      + +
      + +
      + +
      - - -
      - + +
      -
      -
      -
      -
      +
      +
      +
      +
      -
      +{% endblock %} +{% block models_script %} + + -{% include 'admin/common/footer.html' %} + - + layui.use(['table', 'form', 'jquery', 'treetable', 'popup', 'dtree', 'iconPicker'], function () { + let table = layui.table + let form = layui.form + let $ = layui.jquery + let treetable = layui.treetable + let popup = layui.popup + let iconPicker = layui.iconPicker + let dtree = layui.dtree - - - \ No newline at end of file + +{% endblock %} diff --git a/templates/admin/rights/rights_add.html b/templates/admin/rights/rights_add.html index a0674ce..6065695 100644 --- a/templates/admin/rights/rights_add.html +++ b/templates/admin/rights/rights_add.html @@ -1,172 +1,171 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 权限 - {% include 'admin/common/header.html' %} - - -
      -
      -
      +{% endblock %} + +{% block body %} + +
      -
      - -
      -
        +
        +
        + +
        +
          +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          - -
          - - - +
          + +
          + + + +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          - -
          - +
          + +
          + +
          -
          -
          -
          - - +
          +
          + + +
          -
          - + +{% endblock %} +{% block models_script %} + - - \ No newline at end of file + form.on('submit(power-save)', function (data) { + data.field.icon = 'layui-icon ' + data.field.icon + $.ajax({ + url: RIGHTS_API.POWER(0), + data: JSON.stringify(data.field), + dataType: 'json', + contentType: 'application/json', + type: 'post', + success: function (result) { + if (result.success) { + layer.msg(result.message, { icon: 1, time: 1000 }, function () { + parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页 + parent.render() + }) + } else { + layer.msg(result.message, { icon: 2, time: 1000 }) + } + }, + }) + return false + }) + + iconPicker.render({ + // 选择器,推荐使用input + elem: '#icon', + // 数据类型:fontClass/unicode,推荐使用fontClass + type: 'fontClass', + // 是否开启搜索:true/false + search: true, + // 是否开启分页 + page: true, + // 每页显示数量,默认12 + limit: 12, + // 点击回调 + click: function (data) { + console.log(data) + }, + }) + }) + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/rights/rights_edit.html b/templates/admin/rights/rights_edit.html index 95750b2..14029ec 100644 --- a/templates/admin/rights/rights_edit.html +++ b/templates/admin/rights/rights_edit.html @@ -1,206 +1,206 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 权限编辑 - {% include 'admin/common/header.html' %} - - -
          -
          -
          -
          - -
          - +{% endblock %} + +{% block body %} + +
          +
          +
          + +
          + +
          -
          -
          - -
          -
            +
            + +
            +
              +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - - - +
              + +
              + + + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              -
              - - +
              +
              + + +
              -
              - + +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/roles/roles.html b/templates/admin/roles/roles.html index 37e24b6..f35dbfa 100644 --- a/templates/admin/roles/roles.html +++ b/templates/admin/roles/roles.html @@ -1,255 +1,254 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 角色管理 - {% include 'admin/common/header.html' %} - -
              -
              -
              -
              - -
              - +{% endblock %} + +{% block body %} +
              +
              + +
              + +
              + +
              + +
              + +
              + +
              - -
              - -
              - - -
              - + +
              -
              -
              -
              -
              +
              +
              +
              +
              -
              +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + + + + - - + layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () { + let table = layui.table + let form = layui.form + let $ = layui.jquery + let popup = layui.popup - - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/roles/roles_add.html b/templates/admin/roles/roles_add.html index 43832ba..a422864 100644 --- a/templates/admin/roles/roles_add.html +++ b/templates/admin/roles/roles_add.html @@ -1,93 +1,93 @@ - - - +{% extends 'admin/base.html' %} +{% block title %} 角色新增 - {% include 'admin/common/header.html' %} - -
              -
              -
              -
              - -
              - +{% endblock %} + +{% block body %} + +
              +
              +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - - +
              + +
              + + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              -
              - - +
              +
              + + +
              -
              - + +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/roles/roles_edit.html b/templates/admin/roles/roles_edit.html index f5f333b..7369e7e 100644 --- a/templates/admin/roles/roles_edit.html +++ b/templates/admin/roles/roles_edit.html @@ -1,108 +1,107 @@ - - - +{% extends 'admin/base.html' %} +{% block title %} 角色编辑 - {% include 'admin/common/header.html' %} - -
              -
              -
              +{% endblock %} + +{% block body %} + +
              -
              - -
              - +
              +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              - - +
              + +
              + + +
              -
              -
              - -
              - +
              + +
              + +
              -
              -
              - -
              +
              + +
              +
              -
              -
              -
              - - +
              +
              + + +
              -
              - + +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/roles/roles_power.html b/templates/admin/roles/roles_power.html index 5aebcd0..5b73395 100644 --- a/templates/admin/roles/roles_power.html +++ b/templates/admin/roles/roles_power.html @@ -1,85 +1,85 @@ - - - +{% extends 'admin/base.html' %} +{% block title %} 角色授权 - {% include 'admin/common/header.html' %} - -
              -
              -
              +{% endblock %} + +{% block body %} + +
              -
                +
                +
                  +
                  -
                  -
                  -
                  - - +
                  +
                  + + +
                  -
                  - + +{% endblock %} -{% include 'admin/common/footer.html' %} +{% block models_script %} + - - \ No newline at end of file + $.ajax({ + url: ROLE_API.ROLE_POWER(data.field.roleId), + data: data.field, + dataType: 'json', + type: 'put', + success: function (result) { + if (result.success) { + layer.msg(result.message, { icon: 1, time: 1000 }, function () { + parent.layer.close(parent.layer.getFrameIndex(window.name)) + }) + } else { + layer.msg(result.message, { icon: 2, time: 1000 }) + } + }, + }) + return false + }) + + }) + +{% endblock %} \ No newline at end of file diff --git a/templates/admin/users/profile.html b/templates/admin/users/profile.html index 615d8e9..201581d 100644 --- a/templates/admin/users/profile.html +++ b/templates/admin/users/profile.html @@ -1,174 +1,180 @@ - - - +{% extends 'admin/base.html' %} + +{% block title %} 个人中心 - {% include 'admin/common/header.html' %} - - -
                  - {# 左侧栏 #} -
                  - {# 个人信息卡片 #} -
                  -
                  -
                  -