@cpzxrobot/sdk 1.1.69 → 1.1.70
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/factory_gateway.js +7 -0
- package/dist/index.js +25 -0
- package/factory_gateway.ts +8 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/readme.md +1 -0
package/dist/factory_gateway.js
CHANGED
|
@@ -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
|
}
|
package/factory_gateway.ts
CHANGED
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
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参数 |
|
|
102
103
|
| cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
|
|
103
104
|
| cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
|
|
104
105
|
| cpzxrobot().pigfarm.weightMeter.config.list | 获取称重计的配置信息 |
|