处理菜单依赖问题
This commit is contained in:
parent
33e903002b
commit
ccecc9d099
@ -1,7 +1,9 @@
|
||||
package ink.wgink.module.form.controller.route.design;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -18,9 +20,13 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/form")
|
||||
public class FormRouteController {
|
||||
|
||||
@Autowired(required = false)
|
||||
private IMenuBaseService menuBaseService;
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
ModelAndView mv = new ModelAndView("form/list");
|
||||
mv.addObject("hasMenuService", menuBaseService != null ? true : false);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ink.wgink.module.form.service.design.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.DependencyException;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
@ -33,7 +34,7 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
||||
private IFormReportService formReportService;
|
||||
@Autowired
|
||||
private IFormFieldService formFieldService;
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
private IMenuBaseService menuBaseService;
|
||||
|
||||
@Override
|
||||
@ -228,6 +229,9 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
||||
|
||||
@Override
|
||||
public void updateToMenu(String formId, String menuParentId) {
|
||||
if (menuBaseService == null) {
|
||||
throw new DependencyException("菜单业务未依赖");
|
||||
}
|
||||
FormPO formPO = getPO(formId);
|
||||
if (formPO == null) {
|
||||
throw new SearchException("表单不存在");
|
||||
|
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript" th:inline="javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
@ -57,6 +57,7 @@
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var hasMenuService = [[${hasMenuService}]];
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
@ -151,12 +152,12 @@
|
||||
return '<button class="layui-btn layui-btn-xs" lay-event="showDataEvent">查看数据</button>';
|
||||
}
|
||||
},
|
||||
{field:'opition', width:220, title: '操作', fixed:'right', align:'center',
|
||||
{field:'opition', width: hasMenuService ? 220 : 150, title: '操作', fixed:'right', align:'center',
|
||||
templet: function(item) {
|
||||
var btnGroup = '<div class="layui-btn-group">';
|
||||
btnGroup += '<button type="button" class="layui-btn layui-btn-xs" lay-event="dataListEvent">数据列表</button>';
|
||||
btnGroup += '<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="deleteEvent" title="该操作将连同物理表(无数据)一并删除">物理删除</button>';
|
||||
if(item.formType === 'default') {
|
||||
if(hasMenuService && item.formType === 'default') {
|
||||
btnGroup += '<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" lay-event="joinMenuEvent" title="将该表单加入菜单">加入菜单</button>';
|
||||
}
|
||||
btnGroup += '</div>';
|
||||
|
Loading…
Reference in New Issue
Block a user