DocAddScript_wev8.js
7.29 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
var __lastSeccategory = null;
function loadPropAndAcc(seccategory,treeNode,catoptions){
var _document = document;
if(catoptions){
_document = catoptions._document || document;
}
if(treeNode){
options = treeNode.options;
if(treeNode[options.rightKey]==="N"){
jQuery("#divContentInfoATab",_document).trigger("click");
jQuery("#divPropATab",_document).addClass("x-tab-strip-div-disabled").hide();
jQuery("#divAccATab",_document).addClass("x-tab-strip-div-disabled").hide();
jQuery("#seccategory",_document).val("");
jQuery("#SecId",_document).val("");
__lastSeccategory = null;
//jQuery("div#edui156").addClass("hideuploaditem");
jQuery("div.fileupload").hide();
return;
}
}
if(!__lastSeccategory){
__loadPropAndAcc(seccategory,treeNode,catoptions);
__lastSeccategory = seccategory;
}else if(__lastSeccategory!=seccategory){
top.Dialog.confirm(__reSelectCatMsg,function(){
__loadPropAndAcc(seccategory,treeNode,catoptions);
__lastSeccategory = seccategory;
},function(){
parent.selectDefaultNode("categoryid",__lastSeccategory);
});
}
}
var __ajaxNum = 0;
//加载文档属性页、附件信息
function __loadPropAndAcc(seccategory,treeNode,catoptions){
var _document = document;
var options = null;
var url = "/docs/docs/DocAddBaseInfo.jsp?timestamp="+new Date().getTime()+"&secid="+seccategory+"&f_weaver_belongto_userid="+f_weaver_belongto_userid+"&f_weaver_belongto_usertype="+f_weaver_belongto_usertype+"&prjid="+prjid+"&coworkid="+coworkid+"&crmid="+crmid+"&hrmid="+hrmid;
if(window.__DocAddExtPage===true){
url = "/docs/docs/DocAddExtBaseInfo.jsp?timestamp="+new Date().getTime()+"&secid="+seccategory+"&docType="+doctype+"&f_weaver_belongto_userid="+f_weaver_belongto_userid+"&f_weaver_belongto_usertype="+f_weaver_belongto_usertype+"&fromFlowDoc="+fromFlowDoc+"&prjid="+prjid+"&coworkid="+coworkid+"&crmid="+crmid+"&hrmid="+hrmid;
}
jQuery.post("/docs/docs/AddSecIdUseCount.jsp",{secid:seccategory});
//检查最大上传附件大小
jQuery.ajax({
url:"/docs/category/docajax_operation.jsp?ts="+new Date().getTime()+"&secid="+seccategory,
type:"get",
data:{
src:"getSecMaxUploadSize"
},
dataType:"json",
beforeSend:function(){
__ajaxNum++;
//e8showAjaxTips(__ajaxStartMsg,true);
},
complete:function(xhr){
__ajaxNum--;
if(__ajaxNum<=0)
e8showAjaxTips("",false);
},
success:function(data){
try{
if(parseInt(data.maxUploadSize)>0){
bindAttachmentUpload(data.maxUploadSize);
}else{
//jQuery("div#edui156").addClass("hideuploaditem");
jQuery("div.fileupload").hide();
}
}catch(e){}
}
});
//加载文档属性页、附件信息
jQuery.ajax({
url:url,
type:"get",
dataType:"html",
data:catoptions,
beforeSend:function(){
__ajaxNum++;
//e8showAjaxTips(__ajaxStartMsg,true);
},
complete:function(xhr){
__ajaxNum--;
if(__ajaxNum<=0)
e8showAjaxTips("",false);
},
success:function(data){
var divPropContent = jQuery("#divPropContent",_document);
divPropContent.html(data);
jQuery("#divPropATab",_document).removeClass("x-tab-strip-div-disabled").show();
var accUrl="/docs/docs/DocAcc.jsp?mode=add&pagename=docadd&isFromWf=false&operation=getDivAcc&secid="+seccategory+"&f_weaver_belongto_userid="+f_weaver_belongto_userid+"&f_weaver_belongto_usertype="+f_weaver_belongto_usertype;
jQuery("#e8DocAccIfrm",_document).attr("src",accUrl);
try{
var imageidsExt = jQuery("#imageidsExt",_document).val();
jQuery("#delImageidsExt",_document).val(imageidsExt);
jQuery("#imageidsExt",_document).val("");
jQuery("#imagenamesExt",_document).val("");
}catch(e){}
jQuery("#divAccATab",_document).removeClass("x-tab-strip-div-disabled").show();
jQuery("#seccategory",_document).val(seccategory);
jQuery("#SecId",_document).val(seccategory);
var __needinputitems = jQuery("#__needinputitems").val();
var needinputitems = jQuery("#needinputitems").val();
if(__needinputitems){
if(needinputitems){
needinputitems = needinputitems+","+__needinputitems;
}else{
needinputitems = __needinputitems;
}
jQuery("#needinputitems").val(needinputitems);
}
try{
beautySelect("select");
jQuery("#divPropContent").jNice();
}catch(e){
if(window.console)console.log(e,"/docs/docs/DocList.jsp#leftMenuClickFn");
}
}
});
catoptions = jQuery.extend({mouldid:-1},catoptions);
//加载显示模板
loadEditMould(seccategory,catoptions);
}
function getNeedinputitems(){
return jQuery("#needinputitems").val();
}
//加载显示模板
function loadEditMould(seccategory,catoptions){
catoptions = jQuery.extend({mouldid:0,clearContent:false},catoptions);
if(catoptions.clearContent===true){
if(window.__DocAddExtPage===true){//office编辑模板
}else{
if(!ue)return;
ue.setContent("");
}
}
if(catoptions.mouldid){
//加载编辑模板
if(window.__DocAddExtPage===true){//office编辑模板
if(catoptions.mouldid>0){
try{
weaver.WebOffice.Template=catoptions.mouldid;
weaver.WebOffice.WebOpen(); //打开该文档
}catch(e){
if(window.console)console.log(e,"/js/doc/DocAddScript.js#loadEditMould");
}
}else{
jQuery.ajax({
url:"/docs/docs/LoadEditMould.jsp?timestamp="+new Date().getTime(),
type:"get",
dataType:"json",
data:{
secid:seccategory,
mouldid:catoptions.mouldid,
__DocAddExtPage:window.__DocAddExtPage
},
beforeSend:function(){
__ajaxNum++;
//e8showAjaxTips(__ajaxStartMsg,true);
},
complete:function(xhr){
__ajaxNum--;
if(__ajaxNum<=0)
e8showAjaxTips("",false);
},
success:function(data){
try{
if(data.mouldid>0){
weaver.WebOffice.Template=data.mouldid;
weaver.WebOffice.WebOpen(); //打开该文档
}
}catch(e){
if(window.console)console.log(e,"/js/doc/DocAddScript.js#loadEditMould");
}
}
});
}
}else{
jQuery.ajax({
url:"/docs/docs/LoadEditMould.jsp?timestamp="+new Date().getTime(),
type:"get",
dataType:"html",
data:{
secid:seccategory,
mouldid:catoptions.mouldid,
__DocAddExtPage:window.__DocAddExtPage
},
beforeSend:function(){
__ajaxNum++;
//e8showAjaxTips(__ajaxStartMsg,true);
},
complete:function(xhr){
__ajaxNum--;
if(__ajaxNum<=0)
e8showAjaxTips("",false);
},
success:function(data){
if(window.__DocAddExtPage===true){//office编辑模板
}else{
if(!ue)return;
var content = ue.getContent();
if(catoptions.clearContent===true){
content = "";
}
content = data + content;
ue.setContent(content);
}
}
});
}
}
}
function afterSelectCategory(e,datas,name,params){
if(datas){
//if(datas.tag>0){
loadPropAndAcc(datas.id);
parent.selectDefaultNode("categoryid",datas.id);
//}
}
}
function afterSelectMainDoc(e,datas,name,params){
if(datas){
$GetEle("maindoc").value=datas.id;
}
}
function onChangeDocType(doPage,docType){
top.Dialog.confirm(__switchTypeMsg,function(){
window.onbeforeunload=null;
var gotoUrl=getGotoPage(doPage,docType);
gotoUrl=gotoUrl+"&f_weaver_belongto_userid="+f_weaver_belongto_userid+"&f_weaver_belongto_usertype="+f_weaver_belongto_usertype;
location.href=gotoUrl;
return true;
},function(){return false;});
}