完善表单

This commit is contained in:
459816669@qq.com 2021-11-21 20:16:45 +08:00
parent f2bb241f60
commit c12a76bc9e
12 changed files with 744 additions and 3 deletions

View File

@ -68,6 +68,15 @@ public class ShiroUtils
return getSysUser().getUserId().longValue();
}
/**
* 判断当前用户是否是管理员
* @return true是false不是
*/
public static boolean isAdmin()
{
return getSysUser().isAdmin();
}
public static String getDingUserId()
{
return getSysUser().getDingUserId();

View File

@ -6,10 +6,13 @@ import com.alibaba.fastjson.JSON;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.utils.StringUtils;
import com.snow.framework.util.ShiroUtils;
import com.snow.from.domain.SysFormDataRecord;
import com.snow.from.domain.SysFormField;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.domain.request.FormFieldRequest;
import com.snow.from.domain.request.FormRecordRequest;
import com.snow.from.domain.request.FormRequest;
import com.snow.from.service.impl.SysFormDataRecordServiceImpl;
import com.snow.from.service.impl.SysFormFieldServiceImpl;
import com.snow.from.service.impl.SysFormInstanceServiceImpl;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* @author qimingjin
@ -38,6 +42,9 @@ public class FormController {
@Autowired
private SysFormFieldServiceImpl sysFormFieldService;
@Autowired
private SysFormDataRecordServiceImpl sysFormDataRecordService;
/**
* 跳转form表单首页
* @return 首页url路径
@ -110,6 +117,27 @@ public class FormController {
return "/fromPreview";
}
/**
* 保存表单填写记录
* @return
*/
@PostMapping("/form/saveFormRecord")
@ResponseBody
public AjaxResult saveFormRecord(@RequestParam String formId ,
@RequestParam String formData ){
Long userId = ShiroUtils.getUserId();
SysFormDataRecord sysFormDataRecord=new SysFormDataRecord();
sysFormDataRecord.setBelongUserId(String.valueOf(userId));
sysFormDataRecord.setFormData(formData);
sysFormDataRecord.setFormId(formId);
sysFormDataRecord.setCreateBy(String.valueOf(userId));
//获取最大版本号
Integer maxVersion = sysFormDataRecordService.getMaxVersionByUsrId(userId);
//版本号+1组成最新版本号
sysFormDataRecord.setVersion(Optional.ofNullable(maxVersion).orElse(0)+1);
sysFormDataRecordService.insertSysFormDataRecord(sysFormDataRecord);
return AjaxResult.success();
}
/**
* 构建子表数据
* @param formId 表单id

View File

@ -7,9 +7,12 @@ import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.framework.util.ShiroUtils;
import com.snow.from.domain.SysFormDataRecord;
import com.snow.from.domain.SysFormInstance;
import com.snow.from.service.ISysFormFieldService;
import com.snow.from.service.ISysFormInstanceService;
import com.snow.from.service.impl.SysFormDataRecordServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -32,9 +35,9 @@ public class SysFormInstanceController extends BaseController
@Autowired
private ISysFormInstanceService sysFormInstanceService;
@Autowired
private ISysFormFieldService sysFormFieldService;
private SysFormDataRecordServiceImpl sysFormDataRecordService;
@RequiresPermissions("system:instance:view")
@ -53,6 +56,10 @@ public class SysFormInstanceController extends BaseController
public TableDataInfo list(SysFormInstance sysFormInstance)
{
startPage();
if(!ShiroUtils.isAdmin()){
Long userId = ShiroUtils.getUserId();
sysFormInstance.setCreateBy(String.valueOf(userId));
}
List<SysFormInstance> list = sysFormInstanceService.selectSysFormInstanceList(sysFormInstance);
return getDataTable(list);
}
@ -141,6 +148,28 @@ public class SysFormInstanceController extends BaseController
return toAjax(sysFormInstanceService.updateSysFormInstance(sysFormInstance));
}
@RequiresPermissions("system:record:view")
@GetMapping("/formRecord")
public String record(@RequestParam Long id,ModelMap mmap)
{
mmap.put("id",id);
return prefix + "/record";
}
/**
* 查询单数据记录列表
*/
@RequiresPermissions("system:record:list")
@PostMapping("/recordList")
@ResponseBody
public TableDataInfo recordList(SysFormDataRecord sysFormDataRecord)
{
startPage();
List<SysFormDataRecord> list = sysFormDataRecordService.selectSysFormDataRecordList(sysFormDataRecord);
return getDataTable(list);
}
/**
* 删除单实例
*/

View File

@ -0,0 +1,36 @@
package com.snow.from.domain;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 单数据记录对象 sys_form_data_record
*
* @author 阿吉
* @date 2021-11-21
*/
@Data
public class SysFormDataRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Integer id;
/** 表单定义code */
private String formId;
/**
* 表单内容
*/
private String formData;
/** 表单url */
private String formUrl;
/** 表单操作人所属人id */
private String belongUserId;
/** 版本号 */
private Integer version;
}

View File

@ -0,0 +1,24 @@
package com.snow.from.domain.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-11-21 13:34
**/
@Data
public class FormRecordRequest implements Serializable {
private static final long serialVersionUID = 2827721348459680642L;
@NotBlank(message = "表单id不能为空")
private String formId;
@NotBlank(message = "表单数据不能为空")
private String formData;
}

View File

@ -0,0 +1,69 @@
package com.snow.from.mapper;
import java.util.List;
import com.snow.from.domain.SysFormDataRecord;
/**
* 单数据记录Mapper接口
*
* @author 阿吉
* @date 2021-11-21
*/
public interface SysFormDataRecordMapper
{
/**
* 查询单数据记录
*
* @param id 单数据记录ID
* @return 单数据记录
*/
public SysFormDataRecord selectSysFormDataRecordById(Integer id);
/**
* 获取最大版本号
* @param userId 用户id
* @return 最大版本号
*/
Integer getMaxVersionByUsrId(Long userId);
/**
* 查询单数据记录列表
*
* @param sysFormDataRecord 单数据记录
* @return 单数据记录集合
*/
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord);
/**
* 新增单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
public int insertSysFormDataRecord(SysFormDataRecord sysFormDataRecord);
/**
* 修改单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
public int updateSysFormDataRecord(SysFormDataRecord sysFormDataRecord);
/**
* 删除单数据记录
*
* @param id 单数据记录ID
* @return 结果
*/
public int deleteSysFormDataRecordById(Integer id);
/**
* 批量删除单数据记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormDataRecordByIds(String[] ids);
}

View File

@ -0,0 +1,68 @@
package com.snow.from.service;
import com.snow.from.domain.SysFormDataRecord;
import java.util.List;
/**
* 单数据记录Service接口
*
* @author 阿吉
* @date 2021-11-21
*/
public interface ISysFormDataRecordService
{
/**
* 查询单数据记录
*
* @param id 单数据记录ID
* @return 单数据记录
*/
public SysFormDataRecord selectSysFormDataRecordById(Integer id);
/**
* 获取最大版本号
* @param userId 用户id
* @return 最大版本号
*/
Integer getMaxVersionByUsrId(Long userId);
/**
* 查询单数据记录列表
*
* @param sysFormDataRecord 单数据记录
* @return 单数据记录集合
*/
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord);
/**
* 新增单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
public int insertSysFormDataRecord(SysFormDataRecord sysFormDataRecord);
/**
* 修改单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
public int updateSysFormDataRecord(SysFormDataRecord sysFormDataRecord);
/**
* 批量删除单数据记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysFormDataRecordByIds(String ids);
/**
* 删除单数据记录信息
*
* @param id 单数据记录ID
* @return 结果
*/
public int deleteSysFormDataRecordById(Integer id);
}

