refactor(reportingData): 优化批量修改功能
- 在 bathDeclareDate 方法调用成功或失败后,传递参数 1 到 cancelModify 方法 - 修改 cancelModify 方法,添加 val 参数以控制是否重新搜索数据 - 在 reportingData/index.vue 中,根据 cancelBatchModify 的参数决定是否搜索数据
Showing
2 changed files
with
12 additions
and
11 deletions
| ... | @@ -55,7 +55,7 @@ | ... | @@ -55,7 +55,7 @@ |
| 55 | </div> | 55 | </div> |
| 56 | </el-dialog> | 56 | </el-dialog> |
| 57 | </template> | 57 | </template> |
| 58 | - | 58 | + |
| 59 | <script> | 59 | <script> |
| 60 | import { bathDeclareDate } from "@/api/declareData-api.js"; | 60 | import { bathDeclareDate } from "@/api/declareData-api.js"; |
| 61 | export default { | 61 | export default { |
| ... | @@ -113,31 +113,31 @@ | ... | @@ -113,31 +113,31 @@ |
| 113 | bathDeclareDate(obj).then((res) => { | 113 | bathDeclareDate(obj).then((res) => { |
| 114 | if (res.code === "200") { | 114 | if (res.code === "200") { |
| 115 | this.msgSuccess('批量修改成功') | 115 | this.msgSuccess('批量修改成功') |
| 116 | - this.cancelModify() | 116 | + this.cancelModify(1) |
| 117 | } else { | 117 | } else { |
| 118 | this.alertWarningMsg(res.message); | 118 | this.alertWarningMsg(res.message); |
| 119 | } | 119 | } |
| 120 | - | 120 | + |
| 121 | }) | 121 | }) |
| 122 | .catch((err) => { | 122 | .catch((err) => { |
| 123 | console.log(err); | 123 | console.log(err); |
| 124 | this.alertWarningMsg(err.message); | 124 | this.alertWarningMsg(err.message); |
| 125 | - this.cancelModify() | 125 | + this.cancelModify(1) |
| 126 | }); | 126 | }); |
| 127 | } else { | 127 | } else { |
| 128 | return false; | 128 | return false; |
| 129 | } | 129 | } |
| 130 | }); | 130 | }); |
| 131 | }, | 131 | }, |
| 132 | - | 132 | + |
| 133 | - cancelModify(){ | 133 | + cancelModify(val){ |
| 134 | this.batchModifyVisible = false | 134 | this.batchModifyVisible = false |
| 135 | - this.$emit('cancelBatchModify') | 135 | + this.$emit('cancelBatchModify',val) |
| 136 | } | 136 | } |
| 137 | }, | 137 | }, |
| 138 | }; | 138 | }; |
| 139 | </script> | 139 | </script> |
| 140 | - | 140 | + |
| 141 | <style lang="scss" scoped> | 141 | <style lang="scss" scoped> |
| 142 | @import "@/assets/styles/variables.scss"; | 142 | @import "@/assets/styles/variables.scss"; |
| 143 | .modelItem { | 143 | .modelItem { |
| ... | @@ -158,4 +158,3 @@ | ... | @@ -158,4 +158,3 @@ |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | </style> | 160 | </style> |
| 161 | - | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -983,9 +983,11 @@ export default { | ... | @@ -983,9 +983,11 @@ export default { |
| 983 | } | 983 | } |
| 984 | this.batchModifyVisible = true | 984 | this.batchModifyVisible = true |
| 985 | }, | 985 | }, |
| 986 | - cancelBatchModify(){ | 986 | + cancelBatchModify(val){ |
| 987 | this.batchModifyVisible = false | 987 | this.batchModifyVisible = false |
| 988 | - this.search(0); | 988 | + if(val === 1){ |
| 989 | + this.search(0); | ||
| 990 | + } | ||
| 989 | } | 991 | } |
| 990 | }, | 992 | }, |
| 991 | }; | 993 | }; | ... | ... |
-
Please register or login to post a comment