提交 bd99079b 编写于 作者: Skyeye云's avatar Skyeye云

动态表单内容项完成

上级 30f62402
package com.skyeye.dsform.dao;
import java.util.List;
import java.util.Map;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface DsFormContentDao {
public List<Map<String, Object>> queryDsFormContentList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
public int insertDsFormContentMation(Map<String, Object> map) throws Exception;
public Map<String, Object> queryDsFormContentMationByName(Map<String, Object> map) throws Exception;
public int deleteDsFormContentMationById(Map<String, Object> map) throws Exception;
public Map<String, Object> queryDsFormContentMationToEditById(Map<String, Object> map) throws Exception;
public Map<String, Object> queryDsFormContentMationByNameAndId(Map<String, Object> map) throws Exception;
public int editDsFormContentMationById(Map<String, Object> map) throws Exception;
}
...@@ -78,21 +78,26 @@ public class CodeModelHistoryServiceImpl implements CodeModelHistoryService{ ...@@ -78,21 +78,26 @@ public class CodeModelHistoryServiceImpl implements CodeModelHistoryService{
String tPath = inputObject.getRequest().getSession().getServletContext().getRealPath("/"); String tPath = inputObject.getRequest().getSession().getServletContext().getRealPath("/");
String basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB)); String basePath = tPath.substring(0, inputObject.getRequest().getSession().getServletContext().getRealPath("/").indexOf(Constants.PROJECT_WEB));
String strZipPath = basePath + "/" + map.get("filePath").toString(); String strZipPath = basePath + "/" + map.get("filePath").toString();
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(strZipPath)); File zipFile = new File(strZipPath);
byte[] buffer = new byte[1024]; if(zipFile.exists()){
List<Map<String, Object>> beans = codeModelHistoryDao.queryCodeModelHistoryListByFilePath(map); outputObject.setreturnMessage("该文件已存在,生成失败。");
for(Map<String, Object> bean : beans){ }else{
//加入压缩包 ZipOutputStream out = new ZipOutputStream(new FileOutputStream(strZipPath));
ByteArrayInputStream stream = new ByteArrayInputStream(bean.get("content").toString().getBytes()); byte[] buffer = new byte[1024];
out.putNextEntry(new ZipEntry(bean.get("fileName").toString() + "." + bean.get("fileType").toString().toLowerCase())); List<Map<String, Object>> beans = codeModelHistoryDao.queryCodeModelHistoryListByFilePath(map);
int len; for(Map<String, Object> bean : beans){
// 读入需要下载的文件的内容,打包到zip文件 //加入压缩包
while ((len = stream.read(buffer)) > 0) { ByteArrayInputStream stream = new ByteArrayInputStream(bean.get("content").toString().getBytes());
out.write(buffer, 0, len); out.putNextEntry(new ZipEntry(bean.get("fileName").toString() + "." + bean.get("fileType").toString().toLowerCase()));
int len;
// 读入需要下载的文件的内容,打包到zip文件
while ((len = stream.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
out.closeEntry();
} }
out.closeEntry(); out.close();
} }
out.close();
} }
/** /**
......
package com.skyeye.dsform.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface DsFormContentService {
public void queryDsFormContentList(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryDsFormContentMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.dsform.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.skyeye.dsform.dao.DsFormContentDao;
import com.skyeye.dsform.service.DsFormContentService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
@Service
public class DsFormContentServiceImpl implements DsFormContentService{
@Autowired
private DsFormContentDao dsFormContentDao;
/**
*
* @Title: queryDsFormContentList
* @Description: 获取动态表单内容列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryDsFormContentList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = dsFormContentDao.queryDsFormContentList(map,
new PageBounds(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString())));
PageList<Map<String, Object>> beansPageList = (PageList<Map<String, Object>>)beans;
int total = beansPageList.getPaginator().getTotalCount();
outputObject.setBeans(beans);
outputObject.settotal(total);
}
/**
*
* @Title: insertDsFormContentMation
* @Description: 添加动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = dsFormContentDao.queryDsFormContentMationByName(map);
if(bean == null){
Map<String, Object> user = inputObject.getLogParams();
map.put("id", ToolUtil.getSurFaceId());
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
dsFormContentDao.insertDsFormContentMation(map);
}else{
outputObject.setreturnMessage("该动态表单内容名称已存在,不可进行二次保存");
}
}
/**
*
* @Title: deleteDsFormContentMationById
* @Description: 删除动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void deleteDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
dsFormContentDao.deleteDsFormContentMationById(map);
}
/**
*
* @Title: queryDsFormContentMationToEditById
* @Description: 编辑动态表单内容信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryDsFormContentMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = dsFormContentDao.queryDsFormContentMationToEditById(map);
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: editDsFormContentMationById
* @Description: 编辑动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = dsFormContentDao.queryDsFormContentMationByNameAndId(map);
if(bean == null){
dsFormContentDao.editDsFormContentMationById(map);
}else{
outputObject.setreturnMessage("该动态表单内容名称已存在,不可进行二次保存");
}
}
}
package com.skyeye.dsform.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.dsform.service.DsFormContentService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class DsFormContentController {
@Autowired
private DsFormContentService dsFormContentService;
/**
*
* @Title: queryDsFormContentList
* @Description: 获取动态表单内容列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormContentController/queryDsFormContentList")
@ResponseBody
public void queryDsFormContentList(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormContentService.queryDsFormContentList(inputObject, outputObject);
}
/**
*
* @Title: insertDsFormContentMation
* @Description: 添加动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormContentController/insertDsFormContentMation")
@ResponseBody
public void insertDsFormContentMation(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormContentService.insertDsFormContentMation(inputObject, outputObject);
}
/**
*
* @Title: deleteDsFormContentMationById
* @Description: 删除动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormContentController/deleteDsFormContentMationById")
@ResponseBody
public void deleteDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormContentService.deleteDsFormContentMationById(inputObject, outputObject);
}
/**
*
* @Title: queryDsFormContentMationToEditById
* @Description: 编辑动态表单内容信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormContentController/queryDsFormContentMationToEditById")
@ResponseBody
public void queryDsFormContentMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormContentService.queryDsFormContentMationToEditById(inputObject, outputObject);
}
/**
*
* @Title: editDsFormContentMationById
* @Description: 编辑动态表单内容信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormContentController/editDsFormContentMationById")
@ResponseBody
public void editDsFormContentMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormContentService.editDsFormContentMationById(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.dsform.dao.DsFormContentDao">
<select id="queryDsFormContentList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.`name` contentName,
a.html_content htmlContent,
a.html_type htmlType,
a.js_content jsContent,
a.js_type jsType,
CONVERT(a.create_time, char) createTime
FROM
ds_form_content a
WHERE 1 = 1
<if test="contentName != '' and contentName != null">
AND a.`name` LIKE '%${contentName}%'
</if>
ORDER BY a.create_time DESC
</select>
<select id="queryDsFormContentMationByName" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.`name` contentName
FROM
ds_form_content a
WHERE
a.`name` = #{contentName}
</select>
<insert id="insertDsFormContentMation" parameterType="java.util.Map">
INSERT into ds_form_content
(id, `name`, html_content, html_type, js_content, js_type, create_id, create_time)
VALUES
(#{id}, #{contentName}, #{htmlContent}, #{htmlType}, #{jsContent}, #{jsType}, #{createId}, #{createTime})
</insert>
<delete id="deleteDsFormContentMationById" parameterType="java.util.Map">
DELETE
FROM
ds_form_content
WHERE
id = #{id}
</delete>
<select id="queryDsFormContentMationToEditById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.`name` contentName,
a.html_content htmlContent,
a.js_content jsContent
FROM
ds_form_content a
WHERE
a.id = #{id}
</select>
<select id="queryDsFormContentMationByNameAndId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.`name` contentName
FROM
ds_form_content a
WHERE
a.`name` = #{contentName}
AND a.id != #{id}
</select>
<update id="editDsFormContentMationById" parameterType="java.util.Map">
UPDATE ds_form_content
<set>
<if test="contentName != '' and contentName != null">
`name` = #{contentName},
</if>
<if test="htmlContent != '' and htmlContent != null">
html_content = #{htmlContent},
</if>
js_content = #{jsContent}
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
...@@ -356,4 +356,31 @@ ...@@ -356,4 +356,31 @@
</url> </url>
<!-- 代码生成器系列结束 --> <!-- 代码生成器系列结束 -->
<!-- 动态表单系列开始 -->
<url id="dsform001" path="/post/DsFormContentController/queryDsFormContentList" val="获取动态表单内容列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
<property id="contentName" name="contentName" ref="" var="模板内容标题"/>
</url>
<url id="dsform002" path="/post/DsFormContentController/insertDsFormContentMation" val="添加动态表单内容信息" allUse="1">
<property id="contentName" name="contentName" ref="required" var="模板内容标题"/>
<property id="htmlContent" name="htmlContent" ref="required" var="html内容"/>
<property id="htmlType" name="htmlType" ref="required" var="html内容类型"/>
<property id="jsContent" name="jsContent" ref="" var="js内容"/>
<property id="jsType" name="jsType" ref="" var="js内容类型"/>
</url>
<url id="dsform003" path="/post/DsFormContentController/deleteDsFormContentMationById" val="删除动态表单内容信息" allUse="1">
<property id="rowId" name="id" ref="required" var="动态表单内容id"/>
</url>
<url id="dsform004" path="/post/DsFormContentController/queryDsFormContentMationToEditById" val="编辑动态表单内容信息时进行回显" allUse="1">
<property id="rowId" name="id" ref="required" var="动态表单内容id"/>
</url>
<url id="dsform005" path="/post/DsFormContentController/editDsFormContentMationById" val="编辑动态表单内容信息" allUse="1">
<property id="contentName" name="contentName" ref="required" var="模板内容标题"/>
<property id="htmlContent" name="htmlContent" ref="required" var="html内容"/>
<property id="jsContent" name="jsContent" ref="" var="js内容"/>
<property id="rowId" name="id" ref="required" var="动态表单内容id"/>
</url>
<!-- 动态表单系列结束 -->
</controller> </controller>
\ No newline at end of file
...@@ -50,11 +50,11 @@ layui.config({ ...@@ -50,11 +50,11 @@ layui.config({
top.winui.window.msg('请输入模板内容', {icon: 2,time: 2000}); top.winui.window.msg('请输入模板内容', {icon: 2,time: 2000});
}else{ }else{
var params = { var params = {
modelName: $("#modelName").val(), modelName: $("#modelName").val(),
modelContent: encodeURI(editor.getValue()), modelContent: encodeURI(editor.getValue()),
modelText: encodeURI(editor.getValue()), modelText: encodeURI(editor.getValue()),
modelType: $("#modelType").val(), modelType: $("#modelType").val(),
groupId: parent.groupId, groupId: parent.groupId,
}; };
AjaxPostUtil.request({url:reqBasePath + "codemodel007", params:params, type:'json', callback:function(json){ AjaxPostUtil.request({url:reqBasePath + "codemodel007", params:params, type:'json', callback:function(json){
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx',
'solr', 'sql', 'vue'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form;
var htmlEditor = CodeMirror.fromTextArea(document.getElementById("htmlContent"), {
mode : "xml", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
var jsEditor = CodeMirror.fromTextArea(document.getElementById("jsContent"), {
mode : "text/javascript", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
if(isNull(htmlEditor.getValue())){
top.winui.window.msg('请输入模板内容', {icon: 2,time: 2000});
}else{
var params = {
contentName: $("#contentName").val(),
htmlContent: encodeURI(htmlEditor.getValue()),
htmlType: $("#htmlType").val(),
jsContent: encodeURI(jsEditor.getValue()),
jsType: $("#jsType").val(),
};
AjaxPostUtil.request({url:reqBasePath + "dsform002", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
}
return false;
});
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx',
'solr', 'sql', 'vue'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form;
var htmlEditor, jsEditor;
showGrid({
id: "showForm",
url: reqBasePath + "dsform004",
params: {rowId: parent.rowId},
pagination: false,
template: getFileContent('tpl/dsformcontent/dsformcontenteditTemplate.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
htmlEditor = CodeMirror.fromTextArea(document.getElementById("htmlContent"), {
mode : "xml", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
jsEditor = CodeMirror.fromTextArea(document.getElementById("jsContent"), {
mode : "text/javascript", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : false, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
form.render();
form.on('submit(formEditBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
if(isNull(htmlEditor.getValue())){
top.winui.window.msg('请输入模板内容', {icon: 2,time: 2000});
}else{
var params = {
contentName: $("#contentName").val(),
htmlContent: encodeURI(htmlEditor.getValue()),
htmlType: $("#htmlType").val(),
jsContent: encodeURI(jsEditor.getValue()),
jsType: $("#jsType").val(),
rowId: parent.rowId
};
AjaxPostUtil.request({url:reqBasePath + "dsform005", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
}
return false;
});
}
});
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'form', 'codemirror', 'xml', 'clike', 'css', 'htmlmixed', 'javascript', 'nginx',
'solr', 'sql', 'vue'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
//表格渲染
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reqBasePath + 'dsform001',
where:{contentName:$("#contentName").val()},
even:true, //隔行变色
page: true,
limits: [8, 16, 24, 32, 40, 48, 56],
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'contentName', title: '模板标题', width: 120 },
{ field: 'htmlContent', title: 'HTML内容', width: 120, templet: function(d){
return '<i class="fa fa-fw fa-html5 cursor" lay-event="htmlContent"></i>';
}},
{ field: 'jsContent', title: 'JS内容', width: 120, templet: function(d){
if(!isNull(d.jsContent)){
return '<i class="fa fa-fw fa-html5 cursor" lay-event="jsContent"></i>';
}else{
return '-';
}
}},
{ field: 'createTime', title: '创建时间', width: 180 },
{ title: '操作', fixed: 'right', align: 'center', width: 240, toolbar: '#tableBar'}
]]
});
var editor = CodeMirror.fromTextArea(document.getElementById("modelContent"), {
mode : "text/x-java", // 模式
theme : "eclipse", // CSS样式选择
indentUnit : 2, // 缩进单位,默认2
smartIndent : true, // 是否智能缩进
tabSize : 4, // Tab缩进,默认4
readOnly : true, // 是否只读,默认false
showCursorWhenSelecting : true,
lineNumbers : true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
});
table.on('tool(messageTable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
if (layEvent === 'del') { //删除
del(data, obj);
}else if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'htmlContent') { //查看代码内容
var mode = returnModel(data.htmlType);
if (!isNull(mode.length)) {
editor.setOption('mode', mode)
}
editor.setValue(data.htmlContent);
layer.open({
id: 'HTML模板内容',
type: 1,
title: 'HTML模板内容',
shade: 0.3,
area: ['1200px', '600px'],
content: $("#modelContentDiv").html(),
});
}else if (layEvent === 'jsContent') { //查看代码内容
var mode = returnModel(data.jsType);
if (!isNull(mode.length)) {
editor.setOption('mode', mode)
}
editor.setValue(data.jsContent);
layer.open({
id: 'JS模板内容',
type: 1,
title: 'JS模板内容',
shade: 0.3,
area: ['1200px', '600px'],
content: $("#modelContentDiv").html(),
});
}
});
//搜索表单
form.render();
form.on('submit(formSearch)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
loadTable();
}
return false;
});
//删除
function del(data, obj){
var msg = obj ? '确认删除模板【' + obj.data.contentName + '】吗?' : '确认删除选中数据吗?';
layer.confirm(msg, { icon: 3, title: '删除模板' }, function (index) {
layer.close(index);
//向服务端发送删除指令
AjaxPostUtil.request({url:reqBasePath + "dsform003", params:{rowId: data.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
//编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/dsformcontent/dsformcontentedit.html",
title: "编辑模板内容",
pageId: "dsformcontentedit",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
}
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
//新增
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/dsformcontent/dsformcontentadd.html",
title: "新增模板内容",
pageId: "dsformcontentadd",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
});
function loadTable(){
table.reload("messageTable", {where:{contentName:$("#contentName").val()}});
}
exports('dsformcontentlist', {});
});
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">模板内容<i class="red">*</i></label> <label class="layui-form-label">模板内容<i class="red">*</i></label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea id="modelContent" ></textarea> <textarea id="modelContent"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
......
<!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/css/codemirror.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="contentName" name="contentName" win-verify="required" placeholder="请输入模板标题" class="layui-input" maxlength="20"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML内容类型<i class="red">*</i></label>
<div class="layui-input-block">
<select id="htmlType" name="htmlType" class="layui-input" win-verify="required" lay-filter="selectParent">
<option value="html">html</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML模板内容<i class="red">*</i></label>
<div class="layui-input-block">
<textarea id="htmlContent"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS内容类型<i class="red">*</i></label>
<div class="layui-input-block">
<select id="jsType" name="jsType" class="layui-input" win-verify="required" lay-filter="selectParent">
<option value="javascript">javascript</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS模板内容<i class="red">*</i></label>
<div class="layui-input-block">
<textarea id="jsContent"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle">取消</button>
<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/dsformcontent/'}).use('dsformcontentadd');
</script>
</body>
</html>
\ 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/css/codemirror.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">
</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/dsformcontent/'}).use('dsformcontentedit');
</script>
</body>
</html>
\ No newline at end of file
{{#bean}}
<div class="layui-form-item">
<label class="layui-form-label">模板标题<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="contentName" name="contentName" win-verify="required" placeholder="请输入模板标题" class="layui-input" maxlength="20" value="{{contentName}}"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML内容类型<i class="red">*</i></label>
<div class="layui-input-block">
<select id="htmlType" name="htmlType" class="layui-input" win-verify="required" lay-filter="selectParent">
<option value="html">html</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">HTML模板内容<i class="red">*</i></label>
<div class="layui-input-block">
<textarea id="htmlContent">{{htmlContent}}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS内容类型<i class="red">*</i></label>
<div class="layui-input-block">
<select id="jsType" name="jsType" class="layui-input" win-verify="required" lay-filter="selectParent">
<option value="javascript">javascript</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">JS模板内容<i class="red">*</i></label>
<div class="layui-input-block">
<textarea id="jsContent">{{jsContent}}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle">取消</button>
<button class="winui-btn" lay-submit lay-filter="formEditBean">保存</button>
</div>
</div>
{{/bean}}
\ 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/css/codemirror.css" rel="stylesheet" />
</head>
<body>
<div class="txtcenter" style="width:700px;margin:0 auto;padding-top:20px;">
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">模板标题</label>
<div class="layui-input-inline">
<input type="text" id="contentName" name="contentName" placeholder="请输入模板标题" class="layui-input" />
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block" style="margin:0;">
<button class="layui-btn" lay-submit lay-filter="formSearch">搜索</button>
</div>
</div>
</form>
</div>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增模板内容</button>
</div>
</div>
<div id="modelContentDiv" style="height:auto; position: fixed; left: 10000px;">
<textarea id="modelContent"></textarea>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
</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/dsformcontent/'}).use('dsformcontentlist');
</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.
先完成此消息的编辑!
想要评论请 注册