@cpzxrobot/sdk 1.3.50 → 1.3.52
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/device_filter.ts +4 -2
- package/dist/device_filter.js +4 -1
- package/dist/product_gateway.js +21 -0
- package/package.json +1 -1
- package/product_gateway.ts +24 -1
package/device_filter.ts
CHANGED
|
@@ -31,7 +31,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
add(device: any) {
|
|
34
|
-
this.context.ready.then(axios=>{
|
|
34
|
+
this.context.ready.then(axios => {
|
|
35
35
|
return axios.post("/api/v2/device/add", device)
|
|
36
36
|
})
|
|
37
37
|
}
|
|
@@ -208,7 +208,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
|
|
|
208
208
|
if (args.type == "raw") {
|
|
209
209
|
return res;
|
|
210
210
|
} else {
|
|
211
|
-
if (res.data
|
|
211
|
+
if (res.data) {
|
|
212
|
+
throw "device_list error("+JSON.stringify(res)+")";
|
|
213
|
+
} else if (res.data.Error) {
|
|
212
214
|
throw res.data.Error;
|
|
213
215
|
}
|
|
214
216
|
// this.devices.push(res.data);
|
package/dist/device_filter.js
CHANGED
|
@@ -189,7 +189,10 @@ class DeviceFilter {
|
|
|
189
189
|
return res;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
if (res.data
|
|
192
|
+
if (res.data) {
|
|
193
|
+
throw "device_list error(" + JSON.stringify(res) + ")";
|
|
194
|
+
}
|
|
195
|
+
else if (res.data.Error) {
|
|
193
196
|
throw res.data.Error;
|
|
194
197
|
}
|
|
195
198
|
// this.devices.push(res.data);
|
package/dist/product_gateway.js
CHANGED
|
@@ -102,6 +102,27 @@ class ProductGateway extends Object {
|
|
|
102
102
|
return axios.get(`/api/v2/coremde-sale/product/delete?id=${id}`);
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* 导入产品信息
|
|
107
|
+
* @param file 上传的Excel文件
|
|
108
|
+
* @returns Promise
|
|
109
|
+
*/
|
|
110
|
+
import(file) {
|
|
111
|
+
return this.context.ready.then((axios) => {
|
|
112
|
+
return axios.upload(`/api/v2/coremde-sale/product/import`);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
get template() {
|
|
116
|
+
return {
|
|
117
|
+
download: () => {
|
|
118
|
+
return this.context.ready.then((axios) => {
|
|
119
|
+
return axios.getAndSave(`/api/v2/coremde-sale/product/template/download`, {
|
|
120
|
+
fileName: "产品导入模板.xlsx"
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
105
126
|
/**
|
|
106
127
|
* 获取产品单位列表
|
|
107
128
|
* @param args 分页参数
|
package/package.json
CHANGED
package/product_gateway.ts
CHANGED
|
@@ -181,6 +181,29 @@ export class ProductGateway extends Object {
|
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* 导入产品信息
|
|
186
|
+
* @param file 上传的Excel文件
|
|
187
|
+
* @returns Promise
|
|
188
|
+
*/
|
|
189
|
+
import(file: File) {
|
|
190
|
+
return this.context.ready.then((axios) => {
|
|
191
|
+
return axios.upload(`/api/v2/coremde-sale/product/import`);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
get template(){
|
|
196
|
+
return {
|
|
197
|
+
download: () => {
|
|
198
|
+
return this.context.ready.then((axios) => {
|
|
199
|
+
return axios.getAndSave(`/api/v2/coremde-sale/product/template/download`, {
|
|
200
|
+
fileName: "产品导入模板.xlsx"
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
184
207
|
/**
|
|
185
208
|
* 获取产品单位列表
|
|
186
209
|
* @param args 分页参数
|
|
@@ -188,7 +211,7 @@ export class ProductGateway extends Object {
|
|
|
188
211
|
*/
|
|
189
212
|
get units() {
|
|
190
213
|
return {
|
|
191
|
-
list: (args: {pageNo: number, pageSize: number}) => {
|
|
214
|
+
list: (args: { pageNo: number, pageSize: number }) => {
|
|
192
215
|
return this.context.ready.then((axios) => {
|
|
193
216
|
return axios.post(
|
|
194
217
|
`/api/v2/coremde-sale/product/unit/list`,
|