@@ -71,15 +71,13 @@ export class WebPrintingService extends CommonServiceBase {
7171
7272 /**
7373 * @function WebPrintingService.prototype.getPrintingJob
74- * @description 获取 Web 打印输出文档任务。
75- * @param {string } jobId - Web 打印输入文档任务 ID。
74+ * @description 获取 Web 打印输出文档任务, 轮询获取打印状态,只有当状态为完成或失败才返回结果 。
75+ * @param {string } jobId - Web 打印任务 ID
7676 * @param {RequestCallback } callback - 回调函数。
7777 */
7878 getPrintingJob ( jobId , callback ) {
7979 var me = this ;
80- me . processAsync ( `jobs/${ jobId } ` , 'GET' , function ( result ) {
81- me . rollingProcess ( result , me . _processUrl ( `jobs/${ jobId } ` ) , callback ) ;
82- } ) ;
80+ me . rollingProcess ( me . _processUrl ( `jobs/${ jobId } ` ) , callback ) ;
8381 }
8482
8583 /**
@@ -108,11 +106,8 @@ export class WebPrintingService extends CommonServiceBase {
108106 * @description 轮询查询 Web 打印任务。
109107 * @param {Object } result - 服务器返回的结果对象。
110108 */
111- rollingProcess ( result , url , callback ) {
109+ rollingProcess ( url , callback ) {
112110 var me = this ;
113- if ( ! result ) {
114- return ;
115- }
116111 this . id && clearInterval ( this . id ) ;
117112 this . id = setInterval ( function ( ) {
118113 me . request ( {
@@ -142,6 +137,8 @@ export class WebPrintingService extends CommonServiceBase {
142137 result = Util . transformResult ( result ) ;
143138 if ( result . status === 'FINISHED' || result . status === 'ERROR' ) {
144139 clearInterval ( this . id ) ;
140+ } else if ( result . status === 'RUNNING' ) {
141+ options . success = false ;
145142 }
146143 return { result, options } ;
147144 }
0 commit comments