loadbutton.js 28 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 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
var pagetype;

var contentpath = $("#contentpath").val();
//页面加载完后执行
$(document).ready(function() { 
	//设置表单中间的分隔线为当前页面高度
	setMiddleBorder();
	}); 
function loadbutton(status , doctype,outdispatches,argtype){
	// 新建发文操作动态显示标识
	var saveAsdraftFlag = null;
	pagetype=argtype;
	var sendFlag = null;
	var saveFlag = null;
	var deleteFlag = null;
	var filingFlag = null;
	var removeFlag = null;
	var updateFlag = null;
	var logFlag = null;
	var getbackdocFlag = null;
	var rollbackFlag = null;
	var printFlag = null;
	var countersignFlag = null;
	var rewards = "";
	var backto = "";
	var saveFlagStr = "";
	var sendFlagStr = "";
	var removeFlagStr = "";
	var filingFlagStr = "";
	var logFlagStr = "";
	var getbackdocFlagStr = "";
	var viewlogFlagStr = "";
	var rollbackFlagStr = "";
	var printFlagStr = "";
	var countersignFlagStr = "";
	var saveAsdraftFlagStr= "";	
	
	//加载关闭页面提示div
	loadDivPrompt();
	//加载相关附件div
	loadAttachRelateDiv();
	//拼接按钮准备
		//saveAsdraftFlagStr = "<button id=\"saveAsdraft\" class=\"btn btn-info\" type=\"button\" ><span class=\"glyphicon glyphicon-floppy-saved\"></span>存草稿</button>";
        //存草稿
		saveAsdraftFlagStr = "<button id=\"saveAsdraft\" style=\"display:'none'\" class=\"btn btn-info\" type=\"button\" ><span class=\"glyphicon glyphicon-floppy-saved\"></span>存草稿</button>";

		saveFlagStr = "<button id=\"save\" style=\"display:'none'\" class=\"btn btn-info\" type=\"button\" ><span class=\"glyphicon glyphicon-floppy-saved\"></span>保存</button>";
	
		sendFlagStr = "<button id=\"send\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-send\"></span>发送</button>";
	
		removeFlagStr = "<button id=\"delete\" style=\"display:'none'\" class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-trash\"></span>删除</button>";
	
		filingFlagStr = "<button id=\"filing\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-saved\"></span>办结</button>";

		rollbackFlagStr = "<button id=\"rollback\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-arrow-left\"></span>回退</button>";
	
		logFlagStr = "<button id=\"circlelog\" style=\"display:'none'\"  class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-random\"></span>流转日志</button>";
		//退件
		rewards = "<button id=\"rewards\" style=\"display:'none'\"  class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-random\"></span>退件</button>";
		backto = "<button id=\"backto\" style=\"display:'none'\"  class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-transfer\"></span>退回</button>";
		getbackdocFlagStr = "<button id=\"takeback\" class=\"btn btn-info\" type=\"button\" ><span class=\"glyphicon glyphicon-export\"></span>取回</button>";

	var remindingStr= "<button id=\"reminder\" class=\"btn btn-info\" type=\"button\" ><span class=\"glyphicon glyphicon-bell\"></span>提醒</button>";
	var cancelSupervisionStr = "<button id=\"nosupervise\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-remove-circle\"></span>取消督办</button>";
	var supervisionStr = "<button id=\"supervise\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-exclamation-sign\"></span>督办</button>";
	//var printFlagStr = "<button id=\"print\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-send\"></span>发文笺</button>";
	var listType = getUrlParam("listType");
	var button_load=$("#button_load");
	countersignFlagStr = "<button id=\"countersign\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-list-alt\"></span>会签</button>";
	var printStr = "<button id=\"print\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-print\"></span>打印</button>";
	var printStr1 = "<button id=\"print1\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-print\"></span>打印</button>";
	var overFillingStr = "<button id=\"final_filing\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-inbox\"></span>归档</button>";
	var collection = "<button style='display:none;' id=\"collection\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-star\"></span>收藏</button>";
	var cenclCollection = "<button style='display:none;' id=\"cenclCollection\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-star-empty\"></span>取消收藏</button>";
	
	//督办公文按钮
	var dbgw = "<button id=\"dbgw\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-exclamation-sign\"></span>文件督办</button>";
//	if (status == "0" || outdispatches == "拟稿") {
	if (status == "0") {
		if (doctype == "fw") {	
			$("#button_load").append(saveFlagStr+removeFlagStr+sendFlagStr);
		} else if (doctype == "sw" || doctype == "cy" || doctype == "xj") {
			var apeendStr="";
//			莫潇楠修改 18.03.09。新建信件,新建收文不加载办结按钮
			apeendStr=saveFlagStr + sendFlagStr + removeFlagStr;
//			if(doctype == "cy"){
//				apeendStr=saveFlagStr + sendFlagStr + removeFlagStr;
//			}else{
//				apeendStr=saveFlagStr + sendFlagStr + removeFlagStr + filingFlagStr;	
//			}
			$("#button_load").append(apeendStr);
			//$("#filing,#delete").css('display', 'none');
			}else if(doctype=="jy"){
			apeendStr=saveFlagStr + sendFlagStr + removeFlagStr;
			$("#button_load").append(apeendStr);
			//$("#filing,#delete").css('display', 'none');
		}
		// 用于保证待办公文进入详情页后的按钮显示
	}else if (outdispatches == "拟稿" && listType=="endorsementdocumentsData"){ 
		$("#button_load").append(saveFlagStr+removeFlagStr+sendFlagStr+logFlagStr);
	} else {	
		if (listType=="dealedlistData") {// 已办列表点击的详情
			if(doctype=="jy"){
				button_load.append(getbackdocFlagStr + viewlogFlagStr+logFlagStr+printStr1);
			}else{
				button_load.append(getbackdocFlagStr + viewlogFlagStr+logFlagStr+printStr);
			}
		} else if (listType=="archivefileData") {// 归档列表点击的详情
				button_load.append(overFillingStr + viewlogFlagStr+logFlagStr+printStr);
		} else if (listType=="documentSearchData") {// 公文查询点击详情
			if(doctype=="sw"){
				//若为市局意见打开的  不显示督办按钮
				if(status=="2"){supervisionStr="";}
				button_load.append(supervisionStr+cancelSupervisionStr+logFlagStr+printStr+dbgw);
			}else{
				button_load.append(logFlagStr+printStr);
			}
				
		} else if (listType=="supervisionlistData") {// 督办列表点击详情
				button_load.append(remindingStr+cancelSupervisionStr+supervisionStr+viewlogFlagStr+printStr+logFlagStr);
		} else if (listType=="managerlistData") {// 公文管理点击详情
			if(doctype=='fw'){
				button_load.append( saveFlagStr + sendFlagStr + removeFlagStr + viewlogFlagStr+countersignFlagStr+printStr+logFlagStr);
			}else{
				button_load.append( saveFlagStr + sendFlagStr +removeFlagStr + viewlogFlagStr+logFlagStr+printStr+filingFlagStr);
			}
		}else if (listType=="endorsementdocumentsData"){//待办公文点击详情
			if(doctype=='fw'){
//				if(outdispatches=="会签"){
//					var startcountersignStr = "<button id=\"startcountersign\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-blackboard\"></span>确认会签</button>";
//					button_load.append(startcountersignStr+logFlagStr);
//				}else{
//					button_load.append(saveFlagStr +sendFlagStr+ removeFlagStr + viewlogFlagStr+filingFlagStr+countersignFlagStr+printStr+logFlagStr);
//				}
//				莫潇楠 2018年5月10日 星期四  注释以上代码,添加以下一句   修改 发文详情页顶部按钮权限不对
					button_load.append(sendFlagStr+saveFlagStr+rewards+backto + viewlogFlagStr+filingFlagStr+countersignFlagStr+printStr+logFlagStr);
				}else if(doctype=="jy"){
				button_load.append(  sendFlagStr  +viewlogFlagStr+filingFlagStr+printStr1+logFlagStr);
			}else{
				button_load.append(   sendFlagStr  +viewlogFlagStr+filingFlagStr+printStr+logFlagStr + dbgw);
			}
		}else if(listType=="circulatedocumentsData"){//传阅公文点击详情
			button_load.append(  sendFlagStr  +  viewlogFlagStr+printStr+logFlagStr);
		}else if (listType=="draftlistData"){
			button_load.append(  sendFlagStr+countersignFlagStr+printStr);
		}
	
	}	 
	//初始化全部隐藏
	 $("#button_load button").css("display","none");
	 /*会签按钮和市局意见按钮不用权限控制 用代码控制*/
	 if(outdispatches=="会签"){
		 $("#startcountersign").css("display","inline-block");
	 }
	 if(status=="2"){
		 $("#circlelog").css("display","inline-block");
		 
	 }
	 if(status!="0"){
		 $("#button_load").append(collection+cenclCollection);
		 if(doctype=="jy"){
			 $("#circlelog").css("display","inline-block");
		 }
	 }
	     $("#delete").css("display","inline-block");
		 $("#print").css("display","inline-block");
		 $("#print1").css("display","inline-block");
//		 $("#rewards").css("display","inline-block");
		 
// hyh 注释掉   西安需求上不用市局意见    2017/11/27	 
//	 if(doctype == "sw"&&status!="2"){
//			var  urbanViewStr = "<button id=\"urbanView\"class=\"btn btn-info\" type=\"button\"><span class=\"glyphicon glyphicon-comment\"></span>市局意见</button>";
//			$("#button_load")
//			.append(urbanViewStr);
//		}
	 
	 
}
/**
 * 在打印状态的时候才加载份数和发文字号div
 */
