-
@@ -155,13 +154,12 @@ export default {
},
methods: {
/** 查询列表 */
- getList() {
+ async getList() {
try {
this.loading = true;
- StudentApi.getStudentPage(this.queryParams).then(response => {
- this.list = response.data.list;
- this.total = response.data.total;
- });
+ const res = await StudentApi.getStudentPage(this.queryParams);
+ this.list = res.data.list;
+ this.total = res.data.total;
} finally {
this.loading = false;
}
@@ -181,31 +179,25 @@ export default {
this.$refs["formRef"].open(id);
},
/** 删除按钮操作 */
- handleDelete(row) {
- const that = this;
- try {
+ async handleDelete(row) {
const id = row.id;
- this.$modal.confirm('是否确认删除学生编号为"' + id + '"的数据项?').then(()=>{
- return StudentApi.deleteStudent(id);
- }).then(() => {
- that.getList();
- that.$modal.msgSuccess("删除成功");
- }).catch(() => {});
+ await this.$modal.confirm('是否确认删除学生编号为"' + id + '"的数据项?')
+ try {
+ await StudentApi.deleteStudent(id);
+ await this.getList();
+ this.$modal.msgSuccess("删除成功");
} catch {}
},
/** 导出按钮操作 */
- handleExport() {
- const that = this;
+ async handleExport() {
+ await this.$modal.confirm('是否确认导出所有学生数据项?');
try {
- this.$modal.confirm('是否确认导出所有学生数据项?').then(() => {
- that.exportLoading = true;
- return StudentApi.exportStudentExcel(params);
- }).then(response => {
- that.$download.excel(response, '学生.xls');
- });
+ this.exportLoading = true;
+ const res = await StudentApi.exportStudentExcel(this.queryParams);
+ this.$download.excel(res.data, '学生.xls');
} catch {
} finally {
- that.exportLoading = false;
+ this.exportLoading = false;
}
},
}
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/CategoryForm b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/CategoryForm
index 4a364ba14..7fa06e8cf 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/CategoryForm
+++ b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/CategoryForm
@@ -8,10 +8,10 @@
@@ -24,7 +24,7 @@
\ No newline at end of file
diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/index b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/index
index 9ae16fafa..88da68254 100644
--- a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/index
+++ b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/codegen/vue2_tree/vue/index
@@ -1,6 +1,5 @@
-
@@ -31,14 +30,14 @@
@@ -104,12 +103,11 @@ export default {
},
methods: {
/** 查询列表 */
- getList() {
+ async getList() {
try {
this.loading = true;
- CategoryApi.getCategoryList(this.queryParams).then(response => {
- this.list = this.handleTree(response.data, 'id', 'parentId');
- })
+ const res = await CategoryApi.getCategoryList(this.queryParams);
+ this.list = this.handleTree(res.data, 'id', 'parentId');
} finally {
this.loading = false;
}
@@ -129,31 +127,25 @@ export default {
this.$refs["formRef"].open(id);
},
/** 删除按钮操作 */
- handleDelete(row) {
- const that = this;
- try {
+ async handleDelete(row) {
const id = row.id;
- this.$modal.confirm('是否确认删除分类编号为"' + id + '"的数据项?').then(()=>{
- return CategoryApi.deleteCategory(id);
- }).then(() => {
- that.getList();
- that.$modal.msgSuccess("删除成功");
- }).catch(() => {});
+ await this.$modal.confirm('是否确认删除分类编号为"' + id + '"的数据项?')
+ try {
+ await CategoryApi.deleteCategory(id);
+ await this.getList();
+ this.$modal.msgSuccess("删除成功");
} catch {}
},
/** 导出按钮操作 */
- handleExport() {
- const that = this;
+ async handleExport() {
+ await this.$modal.confirm('是否确认导出所有分类数据项?');
try {
- this.$modal.confirm('是否确认导出所有分类数据项?').then(() => {
- that.exportLoading = true;
- return CategoryApi.exportCategoryExcel(params);
- }).then(response => {
- that.$download.excel(response, '分类.xls');
- });
+ this.exportLoading = true;
+ const res = await CategoryApi.exportCategoryExcel(this.queryParams);
+ this.$download.excel(res.data, '分类.xls');
} catch {
} finally {
- that.exportLoading = false;
+ this.exportLoading = false;
}
},
/** 展开/折叠操作 */