selectItemEdit_wev8.js
15.1 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
function batchAddOpen(funcName){
var diag = new window.top.Dialog();
diag.currentWindow = window;
diag.Width = 350;
diag.Height = 350;
var InnerHtml = "<div id='u431' data-label='" + js_label127136 + "'>";
InnerHtml += "<div style='margin-top:10px;margin-bottom:10px;margin-left:10px;text-align:left;'>" + js_label127139 + "</div>";
InnerHtml += "<textarea style='height:304px;width:404px;' id='u431_input'></textarea>";
InnerHtml += "</div>";
diag.Title = js_label127141;
diag.InnerHtml=InnerHtml;
diag.OKEvent = function(){
var returnVal = jQuery(window.top.document).find("#u431_input").val();
if(returnVal != ""){
var objValueList = returnVal.split("\n");
for(var i = 0; i < objValueList.length; i++){
var objValue = objValueList[i];
if(objValue.trim() != ""){
eval(funcName + "(objValue.trim());");
}else if(objValue != "" && objValue.trim() == ''){
eval(funcName + "();");
}
}
}
diag.close();
};//点击确定后调用的方法
diag.show();
jQuery(window.top.document).find("#u431_input").focus();
}
function setPreviewPub(event,datas,name,fieldid){
var pubchoiceId = jQuery("#pubchoiceId").val();
jQuery("#previewPubchoiceId").empty();
var urltemp = "/workflow/selectItem/selectItemAjaxData.jsp?src=pubchoiceback&selectAll=true&id="+pubchoiceId;
if(fieldid > 0){
urltemp = "/workflow/selectItem/selectItemAjaxData.jsp?src=selectItemback&id="+fieldid;
}
jQuery.ajax({
type: "POST",
cache: false,
url: urltemp,
dataType: "json",
async:false,
//contentType : "application/x-www-form-urlencoded;charset=UTF-8",
complete: function(){
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
} ,
success : function (data, textStatus) {
jQuery("#previewPubchoiceId").append("<option value=''></option>");
var _data = data;
for(var i=0;i<_data.length;i++){
var tt = _data[i];
var _id = tt.id;
var _name = tt.name;
jQuery("#previewPubchoiceId").append("<option value='"+_id+"'>"+_name+"</option>");
}
//beautySelect("#previewPubchoiceId");
__jNiceNamespace__.reBeautySelect("#previewPubchoiceId");
editTable('choiceTable0',_data);
var canChangetemp =true;
try{
canChangetemp = js_canChange;
}catch(e){}
if(jQuery("#selectItemShowType").val() != 2 && canChangetemp){
jQuery("#choicediv").show();
}
}
});
}
function cleartable(table_name,FirstShow){
jQuery("#" + table_name).find("tr").each(function(index,event){
//列头的时候,隐藏第一列
if(index == 0){
jQuery(this).find("td:eq(0)").css("display",FirstShow);
}else{
//清除其他列
jQuery(this).remove();
}
});
}
function editTable(table_name,_data){
jQuery("#" + table_name).find("tr").each(function(index,event){
//列头的时候,隐藏第一列
if(index == 0){
jQuery(this).find("td:eq(0)").css("display","none");
}else{
//清除其他列
jQuery(this).remove();
}
});
choicerowindex = 1;
for(var i=0;i<_data.length;i++){
var tt = _data[i];
var _id = tt.id;
var _name = tt.name;
var _defaultvalue = tt.defaultvalue;
var _pathcategory = tt.pathcategory;
var _maincategory = tt.maincategory;
var _isaccordtosubcom = tt.isaccordtosubcom;
var _cancel = tt.cancel;
//拼接HTML
addoTableRowNoedit(_id,_name,_defaultvalue,_pathcategory,_cancel,_isaccordtosubcom);
}
}
function addoTableRowNoedit(id,name,defaultvalue,pathcategory,cancel,isaccordtosubcom){
rowColor1 = "";
obj = document.getElementById("choiceTable0");
ncol=obj.rows[0].cells.length;
oRow = obj.insertRow(-1);
jQuery(oRow).addClass("DataDark");
jQuery(oRow).addClass("notMove");
for(i=0; i<ncol; i++){
oCell1 = oRow.insertCell(i);
switch(i){
case 0:
oCell1.style.display = "none";
break;
case 1:
var oDiv1 = document.createElement("div");
var sHtml1 = id;
oDiv1.innerHTML = sHtml1;
oCell1.appendChild(oDiv1);
break;
case 2:
var oDiv1 = document.createElement("div");
var sHtml1 = name;
sHtml1 +="<input class='Inputstyle detailInput' type='hidden' value='" + name + "'>";
sHtml1 +="<input name='pubid_" + choicerowindex + "' type='hidden' value='" + id + "'>";
oDiv1.innerHTML = sHtml1;
oCell1.appendChild(oDiv1);
break;
case 3:
jQuery(oCell1).addClass("colspanTD");
var oDiv1 = document.createElement("div");
var sHtml1 = " <input type='checkbox' disabled ";
if(defaultvalue == 1){
sHtml1 += " checked ";
}
sHtml1 += ">";
oDiv1.innerHTML = sHtml1;
oCell1.appendChild(oDiv1);
break;
case 4:
jQuery(oCell1).addClass("needhideTD categoryset");
if(jQuery("#selectItemShowType").val() == 2){
oCell1.style.display = "none";
}
var oDiv1 = document.createElement("div");
var sHtml1 = "<input type=checkbox disabled ";
if(isaccordtosubcom == 1){
sHtml1 += "checked";
}
sHtml1 += ">" + js_label22878 + " ";
sHtml1 += pathcategory;
oDiv1.innerHTML = sHtml1;
oCell1.appendChild(oDiv1);
break;
case 5:
jQuery(oCell1).addClass("needhideTD");
if(jQuery("#selectItemShowType").val() == 2){
oCell1.style.display = "none";
}
var oDiv = document.createElement("div");
var sHtml = "<div style='float:left; display:inline;width:25px;' class='childItemDiv'>"
+ "\r\n<span id='childItem"+choicerowindex+"' name='childItem"+choicerowindex+"' ></span>"
+ "\r\n</div><span id=\"childItemSpan"+choicerowindex+"\" class=\"childItemSpan\" name=\"childItemSpan"+choicerowindex+"\"></span>";
oDiv.innerHTML = sHtml;
oCell1.appendChild(oDiv);
jQuery("#childItem"+choicerowindex).e8Browser({
name:"childItem"+choicerowindex,
viewType:"0",
browserValue:"",
isMustInput:"1",
browserSpanValue:"",
getBrowserUrlFn:"showChildSelectItem",
getBrowserUrlFnParams:''+choicerowindex,
_callback:"selectChildSelectItem",
_callbackParams:choicerowindex,
hasInput:false,
isSingle:false,
hasBrowser:true,
width:"25px",
hasAdd:false
});
break;
case 6:
var oDiv1 = document.createElement("div");
var sHtml1 = "<input type='checkbox' disabled name='cancel_' ";
if(cancel == 1){
sHtml1 += " checked ";
}
sHtml1 += " value='1'>";
oDiv1.innerHTML = sHtml1;
oCell1.appendChild(oDiv1);
break;
}
}
choicerowindex++;
//如果是系统表单,不显示根据分部区分
try{
if(js_isbillmanager == 1){
jQuery("#choiceTable0 tr").find("td:eq(4)").hide();
}
}catch(e){}
jQuery("tr.notMove").bind("mousedown", function() {
return false;
});
jQuery("#choiceTable0").jNice();
}
//根据生成的字段显示列表,控制字段的显示
function setShowWithType(showStr){
for(var i = 0; i < showStr.length; i++){
var showFlag=showStr[i];
jQuery("#pubchoiceIdDIV").show();
jQuery("#selectdiv_title").parent().parent().find("td:eq(0)").show();
jQuery("#selectdiv_title").parent().show();
jQuery("#selectdiv_title").show();
if(showFlag == 1){
//公共选择框选择
if(i == 0){
jQuery("#pubchoiceIdDIV").find(".e8_os").show();
}
//上级选择框
if(i == 1){
jQuery("#pubchilchoiceIdDIV").show();
}
//关联子字段
if(i == 2){
jQuery("#childfielddiv").show();
}
//排列方式
if(i == 3){
jQuery("#selectdiv_title").parent().parent().show();
}
//旧预览
if(i == 4){
jQuery("#previewPubchoiceIdDiv").show();
}
//新预览
if(i == 5){
jQuery("#PreViewBtnDiv").show();
}
//选项列表显示
if(i == 6){
jQuery("#choicediv").show();
}
//是否只读
//因为需要重新生成列表,此处需要判断原状态
if(i == 7){
if(tempshowStr.length >=7 && tempshowStr[i] != showFlag){
jQuery("#" + tablenid).find("tr").each(function(index,event){
if(index > 0){
jQuery(this).remove();
}
});
setPreviewPub();
}
}
//添加删除选项
if(i == 8){
jQuery("#tableCtrlBtnDiv").show();
}
//选项选择
if(i == 9){
jQuery("#" + tablenid).find("tr").each(function(index,event){
//隐藏第一列
jQuery(this).find("td:eq(0)").show();
});
}
//关联文档目录和子字段选项
if(i == 10){
jQuery(".colspanTD").attr("colspan","1");
jQuery(".needhideTD").css("display","");
}
}else{
//公共选择框选择
if(i == 0){
jQuery("#pubchoiceIdDIV").find(".e8_os").hide();
}
//上级选择框
if(i == 1){
jQuery("#pubchilchoiceIdDIV").hide();
}
//关联子字段
if(i == 2){
jQuery("#childfielddiv").hide();
}
//排列方式
if(i == 3){
jQuery("#selectdiv_title").parent().parent().hide();
}
//旧预览
if(i == 4){
jQuery("#previewPubchoiceIdDiv").hide();
}
//新预览
if(i == 5){
jQuery("#PreViewBtnDiv").hide();
}
//选项列表显示
if(i == 6){
jQuery("#choicediv").hide();
}
//是否只读
//因为需要重新生成列表,此处需要判断原状态
if(i == 7){
if(tempshowStr.length >=7 && tempshowStr[i] != showFlag){
jQuery("#" + tablenid).find("tr").each(function(index,event){
if(index > 0){
jQuery(this).remove();
}
});
}
}
//添加删除选项
if(i == 8){
jQuery("#tableCtrlBtnDiv").hide();
}
//选项选择
if(i == 9){
jQuery("#" + tablenid).find("tr").each(function(index,event){
//隐藏第一列
jQuery(this).find("td:eq(0)").hide();
});
}
//关联文档目录和子字段选项
if(i == 10){
jQuery(".colspanTD").attr("colspan","3");
jQuery(".needhideTD").css("display","none");
jQuery(".needhideTD").find("input[type='hidden']").val("");
jQuery(".needhideTD").find(".e8_showNameClass").remove();
jQuery(".needhideTD").find("input[type='checkbox']").removeAttr("checked");
jQuery(".needhideTD").find(".jNiceCheckbox").removeClass("jNiceChecked");
}
}
}
tempshowStr = showStr;
}
//根据显示控制字符串,控制页面元素是否显示
function setShow(){
var showStr = getshowStr();
setShowWithType(showStr);
try{
//如果是系统表单,不显示根据分部区分
if(js_isbillmanager == 1){
jQuery("#choiceTable0 tr").find("td:eq(4)").hide();
}
}catch(e){}
}
//判断表示形式和数据来源
function getshowStr(){
var showStr = "";
//表现方式
if(jQuery("#selectItemShowType").val() == 1){
//下拉选择框
//数据来源
//独立选择框
if(jQuery("#selectItemType").val() == 0) showStr = '001000101111';
//公共选择框
if(jQuery("#selectItemType").val() == 1) showStr = '101000110011';
//公共选择框子项
if(jQuery("#selectItemType").val() == 2) showStr = '010000000000';
}else if(jQuery("#selectItemShowType").val() == 2){
//复选框
//数据来源
//独立选择框
if(jQuery("#selectItemType").val() == 0) showStr = '000101101100';
//公共选择框
if(jQuery("#selectItemType").val() == 1) showStr = '100101010000';
//公共选择框子项
if(jQuery("#selectItemType").val() == 2) showStr = '010100000000';
}else if(jQuery("#selectItemShowType").val() == 3){
//单选框
//数据来源
//独立选择框
if(jQuery("#selectItemType").val() == 0) showStr = '001101101111';
//公共选择框
if(jQuery("#selectItemType").val() == 1) showStr = '101101110011';
//公共选择框子项
if(jQuery("#selectItemType").val() == 2) showStr = '010100000000';
}
return showStr;
}