/**
|
* markdown文件预览
|
* @author weidy@2021-3-16
|
* @constructor
|
*/
|
layui.define(['layer','element','form','table','tree'],function(exports){
|
var MD = function(){
|
this.MODELNAME = "platform/objectService/VciMd";
|
this.moduleKey = "VciMd";
|
this.id='VciMd';
|
this.sourceData={};
|
this.backPath = configData.compatibility?path:configData.objectServicePath;
|
this.url={
|
controller:'mdController/',
|
tree:'treeAllMD'
|
};
|
this.getContent=function(){
|
var that = this;
|
var html = "";
|
html = [
|
that.getToolbarHtml(),
|
'<div class="layui-layout" style="display:block;overflow-y: hidden">',
|
'<div class="layui-vci-tree" style="width:200px;float: left;background-color:#ffffff;overflow-y: auto;padding-top: 10px;">',
|
'<ul layui-filter="tree_',that.id,'" style="overflow-x: auto;"><ul>',
|
'</div>',
|
'<div class="layui-layout-border" style="display:block;margin-top:0px;margin-left:205px;">',
|
'<div class="layui-center" style="overflow-y:auto;" id="md_',that.id,'">',
|
'</div>',
|
'</div>',
|
'</div>'
|
].join("");
|
return html;
|
};
|
this.getToolbarHtml = function(){
|
var that = this;
|
return ['<div layui-filter="toolbar_',that.id, '" class="layui-btn-container">',//主列表的按钮
|
'<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_refresh"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
|
'</div>'].join("");
|
};
|
this.init=function(){//基础的html被添加后,再执行初始化
|
var that = this;
|
$webUtil.copyConfig(that,that.moduleKey);
|
var tree = layui.tree;
|
var scrollHeight = window.innerHeight;
|
var treeUL = $('[layui-filter="tree_' + that.id + '"]');
|
var treeHeight = scrollHeight - 200;
|
treeUL.parent().height(treeHeight);
|
tree.init("tree_" + that.id, treeUL, {
|
url: that.url.controller + that.url.tree,
|
backPath: that.backPath,
|
showSearch:true,
|
loadType:tree.loadType.all,
|
click: function (item, elem, options) {
|
that.showMd(item.oid);
|
}
|
});
|
$webUtil.bindDefultButtonLisenter(that, that.id);
|
};
|
this.showMd = function (fileName) {
|
var that = this;
|
$("#md_" + that.id).html('<iframe src="' + projectName +'jslib/layui-2.2.5-debug/lay/platform/objectService/md.html?url=' + (that.backPath + "doc/" + fileName + "?" + TOKEN_KEY + "=" + $webUtil.getToken()) + '" frameborder="none" width="100%" height="' + (window.innerHeight - 250) + '"></iframe>');
|
};
|
this.refresh = function(){
|
var that = this;
|
var tree = layui.tree;
|
tree.reload("tree_" + that.id);
|
};
|
};
|
var md = new MD();
|
exports(md.MODELNAME,md);
|
});
|