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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
| /**
| * 业务类型
| * @author weidy@2020-07-27
| */
| layui.define(['layer','element','form','table','util','platform/objectService/er/erContent'],function(exports){
| var Class = function(){
| this.MODELNAME = "platform/objectService/OsBtmType";
| this.moduleKey = "OsBtmType";
| this.id='OsBtmType';
| this.sourceData={};
| this.columns = [];
| this.backPath = configData.compatibility?path:configData.objectServicePath;
| this.url={
| controller:'btmTypeController/',
| dataGrid:'gridBtmType',
| listAttribute:'gridAttributeByBtmTypeOid',
| export2word:'exportBtmType2Word',
| export2excel:'exportBtmType2Excel',
| getER:'btmTypeController/createERDiagram',
| getUsedER:'btmTypeController/createERUsed'
| };
| this.buttonIconMap = {
| SEARCH:'layui-icon-refresh-2',
| SENIORSEARCH:'layui-icon-query',
| ADD:'layui-icon-add-1',
| EDIT:'layui-icon-edit',
| DELETE:'layui-icon-delete'
| };
| this.vciFieldTypeMap = {
| VTBoolean:"布尔型",
| VTClob: "长文本",
| VTDate:"日期",
| VTDateTime:"日期时间",
| VTTime:"时间",
| VTLong:"长整型",
| VTDouble:"金额/双精度",
| VTInteger:"整形",
| VTFilePath:"文件",
| VTString:"字符串"
| };
| this.getContent=function(){
| var that = this;
| var html = "";
| html = [
| '<div class="layui-layout-border">',
| '<div class="layui-center">',
| that.getToolbarHtml(),
| '<table id="table_', that.id , '" lay-filter="',that.id , '" style="overflow-x:auto;"></table>',
| '</div>',
| '<div class="layui-south" >',
| '<table id="detail_table_',that.id ,'" lay-filter="detail_table_', that.id ,'"></table>',
| '</div>',
| '</div>'
| ].join("");
| return html;
| };
| this.getToolbarHtml =function(){
| var that = this;
| var html = [
| '<div layui-filter="toolbar_button_',that.id,'" class="layui-btn-container">',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_EXPORTWORD"><i class="layui-icon layui-icon-export"></i>导出到word</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_VIEWER"><i class="layui-icon layui-icon-engine"></i>查看E-R图</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_VIEWUSEER"><i class="layui-icon layui-icon-engine"></i>查看E-R图(引用)</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_EXPORTEXCEL"><i class="layui-icon layui-icon-export"></i>导出到数据字典</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_CLEARCACHE"><i class="layui-icon layui-icon-export"></i>刷新服务器缓存</button>',
| '<button class="layui-btn layui-btn-sm" layui-filter="toolbar_',that.id,'_refresh"><i class="layui-icon layui-icon-refresh"></i>刷新</button>',
| '</div>',
| ].join("");
| return html;
| };
| this.init=function(){//基础的html被添加后,再执行初始化
| var that = this;
| $webUtil.copyConfig(that,that.moduleKey);
| var table = layui.table;
| that.checkColumns();//主列表中列。
| that.firstGridLoad = false;
| table.render({
| elem: '#table_' + that.id,
| id: 'table_' + that.id,
| url: that.url.controller + that.url.dataGrid,
| backPath:that.backPath,
| page: {
| limit: 20,
| page: 1
| },
| selectMode:table.selectMode.muti,
| cols: [that.columns],
| rowClick:function(filter,data){
| if(data){
| that.gridAttributeByOid(data.oid);
| }
| },
| done:function(res, cur, count){
| if(!that.firstGridLoad) {
| that.initDetailTable(((res && res.data) ? res.data[0].oid : ""));
| that.firstGridLoad = true;
| }else{
| if(count>0){
| that.gridAttributeByOid(res.data[0].oid);
| }
| }
| }
| });
| $webUtil.createSearchHtml({
| id:'英文名称',
| name:'中文名称'
| },$("[layui-filter='toolbar_button_" + that.id + "']"),'table_' + that.id);
| $webUtil.bindDefultButtonLisenter(that, that.id);
| };
| this.checkColumns = function(){
| var that = this;
| var table = layui.table;
| if(that.columns==null || that.columns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列
| that.columns = [table.getIndexColumn(),table.getCheckColumn(),{
| field:'id',
| title:'业务类型英文',
| width:130
| },{
| field:'name',
| title:'业务类型中文',
| width:150
| },{
| field:'description',
| title:'描述',
| width:150
| },{
| field:'tableName',
| title:'数据库表',
| width:140
| },{
| field:'revisionRuleId',
| title:'版本规则',
| width:130,
| templet:function(d){
| if(!d.revisionFlag){
| return '不控制版本';
| }else{
| return d.revisionRuleId + ' ' + d.revisionRuleName;
| }
| }
| },{
| field:'lifeCycleFlag',
| title:'生命周期',
| width:200,
| templet:function(d){
| if(!d.lifeCycleFlag){
| return '不控制生命周期';
| }else{
| return d.lifeCycleId + ' ' + d.lifeCycleName;
| }
| }
| },{
| field:'secretFlag',
| title:'控制密级',
| width:80,
| templet:function(d){
| return $webUtil.formateBoolean(d.secretFlag);
| }
| },{
| field:'viewFlag',
| title:'是否为视图',
| width:90,
| templet:function(d){
| return $webUtil.formateBoolean(d.viewFlag);
| }
| },{
| field:'versionRule',
| title:'版次规则',
| width:110
| }];
| }
| };
| this.gridAttributeByOid = function(btmTypeOid){
| var that = this;
| if($webUtil.isNull(btmTypeOid)){
| return;
| }
| layui.table.reload("detail_" + that.id,{
| where:{
| btmTypeOid: btmTypeOid
| }
| });
| };
| this.initDetailTable = function(btmTypeOid){
| var that = this;
| var table = layui.table;
| that.checkDetailColumns();
| table.render({
| elem: '#detail_table_' + that.id,
| id: 'detail_' + that.id,
| backPath:that.backPath,
| url: that.url.controller + that.url.listAttribute,
| where:{
| btmTypeOid:btmTypeOid
| },
| cols: [that.detailColumns]
| });
| };
| this.checkDetailColumns = function () {
| var that = this;
| var table = layui.table;
| if(that.detailColumns==null || that.detailColumns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列
| that.detailColumns = [table.getIndexColumn(),table.getCheckColumn(),{
| field:'id',
| title:'属性英文名称',
| width:150
| },{
| field:'name',
| title:'属性中文名称',
| width:200
| },{
| field:'attributeLength',
| title:'长度',
| width:80
| },{
| field:'attrDataType',
| title:'数据类型',
| width:80,
| templet:function(d){
| return that.vciFieldTypeMap[d.attrDataType] || that.vciFieldTypeMap[d.attributeDataType];
| }
| },{
| field:'nullableFlag',
| title:'是否可以为空',
| width:120,
| templet:function(d){
| return $webUtil.formateBoolean(d.nullableFlag);
| }
| },{
| field:'defaultValue',
| title:'默认值',
| width:80
| },{
| field:'precisionLength',
| title:'小数精度',
| width:80
| },{
| field:'scaleLength',
| title:'小数刻度',
| width:80
| },{
| field:'range',
| title:'取值范围',
| width:100
| },{
| field:'referFlag',
| title:'是否参照',
| width:130,
| templet:function(d){
| if(!d.referFlag){
| return '否';
| }else{
| return d.referBtmTypeId
| }
| }
| },{
| field:'enumFlag',
| title:'是否枚举',
| width:130,
| templet:function(d){
| if(!d.enumFlag){
| return '否';
| }else{
| return d.enumId
| }
| }
| }];
| }
| };
| this.refresh = function(){
| var that = this;
| layui.table.reload("table_" + that.id);
| };
| this.VIEWER = function(){
| //er图
| var that = this;
| var idFromGrid = $webUtil.getOidFromGrid("table_" + that.id,true,true,"id");
| var nameFromGrid = $webUtil.getOidFromGrid("table_" + that.id,true,true,"name");
| if(!idFromGrid){
| return false
| }
| var erContent = layui['platform/objectService/er/erContent'];
| var filter = "er_" + that.id;
| var erIndex = layer.open({
| type: 1,
| title: nameFromGrid+' E-R图 (不支持IE8)',
| content: '<div id="' + filter + '" ></div>',
| fullScreen:true,
| shade: true,
| shadeClose: true,
| resize: false,
| success: function (layero) {
| $("#" + filter).html(erContent.getContent(idFromGrid));
| erContent.init(idFromGrid,{
| id:idFromGrid,
| url:that.url.getER
| });
| }
| });
| };
| this.VIEWUSEER = function (){
| //使用当前业务类型的
| var that = this;
| var idFromGrid = $webUtil.getOidFromGrid("table_" + that.id,true,true,"id");
| var nameFromGrid = $webUtil.getOidFromGrid("table_" + that.id,true,true,"name");
| if(!idFromGrid){
| return false;
| }
| var erContent = layui['platform/objectService/er/erContent'];
| var filter = "er_" + that.id;
| var erIndex = layer.open({
| type: 1,
| title: "引用 " +nameFromGrid+' E-R图 (不支持IE8)',
| content: '<div id="' + filter + '" ></div>',
| fullScreen:true,
| shade: true,
| shadeClose: true,
| resize: false,
| success: function (layero) {
| $("#" + filter).html(erContent.getContent(idFromGrid));
| erContent.init(idFromGrid, {
| id: idFromGrid,
| url: that.url.getUsedER
| });
| }
| });
| };
| this.EXPORTWORD = function(){
| //导出word
| var that = this;
| var oidFromGrid = $webUtil.getOidFromGrid("table_" + that.id,false,false,"id");
| $webUtil.fileDownloadPost(that.backPath + that.url.controller + that.url.export2word,{btmTypeIds:oidFromGrid});
| };
| this.EXPORTEXCEL = function(){
| var that = this;
| var oidFromGrid = $webUtil.getOidFromGrid("table_" + that.id,false,false,"id");
| $webUtil.fileDownloadPost(that.backPath + that.url.controller + that.url.export2excel,{btmTypeIds:oidFromGrid});
| };
| this.CLEARCACHE = function (){
| var that = this;
| $webUtil.get("/webUIController/clearCache",{},function (result){
| if(result.success){
| $webUtil.showMsgFromResult(result,"执行成功");
| }else{
| $webUtil.showErrorMsg(result.msg);
| }
| },function (error,xhr){
| $webUtil.showErrorMsg("没有链接上后台服务");
| },that.backPath)
| }
| };
| var cs = new Class();
| exports(cs.MODELNAME,cs);
| });
|
|