@cpzxrobot/sdk 1.3.18 → 1.3.20
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.
- package/dist/index.js +8 -0
- package/dist/mobile_platform.js +6 -7
- package/dist/project_gateway.js +32 -7
- package/dist/web_platform.js +3 -0
- package/dist/windows_platform.js +6 -13
- package/index.ts +8 -0
- package/mobile_platform.ts +6 -8
- package/package.json +1 -1
- package/platform_interface.ts +1 -0
- package/project_gateway.ts +52 -7
- package/web_platform.ts +3 -0
- package/windows_platform.ts +7 -13
package/dist/index.js
CHANGED
|
@@ -310,6 +310,14 @@ class Cpzxrobot {
|
|
|
310
310
|
console.warn("platform not ready, title will be set later");
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
+
addMessage(message) {
|
|
314
|
+
if (this.platform) {
|
|
315
|
+
this.platform.addMessage(message);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
console.warn("platform not ready, message will be set later");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
313
321
|
}
|
|
314
322
|
exports.Cpzxrobot = Cpzxrobot;
|
|
315
323
|
Cpzxrobot.factorySelectorLoaded = false;
|
package/dist/mobile_platform.js
CHANGED
|
@@ -10,13 +10,12 @@ class MobilePlatform {
|
|
|
10
10
|
this.port = null;
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
this.platform = window.flutter_inappwebview;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, false);
|
|
13
|
+
}
|
|
14
|
+
addMessage(message) {
|
|
15
|
+
if (message.id != undefined) {
|
|
16
|
+
const callback = this.sseCallbacks[message.id];
|
|
17
|
+
callback === null || callback === void 0 ? void 0 : callback(message.data);
|
|
18
|
+
}
|
|
20
19
|
}
|
|
21
20
|
getToken() {
|
|
22
21
|
return "";
|
package/dist/project_gateway.js
CHANGED
|
@@ -132,14 +132,33 @@ class ProjectGateway extends Object {
|
|
|
132
132
|
get material() {
|
|
133
133
|
return {
|
|
134
134
|
// 获取材料列表
|
|
135
|
-
list: (
|
|
135
|
+
list: (args) => {
|
|
136
|
+
return this.context.ready.then((axios) => {
|
|
137
|
+
return axios.post(`/api/v2/coremde-sale/project/material/list`, args);
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
// 获取材料详情
|
|
141
|
+
get: (id) => {
|
|
142
|
+
return this.context.ready.then((axios) => {
|
|
143
|
+
return axios.get(`/api/v2/coremde-sale/project/material/${id}`);
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
// 新增材料
|
|
147
|
+
add: (args) => {
|
|
148
|
+
return this.context.ready.then((axios) => {
|
|
149
|
+
return axios.post(`/api/v2/coremde-sale/project/material/add`, args);
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
// 修改材料
|
|
153
|
+
update: (args) => {
|
|
154
|
+
return this.context.ready.then((axios) => {
|
|
155
|
+
return axios.post(`/api/v2/coremde-sale/project/material/update`, args);
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
// 删除材料
|
|
159
|
+
delete: (id) => {
|
|
136
160
|
return this.context.ready.then((axios) => {
|
|
137
|
-
|
|
138
|
-
pageNo,
|
|
139
|
-
pageSize,
|
|
140
|
-
projectId
|
|
141
|
-
};
|
|
142
|
-
return axios.post(`/api/v2/coremde-sale/project/material/list`, params);
|
|
161
|
+
return axios.get(`/api/v2/coremde-sale/project/material/delete/${id}`);
|
|
143
162
|
});
|
|
144
163
|
}
|
|
145
164
|
};
|
|
@@ -303,7 +322,13 @@ class ProjectGateway extends Object {
|
|
|
303
322
|
* @returns Promise
|
|
304
323
|
*/
|
|
305
324
|
add: (args) => {
|
|
325
|
+
// 等待context准备好
|
|
326
|
+
/**
|
|
327
|
+
* @param args BOM配置参数
|
|
328
|
+
* @returns Promise
|
|
329
|
+
*/
|
|
306
330
|
return this.context.ready.then((axios) => {
|
|
331
|
+
// 发送POST请求创建BOM配置
|
|
307
332
|
return axios.post(`/api/v2/coremde-sale/project/bom-config/create`, args);
|
|
308
333
|
});
|
|
309
334
|
}
|
package/dist/web_platform.js
CHANGED
package/dist/windows_platform.js
CHANGED
|
@@ -7,19 +7,12 @@ class WindwosMiniAppPlatform {
|
|
|
7
7
|
this.token = "";
|
|
8
8
|
this.appCode = "";
|
|
9
9
|
this.baseURL = "";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const callback = this.sseCallbacks[event.data.id];
|
|
17
|
-
callback === null || callback === void 0 ? void 0 : callback(event.data.data);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}, false);
|
|
10
|
+
}
|
|
11
|
+
addMessage(message) {
|
|
12
|
+
if (message.id != undefined) {
|
|
13
|
+
const callback = this.sseCallbacks[message.id];
|
|
14
|
+
callback === null || callback === void 0 ? void 0 : callback(message.data);
|
|
15
|
+
}
|
|
23
16
|
}
|
|
24
17
|
getToken() {
|
|
25
18
|
return "";
|
package/index.ts
CHANGED
|
@@ -319,6 +319,14 @@ export class Cpzxrobot {
|
|
|
319
319
|
console.warn("platform not ready, title will be set later");
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
+
|
|
323
|
+
addMessage(message: any){
|
|
324
|
+
if (this.platform) {
|
|
325
|
+
this.platform.addMessage(message);
|
|
326
|
+
} else {
|
|
327
|
+
console.warn("platform not ready, message will be set later");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
322
330
|
}
|
|
323
331
|
|
|
324
332
|
export default function (
|
package/mobile_platform.ts
CHANGED
|
@@ -15,14 +15,12 @@ export class MobilePlatform implements PlatformInterface {
|
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
this.platform = window.flutter_inappwebview;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}, false);
|
|
18
|
+
}
|
|
19
|
+
addMessage(message: any): void {
|
|
20
|
+
if (message.id != undefined) {
|
|
21
|
+
const callback = this.sseCallbacks[message.id];
|
|
22
|
+
callback?.(message.data);
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
25
|
getToken(): string {
|
|
28
26
|
return "";
|
package/package.json
CHANGED
package/platform_interface.ts
CHANGED
|
@@ -9,6 +9,7 @@ export abstract class PlatformInterface {
|
|
|
9
9
|
this.appCode = appCode;
|
|
10
10
|
this.baseURL = baseURL;
|
|
11
11
|
}
|
|
12
|
+
abstract addMessage(message: any): void;
|
|
12
13
|
abstract getToken(): string;
|
|
13
14
|
abstract setToken(token: string): void;
|
|
14
15
|
abstract getSelectedFarmFromMiniApp(): Promise<any>;
|
package/project_gateway.ts
CHANGED
|
@@ -178,14 +178,52 @@ export class ProjectGateway extends Object {
|
|
|
178
178
|
get material() {
|
|
179
179
|
return {
|
|
180
180
|
// 获取材料列表
|
|
181
|
-
list: (
|
|
181
|
+
list: (args: {
|
|
182
|
+
pageNo: number;
|
|
183
|
+
pageSize: number;
|
|
184
|
+
companyId: number;
|
|
185
|
+
materialCode?: string;
|
|
186
|
+
materialName?: string;
|
|
187
|
+
}) => {
|
|
188
|
+
return this.context.ready.then((axios) => {
|
|
189
|
+
return axios.post(`/api/v2/coremde-sale/project/material/list`, args);
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
// 获取材料详情
|
|
193
|
+
get: (id: number) => {
|
|
182
194
|
return this.context.ready.then((axios) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
195
|
+
return axios.get(`/api/v2/coremde-sale/project/material/${id}`);
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
// 新增材料
|
|
199
|
+
add: (args: {
|
|
200
|
+
materialName: string;
|
|
201
|
+
materialCode: string;
|
|
202
|
+
depotQty: string;
|
|
203
|
+
companyId: number;
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
}) => {
|
|
206
|
+
return this.context.ready.then((axios) => {
|
|
207
|
+
return axios.post(`/api/v2/coremde-sale/project/material/add`, args);
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
// 修改材料
|
|
211
|
+
update: (args: {
|
|
212
|
+
id: number;
|
|
213
|
+
materialName: string;
|
|
214
|
+
materialCode: string;
|
|
215
|
+
depotQty: string;
|
|
216
|
+
companyId: number;
|
|
217
|
+
[key: string]: any;
|
|
218
|
+
}) => {
|
|
219
|
+
return this.context.ready.then((axios) => {
|
|
220
|
+
return axios.post(`/api/v2/coremde-sale/project/material/update`, args);
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
// 删除材料
|
|
224
|
+
delete: (id: number) => {
|
|
225
|
+
return this.context.ready.then((axios) => {
|
|
226
|
+
return axios.get(`/api/v2/coremde-sale/project/material/delete/${id}`);
|
|
189
227
|
});
|
|
190
228
|
}
|
|
191
229
|
}
|
|
@@ -387,7 +425,14 @@ export class ProjectGateway extends Object {
|
|
|
387
425
|
materialInfo: string;
|
|
388
426
|
groupId: number;
|
|
389
427
|
}) => {
|
|
428
|
+
|
|
429
|
+
// 等待context准备好
|
|
430
|
+
/**
|
|
431
|
+
* @param args BOM配置参数
|
|
432
|
+
* @returns Promise
|
|
433
|
+
*/
|
|
390
434
|
return this.context.ready.then((axios) => {
|
|
435
|
+
// 发送POST请求创建BOM配置
|
|
391
436
|
return axios.post(`/api/v2/coremde-sale/project/bom-config/create`, args);
|
|
392
437
|
});
|
|
393
438
|
}
|
package/web_platform.ts
CHANGED
|
@@ -14,6 +14,9 @@ export class WebPlatform implements PlatformInterface {
|
|
|
14
14
|
this._selectedFarm = selectedFarm;
|
|
15
15
|
this._selectedUnit = selectedUnit;
|
|
16
16
|
}
|
|
17
|
+
addMessage(message: any): void {
|
|
18
|
+
throw new Error("Method not implemented.");
|
|
19
|
+
}
|
|
17
20
|
getToken(): string {
|
|
18
21
|
return this.token;
|
|
19
22
|
}
|
package/windows_platform.ts
CHANGED
|
@@ -9,19 +9,13 @@ export class WindwosMiniAppPlatform implements PlatformInterface {
|
|
|
9
9
|
baseURL: string = "";
|
|
10
10
|
|
|
11
11
|
constructor() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
callback?.(event.data.data);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}, false);
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
addMessage(message: any): void {
|
|
15
|
+
if (message.id != undefined) {
|
|
16
|
+
const callback = this.sseCallbacks[message.id];
|
|
17
|
+
callback?.(message.data);
|
|
18
|
+
}
|
|
25
19
|
}
|
|
26
20
|
getToken(): string {
|
|
27
21
|
return "";
|