function printLoadDiv(){
	//加载发文字号
	loadNumberDiv();
	//加载份数
	loadpPartNumberDiv();
	
}
//加载发文字号
function loadNumberDiv(){
	$("#fw_numberDiv").html("");
//	2018年8月17日 星期五 莫潇楠 发文字号改成手动填写
	$("#fw_numberDiv").append("<img src=\"../../../image/officedocument/document/icon_reference_number.png\"/> " + 
			"<label class=\"bluefont\">文 &nbsp;&nbsp;&nbsp;&nbsp;号</label>"+
			"<input id=\"refnumber\" class=\"text-border\" type=\"text\"  placeholder=\"\" />");
//	$("#fw_numberDiv").append("<img src=\"../../../image/officedocument/document/icon_reference_number.png\"/> " + 
//			"<label class=\"bluefont\">文件编号</label>"+
//			"<input id=\"refnumber\" readonly=\"true\" class=\"text-border\" type=\"text\"  placeholder=\"\" style=\"width:525px ;\"/>"+
//			"<span class=\"glyphicon glyphicon-remove  \" style=\"float:right; margin-top:-25px;margin-right:195px\" onclick='deleteNumber(this,\"fw\")'></span>"+
//			"<button id=\"createnumber\" style=\"position: absolute;float:right;margin-top:-9px;margin-left: -22px;height:32px;\" class=\"btn btn-info\">" +
//			"<span class=\"glyphicon glyphicon-share-alt\"></span>" +
//	"<label style = \"cursor: pointer;\">生成发文字号</label></button>");

}
//加载文件编号  longwending 2017.9.13
function loadDocNumberDiv(){
	$("#refnumber_div").html("");
//	<!-- 2018年7月26日 星期四  莫潇楠  改来文编号为文件编号 -->
	$("#refnumber_div").append("<img src=\"../../../image/officedocument/document/icon_reference_number.png\"/> " + 
			"<label class=\"bluefont\" style=\"margin-left: 2px;margin-right:4px;\">文件编号</label>"+
			"<input id=\"refnumber\" readonly=\"true\" class=\"text-border placeholder\"\" type=\"text\" style=\"width:140px ;\"/> "+
			"<span id= \"deletNumber\" class=\"glyphicon glyphicon-remove  \" style=\"float:right; margin-top:-30px;margin-right:140px\" onclick='deleteNumber(this)'></span>"+
			"<button id=\"createnumber\" style=\"position: absolute;float:right;margin-top:-10px;height:32px;\" class=\"btn btn-info\">" +
				"<span class=\"glyphicon glyphicon-share-alt\"></span>" +
				"<label style = \"cursor: pointer;\">生成来文编号</label></button>");
                // "<label style = \"cursor: pointer;\">生成</label></button>");//hyh 修改,规划局新需求 2017/12/12

}
//加载份数
function loadpPartNumberDiv(){
	$("#fw_partNumberDiv").html("");
	$("#fw_partNumberDiv").append("<div id=\"partNumber\" class=\"div-radio\">" +
			"<img src=\"../../../image/officedocument/document/icon_reference_number.png\"/> "+
			"<label class=\"bluefont\" style=\"letter-spacing:12px;\">份  数</label>"+
			"<input class=\"text-border\" id=\"partNumber_readonly\" type=\"text\" style=\"display:none;\" value=\"3份\" readonly=\"readonly\">"+
			"<div style=\"display:inline;\">"+
			"<input id=\"radioPart1\" type=\"radio\" name=\"groundPart\" checked=\"checked\"/><label for=\"radioPart1\">3份</label>"+
			"<input id=\"radioPart2\" type=\"radio\" name=\"groundPart\"/><label for=\"radioPart2\">4份</label>"+
			"<input id=\"radioPart3\" type=\"radio\" name=\"groundPart\"/><label for=\"radioPart3\">5份</label>"+
			"<input id=\"radioPart4\" type=\"radio\" name=\"groundPart\"/><label for=\"radioPart4\">自定义</label>"+
			"<input id=\"numbers\" placeholder=\"\"	style=\"display:none;width:10%;margin:0 10px;\"type=\"text\" />"+
			"</div>"+
			"</div>");
}
function loadRollbackButton(doctype){
//	 $("#"+doctype+"_button_load").append("<button " +
//		 		"id=\"rollback\"class=\"btn btn-info\" " +
//		 		"type=\"button\"><span class=\"glyphicon glyphicon-send\">" +
//		 		"</span>回退</button>"					
//			);
}