View File

@ -0,0 +1,103 @@
package com.snow.from.service.impl;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.from.domain.SysFormDataRecord;
import com.snow.from.mapper.SysFormDataRecordMapper;
import com.snow.from.service.ISysFormDataRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 单数据记录Service业务层处理
*
* @author 阿吉
* @date 2021-11-21
*/
@Service
public class SysFormDataRecordServiceImpl implements ISysFormDataRecordService
{
@Autowired
private SysFormDataRecordMapper sysFormDataRecordMapper;
/**
* 查询单数据记录
*
* @param id 单数据记录ID
* @return 单数据记录
*/
@Override
public SysFormDataRecord selectSysFormDataRecordById(Integer id)
{
return sysFormDataRecordMapper.selectSysFormDataRecordById(id);
}
@Override
public Integer getMaxVersionByUsrId(Long userId) {
return sysFormDataRecordMapper.getMaxVersionByUsrId(userId);
}
/**
* 查询单数据记录列表
*
* @param sysFormDataRecord 单数据记录
* @return 单数据记录
*/
@Override
public List<SysFormDataRecord> selectSysFormDataRecordList(SysFormDataRecord sysFormDataRecord)
{
return sysFormDataRecordMapper.selectSysFormDataRecordList(sysFormDataRecord);
}
/**
* 新增单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
@Override
public int insertSysFormDataRecord(SysFormDataRecord sysFormDataRecord)
{
sysFormDataRecord.setCreateTime(DateUtils.getNowDate());
return sysFormDataRecordMapper.insertSysFormDataRecord(sysFormDataRecord);
}
/**
* 修改单数据记录
*
* @param sysFormDataRecord 单数据记录
* @return 结果
*/
@Override
public int updateSysFormDataRecord(SysFormDataRecord sysFormDataRecord)
{
sysFormDataRecord.setUpdateTime(DateUtils.getNowDate());
return sysFormDataRecordMapper.updateSysFormDataRecord(sysFormDataRecord);
}
/**
* 删除单数据记录对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysFormDataRecordByIds(String ids)
{
return sysFormDataRecordMapper.deleteSysFormDataRecordByIds(Convert.toStrArray(ids));
}
/**
* 删除单数据记录信息
*
* @param id 单数据记录ID
* @return 结果
*/
@Override
public int deleteSysFormDataRecordById(Integer id)
{
return sysFormDataRecordMapper.deleteSysFormDataRecordById(id);
}
}

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.snow.from.mapper.SysFormDataRecordMapper">
<resultMap type="SysFormDataRecord" id="SysFormDataRecordResult">
<result property="id" column="id" />
<result property="formId" column="form_id" />
<result property="formData" column="form_data" />
<result property="formUrl" column="form_url" />
<result property="belongUserId" column="belong_user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="version" column="version" />
</resultMap>
<sql id="selectSysFormDataRecordVo">
select id, form_id, form_data, form_url, belong_user_id, create_by, create_time, update_time, update_by, version from sys_form_data_record
</sql>
<select id="selectSysFormDataRecordList" parameterType="SysFormDataRecord" resultMap="SysFormDataRecordResult">
<include refid="selectSysFormDataRecordVo"/>
<where>
<if test="formId != null and formId != ''"> and form_id = #{formId}</if>
<if test="formData != null and formData != ''"> and form_data = #{formData}</if>
<if test="formUrl != null and formUrl != ''"> and form_url = #{formUrl}</if>
<if test="belongUserId != null and belongUserId != ''"> and belong_user_id = #{belongUserId}</if>
<if test="version != null "> and version = #{version}</if>
</where>
</select>
<select id="selectSysFormDataRecordById" parameterType="Integer" resultMap="SysFormDataRecordResult">
<include refid="selectSysFormDataRecordVo"/>
where id = #{id}
</select>
<select id="getMaxVersionByUsrId" parameterType="Long" resultType="integer">
select max(version) from sys_form_data_record
where belong_user_id = #{belongUserId}
</select>
<insert id="insertSysFormDataRecord" parameterType="SysFormDataRecord" useGeneratedKeys="true" keyProperty="id">
insert into sys_form_data_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formId != null and formId != ''">form_id,</if>
<if test="formData != null">form_data,</if>
<if test="formUrl != null and formUrl != ''">form_url,</if>
<if test="belongUserId != null">belong_user_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="version != null">version,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formId != null and formId != ''">#{formId},</if>
<if test="formData != null">#{formData},</if>
<if test="formUrl != null and formUrl != ''">#{formUrl},</if>
<if test="belongUserId != null">#{belongUserId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="version != null">#{version},</if>
</trim>
</insert>
<update id="updateSysFormDataRecord" parameterType="SysFormDataRecord">
update sys_form_data_record
<trim prefix="SET" suffixOverrides=",">
<if test="formId != null and formId != ''">form_id = #{formId},</if>
<if test="formData != null">form_data = #{formData},</if>
<if test="formUrl != null and formUrl != ''">form_url = #{formUrl},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="version != null">version = #{version},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysFormDataRecordById" parameterType="Integer">
delete from sys_form_data_record where id = #{id}
</delete>
<delete id="deleteSysFormDataRecordByIds" parameterType="String">
delete from sys_form_data_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('自定义页面展示')" />
<link rel="stylesheet" href="./layui/css/layui.css" />
<link rel="stylesheet" href="./ayq/modules/formDesigner.css" />
<link rel="stylesheet" href="./ayq/modules/cron.css" />
<link rel="stylesheet" href="./ayq/modules/labelGeneration.css" />
<link rel="stylesheet" href="./ayq/modules/formPreview.css" />
</head>
<body >
<div >
<input type="hidden" name="formId" id="formId" th:value="${formId}">
<div style="margin: 20px 20px;padding: 20px 20px;border: 1px solid #009688;">
<div style="margin-top: 20px">
<h2 th:text="${name}" style="text-align: center"></h2>
</div>
<div id="testdemo" style="margin-top: 15px">
</div>
<div style="margin-top: 20px" class="layui-row">
<div class="layui-col-md4 layui-col-md-offset5">
<button type="button" class="layui-btn layui-btn-normal" name="submit" id="getFormData">提交</button>
</div>
</div>
</div>
</div>
<div class="importjsoncodeview" style="display: none;">
<textarea class="site-demo-text" id="import-json-code-view"></textarea>
<a href="javascript:;" class="layui-btn layui-btn-normal" style="margin-right:20px;" id="import-json-code">导入数据</a>
</div>
<div class="getFormData" style="display: none;">
<textarea class="site-demo-text" id="get-form-data"></textarea>
</div>
<script th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" src="./layui/layui.js"></script>
<script type="text/javascript" src="./ayq/modules/Sortable/Sortable.js"> </script>
<script type="text/javascript" src="./ayq/modules/iceEditor/iceEditor.js"></script>
<script type="text/javascript" src="./ayq/modules/formPreview.js"></script>
<script>
var demojs = [];
//JavaScript代码区域
layui.config(
{base: './ayq/modules/'}).use(['formPreview', 'form','layer','upload'], function () {
var layer = layui.layer;
var $ = layui.jquery;
var upload = layui.upload;
var index = layui.index;
var formPreview = layui.formPreview;
var form = layui.form;
var render;
if (window.localStorage.getItem('layui_form_json') !== undefined) {
var formId=$("#formId").val();
var config = {
url: "/from/instance/getFromInfo",
type: "post",
dataType: "json",
data: {
"formId":formId
},
beforeSend: function () {
layer.msg("正在处理中,请稍后...",{icon: 1});
},
success: function(result) {
if (result.code === 0) {
demojs = JSON.parse(result.msg);
render = formPreview.render({
elem: '#testdemo',
data: demojs,
});
var images = render.getImages();
for (var i = 0; i < images.length; i++) {
upload.render({
elem: '#' + images[i].select
, url: '' + images[i].uploadUrl + ''
, multiple: true
, before: function (obj) {
layer.msg('图片上传中...', {
icon: 16,
shade: 0.01,
time: 0
})
}
, done: function (res) {
layer.close(layer.msg());//关闭上传提示窗口
//上传完毕
$('#uploader-list-' + item.id).append(
'<div id="" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
'<img style="width: 100px;height: 100px;" src=' + res.data.src + '>' +
'<div class="info">' + res.data.title + '</div>' +
'</div>'
);
}
});
}
var filesData = render.getFiles();
for (var i = 0; i < filesData.length; i++) {
upload.render({
elem: '#' + filesData[i].select
, elemList: $('#list-' + filesData[i].select) //列表元素对象
, url: '' + filesData[i].uploadUrl + ''
, accept: 'file'
, multiple: true
, number: 3
, auto: false
, bindAction: '#listAction-' + filesData[i].select
, choose: function (obj) {
var that = this;
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
//读取本地文件
obj.preview(function (index, file, result) {
var tr = $(['<tr id="upload-' + index + '">'
, '<td>' + file.name + '</td>'
, '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
, '<td><div class="layui-progress" lay-filter="progress-demo-' + index + '"><div class="layui-progress-bar" lay-percent=""></div></div></td>'
, '<td>'
, '<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
, '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
, '</td>'
, '</tr>'].join(''));
//单个重传
tr.find('.demo-reload').on('click', function () {
obj.upload(index, file);
});
//删除
tr.find('.demo-delete').on('click', function () {
delete files[index]; //删除对应的文件
tr.remove();
uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
});
that.elemList.append(tr);
element.render('progress'); //渲染新加的进度条组件
});
}
, done: function (res, index, upload) { //成功的回调
var that = this;
//if(res.code == 0){ //上传成功
var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children();
tds.eq(3).html(''); //清空操作
delete this.files[index]; //删除文件队列已经上传成功的文件
return;
//}
this.error(index, upload);
}
, allDone: function (obj) { //多文件上传完毕后的状态回调
console.log(obj)
}
, error: function (index, upload) { //错误回调
var that = this;
var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children();
tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
}
, progress: function (n, elem, e, index) {
element.progress('progress-demo-' + index, n + '%'); //执行进度条。n 即为返回的进度百分比
}
});
}
} else {
layer.msg(result.msg, {icon: 2});
}
}
};
$.ajax(config);
}
});
</script>
</body>
</html>

