TopSearch_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
if(typeof(MEC_NS) == 'undefined'){
MEC_NS = {};
}
MEC_NS.TopSearch = function(type, id, mecJson){
this.type = type;
if(!id){
id = new UUID().toString();
}
this.id = id;
if(!mecJson){
mecJson = this.getDefaultMecJson();
}
this.mecJson = mecJson;
this.utils = require('utils');
this.fieldPanel = this.utils.use('searchFieldpropPanel');
};
/*获取id 必需的方法*/
MEC_NS.TopSearch.prototype.getID = function(){
return this.id;
};
/*获取设计的html, 页面上怎么显示控件完全依赖于此方法。 必需的方法*/
MEC_NS.TopSearch.prototype.getDesignHtml = function(){
return getDesignHtml(this);
};
/*获取构建属性编辑窗体的html,添加和单击控件后会调用此方法,由此方法去构建属性编辑窗体。 必需的方法*/
MEC_NS.TopSearch.prototype.getAttrDlgHtml = function(){
var theId = this.id;
var htm = '<div id="MAD_'+theId+'" style="height: inherit;">';
//基本信息---start
htm += '<div class="title">';
htm += SystemEnv.getHtmlNoteName(4650);
htm += '</div>';
htm += '<div class="form-group">';
htm += '<div class="row">';
htm += '<span class="col-2 span-control">'+SystemEnv.getHtmlNoteName(6030)+'</span>'; //搜索动作:
htm += '<div class="col-m-8">';
htm += '<select id="actionType_' + theId + '" class="form-control search-action">';
htm += '<option value=""></option>';
htm += '<option value="1">' + SystemEnv.getHtmlNoteName(4417) + '</option>'; //刷新列表
htm += '<option value="2">' + SystemEnv.getHtmlNoteName(6237) + '</option>'; //刷新表格
//htm += '<option value="0">' + SystemEnv.getHtmlNoteName(3916) + '</option>'; //自定义
htm += '</select>';
htm += '</div>';
htm += '</div>';
htm += '<div class="refresh-action-container" style="display:none;">';
htm += '<div class="row">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6209) +'</span>'; //选择:
htm += '<div class="col-m-8">';
htm += '<select class="form-control" id="actionTarget_'+theId+'"></select>';
htm += '</div>';
htm += '</div>';
htm += '</div>';
htm += '<div class="custom-action-container" style="display:none;">';
htm += '<div class="row">';
htm += '<span class="col-2 span-control">'+ SystemEnv.getHtmlNoteName(6033) +'</span>'; //执行脚本:
htm += '<div class="col-m-8">';
htm += '<span class="click-control mg-2 inline">';
htm += '<input id="actionScript_'+theId+'" type="hidden" value=""/>';
htm += '<label class="mg-0 scriptTip" id="scriptTip_'+theId+'">'+ SystemEnv.getHtmlNoteName(6034) +'</label>'; //点击输入执行脚本
htm += '</span>';
htm += '</div>';
htm += '</div>';
htm += '</div>';//end
htm += '</div>';
//基本信息---end
//条件设置---start
htm += '<div class="title" style="color:#666;font-weight:normal;border:none;">';
htm += SystemEnv.getHtmlNoteName(6210);//条件设置
htm += '<div data-autobind class="add-before add-condition-btn" data-scroll="bottom">'+SystemEnv.getHtmlNoteName(3518)+'</div>'; //添加
htm += '</div>';
htm += '<div class="form-group" style="padding-top:0;">';
htm += '<table class="table search-fields-table" style="table-layout:fixed;">';
htm += '<thead><tr>';
htm += '<td width="5%"></td>';
htm += '<td width="22%">'+SystemEnv.getHtmlNoteName(4740)+'</td>';//显示名称
htm += '<td width="28%">'+SystemEnv.getHtmlNoteName(4324)+'</td>';//字段名称
htm += '<td width="25%">'+SystemEnv.getHtmlNoteName(4742)+'</td>';//字段类型
htm += '<td width="20%" style="text-align:center;">'+SystemEnv.getHtmlNoteName(6211)+'</td>';//快捷条件
htm += '</tr></thead>';
htm += '<tbody></tbody>';
htm += '</table>';
htm += '<div class="tip-control condition-tip-control">'+SystemEnv.getHtmlNoteName(4159)+'</div>'; //单击右上角的添加按钮以添加内容
htm += '</div>';
//条件设置---end
htm += '</div>';//end MAD
return htm;
};
/*构建属性编辑窗体完成后调用此方法,主要用于一些必须要使用js对页面进行后置操作时,无需要此方法可至空。 不必需的方法,有此方法系统自动调用*/
MEC_NS.TopSearch.prototype.afterAttrDlgBuild = function(){
var that = this,
theId = this.id,
$attrContainer = this.$attrContainer = $("#MAD_" + theId),
$searchFieldsTable = this.$searchFieldsTable = this.$attrContainer.find(".search-fields-table");
this.bindAttrDlgHtmlEvent();
this.fieldPanel('run', {
id: theId,
types: [1,3,5,9],
callback: {
onOK: function(field, target) {
var $target = $(target), $tr = $target.closest("tr");
$target.find("input[name='fieldJson']").val(JSON.stringify(field));
$target.find(".fieldTypeText").html(SystemEnv.getHtmlNoteName(field.fieldlabel));
var haveQuickCondition = (field.fieldtype == 1 && field.htmltype == 6) || field.fieldtype == 9;
that.quickConditionShowHide(haveQuickCondition, $tr);
}
}
});
var actionType = this.mecJson["actionType"] || "1";
$("#actionType_"+theId).val(actionType);
var actionTarget = this.mecJson["actionTarget"];
$("#actionScript_"+theId)[0].value = this.mecJson["actionScript"];
var searchFields = this.mecJson["searchFields"] || [];
if(!searchFields.length){
$attrContainer.find(".condition-tip-control").show();
}else{
searchFields.forEach(function(ele) {
that.addOneSearchFieldToPage(ele, that.mecJson["actionTargetSourceType"]);
});
}
this.actionTypeChange(actionType, actionTarget);
};
/*获取JSON*/
MEC_NS.TopSearch.prototype.getMecJson = function(){
var theId = this.id;
this.mecJson["id"] = theId;
this.mecJson["mectype"] = this.type;
var $attrContainer = $("#MAD_"+theId);
if($attrContainer.length > 0){
this.mecJson["actionType"] = $("#actionType_"+theId).val();
var $actionTarget = $("#actionTarget_"+theId), $option = $actionTarget.find("option:selected");
this.mecJson["actionTarget"] = $actionTarget.val();
this.mecJson["actionTargetSourceType"] = $option.attr("data-sourcetype");
this.mecJson["actionTargetSearchid"] = $option.attr("data-searchid");
this.mecJson["actionScript"] = $("#actionScript_"+theId).val(); //执行脚本
this.mecJson["searchFields"] = this.getSearchFields();
}
return this.mecJson;
};
MEC_NS.TopSearch.prototype.getCopyMecJson = function (mecJson) {
var mec = require("mec");
mec.changeMecJsonUUid(mecJson.searchFields);
};
MEC_NS.TopSearch.prototype.getDefaultMecJson = function(){
return {
actionType: "1",
actionScript: "",
searchFields: []
};
}
$.extend(MEC_NS.TopSearch.prototype, {
autoUpdate: function(){
var mecHandler = MECHandlerPool.getHandler(this.id);
//避免导入插件到低版本时报错
mecHandler && mecHandler.autobind && mecHandler.autobind.update();
},
bindAttrDlgHtmlEvent: function(){
var theId = this.id, that = this;
//搜索动作change
$("#actionType_"+theId).on("change", function(){
that.actionTypeChange($(this).val());
});
$("#actionTarget_"+theId).on("change", function(){
var actionTarget = $(this).val();
var initdata = that.getTargetChangeData(actionTarget);
if(initdata && (initdata.first || initdata.changed)){
that.initCubeSearchFields(actionTarget, initdata);
return;
}
//‘选择’下拉框,选择空来源时,清空字段信息
var $actionTarget = $("#actionTarget_" + theId);
var val = $actionTarget.find("option:selected").text();
if(!val)that.clearConditionData(0);
}).on("select2:opening.before", function(){
var actionTarget = $(this).val();
var actionType = $("#actionType_"+theId).val();
var initdata = that.getTargetChangeData(actionTarget);
that.initActionTarget(actionType, actionTarget, initdata);
});
//执行脚本绑定事件
var $clickControl = this.$attrContainer.find(".custom-action-container .click-control");
$clickControl.click(function(){
var $this = $(this);
var $btnScript = $("#actionScript_" + theId);
var actionScript = $.trim($btnScript.val());
if(!actionScript){
actionScript = "/*\n\t"+SystemEnv.getHtmlNoteName(6213);//可通过参数名params获取搜索条件JSON对象,如:
actionScript += "\n\t{name1: 'value1', name2: 'value2'}";
actionScript += "\n*/\n";
$btnScript.val(actionScript);
}
SL_AddScriptToField($btnScript);
});
SL_ChangeStyle($clickControl, this.mecJson.actionScript);
this.$attrContainer.find(".add-condition-btn").on("click", function(){
var sourceType = $("#actionTarget_"+theId).find("option:selected").attr("data-sourcetype");
that.addOneSearchFieldToPage({
id: new UUID().toString(),
customFieldJson: {
fieldtype: "1",
fieldlabel: "4511",
fieldremind: SystemEnv.getHtmlNoteName(4170),//请输入...
htmltype: "1"
},
quickItems: []
}, sourceType);
});
var $searchFieldsTable = this.$searchFieldsTable;
$searchFieldsTable.on("click", ".delFlag", function(){
$(this).closest("tr").remove();
if(!$searchFieldsTable.find("tbody>tr").length){
that.$attrContainer.find(".condition-tip-control").show();
}
that.autoUpdate();
}).on("change", "select[name='systemFieldName']", function(){
var sourceType = $("#actionTarget_"+theId).find("option:selected").attr("data-sourcetype");
if(sourceType != 1 && sourceType != 3)return;
var $this = $(this), $tr = $this.closest("tr");
var $option = $this.find("option:selected");
if(sourceType == 1) {
var htmlType = $option.data("htmltype"),
fieldType = $option.data("fieldtype"),
isNum = htmlType == 1 && fieldType != 1;
var fieldJsonHtml = $tr.find("input[name='fieldJson']");
//判断是否为日期时间类型,fieldType为2是日期类型,19是时间类型,290是日期时间类型
var isDateTime = htmlType == 3 && (fieldType == 2 || fieldType == 19 || fieldType == 290);
htmlType = isDateTime ? 9 : htmlType;
$tr.find("select[name='systemFieldType']").val(htmlType).trigger("change");
var fieldJson = JSON.parse(fieldJsonHtml.val());
fieldJson.fieldtype = "" + fieldType;
fieldJson.htmltype = "" + htmlType;
fieldJsonHtml.val(JSON.stringify(fieldJson));
that.quickConditionShowHide(isNum || isDateTime, $tr);
}
MLanguage.setValue($tr.find("input[name='showName']"),$option.text());
that.autoUpdate();
}).on("click", ".sbHolder", function(e){
var $this = $(this), reverseClass = "sbToggle-btc-reverse";
if(!$this.hasClass(reverseClass) || !$('.search-fieldprop-panel').length){
that.$attrContainer.find(".sbToggle-btc-reverse").removeClass(reverseClass);
$(this).addClass(reverseClass);
that.fieldPanel('show', this, theId);
e.stopPropagation();
}
}).on("click", ".quick-contion-edit", function(){
var $tr = $(this).closest("tr"),
quickItems = $.parseJSON($tr.find("input[name='quickItems']").val());
var $actionTarget = $("#actionTarget_" + theId);
var sourceType = $actionTarget.find("option:selected").attr("data-sourcetype");
var isDate, isTime;
if(sourceType == 1){
var $fieldOption = $tr.find("select[name='systemFieldName'] option:selected");
var htmltype = $fieldOption.data('htmltype'), fieldtype = $fieldOption.data('fieldtype');
isDate = htmltype == 3 && (fieldtype == 2 || fieldtype == 290);
isTime = htmltype == 3 && fieldtype == 19;
}else{
var fieldJson = $.parseJSON($tr.find("input[name='fieldJson']").val());
var fieldtype = fieldJson.fieldtype, htmltype = fieldJson.htmltype;
isDate = fieldtype == 9 && (htmltype == 1 || htmltype == 3);
isTime = fieldtype == 9 && htmltype == 2;
}
that.utils.openRcDialog("quick-condition-edit", {
title: SystemEnv.getHtmlNoteName(6212),//快捷条件设置
params: {
config: {
quickItems: quickItems,
isDate: isDate,
isTime: isTime
}
}
}, function(result) {
$tr.find("input[name='quickItems']").val(JSON.stringify(result));
});
});
this.$searchFieldsTable.find("tbody").sortable({
revert: false,
axis: "y",
items: "tr",
handle: ".bemove",
update: function(){
that.autoUpdate();
}
});
},
actionTypeChange: function(actionType, actionTarget){
var theId = this.id;
var $refreshContainer = $(".refresh-action-container", this.$attrContainer),
$customContainer = $(".custom-action-container", this.$attrContainer);
$refreshContainer[actionType == "0" ? "hide" : "show"]();
$customContainer[actionType == "0" ? "show" : "hide"]();
this.initActionTarget(actionType, actionTarget);
},
initActionTarget: function(actionType, defVal, initdata){
var theId = this.id, $actionTarget = $("#actionTarget_" + theId), that = this;
var mecType = '';
if(actionType == "1"){
mecType = "NList";
}else if(actionType == "2"){
mecType = "NGridTable";
}
var optionHtml = '<option value=""></option>';
var handlerList = MECHandlerPool.getHandlerByType(mecType);
handlerList.forEach(function(handler, index) {
var id = handler.getID();
var mecJson = handler.getMecJson();
var sourceData = mecJson.sourceData || {},
sourceType = sourceData.sourceType || "",
searchid = sourceData.searchid || "";
if(sourceType == 2) return;//不支持模拟数据
var selected = "";
if(defVal == id || (!defVal && index == 0)) selected = "selected";
optionHtml += '<option data-mectype="'+handler.type+'" '+selected+' data-searchid="'+searchid+'" data-sourcetype="'+sourceType+'" value="'+id+'">';
optionHtml += handler.getName();
optionHtml += '</option>';
});
$actionTarget.empty().html(optionHtml).trigger("change");
var sourceType = $actionTarget.find("option:selected").attr("data-sourcetype");
if(!defVal || (initdata && initdata.changed)){
that.$searchFieldsTable.find("tbody>tr").each(function(){
var $tr = $(this), rowindex = $tr.data("rowindex");
that.initSearchFieldRow(rowindex, sourceType);
});
}
!defVal && this.clearConditionData(handlerList.length);
},
getSearchFields: function(){
var searchFields = [];
this.$searchFieldsTable.find("tbody>tr").each(function(){
var $tr = $(this);
searchFields.push({
id: $tr.data("rowindex"),
showName: MLanguage.getValue($tr.find("input[name='showName']")),
systemFieldName: $tr.find("select[name='systemFieldName']").val(),
customFieldName: $tr.find("input[name='customFieldName']").val(),
customFieldJson: $.parseJSON($tr.find("input[name='fieldJson']").val()),
quickItems: $.parseJSON($tr.find("input[name='quickItems']").val())
});
});
return searchFields;
},
getSourceFieldsData: function(sourceFields, rowid, sourceType){
var searchFields = this.mecJson["searchFields"] || [], defVal;
searchFields.every(function(field){
if(field.id === rowid){
defVal = field.systemFieldName;
return false;
}
return true;
});
var defHtmlType = "", defFieldType = "";
if(sourceType == 1){
var result = sourceFields.filter(function(fieldData){
var htmlType = fieldData.htmlType;
return htmlType == 1 || htmlType == 3 || htmlType == 5;
}).reduce(function(htm, fieldData, index){
var selected = "",
fieldTitle = fieldData.fieldDesc || fieldData.fieldName,
htmlType = fieldData.htmlType;
if((!defVal && index === 0) || fieldData.fieldid == defVal){
defHtmlType = htmlType;
defFieldType = fieldData.fieldtype;
selected = "selected";
}
htm += '<option value="'+fieldData.fieldid+'" data-fieldtype="'+fieldData.fieldtype+'" data-htmltype="'+fieldData.htmlType+'" fieldName="'+fieldData.fieldName+'" fieldTitle="'+fieldTitle+'" '+selected+'>';
htm += MLanguage.parse(fieldData.fieldDesc)+(fieldData.detailtable ? "-"+SystemEnv.getHtmlNoteName(4865) : "");
htm += "</option>";
return htm;
}, '<option value=""></option>');
return [result, defHtmlType, defFieldType];
}else if(sourceType == 3){
var result = sourceFields.reduce(function(htm, fieldData, index){
var selected = "",
fieldTitle = fieldData.fieldDesc || fieldData.fieldName;
if((!defVal && index === 0) || fieldData.fieldid == defVal){
selected = "selected";
}
htm += '<option value="'+fieldData.fieldid+'" fieldName="'+fieldData.fieldName+'" fieldTitle="'+fieldTitle+'" '+selected+'>';
htm += MLanguage.parse(fieldData.fieldDesc)+(fieldData.detailtable ? "-"+SystemEnv.getHtmlNoteName(4865) : "");
htm += "</option>";
return htm;
}, '<option value=""></option>');
return [result];
}
},
initCubeSearchFields: function(actionTarget, initdata){
var that = this;
var mecJson = initdata.mecJson;
var handler = initdata.handler;
var sourceData = mecJson.sourceData || {}, sourceType = sourceData.sourceType || "";
that.switchSearchFieldsMode(that.$searchFieldsTable);
if(sourceType == 1 || sourceType == 3){//建模查询
this.sourceFields = handler.getSourceFields(sourceData);
that.$searchFieldsTable.find("tbody>tr").each(function(){
var $tr = $(this), rowindex = $tr.data("rowindex");
that.initSearchFieldRow(rowindex, sourceType);
});
}
if(!initdata.first && initdata.changed)that.clearConditionData();
},
initSearchFieldRow: function(rowData, sourceType){
var rowindex = rowData;
if(this.utils.isObject(rowData)){
rowindex = rowData.id;
}
var $tr = $("tr[data-rowindex='"+rowindex+"']"), haveQuickCondition = rowData.haveQuickCondition || "";
if(sourceType == 1 || sourceType == 3){
if(!this.sourceFields){
sourceType == 3 && this.quickConditionShowHide(haveQuickCondition, $tr);
return;
}
var source = this.getSourceFieldsData(this.sourceFields || [], rowindex, sourceType);
var val = "";
if(sourceType == 1){
var htmlType = source[1], fieldType = source[2];
haveQuickCondition = (htmlType == 1 && fieldType != 1)
|| (htmlType == 3 && (fieldType == 2 || fieldType == 19 || fieldType == 290));
}
$tr.find("select[name='systemFieldName']").html(source[0]);
val = $tr.find("select[name='systemFieldName'] option:selected").text();
// 解决部分历史数据保存了错误的字段类型导致字段类型显示错误
sourceType == 1 && $tr.find("select[name='systemFieldName']").trigger("change");
// 新增条件设置时默认设置显示名称为字段名称
if ($tr.find("input[name='showName']").val().length == 0){
MLanguage.setValue($tr.find("input[name='showName']"),val);
}
}
sourceType != 3 && this.quickConditionShowHide(haveQuickCondition, $tr);
},
quickConditionShowHide: function(haveQuickCondition, $container){
$container.find(".quickItems.self")[haveQuickCondition ? "hide" : "show"]();
$container.find(".quickItems.custom")[haveQuickCondition ? "show" : "hide"]();
},
addOneSearchFieldToPage: function(rowData, sourceType){
var customFieldName = rowData.customFieldName || "",
fieldJson = rowData.customFieldJson || {},
quickItems = rowData.quickItems || [];
var rowHtml = '<tr data-rowindex="'+rowData.id+'">\
<td class="bemove" width="5%"></td>\
<td width="20%">\
<input data-autobind name="showName" type="text" class="form-control"/>\
</td>\
<td width="30%">\
<div class="systemMode" style="display:none;"><select name="systemFieldName"></select></div>\
<div class="customMode" style="display:none;"><input class="form-control" name="customFieldName" type="text"/>\
</td>\
<td width="25%">\
<div class="systemMode fieldType" style="display:none;">\
<select name="systemFieldType" disabled>\
<option value="1">'+SystemEnv.getHtmlNoteName(4511)/*单行文本*/+'</option>\
<option value="3">'+SystemEnv.getHtmlNoteName(4556)/*浏览按钮*/+'</option>\
<option value="5">'+SystemEnv.getHtmlNoteName(4541)/*选择项*/+'</option>\
<option value="9">'+SystemEnv.getHtmlNoteName(4518)/*日期时间*/+'</option>\
</select>\
</div>\
<div class="customMode fieldType" style="display:none;">\
<div class="sbHolder" style="width:100%;">\
<input type="hidden" name="fieldJson"/>\
<div class="fieldTypeText ellipsis" style="line-height:30px;padding-left:7px;padding-right:20px;">'+SystemEnv.getHtmlNoteName(fieldJson.fieldlabel || 4511)+'</div>\
<span class="sbToggle sbToggle-btc"></span>\
</div>\
</div>\
</td>\
<td width="20%" style="position:relative;text-align:center;padding-right:0;">\
<input type="hidden" name="quickItems"/>\
<div class="self quickItems">'+SystemEnv.getHtmlNoteName(4168)/*无*/+'</div>\
<div class="custom quickItems" style="display:none;">\
<span class="edit-before quick-contion-edit">'+SystemEnv.getHtmlNoteName(6208)/*设置*/+'</span>\
</div>\
<span class="del-after delFlag"></span>\
</td>\
</tr>';
var $row = $(rowHtml), haveQuickCondition;
this.$searchFieldsTable.find("tbody").append($row);
this.switchSearchFieldsMode($row);
$row.find("select").niceSelect();
MLanguage.setValue($row.find("input[name='showName']"), rowData["showName"]);
$row.find("input[name='customFieldName']").val(customFieldName);
$row.find("input[name='fieldJson']").val(JSON.stringify(fieldJson));
$row.find("input[name='quickItems']").val(JSON.stringify(quickItems));
$row.find("select[name='systemFieldType']").val(fieldJson.htmltype);
$row.find("select[name='systemFieldName'] option:selected").data("htmltype",fieldJson.htmltype);
$row.find("select[name='systemFieldName'] option:selected").data("fieldtype",fieldJson.fieldtype);
this.fieldPanel("setField", $row.find(".sbHolder")[0], fieldJson);
$row.MLanguage();
var customHtmlType = fieldJson.fieldtype, customFieldType = fieldJson.htmltype;
haveQuickCondition = (customHtmlType == 1 && customFieldType == 6) || customHtmlType == 9;
rowData.haveQuickCondition = haveQuickCondition;
this.initSearchFieldRow(rowData, sourceType);
this.$attrContainer.find(".condition-tip-control").hide();
},
switchSearchFieldsMode: function($obj){
var theId = this.id;
var actionType = $("#actionType_" + theId).val(),
sourceType = $("#actionTarget_" + theId).find("option:selected").data("sourcetype");
var isCustomMode = actionType == "0" || (sourceType != "1" && sourceType != "3");
$obj.find(".systemMode")[isCustomMode ? "hide" : "show"]();
$obj.find(".customMode")[isCustomMode ? "show" : "hide"]();
if(sourceType == "3"){
$obj.find(".systemMode.fieldType").hide();
$obj.find(".customMode.fieldType").show();
}
},
getTargetChangeData: function(actionTarget){
var handler = MECHandlerPool.getHandler(actionTarget);
if(!handler) return;
var mecJson = handler.getMecJson();
var first = !this.oldMecJson;
var changed = (mecJson != this.oldMecJson)
changed && (this.oldMecJson = mecJson);
var initdata = {
first: first,
changed: changed,
mecJson: mecJson,
handler: handler
}
return initdata;
},
clearConditionData: function(targetLength){
var that = this;
var defFieldJson = {
fieldlabel: "4511",
fieldremind: "请输入...",
fieldtype: "1",
htmltype: "1"
}
if(targetLength == 0){
that.$searchFieldsTable.find("select[name='systemFieldName']").empty();
}
that.$searchFieldsTable.find("select[name='systemFieldName']").val("");
that.$searchFieldsTable.find("input[name='customFieldName']").val("");
that.$searchFieldsTable.find("select[name='systemFieldType']").val(1).trigger("change");
that.$searchFieldsTable.find(".fieldTypeText").html(SystemEnv.getHtmlNoteName(4511));
that.fieldPanel("setField", that.$searchFieldsTable.find(".sbHolder"), defFieldJson);
that.quickConditionShowHide(false, that.$searchFieldsTable);
this.autoUpdate();
}
});