赖素文
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 >
19
# line 1 "D:\CSHHProjects\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 = "" " );
44
# line 15 "D:\CSHHProjects\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 = \"" );
51
# line 16 "D:\CSHHProjects\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" );
58
# line 20 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
59
60
61
62
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
63
64
this . Write ( ": function (flagKey, toolbarId, obj, $event) {\r\n var options = {\r\n " +
" fromId: \"#modifyForm" );
唐召明
authored
about a year ago
65
66
# line 22 "D:\CSHHProjects\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" );
73
# line 23 "D:\CSHHProjects\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" );
82
# line 27 "D:\CSHHProjects\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" +
"" );
90
# line 32 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
91
92
93
94
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
95
96
this . Write ( ": function (data, sysU, toolbarId, obj, $event) {\r\n var options = {\r\n " +
" fromId: \"#modifyForm" );
唐召明
authored
about a year ago
97
98
# line 34 "D:\CSHHProjects\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" );
105
# line 35 "D:\CSHHProjects\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" );
112
# line 36 "D:\CSHHProjects\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" );
120
# line 41 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
121
122
123
124
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
125
126
this . Write ( ": function (sysU, toolbarId, obj, $event) {\r\n var options = {\r\n " +
" url: `/${areaName}/${controllerName}/DelByIds" );
唐召明
authored
about a year ago
127
128
# line 43 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
129
130
131
132
133
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 " +
134
135
" },\r\n\r\n //导出方法\r\n exportOptions: function () {\r\n var " +
"options = {\r\n fromId: \"listForm" );
唐召明
authored
about a year ago
136
137
# line 52 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
138
139
140
141
142
143
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( @"" " ,
url : ` / $ { areaName }/ $ { controllerName }/ Export ` ,
144
isDefault : false ,// false 导出单表, true 导出主明细表
唐召明
authored
about a year ago
145
sendDataWhere :{},
146
// 后台接口返回数据也要保持一致 response . Result = new { head = x , body = x 、 footer = x }
唐召明
authored
about a year ago
147
148
149
150
151
152
153
154
155
156
excelCols : {
head : app . data . cols ,
body : app . data . colsDesc
}
}
return options ;
},
queryOptions " );
157
# line 65 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
158
159
160
161
162
163
164
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" );
165
# line 67 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
166
167
168
169
170
171
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "]\",\r\n fromId: \"listForm" );
172
# line 68 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
173
174
175
176
177
178
179
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" );
180
# line 70 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
181
182
183
184
185
186
187
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n sendDataWhere:{},\r\n mainTable: app.data.tableI" +
"ns" );
188
# line 72 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
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
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 " );
219
# line 96 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
220
221
222
223
224
225
226
227
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" +
"" );
228
# line 101 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
229
230
231
232
233
234
235
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" );
236
# line 104 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
237
238
239
240
241
242
243
244
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" );
245
# line 109 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
246
247
248
249
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
赖素文
authored
8 months ago
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
this . Write ( ": function (data, callBack) {\r\n if (callBack != null) callBack();\r\n " +
" },\r\n\r\n checkboxMethod: function (obj) {\r\n var page = \"\".G" +
"etUrlParam(\"page\"),\r\n xxx = \"\".GetUrlParam(\"xxx\");\r\n i" +
"f (page == \"xxx\") {\r\n var sendData = {\r\n \r\n " +
" };\r\n var ajaxConfig = {\r\n data: s" +
"endData,\r\n url: `${areaName}/${controllerName}/xxx`,\r\n " +
" success: function (result) {\r\n if (sysU.succ" +
"essBefore(result)) return false;\r\n layer.msg(result.Messa" +
"ge);\r\n }\r\n };\r\n sysU.ajax(ajaxC" +
"onfig);\r\n }\r\n },\r\n radioMethod: function (obj) {\r\n " +
" if (!sysU.SetTableRadioCheckBefore()) return;\r\n\r\n if (false) {" +
"\r\n var sendData = {\r\n xyz: \"xx\",\r\n " +
" checkeds: obj.checked,\r\n keys: obj.data.keys,\r\n " +
" };\r\n if (sendData.keys == null || sendData.keys == \"\") " +
"{\r\n layer.alert(\"tableRowOneClick:项目角色标识【keys】为空,请重新关闭后再操作,反复" +
"出现请联系管理员\", { icon: 2, shadeClose: true, title: \"提示\" });\r\n ret" +
"urn false;\r\n }\r\n var ajaxConfig = {\r\n " +
" data: sendData,\r\n url: \"/base/xxx/xxx\",\r\n " +
" success: function (result) {\r\n if (sysU.successBef" +
"ore(result)) return false;\r\n layer.msg(result.Message);\r\n" +
" sysU.refreshTable(app, sysU, null, \"main\");\r\n " +
" }\r\n };\r\n sysU.ajax(ajaxConfig);\r\n " +
" }\r\n },\r\n\r\n //所有动作成功之后\r\n actionSuccess: (flag) => {\r\n " +
" var data = null;\r\n if (flag.includes(\"Desc\")) {\r\n " +
" data = sendDataDescWhere;\r\n }\r\n sysU.refreshTable(app, sy" +
"sU, data, flag);\r\n },\r\n closeAfter: function (callBack) {\r\n " +
" if (callBack != null) callBack();\r\n }\r\n }\r\n\r\n app = {\r\n " +
" data: {\r\n cols" );
279
# line 172 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
280
281
282
283
284
285
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ": [[\r\n { checkbox: true, fixed: true },\r\n" );
286
# line 174 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
287
288
289
290
291
if ( Data . Any ( x => x . Key . Equals ( "id" , StringComparison . OrdinalIgnoreCase )))
# line default
# line hidden
292
# line 175 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
293
294
295
296
297
298
{
# line default
# line hidden
this . Write ( " { field: \"id\", width: 80, hide: true, title: \"Id\" },\r\n" );
299
# line 177 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
300
301
302
303
304
}
# line default
# line hidden
305
# line 178 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
306
307
308
309
310
if ( Data . Any ( x => x . Key . Equals ( "keys" , StringComparison . OrdinalIgnoreCase )))
# line default
# line hidden
311
# line 179 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
312
313
314
315
316
317
{
# line default
# line hidden
this . Write ( " { field: \"keys\", width: 80, hide: true, title: \"Keys\" },\r\n" );
318
# line 181 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
319
320
321
322
323
}
# line default
# line hidden
324
# line 182 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
325
326
327
328
329
foreach ( var item in Data )
# line default
# line hidden
330
# line 183 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
331
332
333
334
335
{
# line default
# line hidden
336
# line 184 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
337
338
339
340
341
if ( item . Key . Equals ( "Id" , StringComparison . OrdinalIgnoreCase ) || item . Key . Equals ( "Keys" , StringComparison . OrdinalIgnoreCase ))
# line default
# line hidden
342
# line 185 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
343
344
345
346
347
{ continue ; }
# line default
# line hidden
348
# line 186 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
349
350
351
352
353
if (! string . IsNullOrWhiteSpace ( item . Value ))
# line default
# line hidden
354
# line 187 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
355
356
357
358
359
360
{
# line default
# line hidden
this . Write ( " { field: \"" );
361
# line 188 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
362
363
364
365
366
367
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\", width: 150, title: \"" );
368
# line 188 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
369
370
371
372
373
374
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Value ));
# line default
# line hidden
this . Write ( "\" },\r\n" );
375
# line 189 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
376
377
378
379
380
381
} else {
# line default
# line hidden
this . Write ( " { field: \"" );
382
# line 190 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
383
384
385
386
387
388
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\", width: 150, title: \"" );
389
# line 190 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
390
391
392
393
394
395
this . Write ( this . ToStringHelper . ToStringWithCulture ( item . Key ));
# line default
# line hidden
this . Write ( "\" },\r\n" );
396
# line 191 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
397
398
399
400
401
}
# line default
# line hidden
402
# line 192 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
赖素文
authored
about a year ago
403
404
405
406
}
# line default
# line hidden
唐召明
authored
about a year ago
407
408
409
410
411
412
413
414
415
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
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 " );
446
# line 230 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
447
448
449
450
451
452
453
454
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" );
455
# line 234 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
456
457
458
459
460
461
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ",\r\n url: `/${areaName}/${controllerName}/Load" );
462
# line 235 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
463
464
465
466
467
468
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( "`,\r\n cols: sysU.columnRecord(app.data.tableElem" );
469
# line 236 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
470
471
472
473
474
475
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
this . Write ( ", app.data.cols" );
476
# line 236 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
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
about a year ago
509
// sysU . tabClick ( "" tableTabBody "" );
唐召明
authored
about a year ago
510
511
512
513
514
515
516
// sysU . initSelecteByEnum ( app . data . selectOptionEnum );
}
},
registerEvent : function () {
},
init : function () {
赖素文
authored
10 months ago
517
app . methods . initFrom ();
唐召明
authored
about a year ago
518
519
// var sendDataWhere = form . val ( "" listForm " );
520
# line 273 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
521
522
523
524
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
525
526
this . Write ( "\")\r\n //var sendDataWhere = \"\".getAllUrlParameters();\r\n app." +
"methods.initTable" );
唐召明
authored
about a year ago
527
528
# line 275 "D:\CSHHProjects\IOT\Hh.Mes.T4\JavaScriptTemplate.tt"
唐召明
authored
about a year ago
529
530
531
532
this . Write ( this . ToStringHelper . ToStringWithCulture ( IsDetail ? "Desc" : "" ));
# line default
# line hidden
赖素文
authored
10 months ago
533
this . Write ( "();\r\n app.registerEvent();\r\n }\r\n };\r\n app.init();\r\n});" );
赖素文
authored
about a year ago
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
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
about a year ago
559
protected System . Text . StringBuilder GenerationEnvironment
赖素文
authored
about a year ago
560
561
562
563
564
565
566
567
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
{
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
}