/** * 代码预览 * @author weidy * @date 2020/08/3 */ layui.define(['layer','element','code','util'],function(exports){ var Class = function(){ this.MODELNAME = "platform/objectService/OsCodePreview"; this.moduleKey = "OsCodePreview"; this.id='OsCodePreview'; this.sourceData={}; this.columns = []; this.backPath = configData.compatibility?path:configData.objectServicePath; this.url={ controller:'codeGenSchemaController/', preview:'previewCodeFile' }; this.getContent=function(){ var that = this; var html = ""; html = [ '
', '
', '
', '
    ', '
  • VO
  • ', '
  • DTO
  • ', '
  • Mapper
  • ', '
  • Mapper.xml
  • ', '
  • Service
  • ', '
  • Service.Impl
  • ', '
  • Controller
  • ', '
  • UI
  • ', '
  • PO
  • ', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
', '
' ].join(""); return html; }; this.init = function(){ var that = this; $webUtil.copyConfig(that,that.moduleKey); var schemaOid = ""; if(that.sourceData){ schemaOid = that.sourceData['oid']; } if($webUtil.isNull(schemaOid)){ $webUtil.showErrorMsg("没有代码生成方案的主键"); return false; } $webUtil.post(that.url.controller + that.url.preview,{oid:schemaOid},function(result){ if(result.success){ for(var key in result.obj){ $("#" + that.id + "_" + key).html('
' + result.obj[key] + "
"); } if(!"PO" in result.obj){ $("#" + that.id + "_PO").html(""); } layui.element.render(); }else{ $webUtil.showErrorMsg(result.msg); } },function(xhr,error){ $webUtil.showErrorMsg("查看代码内容失败,可能是服务器没有启动"); },that.backPath); } }; var cs = new Class(); exports(cs.MODELNAME,cs); });