//function loadDivPrompt(){
	//$("#divPrompt").append("<span><label id=\"action\">操作</label>成功!窗口将在<label id=\"timeInterval\">5</label>秒后关闭!</span>");
	
//}

function loadDivPrompt(){
	$("#divPrompt").append("<span><label id=\"action\">操作</label>成功!窗口将在<label id=\"timeInterval\">5</label>秒后关闭!</span>"
    					   +"<button id=\"close\" class=\"btn btn-info\">我自己关闭</button>");
	
}


function viewhtml(controlid,controlalias,operate){
	var sug;
	$("#" +controlid).html("");
	var viewhtml="";
	var idstr="";
	var addViewShow = "";
	if(controlid.indexOf("nbyj")!=-1){
		idstr="nb";
		sug = "已阅。";
	}else if(controlid.indexOf("zryj")!=-1){
		idstr="zr";
		sug = "已阅。";
	}else if(controlid.indexOf("yjl")!=-1){
		idstr="yjl";
		sug = "已确认。";
	}else if(controlid.indexOf("dbyj")!=-1){
		idstr = "db";
		sug = "已确认。";
	}
	if(operate=="只读"){
		addViewShow = "display:none";
	}
//	this.scrollHeight
	viewhtml="<div class=\"div-reply-content\" style=\"display: block;\">"
		+ "<textarea id=\""+idstr+"yj\" class=\"div-reply-input gw-textarea\" placeholder=\"意见填写\" style=\"margin-bottom: 8px;height:83px;display:none;\" oninput=\"triageViewHight(this);\">"+sug+"</textarea>"
		+ "</div> 					"
		+ "<div id=\""+idstr+"Add\"class=\"div-document-opinion\"style='cursor:pointer;width: 100%;"+addViewShow+"'>"
		+ " <div class=\"div-document-opinion-add\">"
		+ " <span class=\"glyphicon glyphicon-plus\"></span>"
		+ " <label class=\"bluefont\">添加	意见</label>"
		+ " </div>"
		+ "</div>" 
		+ "<div id=\"yj_buttons\"class=\"div-reply-content\" style=\"display:flex;justify-content:flex-end;align-items: center;\">" 
		//冯局 发文 意见时间修改权限3 by zj
		+ (username&&username=='冯涛'?"<div id='yj_buttons_inputs' style='flex-grow:0;display:none;height:30px;width:100%;'> <input id='"+idstr+"isSubmitDate' placeholder='选择时间' style='border:1px solid #ccc;cursor:pointer;' type='text' value=''/> </div>":"")

		+ " <button id=\""+idstr+"commit_view\" style=\"display:none;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\"class=\"btn btn-info\" onclick=\"commitzyview('"+idstr+"')\"><span class=\"glyphicon glyphicon-ok\" ></span>提交</button> "
		+ " <button id=\""+idstr+"canlce_view\"style=\"display:none;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\" class=\"btn btn-info\"  onclick=\"canlezyview('"+idstr+"')\"><span class=\"glyphicon glyphicon-share-alt\"></span>取消</button>    "
		+ "</div>";
	//督办记录显示添加督办记录 xiewu 2018-11-27
	if(idstr == "db"){
		viewhtml="<div class=\"div-reply-content\" style=\"display: block;\">"
			+ "<textarea id=\""+idstr+"yj\" class=\"div-reply-input gw-textarea\" placeholder=\"督办记录填写\" style=\"margin-bottom: 8px;height:83px;display:none;\" oninput=\"triageViewHight(this);\"></textarea>"
			+ "</div> 					"
			+ "<div id=\""+idstr+"Add\"class=\"div-document-opinion\"style='cursor:pointer;width: 100%;"+addViewShow+"'>"
			+ " <div class=\"div-document-opinion-add\">"
			+ " <span class=\"glyphicon glyphicon-plus\"></span>"
			+ " <label class=\"bluefont\">添加督办记录</label>"
			+ " </div>"
			+ "</div>" 
			+ "<div id=\"yj_buttons\"class=\"div-reply-content\" style=\"display:flex;justify-content:flex-end;\">" 
			+ " <button id=\""+idstr+"commit_view\" style=\"display:none;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\"class=\"btn btn-info\" onclick=\"commitzyview('"+idstr+"')\"><span class=\"glyphicon glyphicon-ok\" ></span>提交</button> "
			+ " <button id=\""+idstr+"canlce_view\"style=\"display:none;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\" class=\"btn btn-info\"  onclick=\"canlezyview('"+idstr+"')\"><span class=\"glyphicon glyphicon-share-alt\"></span>取消</button>    "
			+ "</div>";
	}
	if(operate=="可写"){
		
		$("#" +controlid).append(
				  "<div class=\"div-title\" style=\"margin-top:10px;\">"
				+ "<label class=\"titlename\">"+controlalias+"</label>"
				+ "</div>"
				+ "<div id='"+idstr+"_view'>"
				+	"<div class='.div-opinion-user' id='noview'style="+"display:none"+";>"
//				+	"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">暂无意见</label>"
				+	"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">未填写</label>"
				+	"</div>"
				+ "</div>"
				+ viewhtml
				);
	}else if(operate=="只读"){
		$("#" +controlid).append(
				  "<div class=\"div-title\" style=\"margin-top:10px;\">"
				+ "<label class=\"titlename\">"+controlalias+"</label>"
				+ "</div>"
				+ "<div id='"+idstr+"_view'>"
				+	"<div class='.div-opinion-user' id='noview'>"
//				+	"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">暂无意见</label>"
				+	"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">未填写</label>"
				+	"</div>"
				+ "</div>"
				+ viewhtml
				);
	}
//		莫潇楠  过滤局内会签中的局领导意见 18.03.19
	if(idstr == 'yjl'){
		$('#' + controlid + ' .div-title').append(
				"<div style='float:right;display:inline-flex;align-items:center;'>"
				+ "<label style='color:black;margin-right:10px'>"
				+	"<input type='checkbox' id='manager-opinion-check' class='filter-and-order'>" +
				"&nbsp;局领导意见" 
				+ "</label>"
				+ "<div class='btn-group choose-order-btn-group'>\
				  <button type='button' class='btn btn-default dropdown-toggle current-order' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>\
				  <span>默认排序</span>  <span class='caret'></span>\
				  </button>\
				  <ul class='dropdown-menu'>\
				    <li class='filter-and-order' data-order='default'><a href='#'>默认排序</a></li>\
				    <li class='filter-and-order' data-order='newest'><a href='#'>最新在前</a></li>\
				  </ul>\
				</div>"
				+"</div>"
		);
	}
	
		
	layui.use("laydate",function(){
		layui.laydate.render({
			elem:"#"+idstr+'isSubmitDate',
			type:'datetime',
			format:'yyyy-MM-dd HH:mm',
			value:(new Date()).format('yyyy-MM-dd hh:mm')
		});
	});
	
	viewClickEvent(idstr);
}


