Skip to content

Commit 7391756

Browse files
修改部分服务回调参数
1 parent 5aa4102 commit 7391756

19 files changed

+91
-89
lines changed

src/common/iServer/AddressMatchService.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ export class AddressMatchService extends CommonServiceBase {
8585
url,
8686
params,
8787
scope: this,
88-
success(result) {
88+
success(result, options) {
8989
result.eventId = eventId;
90-
this.serviceProcessCompleted(result);
90+
this.serviceProcessCompleted(result, options);
9191
},
92-
failure(result) {
92+
failure(result, options) {
9393
if (result.error) {
9494
result.error.eventId = eventId;
9595
}
9696
result.eventId = eventId;
97-
this.serviceProcessFailed(result);
97+
this.serviceProcessFailed(result, options);
9898
}
9999
});
100100
}
@@ -103,20 +103,20 @@ export class AddressMatchService extends CommonServiceBase {
103103
* @param {Object} result - 服务器返回的结果对象。
104104
* @description 服务流程是否完成
105105
*/
106-
serviceProcessCompleted(result) {
106+
serviceProcessCompleted(result, options) {
107107
if (result.succeed) {
108108
delete result.succeed;
109109
}
110-
super.serviceProcessCompleted(result);
110+
super.serviceProcessCompleted(result, options);
111111
}
112112

113113
/**
114114
* @function AddressMatchService.prototype.serviceProcessCompleted
115115
* @param {Object} result - 服务器返回的结果对象。
116116
* @description 服务流程是否失败
117117
*/
118-
serviceProcessFailed(result) {
119-
super.serviceProcessFailed(result);
118+
serviceProcessFailed(result, options) {
119+
super.serviceProcessFailed(result, options);
120120
}
121121
}
122122

src/common/iServer/ChartQueryService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class ChartQueryService extends CommonServiceBase {
128128
* @description 查询完成,执行此方法。
129129
* @param {Object} result - 服务器返回的结果对象。
130130
*/
131-
serviceProcessCompleted(result) {
131+
serviceProcessCompleted(result, options) {
132132
var me = this;
133133
result = Util.transformResult(result);
134134
if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
@@ -140,7 +140,7 @@ export class ChartQueryService extends CommonServiceBase {
140140
}
141141

142142
}
143-
me.events.triggerEvent("processCompleted", {result: result});
143+
me.events.triggerEvent("processCompleted", {result: result, options});
144144
}
145145

146146
/**

src/common/iServer/DatasetService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,16 @@ export class DatasetService extends CommonServiceBase {
117117
url,
118118
method,
119119
scope: me,
120-
success(result) {
120+
success(result, options) {
121121
result.eventId = eventId;
122-
me.serviceProcessCompleted(result);
122+
me.serviceProcessCompleted(result, options);
123123
},
124-
failure(result) {
124+
failure(result, options) {
125125
if (result.error) {
126126
result.error.eventId = eventId;
127127
}
128128
result.eventId = eventId;
129-
me.serviceProcessFailed(result);
129+
me.serviceProcessFailed(result, options);
130130
}
131131
}
132132
params && (requestConfig.data = Util.toJSON(params));

src/common/iServer/DatasourceService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ export class DatasourceService extends CommonServiceBase {
9494
url,
9595
method,
9696
scope: me,
97-
success(result) {
97+
success(result, options) {
9898
result.eventId = eventId;
99-
this.serviceProcessCompleted(result);
99+
this.serviceProcessCompleted(result, options);
100100
},
101-
failure(result) {
101+
failure(result, options) {
102102
if (result.error) {
103103
result.error.eventId = eventId;
104104
}
105105
result.eventId = eventId;
106-
this.serviceProcessFailed(result);
106+
this.serviceProcessFailed(result, options);
107107
}
108108
}
109109
params && (requestConfig.data = Util.toJSON(params));

src/common/iServer/FieldService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class FieldService {
9595
statisticService.processAsync();
9696
}
9797

98-
_processCompleted(fieldStatisticResult) {
98+
_processCompleted(fieldStatisticResult, options) {
9999
var me = this;
100100
var getAll = true,
101101
result = fieldStatisticResult.result;
@@ -111,7 +111,7 @@ export class FieldService {
111111
}
112112
}
113113
if (getAll) {
114-
me._statisticsCallback({result: me.currentStatisticResult});
114+
me._statisticsCallback({result: me.currentStatisticResult, options});
115115
}
116116
}
117117
}

src/common/iServer/GeoprocessingService.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,31 @@ export class GeoprocessingService extends CommonServiceBase {
7878
waitForJobCompletion(jobId, identifier, options, callback) {
7979
const me = this;
8080
const timer = setInterval(function () {
81-
const serviceProcessCompleted = function (serverResult, eventId) {
81+
const serviceProcessCompleted = function (serverResult, options) {
8282
const state = serverResult.state.runState;
8383
if (options.statusCallback) {
8484
options.statusCallback(state);
8585
}
86-
serverResult.eventId = eventId;
8786
switch (state) {
8887
case 'FINISHED':
8988
clearInterval(timer);
9089
me.events.triggerEvent('processCompleted', {
91-
result: serverResult
90+
result: serverResult,
91+
options
9292
});
9393
break;
9494
case 'FAILED':
9595
clearInterval(timer);
9696
me.events.triggerEvent('processFailed', {
97-
result: serverResult
97+
result: serverResult,
98+
options
9899
});
99100
break;
100101
case 'CANCELED':
101102
clearInterval(timer);
102103
me.events.triggerEvent('processFailed', {
103-
result: serverResult
104+
result: serverResult,
105+
options
104106
});
105107
break;
106108
}
@@ -178,18 +180,18 @@ export class GeoprocessingService extends CommonServiceBase {
178180
params: paramter,
179181
headers: { 'Content-type': 'application/json' },
180182
scope: this,
181-
success(result) {
183+
success(result, options) {
182184
result.eventId = eventId;
183185
const callback = serviceProcessCompleted || this.serviceProcessCompleted.bind(this);
184-
callback(result, eventId);
186+
callback(result, options);
185187
},
186-
failure(result) {
188+
failure(result, options) {
187189
if (result.error) {
188190
result.error.eventId = eventId;
189191
}
190192
result.eventId = eventId;
191193
const callback = serviceProcessFailed || this.serviceProcessFailed.bind(this);
192-
callback(result, eventId);
194+
callback(result, options);
193195
}
194196
});
195197
}

src/common/iServer/GetFeaturesServiceBase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ export class GetFeaturesServiceBase extends CommonServiceBase {
140140
* @description 查询完成,执行此方法。
141141
* @param {Object} result - 服务器返回的结果对象。
142142
*/
143-
serviceProcessCompleted(result) {
143+
serviceProcessCompleted(result, options) {
144144
var me = this;
145145
result = Util.transformResult(result);
146146
if (me.format === DataFormat.GEOJSON && result.features) {
147147
var geoJSONFormat = new GeoJSON();
148148
result.features = geoJSONFormat.toGeoJSON(result.features);
149149
}
150-
me.events.triggerEvent("processCompleted", {result: result});
150+
me.events.triggerEvent("processCompleted", {result: result, options});
151151
}
152152

153153
dataFormat() {

src/common/iServer/GetGridCellInfosService.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class GetGridCellInfosService extends CommonServiceBase {
113113
},
114114
processFailed: function(result) {
115115
if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
116-
callback && callback(result);
116+
callback(result);
117117
}
118118
}
119119
}
@@ -124,16 +124,16 @@ export class GetGridCellInfosService extends CommonServiceBase {
124124
method: "GET",
125125
data: null,
126126
scope: me,
127-
success(result) {
127+
success(result, options) {
128128
result.eventId = eventId;
129-
successFun(result, callback);
129+
successFun(result, options, callback);
130130
},
131-
failure(result) {
131+
failure(result, options) {
132132
if (result.error) {
133133
result.error.eventId = eventId;
134134
}
135135
result.eventId = eventId;
136-
failedFunc(result);
136+
failedFunc(result, options);
137137
}
138138
});
139139
}
@@ -143,7 +143,7 @@ export class GetGridCellInfosService extends CommonServiceBase {
143143
* @description 数据集查询完成,执行此方法。
144144
* @param {Object} result - 服务器返回的结果对象。
145145
*/
146-
getDatasetInfoCompleted(result, callback) {
146+
getDatasetInfoCompleted(result, options, callback) {
147147
var me = this;
148148
result = Util.transformResult(result);
149149
me.datasetType = result.datasetInfo.type;
@@ -152,7 +152,7 @@ export class GetGridCellInfosService extends CommonServiceBase {
152152

153153
/**
154154
* @function GetGridCellInfosService.prototype.queryGridInfos
155-
* @description 执行服务,查询数据集栅格信息信息
155+
* @description 执行服务,查询数据集栅格信息
156156
*/
157157
queryGridInfos(callback) {
158158
var me = this;
@@ -169,8 +169,8 @@ export class GetGridCellInfosService extends CommonServiceBase {
169169
* @description 数据集查询失败,执行此方法。
170170
* @param {Object} result - 服务器返回的结果对象。
171171
*/
172-
getDatasetInfoFailed(result) {
172+
getDatasetInfoFailed(result, options) {
173173
var me = this;
174-
me.serviceProcessFailed(result);
174+
me.serviceProcessFailed(result, options);
175175
}
176176
}

src/common/iServer/GetLayersInfoService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ export class GetLayersInfoService extends CommonServiceBase {
7676
* @description 编辑完成,执行此方法。
7777
* @param {Object} result - 服务器返回的结果对象。
7878
*/
79-
serviceProcessCompleted(result) {
79+
serviceProcessCompleted(result, options) {
8080
var me = this, existRes, layers, len;
8181
result = Util.transformResult(result);
8282

8383
existRes = !!result && result.length > 0;
8484
layers = existRes ? result[0].subLayers.layers : null;
8585
len = layers ? layers.length : 0;
8686
me.handleLayers(len, layers);
87-
me.events.triggerEvent("processCompleted", {result: result[0]});
87+
me.events.triggerEvent("processCompleted", {result: result[0], options});
8888
}
8989

9090
/**

src/common/iServer/ImageService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ export default class ImageService extends CommonServiceBase {
9898
url,
9999
data,
100100
scope: this,
101-
success(result) {
101+
success(result, options) {
102102
result.eventId = eventId;
103-
me.serviceProcessCompleted(result);
103+
me.serviceProcessCompleted(result, options);
104104
},
105-
failure(result) {
105+
failure(result, options) {
106106
if (result.error) {
107107
result.error.eventId = eventId;
108108
}
109109
result.eventId = eventId;
110-
me.serviceProcessFailed(result);
110+
me.serviceProcessFailed(result, options);
111111
}
112112
});
113113
}

src/common/iServer/KnowledgeGraphService.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ export class KnowledgeGraphService extends CommonServiceBase {
235235
method,
236236
url,
237237
scope: this,
238-
success(result) {
238+
success(result, options) {
239239
result.eventId = eventId;
240-
this.serviceProcessCompleted(result);
240+
this.serviceProcessCompleted(result, options);
241241
},
242-
failure(result) {
242+
failure(result, options) {
243243
result.eventId = eventId;
244-
this.serviceProcessFailed(result);
244+
this.serviceProcessFailed(result, options);
245245
}
246246
};
247247
if (params) {
@@ -254,20 +254,20 @@ export class KnowledgeGraphService extends CommonServiceBase {
254254
* @param {Object} result - 服务器返回的结果对象
255255
* @description 服务流程是否完成
256256
*/
257-
serviceProcessCompleted(result) {
257+
serviceProcessCompleted(result, options) {
258258
if (result.succeed) {
259259
delete result.succeed;
260260
}
261-
super.serviceProcessCompleted(result);
261+
super.serviceProcessCompleted(result, options);
262262
}
263263

264264
/**
265265
* @function KnowledgeGraphService.prototype.serviceProcessCompleted
266266
* @param {Object} result - 服务器返回的结果对象
267267
* @description 服务流程是否失败
268268
*/
269-
serviceProcessFailed(result) {
270-
super.serviceProcessFailed(result);
269+
serviceProcessFailed(result, options) {
270+
super.serviceProcessFailed(result, options);
271271
}
272272
/**
273273
* @private

src/common/iServer/MapService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ export class MapService extends CommonServiceBase {
9898
me.request({
9999
method: "GET",
100100
scope: me,
101-
success(result) {
101+
success(result, options) {
102102
result.eventId = eventId;
103-
this.serviceProcessCompleted(result);
103+
this.serviceProcessCompleted(result, options);
104104
},
105-
failure(result) {
105+
failure(result, options) {
106106
if (result.error) {
107107
result.error.eventId = eventId;
108108
}
109109
result.eventId = eventId;
110-
this.serviceProcessFailed(result);
110+
this.serviceProcessFailed(result, options);
111111
}
112112
});
113113
}
@@ -119,7 +119,7 @@ export class MapService extends CommonServiceBase {
119119
* Parameters:
120120
* {Object} result - 服务器返回的结果对象。
121121
*/
122-
serviceProcessCompleted(result) {
122+
serviceProcessCompleted(result, options) {
123123
var me = this;
124124
result = Util.transformResult(result);
125125
var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
@@ -128,7 +128,7 @@ export class MapService extends CommonServiceBase {
128128
me.events && me.events.triggerEvent("processCompleted", {result: result});
129129
} else {
130130
////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
131-
me.events.triggerEvent("processFailed", {error: result});
131+
me.events.triggerEvent("processFailed", {error: result, options});
132132
}
133133
}
134134
}

0 commit comments

Comments
 (0)