shr.defineClass("shr.custom.HRBillBaseEdit", shr.framework.Edit, {
    initalizeDOM: function () {
        shr.custom.HRBillBaseEdit.superClass.initalizeDOM.call(this);
        var that = this;
    }
    /**
 * 提交生效
 * 重写此方法的校验调用方法
 */
    , submitEffectAction: function (event) {
        var _self = this;
        if (_self.validate() && _self.verify()) {
            shr.showConfirm("您确认要提交生效吗？", function () {
                _self.prepareSubmitEffect(event, 'submitEffect');
            });
        }
    }
    , prepareSubmitEffect: function (event, action) {
        var _self = this;
        var data = _self.assembleSaveData(action);

        var target;
        if (event && event.currentTarget) {
            target = event.currentTarget;
        }
        shr.doAction({
            target: target,
            url: _self.dynamicPage_url,
            type: 'post',
            data: data,
            success: function (response) {
                if (response != null || response != "") {
                    _self.back();
                }
            }
        });
    },
    // setButtonVisible: function () {
    // 	shr.custom.HRBillBaseEdit.superClass.setButtonVisible.call(this);
    // 	if (this.getOperateState().toUpperCase() == 'ADDNEW') { //新增状态下不显示套打按钮
    // 		$("#templatePrint").hide();
    // 	}
    // 	if (this.getOperateState().toUpperCase() == 'VIEW') { //查看状态下不允许提交
    // 		$("#submit").hide();
    // 		$("#submitEffect").hide();
    // 	}
    // },
    verify: function () {
        var _self = this;
        var isExist = true;
        if (this.getOperateState().toUpperCase() != 'VIEW') {
            const checkInDate = $("#entrys_checkInDate").shrDateTimePicker("getValue")//入住日期		
            const adjustmentDate = $("#entrys_adjustmentDate").shrDateTimePicker("getValue")//调整日期
            const checkoutDate = $("#entrys_checkoutDate").shrDateTimePicker("getValue")//退宿日期

            var startTimeOfDate = new Date(checkInDate);
            var endTimeOfDate = new Date(checkoutDate);

            var longTime = endTimeOfDate.getTime() - startTimeOfDate.getTime();
            if (longTime <= 0) {
                shr.showInfo({ message: "退宿日期不可大于入住日期！" });
                return false;
            }
            var data = _self.assembleSaveData("save");
            _self.remoteCall({
                method: 'saveverify',
                param: {
                    model: data.model,
                },
                data: data,
                async: false, // 关键点：设置为false实现同步请求
                success: function (data) {
                    console.log(data);
                }, error(msg) {
                    console.log(msg);
                    isExist = false;
                }
            });
        }
        return isExist;
    }
});