main
黄海 3 years ago
parent af05a0f235
commit ba678973c9

@ -3,5 +3,4 @@
每个任务有多个模板, 每个任务有多个模板,
http://10.10.11.124:9000/FengHuang/html/formDesign/listPageInfo.html?module_id=1
http://10.10.11.124:9000/FengHuang/html/formDesign/index.html

@ -4647,8 +4647,8 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
layer.closeAll(); layer.closeAll();
layer.msg('导入成功'); layer.msg('导入成功');
}); });
//注册导出数据
$('.exportJson').on('click', function () { function save(flag) {
//需要获取当前的url中参数module_id和page //需要获取当前的url中参数module_id和page
let module_id = $.getUrlParam('module_id'); let module_id = $.getUrlParam('module_id');
let page = $.getUrlParam('page'); let page = $.getUrlParam('page');
@ -4669,10 +4669,27 @@ layui.config({base: './ayq/modules/'}).define(["layer", 'flow', "laytpl", "eleme
}, },
async: false, async: false,
success: function (result) { success: function (result) {
layer.msg('保存成功!', {icon: 1,time:1500}) layer.msg('保存成功!', {icon: 1, time: 1500},
function (index) {
if (flag) window.location.href = "listPageInfo.html?module_id=" + module_id;
}
);
return; return;
} }
}); });
}
//保存
$('.exportJson').on('click', function () {
save(false);
})
//保存&返回
$('.saveAndPrePage').on('click', function () {
save(true);
})
//直接返回
$('.prePage').on('click', function () {
history.back();
}) })
$('.generateCode').on('click', function () { $('.generateCode').on('click', function () {

@ -175,12 +175,12 @@ layui.define(['layer'], function (exports) {
' <li class="layui-nav-item">\n' + ' <li class="layui-nav-item">\n' +
' <a id="btnExportJson" href="#" class="exportJson">保存</a>\n' + ' <a id="btnExportJson" href="#" class="exportJson">保存</a>\n' +
' </li>\n' + ' </li>\n' +
// ' <li class="layui-nav-item">\n' + ' <li class="layui-nav-item">\n' +
// ' <a href="#" class="previewForm">查看测试页</a>\n' + ' <a href="#" class="saveAndPrePage">保存&返回</a>\n' +
// ' </li>\n' + ' </li>\n' +
// ' <li class="layui-nav-item">\n' + ' <li class="layui-nav-item">\n' +
// ' <a href="#" class="generateCode">生成代码</a>\n' + ' <a href="#" class="prePage">直接返回</a>\n' +
// ' </li>\n' + ' </li>\n' +
' </ul>\n' + ' </ul>\n' +
' </div>\n' + ' </div>\n' +
' <div class="layui-side">\n' + ' <div class="layui-side">\n' +

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>模板内容构建</title>
<link href="./layui/css/layui.css" rel="stylesheet">
<script src="./layui/layui.js"></script>
<!--引用新版本Jquery-->
<script type="text/javascript" src="../../js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../js/jquery_Extend.js"></script>
</head>
<body>
<table class="layui-table" lay-filter="idTest" id="idTest"></table>
<script type="text/html" id="barDemo">
{{#if(d.filled){ }}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="modify">修改</a>
{{#}else{ }}
<a class="layui-btn layui-btn-xs layui-btn" lay-event="modify">设置</a>
{{#} }}
</script>
<script>
layui.use(['layer', 'form', 'table'], function () {
var layer = layui.layer;
var form = layui.form;
var table = layui.table;
//需要获取当前的url中参数module_id和page
let module_id = $.getUrlParam('module_id');
table.render({
elem: '#idTest'
, url: '/FengHuang/zjb/getModulePageFillInfo'
, where: {
module_id: module_id
}
, cols: [[
{field: '', title: '序号', align: 'center', type: 'numbers', fixed: true, width: '5%'}
, {field: 'json', title: '内容', align: 'center'}
, {fixed: 'right', title: '操作', toolbar: '#barDemo', align: 'center', width: 480}
]]
, page: false
, height: 'full'
, done: function (res) {
$("[data-field='json']").children().each(function () {
if ($(this).text() == "[]") {
$(this).text("未填写");
} else {
$(this).text("已填写");
}
})
}
});
table.on('tool(idTest)', function (obj) {
var data = obj.data;
if (obj.event === "modify") {
window.location.href = "designModulePage.html?module_id=" + module_id + "&page=" + data.page;
}
});
});
</script>
</body>
</html>

@ -7,6 +7,9 @@ import com.jfinal.aop.Before;
import com.jfinal.core.Controller; import com.jfinal.core.Controller;
import com.jfinal.ext.interceptor.GET; import com.jfinal.ext.interceptor.GET;
import com.jfinal.ext.interceptor.POST; import com.jfinal.ext.interceptor.POST;
import com.jfinal.plugin.activerecord.Record;
import java.util.List;
public class ZjbController extends Controller { public class ZjbController extends Controller {
ZjbModel zm = new ZjbModel(); ZjbModel zm = new ZjbModel();
@ -24,4 +27,11 @@ public class ZjbController extends Controller {
String json = zm.getModulePage(module_id, page); String json = zm.getModulePage(module_id, page);
renderJson(json); renderJson(json);
} }
@Before({GET.class})
@IsNumericInterface({"module_id"})
public void getModulePageFillInfo(int module_id) {
List<Record> list = zm.getModulePageFillInfo(module_id);
renderJson(CommonUtil.renderJsonForLayUI(list));
}
} }

@ -8,7 +8,10 @@ import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara; import com.jfinal.plugin.activerecord.SqlPara;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class ZjbModel { public class ZjbModel {
@ -43,4 +46,34 @@ public class ZjbModel {
if (list.size() > 0) return list.get(0).getStr("json"); if (list.size() > 0) return list.get(0).getStr("json");
return "[]"; return "[]";
} }
public Record getMoudleInfo(int module_id) {
String sql = "select * from t_zjb_module where module_id=?";
return Db.findFirst(sql, module_id);
}
public List<Record> getModulePageFillInfo(int module_id) {
String sql = "select * from t_zjb_module_page where module_id=?";
List<Record> exist = Db.find(sql, module_id);
Map<Integer, String> _map = new HashMap<>();
for (Record record : exist) {
_map.put(record.getInt("page"), record.getStr("json"));
}
Record record = getMoudleInfo(module_id);
int page_count = record.getInt("page_count");
List<Record> res = new ArrayList<>();
for (int i = 1; i <= page_count; i++) {
Record r = new Record();
r.set("page", i);
if (_map.containsKey(i)) {
r.set("json", _map.get(i));
r.set("filled", true);
} else {
r.set("json", "[]");
r.set("filled", false);
}
res.add(r);
}
return res;
}
} }
Loading…
Cancel
Save