@cpzxrobot/sdk 1.2.17 → 1.2.19

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.
@@ -73,6 +73,13 @@ export class CustomerGateway extends Object {
73
73
  });
74
74
  }
75
75
 
76
+ ///contact/list
77
+ contact(id: number) {
78
+ return this.context.ready.then((axios) => {
79
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
80
+ });
81
+ }
82
+
76
83
  get visit() {
77
84
  return {
78
85
  add: (args: any) => {
package/device_filter.ts CHANGED
@@ -329,52 +329,6 @@ export abstract class DeviceFilter<T extends { id: number }> {
329
329
  return `${year}-${String(month).padStart(2, "0")}`;
330
330
  }
331
331
 
332
- // 报告设备问题
333
- report(id: number, status: number, description: string): Promise<any> {
334
- return this.context.ready.then(() => {
335
- return this.context.axios.post("/api/v3/device/report", {
336
- id,
337
- status,
338
- description
339
- }).then((res) => {
340
- if (res.data.code != 200) {
341
- throw res.data.message;
342
- }
343
- return res.data;
344
- });
345
- });
346
- }
347
-
348
- get ctrl() {
349
- return {
350
- // 获取设备控制参数
351
- get: (deviceId: number,type: string, no: any ): Promise<any> => {
352
- return this.context.ready.then(() => {
353
- return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
354
- .then((res) => {
355
- if (res.data.code != 200) {
356
- throw res.data.message;
357
- }
358
- return res.data;
359
- });
360
- });
361
- },
362
-
363
- // 配置设备控制参数
364
- set: (deviceId: number,type: string, no: any,params: any): Promise<any> => {
365
- return this.context.ready.then(() => {
366
- return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
367
- .then((res) => {
368
- if (res.data.code != 200) {
369
- throw res.data.message;
370
- }
371
- return res.data;
372
- });
373
- });
374
- }
375
- };
376
- }
377
-
378
332
  //获取设备列表,如果options.id为空,则获取用户选中工厂的设备列表,否则获取指定id的工厂的设备
379
333
  //last:获取最新数据
380
334
  // rangeToday:获取今天的第一个数据和最后一个数据
package/device_gateway.ts CHANGED
@@ -319,4 +319,51 @@ export class DeviceGateway extends Object {
319
319
  return faults;
320
320
 
321
321
  }
322
+
323
+
324
+ // 报告设备问题
325
+ report(id: number, status: number, description: string): Promise<any> {
326
+ return this.context.ready.then(() => {
327
+ return this.context.axios.post("/api/v3/device/report", {
328
+ id,
329
+ status,
330
+ description
331
+ }).then((res) => {
332
+ if (res.data.code != 200) {
333
+ throw res.data.message;
334
+ }
335
+ return res.data;
336
+ });
337
+ });
338
+ }
339
+
340
+ get ctrl() {
341
+ return {
342
+ // 获取设备控制参数
343
+ get: (deviceId: number,type: string, no: any ): Promise<any> => {
344
+ return this.context.ready.then(() => {
345
+ return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
346
+ .then((res) => {
347
+ if (res.data.code != 200) {
348
+ throw res.data.message;
349
+ }
350
+ return res.data;
351
+ });
352
+ });
353
+ },
354
+
355
+ // 配置设备控制参数
356
+ set: (deviceId: number,type: string, no: any,params: any): Promise<any> => {
357
+ return this.context.ready.then(() => {
358
+ return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
359
+ .then((res) => {
360
+ if (res.data.code != 200) {
361
+ throw res.data.message;
362
+ }
363
+ return res.data;
364
+ });
365
+ });
366
+ }
367
+ };
368
+ }
322
369
  }
@@ -54,6 +54,12 @@ class CustomerGateway extends Object {
54
54
  });
55
55
  });
56
56
  }