function triageViewHight(obj){
	obj.style.height = "85px";
	if(obj.scrollHeight>70)
		obj.style.height = obj.scrollHeight+'px';
		obj.style.overflowY = "hidden";
}

function fwViewLoad(controlid,controlalias,operate){

	var viewhtml="";
	var idstr="";
	var viewrole="";
	var flag=false;
	if(controlid.indexOf("bm_div")!=-1){
		idstr="bm";
		viewrole="部门负责人意见";
		//意见是否存在
		if(hgviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("hq_div")!=-1){
		idstr="hq";
		viewrole="会签意见";
		//意见是否存在
//		if(hgviewhas=="y"){
//			flag=true;
//		}
	}else if(controlid.indexOf("bgs_div")!=-1){
		idstr="bgs";
		viewrole="办公室主任意见";
		//意见是否存在
		if(shviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("qf_div")!=-1){
		idstr="qf";
		viewrole="局领导意见";
		//意见是否存在
		if(qfviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("ng_div")!=-1){
		idstr="ng";
		viewrole="拟稿人意见";
		//意见是否存在
		if(ngviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("sh_div")!=-1){
		idstr="sh";
		viewrole="办公室审核意见";
		//意见是否存在
		if(shviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("nbcs_div")!=-1){
		idstr="nbcs";
		viewrole="内部初审意见";
		//意见是否存在
		if(nbcsviewhas=="y"){
			flag=true;
		}
	}else if(controlid.indexOf("nbfs_div")!=-1){
		idstr="nbfs";
		viewrole="内部复审意见";
		//意见是否存在
		if(nbfsviewhas=="y"){
			flag=true;
		}
	}
	if(operate=="可写"){
		fwViewHtml(idstr,viewrole,operate,flag);
	}else if(operate=="只读"){
		fwViewHtml(idstr,viewrole,operate);
	}else if(operate=="隐藏"){

		$("#"+idstr+"_title").css("display","none");
	}
	fwViewButtonEvent(idstr);

}

function fwViewHtml(idstr,viewrole,operate,flag){
	var noViewShow="";
	var edit = "";
	if(operate=="只读"){
		noViewShow=
		"<div class='.div-opinion-user'  id='noview' >"
//		+"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">暂无意见</label>"
		+"<label class='div-reply-info' style=\"color: rgb(204, 204, 204);\">未填写</label>"
		+"</div>"
		+ "</div>";
	}
	if(operate=="可写"){
		if(idstr!="hq"){	
			edit="<button id=\""+idstr+"_show\" style='display:none;'class=\"btn btn-info\">" 
				+"<span class=\"glyphicon glyphicon-share-alt\"></span>编辑</button> "}

	}
	
		$("#"+idstr+"_title")
		.append(
				"<img src=\""+contentpath+"/image/officedocument/icon/icon_issued.png\"/>"
						+ "<label class=\"bluefont\">"+viewrole+" </label> "
						);	  //取消编辑按钮  by zj
	

	$("#"+idstr+"_div").append(
					 "<div id='"+idstr+"_view'>"
					 +noViewShow
					+ "<div>"
					+ "<textarea id=\""+idstr+"Opinion\" class=\"gw-textarea\"  placeholder=\"意见填写\""
					+ "	style=\"width: 100%;height:83px; display:none;margin-bottom:6px;overflow-y:hidden;\"oninput=\"triageViewHight(this);\" ></textarea>"
					+ "</div>          				"
					+ "<div id=\""+idstr+"Add\"class=\"div-document-opinion\"style='cursor:pointer; width: 100%;display:none;'>"
					+ "	   <div class=\"div-document-opinion-add\">"
					+ "		 <span class=\"glyphicon glyphicon-plus\"></span>"
					+ "		 <label class=\"bluefont\"style='cursor:pointer;'>添加意见</label>"
					+ "	   </div>"
					+ "	</div>"
					+ "  	<div class=\"qf-botton\" >"
					//冯局 发文 意见时间修改权限4 by zj
					+(username&&username=='冯涛'?"<input id='"+idstr+"isSubmitDate' placeholder='选择时间' style='border:1px solid #ccc;display:none;height:30px;margin-top: 8px;cursor:pointer;' type='text' value=''/> ":"")
					+ "		<input id=\""+idstr+"_isSubmit\"type=\"hidden\" readonly=\"true\" value=''/> "
					+ "	    <button id=\""+idstr+"_cancel\" style='display:none;float:right;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\"'class=\"btn btn-info\"><span class=\"glyphicon glyphicon-share-alt\"></span>取消</button> "
					+ "		<button id=\""+idstr+"_submit\" style='display:none;float:right;margin: 8px 5px 0px 5px;margin-top: 8px;margin-right: 5px;\"'class=\"btn btn-info\"><span class=\"glyphicon glyphicon-ok\"></span>提交</button> "
					+ "		</div>");
	if(operate=="可写"){
			$("#"+idstr+"Add").css("display","block");

		
	}
//	莫潇楠  过滤局内会签中的局领导意见 18.03.19
	if(idstr == 'hq'){
		$("#"+idstr+"_title").append(
				"<div style='float:right;display:inline-flex;align-items:center;'>"
				+ "<label style='color:black;margin-right:10px''>"
				+	"<input type='checkbox' id='manager-opinion-check' class='filter-and-order'>" +
						"&nbsp;局领导意见" 
				+ "</label>"
				+ "<div class='btn-group choose-order-btn-group'>\
				  <button type='button' class='btn btn-default dropdown-toggle current-order' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>\
				  <span>默认排序</span>  <span class='caret'></span>\
				  </button>\
				  <ul class='dropdown-menu'>\
				    <li class='filter-and-order' data-order='default'><a href='#'>默认排序</a></li>\
				    <li class='filter-and-order' data-order='newest'><a href='#'>最新在前</a></li>\
				  </ul>\
				</div>"
				+"</div>"
		);
	}
	layui.use("laydate",function(){
		layui.laydate.render({
			elem:"#"+idstr+'isSubmitDate',
			type:'datetime',
			format:'yyyy-MM-dd HH:mm',
			value:(new Date()).format('yyyy-MM-dd hh:mm')
		});
	});
	
}
/**
 * 意见相关按钮显示
 */
function viewbuttomDisplay(operate,idstr){
	if(operate=="可写"){
		$("#noview").css("display","none");
		$("#"+idstr+"Add,#"+idstr+"_show").css("display","inline-block");
	}else if(operate=="只读"){
		$("#noview").css("display","block");
		$("#"+idstr+"Add,#"+idstr+"_show").css("display","none");
	}else if(operate=="隐藏"){
		$("#noview").css("display","none");
		$("#"+idstr+"Add,#"+idstr+"_show").css("display","none");
	}
	
	//公文管理时隐藏所有添加意见按钮  by zj 2019-03-08
	var listType = getUrlParam("listType");
	if(listType=='managerlistData'){
		$("#"+idstr+"Add").css("display","none");
	}
}
function fwViewButtonEvent(idstr){
	 $("#"+idstr+"_show").click(function(){
			$("#"+idstr+"_show,#"+idstr+"Add").css('display','none');
 		$("#"+idstr+"Opinion,#"+idstr+"_submit,#"+idstr+"_cancel").css('display','inline-block');
 		//冯局 发文 意见时间修改权限2 by zj
 		if(username && username=='冯涛'){
    		$("#"+idstr+"isSubmitDate").css("display","inline");
    	}
		 
	 });
	 
	 $("#"+idstr+"_cancel").click(function(){
		    if(idstr.indexOf("bm")!=-1&&hgviewhas!=null){
				$("#"+idstr+"_show").css('display','inline-block');
			}else if(idstr.indexOf("hq")!=-1&&hqviewhas!=null){
				$("#"+idstr+"Add").css("display","inline-block");
			}else if(idstr.indexOf("bgs")!=-1&&shviewhas!=null){
				$("#"+idstr+"_show").css('display','inline-block');
			}else if(idstr.indexOf("qf")!=-1&&qfviewhas!=null){
				$("#"+idstr+"_show").css('display','inline-block');
			}else if(idstr.indexOf("ng")!=-1&&ngviewhas!=null){
				$("#"+idstr+"_show").css("display","inline-block");
			}else if(idstr.indexOf("sh")!=-1&&shviewhas!=null){
				$("#"+idstr+"_show").css("display","inline-block");
			}else{

				$("#"+idstr+"Add").css("display","inline-block");
			}
//		$("#"+idstr+"_show").css('display','block');
		$("#"+idstr+"Opinion,#"+idstr+"_submit,#"+idstr+"_cancel,#"+idstr+"isSubmitDate").css('display','none');
		 
	 });
}
function viewClickEvent(idstr){
	 
	 $("#"+idstr+"Add").click(function(){
			 zrIsEidte=false;
			 nbIsEidte=false;
			 jbIsEidte=false;
			 hqIsEidte=false;
	    	 $("#"+idstr+"_view,.div-reply").css("display","block");
	    	 $("#"+idstr+"Add").css("display","none");
	       	 $("#"+idstr+"_view").parent().find(".div-reply-content").css('display','flex');
	       	 $("#"+idstr+"yj").css('display','block');
	    	 $("#"+idstr+"commit_view,#"+idstr+"canlce_view").css("display","inline");
	    	//冯局 发文 意见时间修改权限2 by zj
	    	 if(username && username=='冯涛'){	    		 
	    		 $("#yj_buttons_inputs").css("display","inline");
	    	 }
	    	  
	  });
}

function loadAttachRelateDiv(){
	
	$("#origin").append("<a onclick=\"upload_click2('file','FW','originaldoc')\"style='cursor:pointer;'>上传文件</a>");
}
function loadOriginButton() {
	if(pagetype==null||pagetype==undefined){	
		// 原始来文上传附件按钮
		$("#originhead")
				.append(
						"<button class=\"btn btn-info progress-button\" id=\"uploadOriginbtn\""
							+ "onclick=\"upload_click2('file','FW','origindoc')\" data-style=\"fill\""
							+ "data-horizontal>"
							+ "<span class=\"glyphicon glyphicon-file\" style='cursor:pointer;'></span>上传文件"
							+ "</button>");
	}
}

/**
 * 若没有附件,则全部隐藏附件div
 * @param docattachmentpath
 */
function  hideAttachDiv(docattachmentpath){
	if(pagetype!="5"){
		if(docattachmentpath==undefined||docattachmentpath==null){
		 //除发文外其他公文附件div
		 $(".div-attachment").css("display","none");
		 //发文的附件
		 $("#attachmentname").css("display","none");
		}
		//移除事件
//		$(".div-attachment-item").unbind("mouseover");
		$("#origin").css("display","none");
	}
}

function setMiddleBorder(){
	var pageHeight=document.body.clientHeight ;
	$(".div-document-content-left").css("height",pageHeight);
	
}