|
|
@@ -146,7 +146,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import request from "@/utils/request";
|
|
|
+import { getWeightsConfig, updateWeightsConfig } from "@/api/supply";
|
|
|
|
|
|
export default {
|
|
|
name: "SupplyWeightsConfig",
|
|
|
@@ -208,10 +208,7 @@ export default {
|
|
|
async fetchWeights() {
|
|
|
this.loading = true;
|
|
|
try {
|
|
|
- const response = await request({
|
|
|
- url: "http://localhost:5000/api/config/weights",
|
|
|
- method: "get",
|
|
|
- });
|
|
|
+ const response = await getWeightsConfig();
|
|
|
// Flask API可能直接返回权重对象,而不是封装在data字段中
|
|
|
if (
|
|
|
response &&
|
|
|
@@ -260,11 +257,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const response = await request({
|
|
|
- url: "http://localhost:5000/api/config/weights",
|
|
|
- method: "put",
|
|
|
- data: this.weights,
|
|
|
- });
|
|
|
+ const response = await updateWeightsConfig(this.weights);
|
|
|
// Flask API可能直接返回成功消息,而不是封装在msg字段中
|
|
|
if (response && response.message) {
|
|
|
this.message = response.message;
|