shr.defineClass("shr.custom.WorkHandoverList", shr.framework.List, {
	initalizeDOM: function () {
		shr.custom.WorkHandoverList.superClass.initalizeDOM.call(this);
	},
	/**
	 * 提交生效 
	 */
	submitEffectAction: function (event) {
		var _self = this,
			workArea = _self.getWorkarea(),
			$form = $('form', workArea);
		var billId = $("#grid").jqGrid("getSelectedRows");
		if (billId == undefined || billId.length == 0 || (billId && billId.length == 1 && billId[0] == "")) {
			shr.showWarning({ "message": "请先选中单据!" });
			return false;
		}
		shr.showConfirm("是否提交生效？", function () {
			_self.prepareSubmitEffect(event, 'submitEffect');
		});
	},
	/**
	 * 提交生效 
	 */
	prepareSubmitEffect: function (event, action) {
		var _self = this;
		var billId = $("#grid").jqGrid("getSelectedRows");
		var realBillId = [];
		for (var i = 0; i < billId.length; i++) {
			var billState = "";
			if ($("tr[id='" + billId[i] + "']").length > 1) {//多人单据
				billState = $($("tr[id='" + billId[i] + "']")[0]).find("td[aria-describedby='grid_billState']").text();
			} else {
				billState = $("tr[id='" + billId[i] + "'] td[aria-describedby='grid_billState']").text();
			}
			if ("未提交" == billState && $.inArray(billId[i], realBillId) == -1) {
				realBillId.push(billId[i]);
			}
		}
		if (realBillId.length == 0) {
			shr.showError({ message: "请选择未提交的单据!" });
			return;
		}
		//var data = _self.assembleSaveData(action, realBillId);
		var target;
		if (event && event.currentTarget) {
			target = event.currentTarget;
		}
		_self.defaultBatchActionHandle("submitEffect");
	},

	/**
	 *提交之前的校验逻辑
	 */
	beforeSubmit: function () {
		var _self = this;
		return true;
	},
	/**
	 * 提交
	 */
	submitAction: function (event) {
		var _self = this;
		if (!_self.beforeSubmit()) {
			return;
		}
		var realIds = _self.getSelectedRealIds();
		var uipk = _self.getUrlParams('uipk');
		if (!realIds) {
			shr.showError({ message: "请选择未提交的单据!", hiddenAfter: 5 });
			return;
		}
		//调用OSF获取所选未提交单据的下一步参与人信息
		var response = _self.getBillsNextPersonInfo(realIds, uipk);
		shr.showConfirm($.shrI18n.common.tips.submitConfirm, function () {
			_self.doSubmit(event, 'submit', response, realIds);
		});
	},
	/**
	 * 撤销
	 * @param {*} event 
	 * @returns 
	 */
	abortBillAction: function (event) {
		var realBillId = [];
		var that = this;
		//var billId = this.selectedRowId;
		var billId = $(this.gridId).jqGrid("getSelectedRows");
		if (billId == undefined || billId.length == 0 || (billId && billId.length == 1 && billId[0] == "")) {
			shr.showWarning({ "message": jsBizMultLan.atsManager_atsLeaveBillAllList_i18n_28 });
			return;
		}
		that.defaultBatchActionHandle("abortBizBill");
	},
	/**
	 * 反审批
	 * @returns 
	 */
	againstApproveAction: function () {
		var that = this;
		var billId = $(this.gridId).jqGrid("getSelectedRows");;
		if (billId == undefined || billId.length == 0 || (billId && billId.length == 1 && billId[0] == "")) {
			shr.showError({ message: jsBizMultLan.atsManager_atsLeaveBillAllList_i18n_33 });
			return;
		} else {
			var billIds = that.getSelectedIds();
			that.defaultBatchActionHandle("againstApprove");
		}
	},
});