赖素文
authored
about a year ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ------------------------------------------------------------------------------
// < auto - generated >
// 此代码由工具生成。
// 运行时版本 : 17.0 . 0.0
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,这些更改将会丢失。
// </ auto - generated >
// ------------------------------------------------------------------------------
namespace Hh.Mes.T4
{
using System.Linq ;
using System ;
/// < summary >
/// Class to produce the template output
/// </ summary >
赖素文
authored
12 months ago
19
# line 1 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[ global :: System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.VisualStudio.TextTemplating" , "17.0.0.0" )]
public partial class JavaScriptTemplate : JavaScriptTemplateBase
{
# line hidden
/// < summary >
/// Create the template output
/// </ summary >
public virtual string TransformText ()
{
this . Write ( @" let action = null ;
layui . config ({
base : "" / js / "" ,
version : 1
}). use ([ ' system ' ], function () {
var form = layui . form ,
$ = layui . jquery ,
element = layui . element ,
table = layui . table ,
system = layui . system ,
sysU = new system . u (),
sendDataWhere = null ,
sendDataDescWhere = null ,
areaName = "" " );
赖素文
authored
12 months ago
44
# line 15 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
45
46
47
48
49
50
this . Write ( this . ToStringHelper . ToStringWithCulture ( AreaName ));
# line default
# line hidden
this . Write ( "\",\r\n controllerName = \"" );
赖素文
authored
12 months ago
51
# line 16 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
52
53
54
55
this . Write ( this . ToStringHelper . ToStringWithCulture ( ControllerName ));
# line default
# line hidden
唐召明
authored
about a year ago
56
57
this . Write ( "\",\r\n app = null;\r\n\r\n action = {\r\n addOptions" );
赖素文
authored
12 months ago
58
# line 20 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
59
60
61
62
63
64
65
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function () {\r\n var options = {\r\n fromId: \"#modifyFor" +
"m" );
赖素文
authored
12 months ago
66
# line 22 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
67
68
69
70
71
72
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( " form\",\r\n url: `/${areaName}/${controllerName}/Ins" );
赖素文
authored
12 months ago
73
# line 23 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
74
75
76
77
78
79
80
81
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n //sendDataWhere: null,\r\n //isAddWhereExtend: \"" +
"arbitrarily\",\r\n //mainTable: app.data.tableIns,\r\n " +
"submit: \"submit(fromAdd" );
赖素文
authored
12 months ago
82
# line 27 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
83
84
85
86
87
88
89
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ")\"\r\n }\r\n return options;\r\n },\r\n\r\n editOptions" +
"" );
赖素文
authored
12 months ago
90
# line 32 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
91
92
93
94
95
96
97
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function () {\r\n var options = {\r\n fromId: \"#modifyFor" +
"m" );
赖素文
authored
12 months ago
98
# line 34 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
99
100
101
102
103
104
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( " form\",\r\n url: `/${areaName}/${controllerName}/Upd" );
赖素文
authored
12 months ago
105
# line 35 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
106
107
108
109
110
111
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n submit: \"submit(fromUpdate" );
赖素文
authored
12 months ago
112
# line 36 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
113
114
115
116
117
118
119
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ")\"\r\n }\r\n return options;\r\n },\r\n\r\n deleteOptio" +
"ns" );
赖素文
authored
12 months ago
120
# line 41 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
121
122
123
124
125
126
127
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function () {\r\n var options = {\r\n url: `/${areaName}/" +
"${controllerName}/DelByIds" );
赖素文
authored
12 months ago
128
# line 43 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
129
130
131
132
133
134
135
136
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n keyId: \"id\"\r\n }\r\n return options;\r\n " +
" },\r\n\r\n exportOptions: function () {\r\n var options = {\r\n " +
" fromId: \"listForm" );
赖素文
authored
12 months ago
137
# line 51 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( @"" " ,
url : ` / $ { areaName }/ $ { controllerName }/ Export ` ,
isDefault : false ,
sendDataWhere :{},
excelCols : {
head : app . data . cols ,
body : app . data . colsDesc
}
}
return options ;
},
queryOptions " );
赖素文
authored
12 months ago
156
# line 63 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
157
158
159
160
161
162
163
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function () {\r\n var options = {\r\n resetFrom: \"form[la" +
"y-filter=listForm" );
赖素文
authored
12 months ago
164
# line 65 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
165
166
167
168
169
170
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "]\",\r\n fromId: \"listForm" );
赖素文
authored
12 months ago
171
# line 66 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
172
173
174
175
176
177
178
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "\",\r\n urlExport: `/${areaName}/${controllerName}/Export`,\r\n " +
" urlQuery: `/${areaName}/${controllerName}/Load" );
赖素文
authored
12 months ago
179
# line 68 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
180
181
182
183
184
185
186
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n sendDataWhere:{},\r\n mainTable: app.data.tableI" +
"ns" );
赖素文
authored
12 months ago
187
# line 70 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
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
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( @"
}
return options ;
},
/* rowClickOptions : function () {
var options = {
// 是否主子表
isDefault : true ,
targetTableId : app . data . tableElem ,
tabfilter : "" tableTabBody "" ,
tabId : 2 ,
customFn : app . methods . initTableDesc
}
return options ;
},*/
uploadOptions : function () {
var options = {
url : ` / $ { areaName }/ $ { controllerName }/ Import ` ,
fromFile : "" # excelfile "" ,
content : $ ( "" # ImportData "" )
}
return options ;
},
addBefore " );
赖素文
authored
12 months ago
218
# line 94 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
219
220
221
222
223
224
225
226
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function (callBack) {\r\n //callBack是回调函数,如果editBefore有ajax 放在成功之后\r\n " +
" if (callBack != null) callBack();\r\n },\r\n\r\n addSaveBefore" +
"" );
赖素文
authored
12 months ago
227
# line 99 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
228
229
230
231
232
233
234
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function (data, callBack) {\r\n if (callBack != null) callBack();\r\n " +
" },\r\n editBefore" );
赖素文
authored
12 months ago
235
# line 102 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
236
237
238
239
240
241
242
243
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function (data, callBack) {\r\n //data.enable = data.enable.toString()" +
";\r\n form.val(\"modifyForm\", data);\r\n if (callBack != null) " +
"callBack();\r\n },\r\n editSaveBefore" );
赖素文
authored
12 months ago
244
# line 107 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
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
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( @" : function ( data , callBack ) {
if ( callBack != null ) callBack ();
},
checkboxMethod : function ( obj ) {
var page = """" . GetUrlParam ( "" page "" ),
xxx = """" . GetUrlParam ( "" xxx "" );
if ( page == "" xxx "" ) {
var sendData = {
};
var ajaxConfig = {
data : sendData ,
url : `$ { areaName }/ $ { controllerName }/ xxx ` ,
success : function ( result ) {
if ( sysU . successBefore ( result )) return false ;
layer . msg ( result . Message );
}
};
sysU . ajax ( ajaxConfig );
}
},
// 所有动作成功之后
actionSuccess : ( flag ) => {
赖素文
authored
12 months ago
273
274
275
276
277
var data = null ;
if ( flag . includes ( "" Desc "" )) {
data = sendDataDescWhere ;
}
sysU . refreshTable ( app , sysU , data , flag );
唐召明
authored
about a year ago
278
279
280
281
282
283
284
285
286
287
},
closeAfter : function ( callBack ) {
if ( callBack != null ) callBack ();
}
}
app = {
data : {
cols " );
赖素文
authored
12 months ago
288
# line 144 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
289
290
291
292
293
294
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": [[\r\n { checkbox: true, fixed: true },\r\n" );
赖素文
authored
12 months ago
295
# line 146 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
296
297
298
299
300
if ( Data . Any ( x => x . Key . Equals ( "id" , StringComparison . OrdinalIgnoreCase )))
# line default
# line hidden
赖素文
authored
12 months ago
301
# line 147 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
302
303
304
305
306
307
{
# line default
# line hidden
this . Write ( " { field: \"id\", width: 80, hide: true, title: \"Id\" },\r\n" );
赖素文
authored
12 months ago
308
# line 149 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
309
310
311
312
313
}
# line default
# line hidden
赖素文
authored
12 months ago
314
# line 150 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
315
316
317
318
319
if ( Data . Any ( x => x . Key . Equals ( "keys" , StringComparison . OrdinalIgnoreCase )))
# line default
# line hidden
赖素文
authored
12 months ago
320
# line 151 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
321
322
323
324
325
326
{
# line default
# line hidden
this . Write ( " { field: \"keys\", width: 80, hide: true, title: \"Keys\" },\r\n" );
赖素文
authored
12 months ago
327
# line 153 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
328
329
330
331
332
}
# line default
# line hidden
赖素文
authored
12 months ago
333
# line 154 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
334
335
336
337
338
foreach ( var item in Data )
# line default
# line hidden
赖素文
authored
12 months ago
339
# line 155 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
340
341
342
343
344
{
# line default
# line hidden
赖素文
authored
12 months ago
345
# line 156 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
346
347
348
349
350
if ( item . Key . Equals ( "Id" , StringComparison . OrdinalIgnoreCase ) || item . Key . Equals ( "Keys" , StringComparison . OrdinalIgnoreCase ))
# line default
# line hidden
赖素文
authored
12 months ago
351
# line 157 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
352
353
354
355
356
{ continue ; }
# line default
# line hidden
赖素文
authored
12 months ago
357
# line 158 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
358
359
360
361
362
if (! string . IsNullOrWhiteSpace ( item . Value ))
# line default
# line hidden
赖素文
authored
12 months ago
363
# line 159 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
364
365
366
367
368
369
{
# line default
# line hidden
this . Write ( " { field: \"" );
赖素文
authored
12 months ago
370
# line 160 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
371
372
373
374
375
376
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\", width: 150, title: \"" );
赖素文
authored
12 months ago
377
# line 160 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
378
379
380
381
382
383
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Value ));
# line default
# line hidden
this . Write ( "\" },\r\n" );
赖素文
authored
12 months ago
384
# line 161 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
385
386
387
388
389
390
} else {
# line default
# line hidden
this . Write ( " { field: \"" );
赖素文
authored
12 months ago
391
# line 162 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
392
393
394
395
396
397
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\", width: 150, title: \"" );
赖素文
authored
12 months ago
398
# line 162 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
399
400
401
402
403
404
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\" },\r\n" );
赖素文
authored
12 months ago
405
# line 163 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
406
407
408
409
410
}
# line default
# line hidden
赖素文
authored
12 months ago
411
# line 164 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
412
413
414
415
}
# line default
# line hidden
唐召明
authored
about a year ago
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
this . Write ( @" ]],
colsDesc : null ,
tableIns : null ,
tableElem : "" mainList "" ,
tableInsDesc : null ,
tableElemDesc : "" mainListDesc "" ,
// 下拉框配置
selectOption : {
// station : {
// SelType : "" FromUrl "" ,
// SelFrom : ` / $ { areaName }/ $ { controllerName }/ StationLineSelect ` ,
// SelLabel : "" workStationName "" ,
// SelValue : "" workStationCode "" ,
// OptGroup : true ,
// Dom : [ $ ( "" [ name = ' stationCode ' ] "" )]
//},
// 返回的数据 用于后续操作
selectData : {
}
},
// 下拉框配置枚举
selectOptionEnum : {
type : {
SelValue : "" value "" , // key or value
SelFrom : "" dataSource "" , // 固定
Dom : [ $ ( "" select [ name = ' xxx ' ] "" )],
dataSource : window . top . Enumxxx ,
},
// 返回的数据 用于后续操作
selectData : {
}
},
},
methods : {
initTable " );
赖素文
authored
12 months ago
455
# line 202 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
456
457
458
459
460
461
462
463
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": function (opt) {\r\n var config = {};\r\n if (opt != " +
"undefined) $.extend(config, opt);\r\n let options = {\r\n " +
" elem: \"#\" + app.data.tableElem" );
赖素文
authored
12 months ago
464
# line 206 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
465
466
467
468
469
470
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ",\r\n url: `/${areaName}/${controllerName}/Load" );
赖素文
authored
12 months ago
471
# line 207 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
472
473
474
475
476
477
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n cols: sysU.columnRecord(app.data.tableElem" );
赖素文
authored
12 months ago
478
# line 208 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
479
480
481
482
483
484
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ", app.data.cols" );
赖素文
authored
12 months ago
485
# line 208 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( @" ),
toolbar : '# toolbarTable ' ,
where : config ,
// height : "" full - 50 "" ,// 如果是主明细页签,列表主体高度要设置,否则分页导航不直观展示
doneExtend : function ( res , obj ) {
}
}
app . data . tableIns = sysU . initTable ( options );
},
initSelectTable : function () {
var opt1 = {
elem : "" . productCode "" ,
checkedKey : "" productCode "" ,
doneKey : {
key : "" productCode "" ,
lableValue : "" productName ""
},
searchKey : "" productCode "" ,
searchName : "" 产品编码 ""
};
sysU . initSelectProduct ( opt1 );
},
initFrom () {
// sysU . initSelect ( app . data . selectOption );
赖素文
authored
12 months ago
518
// sysU . tabClick ( "" tableTabBody "" );
唐召明
authored
about a year ago
519
520
521
522
523
524
525
526
527
// sysU . initSelecteByEnum ( app . data . selectOptionEnum );
}
},
registerEvent : function () {
},
init : function () {
// var sendDataWhere = form . val ( "" listForm " );
赖素文
authored
12 months ago
528
# line 244 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
529
530
531
532
533
534
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "\")\r\n app.methods.initTable" );
赖素文
authored
12 months ago
535
# line 245 "E:\project\mes\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
536
537
538
539
540
541
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "();\r\n app.methods.initFrom();\r\n app.registerEvent();\r\n " +
" }\r\n };\r\n app.init();\r\n});" );
赖素文
authored
about a year ago
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
return this . GenerationEnvironment . ToString ();
}
}
# line default
# line hidden
# region Base class
/// < summary >
/// Base class for this transformation
/// </ summary >
[ global :: System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.VisualStudio.TextTemplating" , "17.0.0.0" )]
public class JavaScriptTemplateBase
{
# region Fields
private global :: System . Text . StringBuilder generationEnvironmentField ;
private global :: System . CodeDom . Compiler . CompilerErrorCollection errorsField ;
private global :: System . Collections . Generic . List < int > indentLengthsField ;
private string currentIndentField = "" ;
private bool endsWithNewline ;
private global :: System . Collections . Generic . IDictionary < string , object > sessionField ;
# endregion
# region Properties
/// < summary >
/// The string builder that generation - time code is using to assemble generated output
/// </ summary >
赖素文
authored
12 months ago
567
protected System . Text . StringBuilder GenerationEnvironment
赖素文
authored
about a year ago
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
{
get
{
if (( this . generationEnvironmentField == null ))
{
this . generationEnvironmentField = new global :: System . Text . StringBuilder ();
}
return this . generationEnvironmentField ;
}
set
{
this . generationEnvironmentField = value ;
}
}
/// < summary >
/// The error collection for the generation process
/// </ summary >
public System . CodeDom . Compiler . CompilerErrorCollection Errors
{
get
{
if (( this . errorsField == null ))
{
this . errorsField = new global :: System . CodeDom . Compiler . CompilerErrorCollection ();
}
return this . errorsField ;
}
}
/// < summary >
/// A list of the lengths of each indent that was added with PushIndent
/// </ summary >
private System . Collections . Generic . List < int > indentLengths
{
get
{
if (( this . indentLengthsField == null ))
{
this . indentLengthsField = new global :: System . Collections . Generic . List < int >();
}
return this . indentLengthsField ;
}
}
/// < summary >
/// Gets the current indent we use when adding lines to the output
/// </ summary >
public string CurrentIndent
{
get
{
return this . currentIndentField ;
}
}
/// < summary >
/// Current transformation session
/// </ summary >
public virtual global :: System . Collections . Generic . IDictionary < string , object > Session
{
get
{
return this . sessionField ;
}
set
{
this . sessionField = value ;
}
}
# endregion
# region Transform - time helpers
/// < summary >
/// Write text directly into the generated output
/// </ summary >
public void Write ( string textToAppend )
{
if ( string . IsNullOrEmpty ( textToAppend ))
{
return ;
}
// If we ' re starting off , or if the previous text ended with a newline ,
// we have to append the current indent first .
if ((( this . GenerationEnvironment . Length == 0 )
|| this . endsWithNewline ))
{
this . GenerationEnvironment . Append ( this . currentIndentField );
this . endsWithNewline = false ;
}
// Check if the current text ends with a newline
if ( textToAppend . EndsWith ( global :: System . Environment . NewLine , global :: System . StringComparison . CurrentCulture ))
{
this . endsWithNewline = true ;
}
// This is an optimization . If the current indent is "" , then we don ' t have to do any
// of the more complex stuff further down .
if (( this . currentIndentField . Length == 0 ))
{
this . GenerationEnvironment . Append ( textToAppend );
return ;
}
// Everywhere there is a newline in the text , add an indent after it
textToAppend = textToAppend . Replace ( global :: System . Environment . NewLine , ( global :: System . Environment . NewLine + this . currentIndentField ));
// If the text ends with a newline , then we should strip off the indent added at the very end
// because the appropriate indent will be added when the next time Write () is called
if ( this . endsWithNewline )
{
this . GenerationEnvironment . Append ( textToAppend , 0 , ( textToAppend . Length - this . currentIndentField . Length ));
}
else
{
this . GenerationEnvironment . Append ( textToAppend );
}
}
/// < summary >
/// Write text directly into the generated output
/// </ summary >
public void WriteLine ( string textToAppend )
{
this . Write ( textToAppend );
this . GenerationEnvironment . AppendLine ();
this . endsWithNewline = true ;
}
/// < summary >
/// Write formatted text directly into the generated output
/// </ summary >
public void Write ( string format , params object [] args )
{
this . Write ( string . Format ( global :: System . Globalization . CultureInfo . CurrentCulture , format , args ));
}
/// < summary >
/// Write formatted text directly into the generated output
/// </ summary >
public void WriteLine ( string format , params object [] args )
{
this . WriteLine ( string . Format ( global :: System . Globalization . CultureInfo . CurrentCulture , format , args ));
}
/// < summary >
/// Raise an error
/// </ summary >
public void Error ( string message )
{
System . CodeDom . Compiler . CompilerError error = new global :: System . CodeDom . Compiler . CompilerError ();
error . ErrorText = message ;
this . Errors . Add ( error );
}
/// < summary >
/// Raise a warning
/// </ summary >
public void Warning ( string message )
{
System . CodeDom . Compiler . CompilerError error = new global :: System . CodeDom . Compiler . CompilerError ();
error . ErrorText = message ;
error . IsWarning = true ;
this . Errors . Add ( error );
}
/// < summary >
/// Increase the indent
/// </ summary >
public void PushIndent ( string indent )
{
if (( indent == null ))
{
throw new global :: System . ArgumentNullException ( "indent" );
}
this . currentIndentField = ( this . currentIndentField + indent );
this . indentLengths . Add ( indent . Length );
}
/// < summary >
/// Remove the last indent that was added with PushIndent
/// </ summary >
public string PopIndent ()
{
string returnValue = "" ;
if (( this . indentLengths . Count > 0 ))
{
int indentLength = this . indentLengths [( this . indentLengths . Count - 1 )];
this . indentLengths . RemoveAt (( this . indentLengths . Count - 1 ));
if (( indentLength > 0 ))
{
returnValue = this . currentIndentField . Substring (( this . currentIndentField . Length - indentLength ));
this . currentIndentField = this . currentIndentField . Remove (( this . currentIndentField . Length - indentLength ));
}
}
return returnValue ;
}
/// < summary >
/// Remove any indentation
/// </ summary >
public void ClearIndent ()
{
this . indentLengths . Clear ();
this . currentIndentField = "" ;
}
# endregion
# region ToString Helpers
/// < summary >
/// Utility class to produce culture - oriented representation of an object as a string .
/// </ summary >
public class ToStringInstanceHelper
{
private System . IFormatProvider formatProviderField = global :: System . Globalization . CultureInfo . InvariantCulture ;
/// < summary >
/// Gets or sets format provider to be used by ToStringWithCulture method .
/// </ summary >
public System . IFormatProvider FormatProvider
{
get
{
return this . formatProviderField ;
}
set
{
if (( value != null ))
{
this . formatProviderField = value ;
}
}
}
/// < summary >
/// This is called from the compile / run appdomain to convert objects within an expression block to a string
/// </ summary >
public string ToStringWithCulture ( object objectToConvert )
{
if (( objectToConvert == null ))
{
throw new global :: System . ArgumentNullException ( "objectToConvert" );
}
System . Type t = objectToConvert . GetType ();
System . Reflection . MethodInfo method = t . GetMethod ( "ToString" , new System . Type [] {
typeof ( System . IFormatProvider )});
if (( method == null ))
{
return objectToConvert . ToString ();
}
else
{
return (( string )( method . Invoke ( objectToConvert , new object [] {
this . formatProviderField })));
}
}
}
private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper ();
/// < summary >
/// Helper to produce culture - oriented representation of an object as a string
/// </ summary >
public ToStringInstanceHelper ToStringHelper
{
get
{
return this . toStringHelperField ;
}
}
# endregion
}
# endregion
}