|
|
|
@ -13,49 +13,86 @@
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<table class="layui-table" lay-filter="idTest" id="idTest"></table>
|
|
|
|
|
<script type="text/html" id="barDemo">
|
|
|
|
|
<script type="text/html" id="bar1">
|
|
|
|
|
{{#if(d.filled){ }}
|
|
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="modify">修改</a>
|
|
|
|
|
<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 type="text/html" id="bar2">
|
|
|
|
|
{{#if(d.doc_file){ }}
|
|
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-warm update_doc" lay-event="upload_doc" page="{{d.page}}">重新上传</a>
|
|
|
|
|
{{#}else{ }}
|
|
|
|
|
{{#if(d.filled){ }}
|
|
|
|
|
<a class="layui-btn layui-btn-xs layui-btn upload_doc" lay-event="upload_doc" page="{{d.page}}">上传</a>
|
|
|
|
|
{{#} }}
|
|
|
|
|
{{#} }}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
layui.use(['layer', 'form', 'table'], function () {
|
|
|
|
|
layui.use(['layer', 'form', 'table', 'upload'], function () {
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
var upload = layui.upload; //得到 upload 对象
|
|
|
|
|
|
|
|
|
|
//需要获取当前的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("已填写");
|
|
|
|
|
|
|
|
|
|
function bindTable() {
|
|
|
|
|
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', templet: function (d) {
|
|
|
|
|
if (d.json.length > 2)
|
|
|
|
|
return '已填写'
|
|
|
|
|
else
|
|
|
|
|
return '待填写'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
, {fixed: 'right', title: '页面构建', toolbar: '#bar1', align: 'center', width: 240}
|
|
|
|
|
, {fixed: 'right', title: '模板上传', toolbar: '#bar2', align: 'center', width: 240}
|
|
|
|
|
]]
|
|
|
|
|
, page: false
|
|
|
|
|
, height: 'full'
|
|
|
|
|
, done: function (res) {
|
|
|
|
|
//创建一个上传组件
|
|
|
|
|
upload.render({
|
|
|
|
|
elem: '.upload_doc'
|
|
|
|
|
, url: '/FengHuang/zjb/uploadDoc?module_id=' + module_id,
|
|
|
|
|
before: function () {
|
|
|
|
|
var tableElem = this.item;
|
|
|
|
|
let page = tableElem.attr('page');
|
|
|
|
|
this.url = this.url + "&page=" + page;
|
|
|
|
|
},
|
|
|
|
|
done: function () {
|
|
|
|
|
layer.msg('保存成功!', {icon: 1, time: 1500},
|
|
|
|
|
function (index) {
|
|
|
|
|
bindTable();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
accept: 'file',
|
|
|
|
|
acceptMime: "application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
|
|
exts: 'docx|doc', //只允许上传word文件
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bindTable();
|
|
|
|
|
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;
|
|
|
|
|
window.location.href = "designModulePage.html?module_id=" + module_id + "&page=" + data.page;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|