57
+ ///contact/list
58
+ contact(id) {
59
+ return this.context.ready.then((axios) => {
60
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
61
+ });
62
+ }
57
63
  get visit() {
58
64
  return {
59
65
  add: (args) => {
@@ -293,49 +293,6 @@ class DeviceFilter {
293
293
  // 使用 `padStart` 方法来确保月份和日期总是两位数
294
294
  return `${year}-${String(month).padStart(2, "0")}`;
295
295
  }
296
- // 报告设备问题
297
- report(id, status, description) {
298
- return this.context.ready.then(() => {
299
- return this.context.axios.post("/api/v3/device/report", {
300
- id,
301
- status,
302
- description
303
- }).then((res) => {
304
- if (res.data.code != 200) {
305
- throw res.data.message;
306
- }
307
- return res.data;
308
- });
309
- });
310
- }
311
- get ctrl() {
312
- return {
313
- // 获取设备控制参数
314
- get: (deviceId, type, no) => {
315
- return this.context.ready.then(() => {
316
- return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
317
- .then((res) => {
318
- if (res.data.code != 200) {
319
- throw res.data.message;
320
- }
321
- return res.data;
322
- });
323
- });
324
- },
325
- // 配置设备控制参数
326
- set: (deviceId, type, no, params) => {
327
- return this.context.ready.then(() => {
328
- return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
329
- .then((res) => {
330
- if (res.data.code != 200) {
331
- throw res.data.message;
332
- }
333
- return res.data;
334
- });
335
- });
336
- }
337
- };
338
- }
339
296
  //获取设备列表,如果options.id为空,则获取用户选中工厂的设备列表,否则获取指定id的工厂的设备
340
297
  //last:获取最新数据
341
298
  // rangeToday:获取今天的第一个数据和最后一个数据
@@ -233,5 +233,48 @@ class DeviceGateway extends Object {
233
233
  }
234
234
  return faults;
235
235
  }
236
+ // 报告设备问题
237
+ report(id, status, description) {
238
+ return this.context.ready.then(() => {
239
+ return this.context.axios.post("/api/v3/device/report", {
240
+ id,
241
+ status,
242
+ description
243
+ }).then((res) => {
244
+ if (res.data.code != 200) {
245
+ throw res.data.message;
246
+ }
247
+ return res.data;
248
+ });
249
+ });
250
+ }
251
+ get ctrl() {
252
+ return {
253
+ // 获取设备控制参数
254
+ get: (deviceId, type, no) => {
255
+ return this.context.ready.then(() => {
256
+ return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
257
+ .then((res) => {
258
+ if (res.data.code != 200) {
259
+ throw res.data.message;
260
+ }
261
+ return res.data;
262
+ });
263
+ });
264
+ },
265
+ // 配置设备控制参数
266
+ set: (deviceId, type, no, params) => {
267
+ return this.context.ready.then(() => {
268
+ return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
269
+ .then((res) => {
270
+ if (res.data.code != 200) {
271
+ throw res.data.message;
272
+ }
273
+ return res.data;
274
+ });
275
+ });
276
+ }
277
+ };
278
+ }
236
279
  }
237
280
  exports.DeviceGateway = DeviceGateway;
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ const company_gateway_1 = require("./company_gateway");
25
25
  const news_gateway_1 = require("./news_gateway");
26
26
  const logs_gateway_1 = require("./logs_gateway");
27
27
  const robot_gateway_1 = require("./robot_gateway");
28
+ const quotation_gateway_1 = require("./quotation_gateway");
28
29
  class Cpzxrobot {
29
30
  constructor(appCode) {
30
31
  this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
@@ -42,6 +43,7 @@ class Cpzxrobot {
42
43
  this.news = new news_gateway_1.NewsGateway(this);
43
44
  this.logs = new logs_gateway_1.LogsGateway(this);
44
45
  this.robot = new robot_gateway_1.RobotGateway(this);
46
+ this.quotation = new quotation_gateway_1.QuotationGateway(this);
45
47
  //获取当前浏览器的域名
46
48
  this.ready = new Promise((resolve, reject) => {
47
49
  this.resolveReady = resolve;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationGateway = void 0;
4
+ class QuotationGateway extends Object {
5
+ constructor(context) {
6
+ super();
7
+ this.context = context;
8
+ }
9
+ list(args) {
10
+ return this.context.ready.then((axios) => {
11
+ return axios.post(`/api/v2/coremde-sale/quotation/list`, args);
12
+ });
13
+ }
14
+ add(args) {
15
+ return this.context.ready.then((axios) => {
16
+ return axios.post(`/api/v2/coremde-sale/quotation/add`, args);
17
+ });
18
+ }
19
+ }
20
+ exports.QuotationGateway = QuotationGateway;
package/index.ts CHANGED
@@ -20,6 +20,7 @@ import { CompanyGateway } from "./company_gateway";
20
20
  import { NewsGateway } from "./news_gateway";
21
21
  import { LogsGateway } from "./logs_gateway";
22
22
  import { RobotGateway } from "./robot_gateway";
23
+ import { QuotationGateway } from "./quotation_gateway";
23
24
 
24
25
  export class Cpzxrobot {
25
26
  device: DeviceGateway;
@@ -70,6 +71,7 @@ export class Cpzxrobot {
70
71
  news: NewsGateway = new NewsGateway(this);
71
72
  logs: LogsGateway = new LogsGateway(this);
72
73
  robot: RobotGateway = new RobotGateway(this);
74
+ quotation: QuotationGateway = new QuotationGateway(this);
73
75
 
74
76
 
75
77
  constructor(appCode: string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,28 @@
1
+
2
+ import { Cpzxrobot } from "./types";
3
+
4
+ export class QuotationGateway extends Object {
5
+ context: Cpzxrobot;
6
+
7
+ constructor(context: Cpzxrobot) {
8
+ super();
9
+ this.context = context;
10
+ }
11
+
12
+ list(args: {
13
+ pageNo: number;
14
+ pageSize: number;
15
+ name?: string;
16
+ companyId?: number;
17
+ }) {
18
+ return this.context.ready.then((axios) => {
19
+ return axios.post(`/api/v2/coremde-sale/quotation/list`, args);
20
+ });
21
+ }
22
+
23
+ add(args: any) {
24
+ return this.context.ready.then((axios) => {
25
+ return axios.post(`/api/v2/coremde-sale/quotation/add`, args);
26
+ });
27
+ }
28
+ }
package/readme.md CHANGED
@@ -534,6 +534,23 @@ cpzxrobot().product.price.add({
534
534
  })
535
535
  ```
536
536
 
537
+ ### 报价单管理
538
+ #### 报价单基础操作
539
+ ```javascript
540
+ // 获取报价单列表
541
+ cpzxrobot().quotation.list({
542
+ pageNo: number,
543
+ pageSize: number,
544
+ name?: string,
545
+ companyId?: number
546
+ })
547
+
548
+ // 创建报价单
549
+ cpzxrobot().quotation.add({
550
+ // 报价单数据
551
+ })
552
+ ```
553
+
537
554
  ### 合同管理
538
555
  #### 合同基础操作
539
556
  ```javascript
@@ -793,8 +810,8 @@ baseURL: "/"
793
810
  | cpzxrobot().user.list | 列出用户(传入工厂) |
794
811
  | cpzxrobot().user.info | 获取用户信息,传入userId参数 |
795
812
  | cpzxrobot().user.listByRole | 列出用户(传入公司和角色) |
796
- | cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
797
- | cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
813
+ | cpzxrobot().user.approval.count | 获list | 获取用户审批列表,传入userId和status参数 |
814
+ | cpzxrobot().user.approval.取用户审批列表的数量,传入userId和status参数 |
798
815
  | cpzxrobot().user.approval.submits | 获取已提交的用户审批 |
799
816
  | cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
800
817
  | cpzxrobot().user.checkin.list | 列出用户签到记录,传入userId和date参数 |
@@ -866,6 +883,7 @@ baseURL: "/"
866
883
  | cpzxrobot().customer.stat.totalCount | 统计客户总数 |
867
884
  | cpzxrobot().customer.stat.amount | 统计追踪、在建阶段的项目金额 |
868
885
  | cpzxrobot().customer.stat.project | 追踪项目统计 |
886
+ | cpzxrobot().customer.contact | 获取客户联系人信息 |
869
887
  | cpzxrobot().company.list | 获得公司列表,传入必要的分页参数 |
870
888
  | cpzxrobot().company.rank.byRevenue | 按公司营收获取排名,传入必要的分页参数 |
871
889
  | cpzxrobot().company.rank.byProfit | 按公司利润获取排名,传入必要的分页参数 |
package/types.d.ts CHANGED
@@ -15,6 +15,7 @@ import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
15
15
  import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
16
16
  import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
17
17
  import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
18
+ import { QuotationGateway } from "./quotation_gateway";
18
19
 
19
20
  type Device = {
20
21
  id: number;
@@ -333,6 +334,7 @@ class Cpzxrobot {
333
334
  company: CompanyGateway;
334
335
  logs: LogsGateway;
335
336
  robot: RobotGateway;
337
+ quotation: QuotationGateway;
336
338
  dict: (key: string) => any;
337
339
  _getSelectedFarmFromMiniApp: () => Promise<Factory>;
338
340
  _getSelectedUnitFromMiniApp: () => Promise<Unit>;