提交 1c26b788 编写于 作者: doc_wei's avatar doc_wei

动态表单内容项说明完成

上级 a7152c73
...@@ -87,7 +87,8 @@ public class Constants { ...@@ -87,7 +87,8 @@ public class Constants {
/** /**
* 保存模板说明的redis的key * 保存模板说明的redis的key
*/ */
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel"; public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel";//代码生成器模板规范说明key
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT = "exexplaintodsformcontent";//动态表单内容项模板规范说明key
} }
package com.skyeye.exexplain.dao;
import java.util.Map;
public interface ExExplainToDsFormContentDao {
public int insertExExplainToDsFormContentMation(Map<String, Object> map) throws Exception;
public Map<String, Object> queryExExplainToDsFormContentMation(Map<String, Object> map) throws Exception;
public int editExExplainToDsFormContentMationById(Map<String, Object> map) throws Exception;
}
package com.skyeye.exexplain.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface ExExplainToDsFormContentService {
public void insertExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editExExplainToDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToDsFormContentMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception;
}
...@@ -7,9 +7,7 @@ import org.springframework.stereotype.Service; ...@@ -7,9 +7,7 @@ import org.springframework.stereotype.Service;
import com.skyeye.exexplain.dao.ExExplainToCodeModelDao; import com.skyeye.exexplain.dao.ExExplainToCodeModelDao;
import com.skyeye.exexplain.service.ExExplainToCodeModelService; import com.skyeye.exexplain.service.ExExplainToCodeModelService;
import com.skyeye.jedis.JedisClient; import com.skyeye.jedis.JedisClient;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.skyeye.common.constans.Constants; import com.skyeye.common.constans.Constants;
import com.skyeye.common.object.InputObject; import com.skyeye.common.object.InputObject;
......
package com.skyeye.exexplain.service.impl;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.skyeye.exexplain.dao.ExExplainToDsFormContentDao;
import com.skyeye.exexplain.service.ExExplainToDsFormContentService;
import com.skyeye.jedis.JedisClient;
import net.sf.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.skyeye.common.constans.Constants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
@Service
public class ExExplainToDsFormContentServiceImpl implements ExExplainToDsFormContentService{
@Autowired
private ExExplainToDsFormContentDao exExplainToDsFormContentDao;
@Autowired
public JedisClient jedisClient;
/**
*
* @Title: insertExExplainToDsFormContentMation
* @Description: 添加动态表单内容项说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormContentDao.queryExExplainToDsFormContentMation(map);
if(bean == null){
Map<String, Object> user = inputObject.getLogParams();
String id = ToolUtil.getSurFaceId();
map.put("id", id);
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
exExplainToDsFormContentDao.insertExExplainToDsFormContentMation(map);
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT);
bean = new HashMap<>();
bean.put("id", id);
outputObject.setBean(bean);
}else{
outputObject.setreturnMessage("该动态表单内容项说明已存在,不可进行二次保存");
}
}
/**
*
* @Title: queryExExplainToDsFormContentMation
* @Description: 编辑动态表单内容项说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormContentDao.queryExExplainToDsFormContentMation(map);
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: editExExplainToDsFormContentMationById
* @Description: 编辑动态表单内容项说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editExExplainToDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormContentDao.queryExExplainToDsFormContentMation(map);
if(bean == null){
outputObject.setreturnMessage("该动态表单内容项说明不存在,不可进行编辑");
}else{
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT);
exExplainToDsFormContentDao.editExExplainToDsFormContentMationById(map);
}
}
/**
*
* @Title: queryExExplainToDsFormContentMationToShow
* @Description: 获取动态表单内容项说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
@Override
public void queryExExplainToDsFormContentMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
if(jedisClient.exists(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT)){
map = JSONObject.fromObject(jedisClient.get(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT));
}else{
Map<String, Object> bean = exExplainToDsFormContentDao.queryExExplainToDsFormContentMation(map);
if(bean == null){
map.put("title", "标题");
map.put("content", "等待发布说明。");
}else{
jedisClient.set(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT, JSON.toJSONString(bean));
map = bean;
}
}
outputObject.setBean(map);
}
}
package com.skyeye.exexplain.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.skyeye.exexplain.service.ExExplainToDsFormContentService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class ExExplainToDsFormContentController {
@Autowired
private ExExplainToDsFormContentService exExplainToDsFormContentService;
/**
*
* @Title: insertExExplainToDsFormContentMation
* @Description: 添加动态表单内容项说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormContentController/insertExExplainToDsFormContentMation")
@ResponseBody
public void insertExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormContentService.insertExExplainToDsFormContentMation(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToDsFormContentMation
* @Description: 编辑动态表单内容项说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormContentController/queryExExplainToDsFormContentMation")
@ResponseBody
public void queryExExplainToDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormContentService.queryExExplainToDsFormContentMation(inputObject, outputObject);
}
/**
*
* @Title: editExExplainToDsFormContentMationById
* @Description: 编辑动态表单内容项说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormContentController/editExExplainToDsFormContentMationById")
@ResponseBody
public void editExExplainToDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormContentService.editExExplainToDsFormContentMationById(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToDsFormContentMationToShow
* @Description: 获取动态表单内容项说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormContentController/queryExExplainToDsFormContentMationToShow")
@ResponseBody
public void queryExExplainToDsFormContentMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormContentService.queryExExplainToDsFormContentMationToShow(inputObject, outputObject);
}
}
<?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.skyeye.exexplain.dao.ExExplainToDsFormContentDao">
<select id="queryExExplainToDsFormContentMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.title,
a.content
FROM
ex_explain_to_ds_form_content a
LIMIT 1
</select>
<insert id="insertExExplainToDsFormContentMation" parameterType="java.util.Map">
INSERT into ex_explain_to_ds_form_content
(id, title, content, create_id, create_time)
VALUES
(#{id}, #{title}, #{content}, #{createId}, #{createTime})
</insert>
<update id="editExExplainToDsFormContentMationById" parameterType="java.util.Map">
UPDATE ex_explain_to_ds_form_content
<set>
<if test="title != '' and title != null">
title = #{title},
</if>
<if test="content != '' and content != null">
content = #{content},
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
...@@ -397,6 +397,19 @@ ...@@ -397,6 +397,19 @@
</url> </url>
<url id="exexplaintocodemodel004" path="/post/ExExplainToCodeModelController/queryExExplainToCodeModelMationToShow" val="获取代码生成器说明信息供展示" allUse="1"> <url id="exexplaintocodemodel004" path="/post/ExExplainToCodeModelController/queryExExplainToCodeModelMationToShow" val="获取代码生成器说明信息供展示" allUse="1">
</url> </url>
<url id="exexplaintodsformcontent001" path="/post/ExExplainToDsFormContentController/insertExExplainToDsFormContentMation" val="添加动态表单内容项说明信息" allUse="1">
<property id="title" name="title" ref="required" var="动态表单内容项说明标题"/>
<property id="content" name="content" ref="required" var="动态表单内容项说明内容"/>
</url>
<url id="exexplaintodsformcontent002" path="/post/ExExplainToDsFormContentController/queryExExplainToDsFormContentMation" val="编辑动态表单内容项说明信息时进行回显" allUse="1">
</url>
<url id="exexplaintodsformcontent003" path="/post/ExExplainToDsFormContentController/editExExplainToDsFormContentMationById" val="编辑动态表单内容项说明信息" allUse="1">
<property id="title" name="title" ref="required" var="动态表单内容项说明标题"/>
<property id="content" name="content" ref="required" var="动态表单内容项说明内容"/>
<property id="rowId" name="id" ref="required" var="动态表单内容项说明id"/>
</url>
<url id="exexplaintodsformcontent004" path="/post/ExExplainToDsFormContentController/queryExExplainToDsFormContentMationToShow" val="获取动态表单内容项说明信息供展示" allUse="1">
</url>
<!-- 系统各部分说明结束 --> <!-- 系统各部分说明结束 -->
</controller> </controller>
\ No newline at end of file
...@@ -10,6 +10,23 @@ layui.config({ ...@@ -10,6 +10,23 @@ layui.config({
var $ = layui.$, var $ = layui.$,
form = layui.form; form = layui.form;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformcontent004", params:{}, type:'json', callback:function(json){
if(json.returnCode == 0){
layer.open({
type: 1,
closeBtn: 0,//关闭按钮
resize: false,//是否允许拉伸
offset: 'l', // 具体配置参考:offset参数项
content: json.bean.content,
area: ['200px', '400px'],
shade: 0, //不显示遮罩
title: json.bean.title
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
var htmlEditor = CodeMirror.fromTextArea(document.getElementById("htmlContent"), { var htmlEditor = CodeMirror.fromTextArea(document.getElementById("htmlContent"), {
mode : "xml", // 模式 mode : "xml", // 模式
theme : "eclipse", // CSS样式选择 theme : "eclipse", // CSS样式选择
......
...@@ -11,6 +11,23 @@ layui.config({ ...@@ -11,6 +11,23 @@ layui.config({
form = layui.form; form = layui.form;
var htmlEditor, jsEditor; var htmlEditor, jsEditor;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformcontent004", params:{}, type:'json', callback:function(json){
if(json.returnCode == 0){
layer.open({
type: 1,
closeBtn: 0,//关闭按钮
resize: false,//是否允许拉伸
offset: 'l', // 具体配置参考:offset参数项
content: json.bean.content,
area: ['200px', '400px'],
shade: 0, //不显示遮罩
title: json.bean.title
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
showGrid({ showGrid({
id: "showForm", id: "showForm",
url: reqBasePath + "dsform004", url: reqBasePath + "dsform004",
......
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form', 'layedit'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form,
layedit = layui.layedit;
var layContent;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformcontent002", params:{}, type:'json', callback:function(json){
if(json.returnCode == 0){
if(!isNull(json.bean)){
rowId = json.bean.id;
$("#title").val(json.bean.title);
$("#content").val(json.bean.content);
}
layContent = layedit.build('content', {
tool: [
'strong' //加粗
,'italic' //斜体
,'underline' //下划线
,'del' //删除线
,'|' //分割线
,'left' //左对齐
,'center' //居中对齐
,'right' //右对齐
,'link' //超链接
,'unlink' //清除链接
,'face' //表情
]
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
if(isNull(layedit.getContent(layContent))){
top.winui.window.msg('请输入内容。', {icon: 2,time: 2000});
}else{
var params = {
title: $("#title").val(),
content: encodeURI(layedit.getContent(layContent)),
};
if(isNull(rowId)){
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformcontent001", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
rowId = json.bean.id;
top.winui.window.msg('保存成功', {icon: 1,time: 2000});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
params.rowId = rowId;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformcontent003", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg('保存成功', {icon: 1,time: 2000});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
}
}
return false;
});
});
});
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">标题<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="title" name="title" win-verify="required" placeholder="请输入标题" class="layui-input" maxlength="50"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<textarea id="content" name="content" style="display: none;"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/exexplain/'}).use('exexplaintodsformcontent');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册