@cpzxrobot/sdk 1.1.69 → 1.1.71

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.
@@ -69,6 +69,28 @@ export class CustomerGateway extends Object {
69
69
  );
70
70
  });
71
71
  },
72
+ update: (args: any) => {
73
+ return this.context.ready.then((axios) => {
74
+ return axios.post(
75
+ `/api/v2/coremde-sale/customer/visit/update`,
76
+ args,
77
+ );
78
+ });
79
+ },
80
+ delete: (id: number) => {
81
+ return this.context.ready.then((axios) => {
82
+ return axios.get(
83
+ `/api/v2/coremde-sale/customer/visit/delete?id=${id}`,
84
+ );
85
+ });
86
+ },
87
+ get: (id: number) => {
88
+ return this.context.ready.then((axios) => {
89
+ return axios.get(
90
+ `/api/v2/coremde-sale/customer/visit/get?id=${id}`,
91
+ );
92
+ });
93
+ },
72
94
  }
73
95
  }
74
96
 
@@ -50,6 +50,21 @@ class CustomerGateway extends Object {
50
50
  return axios.post(`/api/v2/coremde-sale/customer/visit/add`, args);
51
51
  });
52
52
  },
53
+ update: (args) => {
54
+ return this.context.ready.then((axios) => {
55
+ return axios.post(`/api/v2/coremde-sale/customer/visit/update`, args);
56
+ });
57
+ },
58
+ delete: (id) => {
59
+ return this.context.ready.then((axios) => {
60
+ return axios.get(`/api/v2/coremde-sale/customer/visit/delete?id=${id}`);
61
+ });
62
+ },
63
+ get: (id) => {
64
+ return this.context.ready.then((axios) => {
65
+ return axios.get(`/api/v2/coremde-sale/customer/visit/get?id=${id}`);
66
+ });
67
+ },
53
68
  };
54
69
  }
55
70
  get stat() {
@@ -136,5 +136,12 @@ class FactoryGateway extends Object {
136
136
  },
137
137
  };
138
138
  }
139
+ get batch() {
140
+ return {
141
+ list: (factory) => {
142
+ return this.context.axios.get(`/api/v2/batch/factory/${factory.id}`);
143
+ }
144
+ };
145
+ }
139
146
  }
140
147
  exports.FactoryGateway = FactoryGateway;
package/dist/index.js CHANGED
@@ -90,6 +90,31 @@ class Cpzxrobot {
90
90
  // @ts-ignore
91
91
  instance.getAndPreview = instance.getAndSave;
92
92
  // @ts-ignore
93
+ instance.upload = (url, option) => {
94
+ //add a file button to the body
95
+ var button = document.createElement("input");
96
+ button.type = "file";
97
+ button.style.display = "none";
98
+ document.body.appendChild(button);
99
+ button.onchange = (e) => {
100
+ var _a;
101
+ var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
102
+ if (file) {
103
+ const formData = new FormData();
104
+ formData.append((option === null || option === void 0 ? void 0 : option["fileField"]) || "file", file);
105
+ for (let key in option === null || option === void 0 ? void 0 : option["data"]) {
106
+ formData.append(key, option["data"][key]);
107
+ }
108
+ instance.post(url, formData).then((res) => {
109
+ button.remove();
110
+ });
111
+ }
112
+ else {
113
+ button.remove();
114
+ }
115
+ };
116
+ };
117
+ // @ts-ignore
93
118
  this.axios = instance;
94
119
  }
95
120
  }
@@ -154,13 +154,9 @@ class ProjectGateway extends Object {
154
154
  }, fileName);
155
155
  });
156
156
  },
157
- approval: (id, agree, auditInfo) => {
157
+ approval: (args) => {
158
158
  return this.context.ready.then((axios) => {
159
- return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, {
160
- id,
161
- agree,
162
- auditInfo,
163
- });
159
+ return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, args);
164
160
  });
165
161
  }
166
162
  };
@@ -170,4 +170,12 @@ export class FactoryGateway extends Object {
170
170
  },
171
171
  };
172
172
  }
173
+
174
+ get batch(){
175
+ return {
176
+ list: (factory: Factory) => {
177
+ return this.context.axios.get(`/api/v2/batch/factory/${factory.id}`);
178
+ }
179
+ }
180
+ }
173
181
  }
package/index.ts CHANGED
@@ -123,7 +123,7 @@ export class Cpzxrobot {
123
123
  }
124
124
  // @ts-ignore
125
125
  instance.getAndPreview = instance.getAndSave;
126
-
126
+ // @ts-ignore
127
127
  instance.upload = (url: string, option?: {
128
128
  [key: string]: any;
129
129
  }) => {
@@ -132,7 +132,7 @@ export class Cpzxrobot {
132
132
  button.type = "file";
133
133
  button.style.display = "none";
134
134
  document.body.appendChild(button);
135
- button.onchange = (e:Event) => {
135
+ button.onchange = (e: Event) => {
136
136
  var file = (e.target as HTMLInputElement).files?.[0];
137
137
  if (file) {
138
138
  const formData = new FormData();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.69",
3
+ "version": "1.1.71",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -195,13 +195,9 @@ export class ProjectGateway extends Object {
195
195
  },fileName);
196
196
  });
197
197
  },
198
- approval:(id: number, agree: 1 | 0, auditInfo: string) =>{
198
+ approval:(args:any) =>{
199
199
  return this.context.ready.then((axios) => {
200
- return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, {
201
- id,
202
- agree,
203
- auditInfo,
204
- });
200
+ return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, args);
205
201
  });
206
202
  }
207
203
  };
package/readme.md CHANGED
@@ -99,6 +99,7 @@ baseURL: "/"
99
99
  | cpzxrobot().factory.workshop.get | 获得工厂的某个车间信息 |
100
100
  | cpzxrobot().factory.workshop.post | 添加车间信息 |
101
101
  | cpzxrobot().factory.workshop.types | 获得车间的类型列表 |
102
+ | cpzxrobot().factory.batch.list | 获得批次列表,传入factoryId参数 |ldiba
102
103
  | cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
103
104
  | cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
104
105
  | cpzxrobot().pigfarm.weightMeter.config.list | 获取称重计的配置信息 |
package/types.d.ts CHANGED
@@ -305,9 +305,10 @@ interface DataQueryArgs {
305
305
  | "max"
306
306
  | "raw"
307
307
  | "difference";
308
- period?: "1mo" | "1d" | null;
308
+ period?: "1mo" | "1d" | "1h" |null; // 统计周期,默认为1d
309
309
  offset?: string; // 可以设置统计偏移量,比如设置18h, 则统计从当天晚上6点开始
310
310
  [key: string]: any;
311
+ aggerate?: string;
311
312
  }
312
313
 
313
314
  class Cpzxrobot {