Skip to content

Commit 454b547

Browse files
committed
【fix】更改地理处理服务的任务状态名称,优化代码
1 parent 11e0411 commit 454b547

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

src/common/iServer/GeoprocessingService.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ export class GeoprocessingService extends CommonServiceBase {
2727
* @description 获取地理处理工具列表。
2828
*/
2929
getTools() {
30-
const url = `${this.url}/list`;
31-
this._get(url);
30+
this._get(`${this.url}/list`);
3231
}
3332
/**
3433
* @function SuperMap.GeoprocessingService.prototype.getTool
3534
* @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
3635
* @param {string} identifier - 地理处理工具ID。
3736
*/
3837
getTool(identifier) {
39-
const url = `${this.url}/${identifier}`;
40-
this._get(url);
38+
this._get(`${this.url}/${identifier}`);
4139
}
4240
/**
4341
* @function SuperMap.GeoprocessingService.prototype.execute
@@ -49,9 +47,8 @@ export class GeoprocessingService extends CommonServiceBase {
4947
execute(identifier, parameter, environment) {
5048
parameter = parameter ? parameter : null;
5149
environment = environment ? environment : null;
52-
const paramter = { parameter, environment };
53-
const url = `${this.url}/${identifier}/execute`;
54-
this._get(url, paramter);
50+
const executeParamter = { parameter, environment };
51+
this._get(`${this.url}/${identifier}/execute`, executeParamter);
5552
}
5653
/**
5754
* @function SuperMap.GeoprocessingService.prototype.submitJob
@@ -63,13 +60,12 @@ export class GeoprocessingService extends CommonServiceBase {
6360
submitJob(identifier, parameter, environments) {
6461
parameter = parameter ? parameter : null;
6562
environments = environments ? environments : null;
66-
const asyncParameter = { parameter: parameter, environments: environments };
67-
const url = `${this.url}/${identifier}/jobs`;
63+
const asyncParamter = { parameter: parameter, environments: environments };
6864
this.request({
69-
url: url,
65+
url: `${this.url}/${identifier}/jobs`,
7066
headers: { 'Content-type': 'application/json' },
7167
method: 'POST',
72-
data: JSON.stringify(asyncParameter),
68+
data: JSON.stringify(asyncParamter),
7369
scope: this,
7470
success: this.serviceProcessCompleted,
7571
failure: this.serviceProcessFailed
@@ -87,7 +83,6 @@ export class GeoprocessingService extends CommonServiceBase {
8783
*/
8884
waitForJobCompletion(jobId, identifier, options) {
8985
const me = this;
90-
const url = `${me.url}/${identifier}/jobs/${jobId}`;
9186
const timer = setInterval(function () {
9287
const serviceProcessCompleted = function (serverResult) {
9388
const state = serverResult.state.runState;
@@ -107,15 +102,15 @@ export class GeoprocessingService extends CommonServiceBase {
107102
result: serverResult
108103
});
109104
break;
110-
case 'CANCEL':
105+
case 'CANCELED':
111106
clearInterval(timer);
112107
me.events.triggerEvent('processFailed', {
113108
result: serverResult
114109
});
115110
break;
116111
}
117112
};
118-
me._get(url, null, serviceProcessCompleted);
113+
me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
119114
}, options.interval);
120115
}
121116

@@ -126,8 +121,7 @@ export class GeoprocessingService extends CommonServiceBase {
126121
* @param {string} jobId - 地理处理任务ID。
127122
*/
128123
getJobInfo(identifier, jobId) {
129-
const url = `${this.url}/${identifier}/jobs/${jobId}`;
130-
this._get(url);
124+
this._get(`${this.url}/${identifier}/jobs/${jobId}`);
131125
}
132126

133127
/**
@@ -137,8 +131,7 @@ export class GeoprocessingService extends CommonServiceBase {
137131
* @param {string} jobId - 地理处理任务ID。
138132
*/
139133
cancelJob(identifier, jobId) {
140-
const url = `${this.url}/${identifier}/jobs/${jobId}/cancel`;
141-
this._get(url);
134+
this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
142135
}
143136
/**
144137
* @function SuperMap.GeoprocessingService.prototype.getJobs

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy