ls-pro-common 3.1.63 → 3.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { ApiResponse } from '../typing';
1
2
  /**
2
3
  * 后台任务进度查看
3
4
  *
@@ -5,5 +6,5 @@
5
6
  * @param taskName 后台任务名称,
6
7
  * @returns
7
8
  */
8
- declare const taskProcess: (taskId: string, taskName?: string) => void;
9
+ declare const taskProcess: (taskId: string, taskName: string | undefined, callback: (result: ApiResponse | false) => void) => void;
9
10
  export default taskProcess;
@@ -14,7 +14,9 @@ import { httpGet } from '../http';
14
14
  */
15
15
  var taskProcess = function taskProcess(taskId) {
16
16
  var taskName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
17
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
17
18
  if (!taskId) {
19
+ callback(false);
18
20
  return;
19
21
  }
20
22
  var exit = false;
@@ -81,6 +83,7 @@ var taskProcess = function taskProcess(taskId) {
81
83
  })),
82
84
  onClose: function onClose() {
83
85
  exit = true;
86
+ callback(false);
84
87
  document.removeEventListener('mouseup', onUp);
85
88
  document.removeEventListener('mousemove', onMove);
86
89
  }
@@ -91,8 +94,8 @@ var taskProcess = function taskProcess(taskId) {
91
94
  if (exit) return;
92
95
  var url = '/lesoon/lesoon-msg-center-api/bizAsyncTaskManage/page';
93
96
  httpGet(url, {
94
- 'page': 1,
95
- 'pageSize': 1,
97
+ page: 1,
98
+ pageSize: 1,
96
99
  where: {
97
100
  taskId: taskId
98
101
  }
@@ -102,6 +105,7 @@ var taskProcess = function taskProcess(taskId) {
102
105
  var row = rows === null || rows === void 0 ? void 0 : rows[0];
103
106
  if (!row) {
104
107
  showError('获取任务进度失败,请在消息中心查看任务结果');
108
+ callback(result);
105
109
  _notification.close(key);
106
110
  } else {
107
111
  var status = row.status,
@@ -123,12 +127,20 @@ var taskProcess = function taskProcess(taskId) {
123
127
  showWarn('任务已终止,请在消息中心查看任务结果');
124
128
  }
125
129
  sleep(1.5).then(function () {
130
+ callback(result);
126
131
  _notification.close(key);
127
132
  });
128
133
  }
129
134
  }
130
135
  }).catch(function () {
131
136
  showError('获取任务进度失败,请在消息中心查看任务结果');
137
+ callback({
138
+ flag: {
139
+ retCode: '9999',
140
+ retMsg: '获取任务进度失败,请在消息中心查看任务结果'
141
+ },
142
+ success: false
143
+ });
132
144
  _notification.close(key);
133
145
  });
134
146
  };
@@ -1,3 +1,4 @@
1
+ import { ApiResponse } from '../typing';
1
2
  /**
2
3
  * 后台任务进度查看
3
4
  *
@@ -5,5 +6,5 @@
5
6
  * @param taskName 后台任务名称,
6
7
  * @returns
7
8
  */
8
- declare const taskProcess: (taskId: string, taskName?: string) => void;
9
+ declare const taskProcess: (taskId: string, taskName: string | undefined, callback: (result: ApiResponse | false) => void) => void;
9
10
  export default taskProcess;
@@ -14,7 +14,9 @@ import { httpGet } from '../http';
14
14
  */
15
15
  var taskProcess = function taskProcess(taskId) {
16
16
  var taskName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
17
+ var callback = arguments.length > 2 ? arguments[2] : undefined;
17
18
  if (!taskId) {
19
+ callback(false);
18
20
  return;
19
21
  }
20
22
  var exit = false;
@@ -81,6 +83,7 @@ var taskProcess = function taskProcess(taskId) {
81
83
  })),
82
84
  onClose: function onClose() {
83
85
  exit = true;
86
+ callback(false);
84
87
  document.removeEventListener('mouseup', onUp);
85
88
  document.removeEventListener('mousemove', onMove);
86
89
  }
@@ -91,8 +94,8 @@ var taskProcess = function taskProcess(taskId) {
91
94
  if (exit) return;
92
95
  var url = '/lesoon/lesoon-msg-center-api/bizAsyncTaskManage/page';
93
96
  httpGet(url, {
94
- 'page': 1,
95
- 'pageSize': 1,
97
+ page: 1,
98
+ pageSize: 1,
96
99
  where: {
97
100
  taskId: taskId
98
101
  }
@@ -102,6 +105,7 @@ var taskProcess = function taskProcess(taskId) {
102
105
  var row = rows === null || rows === void 0 ? void 0 : rows[0];
103
106
  if (!row) {
104
107
  showError('获取任务进度失败,请在消息中心查看任务结果');
108
+ callback(result);
105
109
  _notification.close(key);
106
110
  } else {
107
111
  var status = row.status,
@@ -123,12 +127,20 @@ var taskProcess = function taskProcess(taskId) {
123
127
  showWarn('任务已终止,请在消息中心查看任务结果');
124
128
  }
125
129
  sleep(1.5).then(function () {
130
+ callback(result);
126
131
  _notification.close(key);
127
132
  });
128
133
  }
129
134
  }
130
135
  }).catch(function () {
131
136
  showError('获取任务进度失败,请在消息中心查看任务结果');
137
+ callback({
138
+ flag: {
139
+ retCode: '9999',
140
+ retMsg: '获取任务进度失败,请在消息中心查看任务结果'
141
+ },
142
+ success: false
143
+ });
132
144
  _notification.close(key);
133
145
  });
134
146
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.63",
3
+ "version": "3.1.64",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [