表单列表查询最新内容,增加历史表单列表按钮
This commit is contained in:
parent
dcb8459a9b
commit
f458400c5a
@ -310,4 +310,38 @@ public class FormController extends DefaultBaseController {
|
|||||||
return formService.listPage(page);
|
return formService.listPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "最新表单分页列表", notes = "最新表单分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage-latest")
|
||||||
|
public SuccessResultList<List<FormDTO>> listPageLatest(ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return formService.listPageLatest(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "历史表单分页列表", notes = "历史表单分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "formId", value = "表单ID", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage-history/form-id/{formId}")
|
||||||
|
public SuccessResultList<List<FormDTO>> listPageHistoryByFormId(@PathVariable("formId") String formId,
|
||||||
|
ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return formService.listPageHistoryByFormId(formId, page);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,13 @@ public class FormRouteController {
|
|||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list-history")
|
||||||
|
public ModelAndView listHistory() {
|
||||||
|
ModelAndView mv = new ModelAndView("form/list-history");
|
||||||
|
mv.addObject("hasMenuService", menuBaseService != null ? true : false);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("list-select")
|
@GetMapping("list-select")
|
||||||
public ModelAndView listSelect() {
|
public ModelAndView listSelect() {
|
||||||
ModelAndView mv = new ModelAndView("form/list-select");
|
ModelAndView mv = new ModelAndView("form/list-select");
|
||||||
|
@ -41,7 +41,7 @@ public interface IFormDao extends IInitBaseTable {
|
|||||||
|
|
||||||
List<FormDTO> list(Map<String, Object> params) throws SearchException;
|
List<FormDTO> list(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
List<FormDTO> listPO(Map<String, Object> params) throws SearchException;
|
List<FormPO> listPO(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
String getSavePageCodeByCodeAndVersion(Map<String, Object> params) throws SearchException;
|
String getSavePageCodeByCodeAndVersion(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
@ -285,6 +285,14 @@ public interface IFormService {
|
|||||||
*/
|
*/
|
||||||
List<FormDTO> list(Map<String, Object> params);
|
List<FormDTO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本最新列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FormDTO> listLatest(Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*
|
*
|
||||||
@ -299,7 +307,15 @@ public interface IFormService {
|
|||||||
* @param params
|
* @param params
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<FormDTO> listPO(Map<String, Object> params);
|
List<FormPO> listPO(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本最新列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FormPO> listPOLatest(Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表
|
* 分页列表
|
||||||
@ -310,4 +326,20 @@ public interface IFormService {
|
|||||||
SuccessResultList<List<FormDTO>> listPage(ListPage page);
|
SuccessResultList<List<FormDTO>> listPage(ListPage page);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最新表单分页列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SuccessResultList<List<FormDTO>> listPageLatest(ListPage page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史表单分页列表
|
||||||
|
*
|
||||||
|
* @param formId
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SuccessResultList<List<FormDTO>> listPageHistoryByFormId(String formId, ListPage page);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import ink.wgink.exceptions.DependencyException;
|
|||||||
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.exceptions.SearchException;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
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;
|
||||||
@ -363,6 +364,13 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
|||||||
return formDao.list(params);
|
return formDao.list(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FormDTO> listLatest(Map<String, Object> params) {
|
||||||
|
params = params == null ? getHashMap(2) : params;
|
||||||
|
params.put("latestVersion", "true");
|
||||||
|
return list(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FormDTO> listByIds(List<String> formIds) {
|
public List<FormDTO> listByIds(List<String> formIds) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
@ -371,11 +379,18 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FormDTO> listPO(Map<String, Object> params) {
|
public List<FormPO> listPO(Map<String, Object> params) {
|
||||||
params = params == null ? getHashMap(2) : params;
|
params = params == null ? getHashMap(2) : params;
|
||||||
return formDao.listPO(params);
|
return formDao.listPO(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FormPO> listPOLatest(Map<String, Object> params) {
|
||||||
|
params = params == null ? getHashMap(2) : params;
|
||||||
|
params.put("latestVersion", ISystemConstant.IS_TRUE);
|
||||||
|
return listPO(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<FormDTO>> listPage(ListPage page) {
|
public SuccessResultList<List<FormDTO>> listPage(ListPage page) {
|
||||||
PageHelper.startPage(page.getPage(), page.getRows());
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
@ -384,4 +399,23 @@ public class FormServiceImpl extends DefaultBaseService implements IFormService
|
|||||||
return new SuccessResultList<>(dataDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
return new SuccessResultList<>(dataDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultList<List<FormDTO>> listPageLatest(ListPage page) {
|
||||||
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
|
List<FormDTO> dataDTOs = listLatest(page.getParams());
|
||||||
|
PageInfo<FormDTO> pageInfo = new PageInfo<>(dataDTOs);
|
||||||
|
return new SuccessResultList<>(dataDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultList<List<FormDTO>> listPageHistoryByFormId(String formId, ListPage page) {
|
||||||
|
FormPO latestFormPO = getPO(formId);
|
||||||
|
if (latestFormPO == null) {
|
||||||
|
throw new SearchException("表单不存在");
|
||||||
|
}
|
||||||
|
page.getParams().put("isHistory", ISystemConstant.IS_TRUE);
|
||||||
|
page.getParams().put("latestFormId", formId);
|
||||||
|
page.getParams().put("formCode", latestFormPO.getFormCode());
|
||||||
|
return listPage(page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,26 +328,51 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="list" parameterType="map" resultMap="formDTO">
|
<select id="list" parameterType="map" resultMap="formDTO">
|
||||||
SELECT
|
SELECT
|
||||||
form_id,
|
t1.form_id,
|
||||||
form_code,
|
t1.form_code,
|
||||||
form_name,
|
t1.form_name,
|
||||||
form_summary,
|
t1.form_summary,
|
||||||
form_type,
|
t1.form_type,
|
||||||
form_status,
|
t1.form_status,
|
||||||
form_table_name,
|
t1.form_table_name,
|
||||||
form_version,
|
t1.form_version,
|
||||||
main_title_tpl
|
t1.main_title_tpl
|
||||||
FROM
|
FROM
|
||||||
form_form
|
form_form t1
|
||||||
|
<if test="latestVersion != null and latestVersion == 'true'">
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT
|
||||||
|
form_code,
|
||||||
|
MAX(form_version) max_form_version
|
||||||
|
FROM
|
||||||
|
form_form
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
GROUP BY
|
||||||
|
form_code
|
||||||
|
) jt1
|
||||||
|
ON
|
||||||
|
t1.form_code = jt1.form_code
|
||||||
|
AND
|
||||||
|
t1.form_version = jt1.max_form_version
|
||||||
|
</if>
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
t1.is_delete = 0
|
||||||
|
<if test="formCode != null and formCode != ''">
|
||||||
|
AND
|
||||||
|
t1.form_code = #{formCode}
|
||||||
|
</if>
|
||||||
|
<if test="isHistory != null and isHistory == 'true'">
|
||||||
|
AND
|
||||||
|
t1.form_id != #{latestFormId}
|
||||||
|
</if>
|
||||||
<if test="keywords != null and keywords != ''">
|
<if test="keywords != null and keywords != ''">
|
||||||
AND
|
AND
|
||||||
form_name LIKE CONCAT('%', #{keywords}, '%')
|
t1.form_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="formIds != null and formIds.size > 0">
|
<if test="formIds != null and formIds.size > 0">
|
||||||
AND
|
AND
|
||||||
form_id IN
|
t1.form_id IN
|
||||||
<foreach collection="formIds" index="index" open="(" separator="," close=")">
|
<foreach collection="formIds" index="index" open="(" separator="," close=")">
|
||||||
#{formIds[${index}]}
|
#{formIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -357,19 +382,36 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="listPO" parameterType="map" resultMap="formPO">
|
<select id="listPO" parameterType="map" resultMap="formPO">
|
||||||
SELECT
|
SELECT
|
||||||
form_id,
|
t1.form_id,
|
||||||
form_code,
|
t1.form_code,
|
||||||
form_name,
|
t1.form_name,
|
||||||
form_summary,
|
t1.form_summary,
|
||||||
form_type,
|
t1.form_type,
|
||||||
form_status,
|
t1.form_status,
|
||||||
form_table_name,
|
t1.form_table_name,
|
||||||
form_version,
|
t1.form_version,
|
||||||
main_title_tpl
|
t1.main_title_tpl
|
||||||
FROM
|
FROM
|
||||||
form_form
|
form_form t1
|
||||||
|
<if test="latestVersion != null and latestVersion == 'true'">
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT
|
||||||
|
form_code,
|
||||||
|
MAX(form_version) max_form_version
|
||||||
|
FROM
|
||||||
|
form_form
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
GROUP BY
|
||||||
|
form_code
|
||||||
|
) jt1
|
||||||
|
ON
|
||||||
|
t1.form_code = jt1.form_code
|
||||||
|
AND
|
||||||
|
t1.form_version = jt1.max_form_version
|
||||||
|
</if>
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
t1.is_delete = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 代码 -->
|
<!-- 代码 -->
|
||||||
|
@ -82,8 +82,8 @@ function OaFormUtil(layui) {
|
|||||||
signListDom += [
|
signListDom += [
|
||||||
'<div>',
|
'<div>',
|
||||||
' <span>' + item.content + '</span>',
|
' <span>' + item.content + '</span>',
|
||||||
' <span>->' + item.userName + '</span>',
|
' <span> ' + item.userName + '</span>',
|
||||||
' <span>->' + item.time + '</span>',
|
' <span> →' + item.time + '</span>',
|
||||||
'</div>'
|
'</div>'
|
||||||
].join('');
|
].join('');
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ function OaFormUtil(layui) {
|
|||||||
}
|
}
|
||||||
var jointlySignListText = '';
|
var jointlySignListText = '';
|
||||||
for (var i = 0, item; item = jointlySigns[i++];) {
|
for (var i = 0, item; item = jointlySigns[i++];) {
|
||||||
jointlySignListText += item.content + ' ->' + item.userName + ' ->' + item.time + '\n';
|
jointlySignListText += item.content + ' ' + item.userName + ' →' + item.time + '\n';
|
||||||
}
|
}
|
||||||
formData[key] = jointlySignListText;
|
formData[key] = jointlySignListText;
|
||||||
}
|
}
|
||||||
|
409
module-form/src/main/resources/templates/form/list-history.html
Normal file
409
module-form/src/main/resources/templates/form/list-history.html
Normal file
@ -0,0 +1,409 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#request.getContextPath() + '/'} ">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||||
|
<!-- 表头按钮字典 -->
|
||||||
|
<script type="text/html" id="headerToolBar">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="remove">
|
||||||
|
<i class="fa fa-lg fa-trash"></i> 删除
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script type="text/javascript" th:inline="javascript">
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'table', 'laydate', 'ztree'], function() {
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var form = layui.form;
|
||||||
|
var table = layui.table;
|
||||||
|
var admin = layui.admin;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
var hasMenuService = [[${hasMenuService}]];
|
||||||
|
var queryParams = top.restAjax.params(window.location.href);
|
||||||
|
var formId = queryParams.formId;
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
function initTable() {
|
||||||
|
table.render({
|
||||||
|
elem: '#dataTable',
|
||||||
|
id: 'dataTable',
|
||||||
|
url: top.restAjax.path('api/form/listpage-history/form-id/{formId}', [formId]),
|
||||||
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
|
height: $win.height() - 20,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
|
toolbar: '#headerToolBar',
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'rows'
|
||||||
|
},
|
||||||
|
cols: [
|
||||||
|
[
|
||||||
|
{type:'checkbox', fixed: 'left'},
|
||||||
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
|
{field:'formId', width:200, title: '表单ID', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
return row.formId;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formCode', width:200, title: '表单编码', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
return row.formCode +' <span class="layui-badge layui-bg-blue">v:'+ row.formVersion +'</span>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formName', width:160, title: '表单名称', align:'center',},
|
||||||
|
{field:'formSummary', width:160, title: '表单说明', align:'center',},
|
||||||
|
{field:'formType', width:100, title: '表单类型', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
if(!row.formType) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
if(row.formType == 'default') {
|
||||||
|
return '<span class="layui-badge layui-bg-green">默认</span>';
|
||||||
|
}
|
||||||
|
if(row.formType == 'oa') {
|
||||||
|
return '<span class="layui-badge layui-bg-blue">OA表单</span>';
|
||||||
|
}
|
||||||
|
return '<span class="layui-badge">错误</span>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formStatus', width:100, title: '表单状态', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var field = row.formStatus;
|
||||||
|
if(!field) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
var checked = '';
|
||||||
|
if(field === 'active') {
|
||||||
|
checked = 'checked'
|
||||||
|
}
|
||||||
|
return '<input type="checkbox" lay-skin="switch" lay-text="激活|未激活" '+ checked +' lay-filter="formStatusFilter" data-form-id="'+ row.formId +'">';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formTableName', width:200, title: '表名', align:'center', },
|
||||||
|
{field:'pcPageCode', width:220, title: 'PC端代码', align:'center',
|
||||||
|
templet: function(item) {
|
||||||
|
return '<div class="layui-btn-group">' +
|
||||||
|
'<button class="layui-btn layui-btn-xs" lay-event="savePageCodeEvent">新增页面</button>' +
|
||||||
|
'<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="updatePageCodeEvent">修改页面</button>' +
|
||||||
|
'<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="showPageCodeEvent">详情页面</button>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{field:'printPageCode', width:100, title: 'OA打印', align:'center',
|
||||||
|
templet: function(item) {
|
||||||
|
if(item.formType === 'default') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return '<div class="layui-btn-group">' +
|
||||||
|
'<button class="layui-btn layui-btn-xs" lay-event="printPageCodeEvent">打印页面</button>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'appPageCode', width:220, title: 'APP端代码', align:'center',
|
||||||
|
templet: function(item) {
|
||||||
|
return '<div class="layui-btn-group">' +
|
||||||
|
'<button class="layui-btn layui-btn-xs" lay-event="appSavePageCodeEvent">新增页面</button>' +
|
||||||
|
'<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="appUpdatePageCodeEvent">修改页面</button>' +
|
||||||
|
'<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="appShowPageCodeEvent">详情页面</button>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formSourceData', width:100, title: '原数据', align:'center',
|
||||||
|
templet: function(item) {
|
||||||
|
return '<button class="layui-btn layui-btn-xs" lay-event="showDataEvent">查看数据</button>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{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(hasMenuService && item.formType === 'default') {
|
||||||
|
btnGroup += '<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" lay-event="joinMenuEvent" title="将该表单加入菜单">加入菜单</button>';
|
||||||
|
}
|
||||||
|
btnGroup += '</div>';
|
||||||
|
return btnGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
page: true,
|
||||||
|
parseData: function(data) {
|
||||||
|
return {
|
||||||
|
'code': 0,
|
||||||
|
'msg': '',
|
||||||
|
'count': data.total,
|
||||||
|
'data': data.rows
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 重载表格
|
||||||
|
function reloadTable() {
|
||||||
|
table.reload('dataTable', {
|
||||||
|
where: {
|
||||||
|
keywords: $('#keywords').val(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化日期
|
||||||
|
function initDate() {}
|
||||||
|
// 删除
|
||||||
|
function removeData(ids) {
|
||||||
|
top.dialog.msg(top.dataMessage.delete, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function (index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var layIndex;
|
||||||
|
top.restAjax.delete(top.restAjax.path('api/form/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||||
|
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||||
|
reloadTable();
|
||||||
|
}, function (code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function () {
|
||||||
|
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function () {
|
||||||
|
top.dialog.close(layIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
initTable();
|
||||||
|
initDate();
|
||||||
|
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
reloadTable();
|
||||||
|
});
|
||||||
|
// 事件 - 增删改
|
||||||
|
table.on('toolbar(dataTable)', function(obj) {
|
||||||
|
var layEvent = obj.event;
|
||||||
|
var checkStatus = table.checkStatus('dataTable');
|
||||||
|
var checkDatas = checkStatus.data;
|
||||||
|
if(layEvent === 'save') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '表单设计器',
|
||||||
|
url: top.restAjax.path('route/form-design/save', []),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(layEvent === 'update') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||||
|
} else if(checkDatas.length > 1) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||||
|
} else {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '表单设计器',
|
||||||
|
url: top.restAjax.path('route/form-design/update?formId={formId}', [checkDatas[0].formId]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if(layEvent === 'remove') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||||
|
} else {
|
||||||
|
var ids = '';
|
||||||
|
for(var i = 0, item; item = checkDatas[i++];) {
|
||||||
|
if(i > 1) {
|
||||||
|
ids += '_';
|
||||||
|
}
|
||||||
|
ids += item.formId;
|
||||||
|
}
|
||||||
|
removeData(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
table.on('tool(dataTable)', function(obj) {
|
||||||
|
var event = obj.event;
|
||||||
|
var data = obj.data;
|
||||||
|
if(event === 'savePageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '新增页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-save-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'updatePageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '修改页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-update-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'showPageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '详情页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-show-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'printPageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '打印页面模板【需要打印的内容添加到 startprint 与 endprint 之间,两个注释不能删除,变量用 ${XXX}占位(视频、音频、文件、附件只打印文件名称)】',
|
||||||
|
url: top.restAjax.path('route/form/get-print-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'appSavePageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: 'APP新增页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-app-save-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'appUpdatePageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: 'APP修改页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-app-update-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'appShowPageCodeEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: 'APP详情页面模板',
|
||||||
|
url: top.restAjax.path('route/form/get-app-show-page-code?formId={formId}&formCode={formCode}&formVersion={formVersion}', [data.formId, data.formCode, data.formVersion]),
|
||||||
|
width: '99%',
|
||||||
|
height: '99%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'showDataEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '表单数据',
|
||||||
|
url: top.restAjax.path('route/form/get-form-source-data?formId={formId}', [data.formId]),
|
||||||
|
width: '500px',
|
||||||
|
height: '90%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'showFormEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '预览',
|
||||||
|
url: top.restAjax.path('route/form-report/list?formCode={formCode}&formVersion={formVersion}', [data.formCode, data.formVersion]),
|
||||||
|
width: '80%',
|
||||||
|
height: '80%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'dataListEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '数据列表',
|
||||||
|
url: top.restAjax.path('route/form-report/list/code/{formCode}/version/{formVersion}', [data.formCode, data.formVersion]),
|
||||||
|
width: '70%',
|
||||||
|
height: '80%',
|
||||||
|
onClose: function () {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if(event === 'formFieldEvent') {
|
||||||
|
|
||||||
|
} else if(event === 'deleteEvent') {
|
||||||
|
top.dialog.confirm('该操作将连同物理表(无数据)一并删除,确定吗?', function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var layIndex;
|
||||||
|
top.restAjax.delete(top.restAjax.path('api/form/delete/{id}', [data.formId]), {}, null, function (code, data) {
|
||||||
|
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||||
|
reloadTable();
|
||||||
|
}, function (code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function () {
|
||||||
|
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function () {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
form.on('switch(formStatusFilter)', function(obj) {
|
||||||
|
var dataset = obj.elem.dataset;
|
||||||
|
var formId = dataset.formId;
|
||||||
|
var checked = obj.elem.checked;
|
||||||
|
top.restAjax.put(top.restAjax.path('api/form/update-status/{formId}/{formStatus}', [formId, checked ? 'active' : 'inactive']), {}, null, function(code, data) {
|
||||||
|
top.dialog.msg('修改成功');
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
obj.elem.checked = !checked;
|
||||||
|
form.render('checkbox')
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -64,7 +64,7 @@
|
|||||||
table.render({
|
table.render({
|
||||||
elem: '#dataTable',
|
elem: '#dataTable',
|
||||||
id: 'dataTable',
|
id: 'dataTable',
|
||||||
url: top.restAjax.path('api/form/listpage', []),
|
url: top.restAjax.path('api/form/listpage-latest', []),
|
||||||
width: admin.screen() > 1 ? '100%' : '',
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
height: $win.height() - 90,
|
height: $win.height() - 90,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
@ -152,6 +152,11 @@
|
|||||||
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:'historyList', width:80, title: '历史', align:'center', fixed: 'right',
|
||||||
|
templet: function(item) {
|
||||||
|
return '<button class="layui-btn layui-btn-xs" lay-event="showHistoryEvent">查看</button>';
|
||||||
|
}
|
||||||
|
},
|
||||||
{field:'opition', width: hasMenuService ? 220 : 150, title: '操作', fixed:'right', align:'center',
|
{field:'opition', width: hasMenuService ? 220 : 150, title: '操作', fixed:'right', align:'center',
|
||||||
templet: function(item) {
|
templet: function(item) {
|
||||||
var btnGroup = '<div class="layui-btn-group">';
|
var btnGroup = '<div class="layui-btn-group">';
|
||||||
@ -404,6 +409,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else if(event === 'showHistoryEvent') {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '选择要添加的根节点',
|
||||||
|
width: '80%',
|
||||||
|
height: '80%',
|
||||||
|
url: top.restAjax.path('route/form/list-history?formId={formId}', [data.formId]),
|
||||||
|
onClose: function() {}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<!--startprint-->
|
<!--startprint-->
|
||||||
|
|
||||||
<!-- 这里是打印位置 -->
|
<!-- 这里是打印位置 -->
|
||||||
|
<!-- 表单数据对象 formData -->
|
||||||
|
|
||||||
<!--endprint-->
|
<!--endprint-->
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user