调整了表单生成器,增加了默认表单加入菜单功能
This commit is contained in:
parent
40c11f84f4
commit
cfcf647d47
@ -151,6 +151,17 @@ public class FormController extends DefaultBaseController {
|
|||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "更新到菜单", notes = "更新到菜单接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "formId", value = "表单ID", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "menuParentId", value = "上级菜单ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@PutMapping("update-to-menu/form-id/{formId}/menu-parent-id/{menuParentId}")
|
||||||
|
public SuccessResult updateToMenu(@PathVariable("formId") String formId, @PathVariable("menuParentId") String menuParentId) {
|
||||||
|
formService.updateToMenu(formId, menuParentId);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "表单列表", notes = "表单列表接口")
|
@ApiOperation(value = "表单列表", notes = "表单列表接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
|
@ -71,6 +71,23 @@ public class FormReportRouteController {
|
|||||||
@GetMapping("list/code/{formCode}/version/{formVersion}")
|
@GetMapping("list/code/{formCode}/version/{formVersion}")
|
||||||
public ModelAndView list(@PathVariable("formCode") String formCode,
|
public ModelAndView list(@PathVariable("formCode") String formCode,
|
||||||
@PathVariable("formVersion") Integer formVersion) {
|
@PathVariable("formVersion") Integer formVersion) {
|
||||||
|
ModelAndView mv = new ModelAndView("form-report/list");
|
||||||
|
mv.addObject("isFromMenu", false);
|
||||||
|
setObject(formCode, formVersion, mv);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("list/code/{formCode}/version/{formVersion}/{isFromMenu}")
|
||||||
|
public ModelAndView list(@PathVariable("formCode") String formCode,
|
||||||
|
@PathVariable("formVersion") Integer formVersion,
|
||||||
|
@PathVariable("isFromMenu") Boolean isFromMenu) {
|
||||||
|
ModelAndView mv = new ModelAndView("form-report/list");
|
||||||
|
mv.addObject("isFromMenu", isFromMenu);
|
||||||
|
setObject(formCode, formVersion, mv);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setObject(String formCode, Integer formVersion, ModelAndView mv) {
|
||||||
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
||||||
if (formPO == null) {
|
if (formPO == null) {
|
||||||
throw new SearchException("表单不存在");
|
throw new SearchException("表单不存在");
|
||||||
@ -84,12 +101,11 @@ public class FormReportRouteController {
|
|||||||
return showField;
|
return showField;
|
||||||
}
|
}
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
ModelAndView mv = new ModelAndView("form-report/list");
|
|
||||||
mv.addObject("formCode", formCode);
|
mv.addObject("formCode", formCode);
|
||||||
mv.addObject("formVersion", formVersion);
|
mv.addObject("formVersion", formVersion);
|
||||||
mv.addObject("formType", formPO.getFormType());
|
mv.addObject("formType", formPO.getFormType());
|
||||||
mv.addObject("showFields", showFields);
|
mv.addObject("showFields", showFields);
|
||||||
return mv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,14 @@ public interface IFormService {
|
|||||||
*/
|
*/
|
||||||
void updateAppShowPageCode(String formId, String appShowPageCode);
|
void updateAppShowPageCode(String formId, String appShowPageCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存到菜单
|
||||||
|
*
|
||||||
|
* @param formId
|
||||||
|
* @param menuParentId
|
||||||
|
*/
|
||||||
|
void updateToMenu(String formId, String menuParentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*
|
*
|
||||||
@ -284,4 +292,5 @@ public interface IFormService {
|
|||||||
*/
|
*/
|
||||||
SuccessResultList<List<FormDTO>> listPage(ListPage page);
|
SuccessResultList<List<FormDTO>> listPage(ListPage page);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.exceptions.ParamsException;
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.exceptions.RemoveException;
|
import ink.wgink.exceptions.RemoveException;
|
||||||
|
import ink.wgink.exceptions.SearchException;
|
||||||
|
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||||
import ink.wgink.module.form.dao.design.IFormDao;
|
import ink.wgink.module.form.dao.design.IFormDao;
|
||||||
import ink.wgink.module.form.pojo.dtos.design.FormDTO;
|
import ink.wgink.module.form.pojo.dtos.design.FormDTO;
|
||||||
import ink.wgink.module.form.pojo.pos.design.FormPO;
|
import ink.wgink.module.form.pojo.pos.design.FormPO;
|
||||||
@ -31,6 +33,8 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
|||||||
private IFormReportService formReportService;
|
private IFormReportService formReportService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IFormFieldService formFieldService;
|
private IFormFieldService formFieldService;
|
||||||
|
@Autowired
|
||||||
|
private IMenuBaseService menuBaseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createDynamicForm(String createTableSQL) {
|
public void createDynamicForm(String createTableSQL) {
|
||||||
@ -213,6 +217,16 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
|||||||
formDao.update(params);
|
formDao.update(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateToMenu(String formId, String menuParentId) {
|
||||||
|
FormPO formPO = getPO(formId);
|
||||||
|
if (formPO == null) {
|
||||||
|
throw new SearchException("表单不存在");
|
||||||
|
}
|
||||||
|
String menuUrl = String.format("/route/form-report/list/code/%s/version/%d/true", formPO.getFormCode(), formPO.getFormVersion());
|
||||||
|
menuBaseService.saveAndReturnIdByParentIdAndNameAndUrl(menuParentId, formPO.getFormName(), menuUrl);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FormDTO get(Map<String, Object> params) {
|
public FormDTO get(Map<String, Object> params) {
|
||||||
params = params == null ? getHashMap(0) : params;
|
params = params == null ? getHashMap(0) : params;
|
||||||
|
@ -266,7 +266,7 @@ layui.config({
|
|||||||
*/
|
*/
|
||||||
Class.prototype.config = {
|
Class.prototype.config = {
|
||||||
version: "1.0",
|
version: "1.0",
|
||||||
formName: "表单设计器",
|
formName: "",
|
||||||
Author: "WenG",
|
Author: "WenG",
|
||||||
formId: "id",
|
formId: "id",
|
||||||
mainTitleTpl: '',
|
mainTitleTpl: '',
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-anim layui-anim-fadein">
|
<div th:class="${isFromMenu ? 'layui-fluid layui-anim layui-anim-fadein' : 'layui-anim layui-anim-fadein'}">
|
||||||
<div class="layui-row">
|
<div class="layui-row">
|
||||||
<div class="layui-col-md12">
|
<div class="layui-col-md12">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
@ -60,6 +60,7 @@
|
|||||||
var formVersion = [[${formVersion}]];
|
var formVersion = [[${formVersion}]];
|
||||||
var formType = [[${formType}]];
|
var formType = [[${formType}]];
|
||||||
var showFields = [[${showFields}]];
|
var showFields = [[${showFields}]];
|
||||||
|
var isFromMenu = [[${isFromMenu}]]
|
||||||
|
|
||||||
// 初始化表格
|
// 初始化表格
|
||||||
function initTable() {
|
function initTable() {
|
||||||
@ -236,7 +237,7 @@
|
|||||||
id: 'dataTable',
|
id: 'dataTable',
|
||||||
url: top.restAjax.path('api/form-report/listpage-all-fields/code/{formCode}/version/{formVersion}', [formCode, formVersion]),
|
url: top.restAjax.path('api/form-report/listpage-all-fields/code/{formCode}/version/{formVersion}', [formCode, formVersion]),
|
||||||
width: admin.screen() > 1 ? '100%' : '',
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
height: $win.height() - 22,
|
height: $win.height() - (isFromMenu ? 50 : 22),
|
||||||
limit: 20,
|
limit: 20,
|
||||||
limits: [20, 40, 60, 80, 100, 200],
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
toolbar: '#headerToolBar',
|
toolbar: '#headerToolBar',
|
||||||
@ -308,7 +309,7 @@
|
|||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '新增',
|
title: '新增',
|
||||||
url: top.restAjax.path('route/form-report/save/code/{formCode}/version/{formVersion}', [formCode, formVersion]),
|
url: top.restAjax.path('route/form-report/save/code/{formCode}/version/{formVersion}', [formCode, formVersion]),
|
||||||
width: '500px',
|
width: isFromMenu ? '75%' : '60%',
|
||||||
height: '85%',
|
height: '85%',
|
||||||
onClose: function () {
|
onClose: function () {
|
||||||
reloadTable();
|
reloadTable();
|
||||||
@ -323,7 +324,7 @@
|
|||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '编辑',
|
title: '编辑',
|
||||||
url: top.restAjax.path('route/form-report/update/code/{formCode}/version/{formVersion}?uid={uid}', [formCode, formVersion, checkDatas[0].uid]),
|
url: top.restAjax.path('route/form-report/update/code/{formCode}/version/{formVersion}?uid={uid}', [formCode, formVersion, checkDatas[0].uid]),
|
||||||
width: '500px',
|
width: isFromMenu ? '75%' : '60%',
|
||||||
height: '85%',
|
height: '85%',
|
||||||
onClose: function () {
|
onClose: function () {
|
||||||
reloadTable();
|
reloadTable();
|
||||||
|
@ -140,13 +140,16 @@
|
|||||||
return '<button class="layui-btn layui-btn-xs" lay-event="showDataEvent">查看数据</button>';
|
return '<button class="layui-btn layui-btn-xs" lay-event="showDataEvent">查看数据</button>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{field:'opition', width:150, title: '操作', fixed:'right', align:'center',
|
{field:'opition', width:220, title: '操作', fixed:'right', align:'center',
|
||||||
templet: function(item) {
|
templet: function(item) {
|
||||||
return '<div class="layui-btn-group">' +
|
var btnGroup = '<div class="layui-btn-group">';
|
||||||
'<button type="button" class="layui-btn layui-btn-xs" lay-event="reportListEvent">数据列表</button>'+
|
btnGroup += '<button type="button" class="layui-btn layui-btn-xs" lay-event="dataListEvent">数据列表</button>';
|
||||||
// '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="formFieldEvent">字段列表</button>'+
|
btnGroup += '<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="deleteEvent" title="该操作将连同物理表(无数据)一并删除">物理删除</button>';
|
||||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="deleteEvent" title="该操作将连同物理表(无数据)一并删除">物理删除</button>'+
|
if(item.formType === 'default') {
|
||||||
'</div>';
|
btnGroup += '<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" lay-event="joinMenuEvent" title="将该表单加入菜单">加入菜单</button>';
|
||||||
|
}
|
||||||
|
btnGroup += '</div>';
|
||||||
|
return btnGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -327,9 +330,9 @@
|
|||||||
onClose: function () {
|
onClose: function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if(event === 'reportListEvent') {
|
} else if(event === 'dataListEvent') {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '上报列表',
|
title: '数据列表',
|
||||||
url: top.restAjax.path('route/form-report/list/code/{formCode}/version/{formVersion}', [data.formCode, data.formVersion]),
|
url: top.restAjax.path('route/form-report/list/code/{formCode}/version/{formVersion}', [data.formCode, data.formVersion]),
|
||||||
width: '70%',
|
width: '70%',
|
||||||
height: '80%',
|
height: '80%',
|
||||||
@ -353,6 +356,33 @@
|
|||||||
top.dialog.close(layIndex);
|
top.dialog.close(layIndex);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if(event === 'joinMenuEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '选择要添加的根节点',
|
||||||
|
width: '300px',
|
||||||
|
height: '400px',
|
||||||
|
url: top.restAjax.path('route/menu/list-tree-select', []),
|
||||||
|
onClose: function() {
|
||||||
|
var selectedNodes = top.dialog.dialogData.selectedNodes;
|
||||||
|
if(!selectedNodes || selectedNodes.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var menuParentId = selectedNodes[0].id;
|
||||||
|
top.dialog.confirm('确定添加到该节点吗?', function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var layIndex;
|
||||||
|
top.restAjax.put(top.restAjax.path('api/form/update-to-menu/form-id/{formId}/menu-parent-id/{parentMenuId}', [data.formId, menuParentId]), {}, null, function (code, data) {
|
||||||
|
top.dialog.msg('添加成功,刷新菜单查看');
|
||||||
|
}, function (code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function () {
|
||||||
|
layIndex = top.dialog.msg('正在添加...', {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function () {
|
||||||
|
top.dialog.close(layIndex);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user