import { edit, add, detail } from "@/api/wms/inter-order"; import { saveWmsMessages } from "@/api/wms/message"; submitForm() { this.goodsType = this.$refs.goodsType.item; this.form.goodOrderItems = this.goodsType.goodList; console.log(this.form.goodOrderItems); this.loadingbut = true; this.$refs.form.validate((valid) => { if (valid) { add(this.form).then(res => { this.$message.success("保存成功!"); this.loadingbut = false; this.back(); }); } } 执行完add后,在执行一下saveWmsMessages,执行saveWmsMessages不需要成功和失败的通知,我该怎么改
时间: 2024-02-14 17:12:01 浏览: 7
如果您不需要执行成功和失败的通知,可以将 saveWmsMessages 方法放在 add 方法的后面,这样它会在 add 方法执行成功后立即执行,代码如下:
```
add(this.form).then(res => {
this.$message.success("保存成功!");
this.loadingbut = false;
this.back();
});
saveWmsMessages();
```
这样在 add 方法执行成功后,会立即执行 saveWmsMessages 方法,但不会处理执行成功和失败后的操作。
相关问题
import { edit, add, detail } from "@/api/wms/inter-order"; import { saveWmsMessages } from "@/api/wms/message"; submitForm() { this.goodsType = this.$refs.goodsType.item; this.form.goodOrderItems = this.goodsType.goodList; console.log(this.form.goodOrderItems); this.loadingbut = true; this.$refs.form.validate((valid) => { if (valid) { add(this.form).then(res => { this.$message.success("保存成功!"); this.loadingbut = false; this.back(); }); } } 执行完add后,在执行一下saveWmsMessages,我该怎么改
您可以在 add 方法的回调函数中加入 saveWmsMessages 的调用,代码如下:
```
add(this.form).then(res => {
this.$message.success("保存成功!");
this.loadingbut = false;
this.back();
saveWmsMessages().then(res => {
// 执行成功的操作
}).catch(err => {
// 执行失败的操作
});
});
```
这样当 add 方法执行成功后,会立即执行 saveWmsMessages 方法。请注意,在 saveWmsMessages 方法中,您需要根据具体情况来处理执行成功和失败后的操作。
This dependency was not found: * @/api/wms/category in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/system/category/index.vue?vue&type=script&lang=js& To install it, you can run: npm install --save @/api/wms/category This dependency was not found: * @/api/wms/category in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/system/category/index.vue?vue&type=script&lang=js& To install it, you can run: npm install --save @/api/wms/category
This error message indicates that the dependency "@/api/wms/category" could not be found. It seems that you need to install this dependency in order to resolve the issue.
To install the missing dependency, you can run the following command in your terminal:
```
npm install --save @/api/wms/category
```
This command will install the "@/api/wms/category" package and save it as a dependency in your project's package.json file. Once the installation is complete, you should be able to resolve the dependency and resolve the error.