diff --git a/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java b/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java new file mode 100644 index 00000000..f10da0f4 --- /dev/null +++ b/src/main/java/cn/stylefeng/guns/modular/dict/DictTypeViewController.java @@ -0,0 +1,71 @@ +package cn.stylefeng.guns.modular.dict; + + +import cn.stylefeng.roses.kernel.dict.modular.pojo.request.DictTypeRequest; +import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService; +import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource; +import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource; +import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; + +/** + * 字典类型视图控制器 + * + * @Author: huangyao + * @Date: 2021/1/6 20:53 + **/ +@Controller +@Slf4j +@ApiResource(name = "字典类型管理相关的界面渲染", path = "dictType") +public class DictTypeViewController { + + private String PREFIX = "/modular/system/dictType"; + + @Autowired + private DictTypeService dictTypeService; + + /** + * 字典类型管理-字典类型-视图 + * + * @param + * @return + * @author huangyao + * @date 2021/1/6 21:08 + */ + @GetResource(name = "字典类型管理-字典类型-视图", path = "", requiredPermission = false, requiredLogin = false) + public String indexView() { + return PREFIX + "/dictType.html"; + } + + /** + * 字典类型管理-添加-视图 + * + * @param + * @return + * @author huangyao + * @date 2021/1/6 21:25 + */ + @GetResource(name = "字典类型管理-添加-视图", path = "/addView", requiredPermission = false, requiredLogin = false) + public String addView() { + return PREFIX + "/dictType_add.html"; + } + + /** + * 字典类型管理-编辑-视图 + * + * @param + * @return + * @author huangyao + * @date 2021/1/6 21:26 + */ + @GetResource(name = "字典类型管理-编辑-视图", path = "/editView", requiredPermission = false, requiredLogin = false) + public String editView() { + return PREFIX + "/dictType_edit.html"; + } + +// public ResponseData list(DictTypeRequest dictTypeRequest) { +// return ResponseData.; +// } +} diff --git a/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java b/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java new file mode 100644 index 00000000..2b976a8d --- /dev/null +++ b/src/main/java/cn/stylefeng/guns/modular/dict/DictViewController.java @@ -0,0 +1,19 @@ +package cn.stylefeng.guns.modular.dict; + +import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; + +/** + * 字典视图控制器 + * + * @Author: huangyao + * @Date: 2021/1/6 20:52 + **/ +@Controller +@Slf4j +@ApiResource(name = "字典管理相关的界面渲染", path = "dictType") +public class DictViewController { + + private String PREFIX = "/modular/system/dict"; +} diff --git a/src/main/webapp/assets/modular/system/dictType/dictType.js b/src/main/webapp/assets/modular/system/dictType/dictType.js index b6473fb3..604cf45c 100644 --- a/src/main/webapp/assets/modular/system/dictType/dictType.js +++ b/src/main/webapp/assets/modular/system/dictType/dictType.js @@ -1,8 +1,8 @@ -layui.use(['table', 'ax', 'func'], function () { +layui.use(['table', 'func'], function () { var $ = layui.$; var table = layui.table; - var $ax = layui.ax; var func = layui.func; + var HttpRequest = layui.HttpRequest; /** * 字典类型表管理 @@ -74,7 +74,7 @@ layui.use(['table', 'ax', 'func'], function () { func.open({ height: 630, title: '添加字典类型', - content: Feng.ctxPath + '/dictType/add', + content: Feng.ctxPath + '/dictType/addView', tableId: DictType.tableId }); }; @@ -88,7 +88,7 @@ layui.use(['table', 'ax', 'func'], function () { func.open({ height: 630, title: '修改字典类型', - content: Feng.ctxPath + '/dictType/edit?dictTypeId=' + data.dictTypeId, + content: Feng.ctxPath + '/dictType/editView?dictTypeId=' + data.dictTypeId, tableId: DictType.tableId }); }; @@ -106,14 +106,14 @@ layui.use(['table', 'ax', 'func'], function () { } var operation = function () { - var ajax = new $ax(Feng.ctxPath + "/dictType/delete", function (data) { - Feng.success("删除成功!"); - table.reload(DictType.tableId); - }, function (data) { - Feng.error("删除失败!" + data.responseJSON.message + "!"); - }); - ajax.set("dictTypeId", data.dictTypeId); - ajax.start(); + // var ajax = new $ax(Feng.ctxPath + "/dictType/delete", function (data) { + // Feng.success("删除成功!"); + // table.reload(DictType.tableId); + // }, function (data) { + // Feng.error("删除失败!" + data.responseJSON.message + "!"); + // }); + // ajax.set("dictTypeId", data.dictTypeId); + // ajax.start(); }; Feng.confirm("是否删除?", operation); @@ -122,7 +122,7 @@ layui.use(['table', 'ax', 'func'], function () { // 渲染表格 var tableResult = table.render({ elem: '#' + DictType.tableId, - url: Feng.ctxPath + '/dictType/list', + url: Feng.ctxPath + '/dictType/getDictTypePageList', page: true, height: "full-98", cellMinWidth: 100, diff --git a/src/main/webapp/assets/modular/system/dictType/dictType_add.js b/src/main/webapp/assets/modular/system/dictType/dictType_add.js index 1e46e9f5..28cd7c46 100644 --- a/src/main/webapp/assets/modular/system/dictType/dictType_add.js +++ b/src/main/webapp/assets/modular/system/dictType/dictType_add.js @@ -15,30 +15,25 @@ var DictTypeInfoDlg = { } }; -layui.use(['form', 'ax', 'admin'], function () { +layui.use(['form', 'admin', 'HttpRequest'], function () { var $ = layui.jquery; - var $ax = layui.ax; var form = layui.form; var admin = layui.admin; + var HttpRequest = layui.HttpRequest; //表单提交事件 form.on('submit(btnSubmit)', function (data) { - var ajax = new $ax(Feng.ctxPath + "/dictType/addItem", function (data) { - Feng.success("添加成功!"); - - //传给上个页面,刷新table用 - admin.putTempData('formOk', true); - - //关掉对话框 + var request = new HttpRequest(Feng.ctxPath + "/dictType/addDictType", 'post', function (data) { admin.closeThisDialog(); - + Feng.success("添加成功!"); + admin.putTempData('formOk', true); }, function (data) { - Feng.error("添加失败!" + data.responseJSON.message) + admin.closeThisDialog(); + Feng.error("添加失败!" + data.message); }); - ajax.set(data.field); - ajax.start(); - return false; + request.set(data.field); + request.start(true); }); }); \ No newline at end of file diff --git a/src/main/webapp/pages/modular/system/dictType/dictType.html b/src/main/webapp/pages/modular/system/dictType/dictType.html index 6044264e..62077e24 100644 --- a/src/main/webapp/pages/modular/system/dictType/dictType.html +++ b/src/main/webapp/pages/modular/system/dictType/dictType.html @@ -30,9 +30,7 @@