shr.defineClass("shr.esign.ESignGlobalStatusOverviewList", shr.framework.List, {
    initalizeDOM: function () {
        var _self = this;

        shr.esign.ESignGlobalStatusOverviewList.superClass.initalizeDOM.call(this);
        if(_self.initData&&_self.initData.custom_params){
        }

    },
    /**
     *撤销签署流程
     */
    revoke_by_fileAction: function () {
        var _self = this;
        var selectedIds = this.getSelectedIds();
        _self.doRemoteWithBatchAction({
            method: 'revoke_by_file',
            billId: selectedIds
        });
    },
    /**
     *基于文件发起签署
     */
    create_by_fileAction: function () {
        var _self = this;
        var selectedIds = this.getSelectedIds();
        _self.doRemoteWithBatchAction({
            method: 'create_by_file',
            billId: selectedIds
        });
    },
    /**
     *催签流程中签署人
     */
    urge_by_fileAction: function () {
        var _self = this;

        var selectedIds = this.getSelectedIds();
        _self.doRemoteWithBatchAction({
            method: 'urge_by_file',
            billId: selectedIds
        });
    },
    /**
     *  审批
     */
    previewAction: function () {
        var _self = this;

        var selectedIds = this.getSelectedIds();

        _self.doRemoteWithBatchAction({
            method: 'preview',
            billId: selectedIds,
            success:function (response){
                if(response){
                    setTimeout(()=>{
                        _self.reloadPage({
                            uipk: "com.kingdee.eas.custom.esign.app.ESignGlobalStatusOverview.view",
                            billId: selectedIds,
                            method: 'view'
                        });
                    },500);
                }
            }
        });
    },
    /**
     *  审批
     */
    syncAttachmentsAction: function () {
        var _self = this;

        var selectedIds = this.getSelectedIds();
        _self.doRemoteWithBatchAction({
            method: 'syncAttachments',
            billId: selectedIds
        });
    },
    /**
     *  同步签署状态
     */
    detail_sign_fieldsAction: function () {
        var _self = this;

        var selectedIds = this.getSelectedIds();
        _self.doRemoteWithBatchAction({
            method: 'detail_sign_fields',
            billId: selectedIds
        });
    },
    /**
     * 执行远程服务端方法，适用于有批量操作的远程调用
     */
    doRemoteWithBatchAction: function (param) {
        var _self = this;
        var data = param;
        data = $.extend(_self.prepareParam(), data);
        data = $.extend({ permItemId: shr.getCurrentPagePermItemId() }, data);
        var func = data.func;
        var success = param.success;
        delete data.func;
        shr.doWithBatchAction({
            url: _self.dynamicPage_url,
            type: 'post',
            data: data,
            success: function (response) {
                if (response) {
                    if (func && typeof func === "function") {
                        func(response);
                    }

                    if (success && typeof success === "function") {
                        return success(response);
                    }
                    var batchTipsData = _self.batchTipsDataHandler(response, data);

                    $(_self).shrMessageTips({
                        isSuccess: batchTipsData.isSuccess,
                        successCount: batchTipsData.successCount,
                        failureCount: batchTipsData.failureCount,
                        confirmCallback: function () {
                            $(_self).shrDetailTips({
                                tableData: batchTipsData.tmp,
                                successCount: batchTipsData.successCount,
                                failureCount: batchTipsData.failureCount,
                                colNamesData: batchTipsData.tableModel,
                                isSortable: _self.batchHandlerWhetherSortable(),
                                modalWidth: param.modalWidth || ''
                            }).shrDetailTips("open");
                        },

                        closeCallback: function () {
                            // 这里需要存一下是否全部成功的标识
                            sessionStorage.setItem('deleteSuccess', batchTipsData.failureCount ? 0 : 1);
                            _self.reloadGrid();
                        }
                    }).shrMessageTips("open");
                } else {
                    $(_self).shrMessageTips("_setDetailDisable");
                }
            },
            error: function (response) {
                if (param.billId && param.billId.split(',').length > 1) {
                    _self.reloadGrid();
                }
            }
        });
    },
})