NoticeBar_wev8.js
27.6 KB
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
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
559
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
if(typeof(MEC_NS) == 'undefined'){
MEC_NS = {};
}
MEC_NS.NoticeBar = function(type, id, mecJson){
this.type = type;
if(!id){
id = new UUID().toString();
}
this.id = id;
if(!mecJson){
mecJson = this.getDefaultMecJson();
}
this.mecJson = mecJson;
var that = this;
require(['mec'], function(mec){
that.remark = function(){
return mec.remark(that.mecJson.dsName);
};
});
}
/*获取id。 必需的方法*/
MEC_NS.NoticeBar.prototype.getID = function(){
return this.id;
};
/*获取设计的html, 页面上怎么显示控件完全依赖于此方法。 必需的方法*/
MEC_NS.NoticeBar.prototype.getDesignHtml = function(){
return getDesignHtml(this);
};
MEC_NS.NoticeBar.loadData = function(callback) {
UrlSelectUtil.nav.loadNavItems(callback);
};
MEC_NS.NoticeBar.prototype.runWhenPageOnLoad = function () {
this.afterDesignHtmlBuild();
};
MEC_NS.NoticeBar.prototype.afterDesignHtmlBuild = function () {
var $container = $("#NMEC_" + this.id);
var $noticeHeader = $container.find(".wev-notice-header"),
$swipeWrapper = $container.find(".swiper-container"),
height = $noticeHeader.find("span").height() || 40;
$swipeWrapper.find(".swiper-slide").each(function(){
var h = $(this).height();
height = h > height ? h : height;
});
if(height < 40) height = 40;
$container.find(".swiper-slide").css("height", height);
$noticeHeader.css("height", height);
$swipeWrapper.css("height", height);
};
/*获取构建属性编辑窗体的html,添加和单击控件后会调用此方法,由此方法去构建属性编辑窗体。 必需的方法*/
MEC_NS.NoticeBar.prototype.getAttrDlgHtml = function(){
var theId = this.id;
var htm = '<div id="MAD'+theId+'" style="height: inherit;">';
htm += '<div class="title">'+SystemEnv.getHtmlNoteName(4650)+'</div>';//基本信息
htm += '<div class="form-group">';
htm += '<div class="row">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6056) +'</span>'; //数据来源:
htm += '<div class="col-m-8">';
htm += '<select class="form-control" id="dsName_'+theId+'"></select>';
htm += '</div>';
htm += '</div>';
htm += '<div class="row">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6057) +'</span>'; //公告内容:
htm += '<div class="col-m-8">';
htm += '<select class="form-control" id="dsKey_'+theId+'"></select>';
htm += '</div>';
htm += '</div>';
htm += '<div class="row">';
htm += '<span class="col-2 span-control"></span>';
htm += '<div class="col-m-8">';
htm += '<textarea id="noticeContent_'+theId+'" data-autobind class="area-control" placeholder="'+SystemEnv.getHtmlNoteName(6058)+'"></textarea>'; //请输入自定义公告内容,数据集变量用{data.v}表示
htm += "</div>";
htm += '</div>';
htm += '<div class="row" style="position: relative;">';
htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(4145) + '</span> '; //数据链接:
//htm += '<div class="col-m-8 inline-icons">';
//htm += '<div class="url-selector">';
// htm += '<input type="text" id="dataurl_'+theId+'" class="form-control"/>';
//htm += '</div>';
//htm += '</div>';
htm += "<div class='sbHolder' id='dataurlSbHolder_"+theId+"' style='position: absolute;width:calc(100% - 65px)'>";
htm += "<a href='javascript:void(0);' class='sbToggle sbToggle-btc'></a>";
htm += "<input class='panel-input' type='text' readonly='readonly' unselectable='on' autocomplete='off'/>";
htm += "<input id='dataurl_"+theId+"' type='hidden' name='dataurl' />";
htm += "</div>";
htm += '</div>';
htm += '<div class="row" style="margin-top:10px;margin-bottom:10px;">'
htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6059)+'</span>'; //轮播方式:
htm += '<div class="col-8 pd-7">';
htm += '<div class="multi-switch">';
htm += '<span>';
htm += '<input type="checkbox" data-checkbox="false" name="direction" value="vertical"/>';
htm += '<span class="cbboxLabel">'+SystemEnv.getHtmlNoteName(6060)+'</span>'; //上下滚动
htm += '</span>';
htm += '<span>';
htm += '<input type="checkbox" data-checkbox="false" name="direction" value="horizontal"/>';
htm += '<span class="cbboxLabel">'+SystemEnv.getHtmlNoteName(6061)+'</span>'; //左右切换
htm += '</span>';
htm += '</div>';
htm += '</div>';
htm += '</div>';//end row
htm += '<div class="row header-container" style="position: relative;">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6062) + '</span> '; //头部:
htm += '<div class="col-m-8">';
htm += '<div class="col-3" style="padding-right:10px;">';
htm += '<select class="form-control" data-autobind id="headerType_'+theId+'">';
htm += '<option value="1">'+SystemEnv.getHtmlNoteName(4373)+'</option>'; //文字
htm += '<option value="2">'+SystemEnv.getHtmlNoteName(4167)+'</option>'; //图片
htm += '</select>';
htm += '</div>';
htm += '<div class="col-6 header-text-area">';
htm += '<input type="text" data-autobind id="headerText_'+theId+'" placeholder="' + SystemEnv.getHtmlNoteName(6063) + '" class="form-control" '+MLanguage.ATTR+'/>';
htm += '</div>';
htm += '<div class="col-6 header-icon-area" style="display:none;">';
htm += '<div style="width:25px;"><img class="header-icon icon" style="height:18px;margin-top:4px;" src="/mobilemode/images/mec/add-img-btn_wev8.png"></div>';
htm += '<input type="hidden" id="headerIconType_'+theId+'"/>';
htm += '<input type="hidden" id="headerIconPath_'+theId+'"/>';
htm += '</div>';
htm += '</div>';
htm += '</div>';
htm += '<div class="row" style="position: relative;">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6064) + '</span> '; //公告条数:
htm += '<div class="col-m-8">';
htm += '<input type="text" id="noticeSize_'+theId+'" placeholder="' + SystemEnv.getHtmlNoteName(6065) + '" class="form-control"/>';//数字,缺省默认显示数据集中返回的所有记录
htm += '</div>';
htm += '</div>';
htm+='<div class="bottom">';
htm += '<div class="save-btn">'+SystemEnv.getHtmlNoteName(3451)+'</div>'; //确定
htm += '</div>';
htm += '</div>';//end form-group
htm += '</div>';//end MADNoticeBar
htm += '<div class="MAD_Alert">'+SystemEnv.getHtmlNoteName(4115)+'</div>'; //已生成到布局
return htm;
};
/*构建属性编辑窗体完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.NoticeBar.prototype.afterAttrDlgBuild = function(){
var that = this,
theId = this.id,
$attrContainer = this.$attrContainer = $("#MAD_" + theId);
this.bindAttrDlgHtmlEvent();
this.getDSOptionHtml(this.mecJson["dsName"], this.mecJson["dsKey"], true);
$("#noticeContent_" + theId).val(this.mecJson["noticeContent"]);
$("#dataurl_" + theId).val(this.mecJson["dataurl"]);
UrlSelectUtil.link.setUrlLink( $("#dataurl_"+theId).parent(),this.mecJson["dataurl"]);
var direction = this.mecJson["direction"];
var $direction = $attrContainer.find("input[type='checkbox'][name='direction'][value='" + direction + "']");
if($direction.length > 0){
$direction.switched();
}
var headerType = this.mecJson["headerType"] || "1";
$("#headerType_" + theId).val(headerType)
that.headerTypeChange(headerType);
MLanguage.setValue($("#headerText_"+theId), this.mecJson["headerText"]);
$("#headerIconType_" + theId).val(this.mecJson["headerIconType"]);
var headerIconPath = this.mecJson["headerIconPath"];
$("#headerIconPath_" + theId).val(headerIconPath);
that.setHeaderImgPath(headerIconPath);
$("#noticeSize_" + theId).val(this.mecJson["noticeSize"]);
$("#MAD_"+theId).switcher({
onClick: function () {
that.autoUpdate();
}
});
//require("utils").urlSelector("dataurl_"+theId);
$('#dataurlSbHolder_' + theId).on("click",function (e) {
showUrlSelectPanel(this);
e.stopPropagation();
});
};
/*获取JSON*/
MEC_NS.NoticeBar.prototype.getMecJson = function(){
var theId = this.id;
this.mecJson["id"] = theId;
this.mecJson["mectype"] = this.type;
var $attrContainer = $("#MAD_"+theId);
if($attrContainer.length > 0){
var $dsName = $("#dsName_" + theId), dsName = $dsName.val();
this.mecJson["dsName"] = dsName||'';
var dsMecId = $("option[value="+dsName+"]", $dsName).data("id")
this.mecJson["dsMecId"] = dsMecId;
this.mecJson["dsKey"] = $("#dsKey_" + theId).val()||'';
this.mecJson["noticeContent"] = $("#noticeContent_" + theId).val();
this.mecJson["dataurl"] = $("#dataurl_" + theId).val();
var $direction = $attrContainer.find("input[type='checkbox'][name='direction']:checked");
if($direction.length > 0){
this.mecJson["direction"] = $direction.val();
}
this.mecJson["headerType"] = $("#headerType_" + theId).val();
this.mecJson["headerText"] = MLanguage.getValue($("#headerText_"+theId));
this.mecJson["headerIconType"] = $("#headerIconType_" + theId).val();
this.mecJson["headerIconPath"] = $("#headerIconPath_" + theId).val();
this.mecJson["noticeSize"] = $("#noticeSize_" + theId).val();
}
return this.mecJson;
};
MEC_NS.NoticeBar.prototype.getDefaultMecJson = function(){
return {
items: [],
dsName: "",
dsKey: "",
noticeContent: "",
dataurl: "",
direction: 'vertical',
headerType: "2",
headerText: "",
headerIconType: "2",
headerIconPath: "/mobilemode/piclibrary/01-E9_default/systemprompt.png",
noticeSize: "10"
}
};
$.extend(MEC_NS.NoticeBar.prototype, {
autoUpdate: function(){
var mecHandler = MECHandlerPool.getHandler(this.id);
//避免导入插件到低版本时报错
mecHandler && mecHandler.autobind && mecHandler.autobind.update();
},
bindAttrDlgHtmlEvent: function(){
var that = this, theId = this.id, $attrContainer = this.$attrContainer;
var insertText = function(obj, value){
if (document.selection) {
var sel = document.selection.createRange();
sel.text = value;
} else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {
var startPos = obj.selectionStart,
endPos = obj.selectionEnd,
cursorPos = startPos,
tmpStr = obj.value;
obj.value = tmpStr.substring(0, startPos) + value + tmpStr.substring(endPos, tmpStr.length);
cursorPos += value.length;
obj.selectionStart = obj.selectionEnd = cursorPos;
} else {
obj.value += value;
}
setTimeout(function(){
obj.focus();
}, 100);
};
$("#dsName_" + theId).on("change", function(e){
that.getDSKeyOptionHtml();
that.autoUpdate();
}).on("select2:opening.namebefore", function(){
that.getDSOptionHtml($(this).val());
});
$("#dsKey_" + theId).on("change", function(e){
var $content = $("#noticeContent_" + theId), content = $content.val();
var dsName = $("#dsName_" + theId).val(), dsValue = $(this).val();
if(dsValue){
insertText($content[0], '{' + dsName + '.' + dsValue + '}');
that.autoUpdate();
}
});
$("#headerType_" + theId).on("change", function(){
that.headerTypeChange($(this).val());
});
var $headerIcon = $attrContainer.find("img.header-icon");
$headerIcon.on("click", function(e){
var $headerIconType = $("#headerIconType_" + theId),
$headerIconPath = $("#headerIconPath_" + theId),
headerIconType = $headerIconType.val() || "0",
headerIconPath = $headerIconPath.val();
var params = "pic_type=" + headerIconType + "&pic_path=" + encodeURIComponent(headerIconPath);
showPicsetModal(params, function(result){
var headerIconType = result["pic_type"];
var headerIconPath = result["pic_path"];
$headerIconType.val(headerIconType);
$headerIconPath.val(headerIconPath);
that.setHeaderImgPath(headerIconPath);
that.autoUpdate();
});
e.stopPropagation();
});
},
getDSOptionHtml: function(defDs, defKey, initialize){
var that = this, theId = this.id;
var datasetHandlers = [];
if(initialize){
MECHandlerPool.eachHandler(function(){
if(this.type == 'DataSet'){
datasetHandlers.push(this);
}
});
}else{
var $mecDesignContainer = $("#MEC_Design_Container");
var $dataSets = $mecDesignContainer.find("abbr[m_type='DataSet']");
$dataSets.each(function(){
var handler = MECHandlerPool.getHandler($(this).attr("id"));
handler && datasetHandlers.push(handler);
});
}
var optionHtml = '';
if(datasetHandlers.length == 0){
optionHtml += '<option value="">'+SystemEnv.getHtmlNoteName(4394)+'</option>';//请添加数据集
}else{
datasetHandlers.forEach(function(handler) {
var dsName = handler.mecJson.name;
var selectHtml = "";
if(defDs && dsName.toLowerCase() == defDs.toLowerCase()){
selectHtml = ' selected = "selected" ';
}
optionHtml += '<option data-id="' + handler.id + '" value="' + dsName + '" '+ selectHtml +'>' + dsName + '</option>';
});
}
$("#dsName_" + theId).html(optionHtml);
that.getDSKeyOptionHtml(defKey);
},
getDSKeyOptionHtml: function(defKey){
var that = this, theId = this.id, $attrContainer = this.$attrContainer;
var $dsName = $("#dsName_" + theId), $dsKey = $("#dsKey_" + theId);
var val = $dsName.val();
var $option = $("option[value="+val+"]", $dsName);
var dsMecId = $option.data("id");
var mecHandler = MECHandlerPool.getHandler(dsMecId);
if(!mecHandler){
return;
}
mecHandler.getMecJson();
var sourceType = mecHandler.mecJson["sourceType"];
$dsKey.off('select2:opening');
if(sourceType == 0){
var tableid = mecHandler.mecJson["tableid"];
$dsKey.html("");
that.getDSKeyOptionHtmlWithTable(dsMecId, tableid, defKey, true);
}
if(sourceType == 2){
$dsKey.html('<option value="">'+SystemEnv.getHtmlNoteName(4752)+'</option>');//未找到结果
}
if(sourceType == 3){
$dsKey.html("");
that.getDSKeyOptionHtmlWithApi(dsMecId, defKey, true);
}
if(sourceType == 1){
var sql = mecHandler.mecJson["sql"];
var wherePattern = /(.*)where/gi;
if(!wherePattern.test(sql)){
sql += "where 1=1";
}
var tablesArray = [];
var fieldsArray = [];
//获取字段
var allFieldPattern = /select(\s+.*\s+)from(.*)where/gi;
var matches = allFieldPattern.exec(sql);
if(matches != null && matches.length > 0){
var fieldsString = matches[1];
var tableString = matches[2];
//直接从sql中提取字段
var fieldsArrayTemp = fieldsString.split(",");
for(var i = 0; i < fieldsArrayTemp.length; i++){
var field = "";
var fieldTemp = fieldsArrayTemp[i];
var asteriskPattern = /(\w+)?(\.|\s+)?(\*)/;
var asteriskMatches = asteriskPattern.exec(fieldTemp);
//包含*,需要查数据库
//获取数据库表名
if(asteriskMatches != null){
var tablesArrayTemp = [];
tablesArrayTemp = tableString.split(",");
//包含*的查询字段是否包含表别名
var tableAlias = asteriskMatches[1];
//匹配表名
//不包含表别名,则获取sql中所有表名
if(tableAlias == undefined){
fieldsArray = [];
tablesArray = [];
for(var j = 0; j < tablesArrayTemp.length; j++){
var tablePattern = /(\w+)((\s+(as\s+)?)(\w+))?\s*((\w+\s+)?join\s+(\w+)(\s+(as\s+)?)(\w+))?/gi;
var tableTemp = tablesArrayTemp[j];
var tableMatches = tablePattern.exec(tableTemp);
if(tableMatches == null){
continue;
}
if(tableMatches[1] != undefined){
tablesArray.push(tableMatches[1]);
}
if(tableMatches[8] != undefined){
tablesArray.push(tableMatches[8]);
}
}
break;
}else{//包含表别名,则获取别名指向的数据库表
for(var j = 0; j < tablesArrayTemp.length; j++){
var tablePattern = /(\w+)((\s+(as\s+)?)(\w+))?\s*((\w+\s+)?join\s+(\w+)(\s+(as\s+)?)(\w+))?/gi;
var tableTemp = tablesArrayTemp[j];
var tableMatches = tablePattern.exec(tableTemp);
if(tableMatches == null){
continue;
}
if(tableMatches[1] != undefined && tableMatches[5] == tableAlias){
tablesArray.push(tableMatches[1]);
}
if(tableMatches[8] != undefined && tableMatches[11] == tableAlias){
tablesArray.push(tableMatches[8]);
}
}
continue;
}
}
//查询字段是否包含别名
var aliasPattern = /(\(.*\)|\w+\.?\w+)(\s+as\s+|\s+)(\w+)/gi;
var aliasMatches = aliasPattern.exec(fieldTemp);
if(aliasMatches != null){
field = aliasMatches[3];
fieldsArray.push(field);
continue;
}
//是否包含点
var dotPattern = /\w+\.(\w+)/;
var dotMatches = dotPattern.exec(fieldTemp);
if(dotMatches != null){
field = dotMatches[1];
fieldsArray.push(field);
continue;
}
field = fieldTemp.trim();
fieldsArray.push(field);
}
}
$dsKey.html("<option value=\"\">"+SystemEnv.getHtmlNoteName(4392)+"</option>");//选择数据集变量
for(var i = 0; i < fieldsArray.length; i++){
var optionHtml = "<option value=\"" + fieldsArray[i] + "\"";
if(fieldsArray[i] == defKey){
optionHtml += "selected=selected";
}
optionHtml += ">" + fieldsArray[i] + "</option>";
$dsKey.append(optionHtml)
}
if(tablesArray.length > 0){
that.getDSKeyOptionHtmlWithSql(dsMecId, tablesArray.toString(), defKey, true);
}else{
$dsKey.off('select2:opening').on("select2:opening.before", function(){
that.getDSKeyOptionHtml($(this).val());
});
}
}
},
getDSKeyOptionHtmlWithTable: function(mecId, billid, defval, hasEmptyOption){
var that = this, theId = this.id, mecHandler = MECHandlerPool.getHandler(mecId);
if(!mecHandler){
return;
}
require("utils").api("designer/plugin", {
action: "getFieldsByBillid",
data: {
billid: billid
},
}, function (result) {
var optionHtml = "";
if(hasEmptyOption){
optionHtml+= "<option value=\"\">"+SystemEnv.getHtmlNoteName(4392)+"</option>";//选择数据集变量
}
var data = result.data;
for(var i = 0; i < data.length; i++){
var field_name = data[i]["fieldname"];
var label_name = data[i]["labelName"];
optionHtml+= "<option value=\""+field_name+"\"";
if(defval && field_name.toLowerCase()==defval.toLowerCase()){
optionHtml+= " selected = \"selected\" ";
}
optionHtml+= ">"+label_name+"</option>";
}
$("#dsKey_" + theId).html(optionHtml);
});
},
getDSKeyOptionHtmlWithSql: function(mecId, tableArray, defval, hasEmptyOption){
var that = this, theId = this.id, mecHandler = MECHandlerPool.getHandler(mecId);
if(!mecHandler){
return;
}
var datasource = mecHandler.mecJson["datasource"];
if(datasource.length == 0){
datasource = "$ECOLOGY_SYS_LOCAL_POOLNAME";
}
require("utils").api("designer/plugin", {
action: "getFieldsByTableArray",
data: {
datasource: datasource,
tablenames: tableArray
},
}, function (result) {
var optionHtml = "";
if(hasEmptyOption){
optionHtml+= "<option value=\"\">"+SystemEnv.getHtmlNoteName(4392)+"</option>";//选择数据集变量
}
var data = result.data;
for(var i = 0; i < data.length; i++){
var column_name = data[i]["column_name"];
optionHtml+= "<option value=\""+column_name+"\"";
if(defval && column_name.toLowerCase()==defval.toLowerCase()){
optionHtml+= " selected = \"selected\" ";
}
optionHtml+= ">"+column_name+"</option>";
}
$("#dsKey_" + theId).html(optionHtml);
});
},
getDSKeyOptionHtmlWithApi: function(mecId, defval, hasEmptyOption){
var that = this, theId = this.id, mecHandler = MECHandlerPool.getHandler(mecId);
if(!mecHandler){
return;
}
var apiConfig = mecHandler.mecJson.apiConfig;
var apiId = apiConfig && apiConfig.api.id || "";
var outFormat = mecHandler.mecJson.outFormat;
require("utils").api("api", {
action: "info",
data: {
id: apiId
},
}, function (result) {
apiResult = result.data;
var resultDefine = apiResult.resultDefine || [];
var data = [], resultKey = outFormat.DATAS;
if(resultKey){
resultDefine.forEach(function(ele) {
var pname = ele.name;
if(pname !== resultKey && pname.substring(resultKey.length).indexOf(".") === 0){
var newName = pname.substring(resultKey.length+1);
if(newName.indexOf(".") == -1){
data.push({
name: pname.substring(resultKey.length+1),
remark: ele.remark,
type: ele.type
});
}
}
});
}else{
resultDefine.forEach(function(ele) {
if(ele.name.indexOf(".") == -1){
data.push({
name: ele.name,
remark: ele.remark,
type: ele.type
});
}
});
}
var optionHtml = "";
var lang = top.require('i18n/lang');
if(hasEmptyOption){
optionHtml+= "<option value=\"\">"+SystemEnv.getHtmlNoteName(4392)+"</option>";//选择数据集变量
}
for(var i = 0; i < data.length; i++){
var field_name = data[i]["name"];
var label_name = lang.parse(data[i]["remark"]);
optionHtml+= "<option value=\""+field_name+"\"";
if(defval && field_name.toLowerCase()==defval.toLowerCase()){
optionHtml+= " selected = \"selected\" ";
}
optionHtml+= ">"+label_name+"</option>";
}
$("#dsKey_" + theId).html(optionHtml);
});
},
headerTypeChange: function(headerType){
var $attrContainer = this.$attrContainer;
if(headerType == "1"){
$attrContainer.find(".header-text-area").show();
$attrContainer.find(".header-icon-area").hide();
}else{
$attrContainer.find(".header-text-area").hide();
$attrContainer.find(".header-icon-area").show();
}
},
setHeaderImgPath: function(headerIconPath){
var $picImg = this.$attrContainer.find("img.header-icon");
if(headerIconPath){
if(headerIconPath.indexOf("/mobilemode/piclibrary/qn_ffffff") === 0){
$picImg.css({"background-color":"#eee", "border-radius":"3px"});
}
$picImg[0].src = headerIconPath;
}else{
$picImg[0].src = "/mobilemode/images/mec/add-img-btn_wev8.png";
}
}
});