shr.defineClass("shr.custom.RoomChangeApplicationBatchEdit", shr.framework.Edit, {
	initalizeDOM: function () {
		shr.custom.RoomChangeApplicationBatchEdit.superClass.initalizeDOM.call(this);
		var that = this;
		that.entrys();
	}
	
	,setButtonVisible:function(){
		var billState = $("#billState").val();
		//alert(billState);
		if (billState) {
			if (billState==3 || 
				'审批不通过'==billState ||
					billState ==4||
					'审批通过'==billState ||
					billState ==2||
					'审批中'==billState ) {
				$("#edit").hide();
				$("#submit").hide();
				$("#submitEffect").hide();
			} else if (1==billState ||
				'未审批'== billState ||
					2 == billState || 
					'审批中'==billState) { //未审批或审批中
				if(!this.isFromWF()){
					$("#edit").hide();
					$("#submit").hide();
					$("#submitEffect").hide();
				}
			}
		}
		if (this.getOperateState().toUpperCase() == 'VIEW') { //查看状态下不允许提交
			//不允许提交生效
			$("#submitEffect").hide();
		}
		//如果是工作流打回,界面上的"取消"不显示
		if (this.isFromWF()) {
			$("#cancelAll").hide(); 
		}
	},
	entrys() {
		waf("#entrys").jqGrid("option", {
			afterEditCell: function (rowid, cellname, value, iRow, iCol) {
				$('#' + iRow + '_person').shrPromptBox("option", {
					onchange: function (e, val) {
						if (cellname == "person") {
							var adminOrg = {
								name: val.current["adminOrgUnit.name"],
								id: val.current["adminOrgUnit.id"]
							}
							$("#entrys").jqGrid('setCell', rowid, "adminOrg", adminOrg);
							var position = {
								name: val.current["position.name"],
								id: val.current["position.id"]
							}
							$("#entrys").jqGrid('setCell', rowid, "position", position);
						}
					}
				});
			},
			beforeSaveCell: function (rowid, cellname, value, iRow, iCol) {
			},
			afterSaveCell: function (rowid, cellname, value, iRow, iCol) {
			},
			beforeEditCell: function (rowid, cellname, value, iRow, iCol) {
			}
		});
	}
});
