1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
| /**
| * 代码预览
| * @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 = [
| '<div class="layui-layout-border">',
| '<div class="layui-center">',
| '<div class="layui-tab">',
| '<ul class="layui-tab-title">',
| '<li class="layui-this">VO</li>',
| '<li>DTO</li>',
| '<li>Mapper</li>',
| '<li>Mapper.xml</li>',
| '<li>Service</li>',
| '<li>Service.Impl</li>',
| '<li>Controller</li>',
| '<li>UI</li>',
| '<li>PO</li>',
| '</ul>',
| '<div class="layui-tab-content">',
| '<div class="layui-tab-item layui-show" id="',that.id ,'_VO"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_DTO"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_Mapper"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_Mapperxml"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_Service"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_ServiceImpl"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_Controller"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_UI"> </div>',
| '<div class="layui-tab-item" id="',that.id ,'_PO"> </div>',
| '</div>',
| '</div>',
| '</div>',
| '</div>'
| ].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('<pre class="layui-code" lay-encode="true" lay-skin="notepad">' + result.obj[key] + "</pre>");
| }
| 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);
| });
|
|