main
黄海 3 years ago
parent 3cc3b6a12c
commit 439548129e

@ -14,11 +14,13 @@
<table class="layui-table" lay-filter="idTest" id="idTest"></table>
<script type="text/html" id="barDemo">
{{#if(d.filled){ }}
{{#if(d.page_finish){ }}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="modify">修改</a>
{{#}else{ }}
{{#if(d.module_finish){ }}
<a class="layui-btn layui-btn-xs layui-btn" lay-event="modify">填写</a>
{{#} }}
{{#} }}
</script>
<script>
@ -37,20 +39,22 @@
}
, cols: [[
{field: '', title: '序号', align: 'center', type: 'numbers', fixed: true, width: '5%'}
, {field: 'json', title: '内容', align: 'center'}
, {field: 'module_finish', title: '模板', align: 'center',templet:function(d){
if(d.module_finish== 0)
return '未填写'
else
return '已填写'
}}
, {field: 'page_finish', title: '内容', align: 'center',templet:function(d){
if(d.page_finish== 0)
return '未填写'
else
return '已填写'
}}
, {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;

@ -102,16 +102,29 @@ public class ZjbModel {
_map.put(r1.getInt("page"), r1.getStr("json"));
}
//模板的填充完成情况
sql = "select * from t_zjb_module_page where module_id=?";
List<Record> listModuleFinish = Db.find(sql, module_id);
Map<Integer, String> _mapModuleFinish = new HashMap<>();
for (Record r2 : listModuleFinish) {
_mapModuleFinish.put(r2.getInt("page"), r2.getStr("json"));
}
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);
r.set("page_finish", true);
} else {
r.set("json", "[]");
r.set("filled", false);
r.set("page_finish", false);
}
if (_mapModuleFinish.containsKey(i)) {
r.set("module_finish", true);
} else {
r.set("module_finish", false);
}
res.add(r);
}

Loading…
Cancel
Save