View File

@ -78,7 +78,8 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="fromDetail(\'' + row.id+ '\')"><i class="fa fa-edit"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="fromDetail(\'' + row.id+ '\')"><i class="fa fa-add"></i>填写表单</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="formRecordDetail(\'' + row.id+ '\')"><i class="fa fa-eyes"></i>查看表单</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
@ -95,6 +96,11 @@
function designFrom() {
var detailUrl="/formIndex";
$.modal.openTab("设计表单", detailUrl);
}
function formRecordDetail(id) {
var detailUrl="/from/instance/formRecord?id="+id;
$.modal.openTab("表单数据列表", detailUrl);
}
</script>

View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('单数据记录列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<input type="hidden" name="id" id="id" th:value="${id}">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>版本号:</label>
<input type="text" name="version"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:record:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:record:remove')}]];
var prefix = ctx + "/from/instance";
$(function() {
var options = {
url: "/from/instance/recordList",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
queryParams:queryParams,
modalName: "单数据记录",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'formId',
title: '表单ID'
},
{
field: 'belongUserId',
title: '表单操作人所属人id'
},
{
field: 'version',
title: '版本号'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
function queryParams(params) {
var search = $.table.queryParams(params);
search["formId"]=$("#id").val();
search.version = $("#version").val();
return search;
}
$.table.init(options);
});
</script>
</body>
</html>