Commit 6c753560 by chenwq

feat: 在审批相关页面添加加载提示,优化用户体验

1 parent 26c1740d
......@@ -80,6 +80,7 @@ export default {
async getDetail() {
if (!this.id)
return;
util.showLoading();
try {
const params = { id: this.id, phone: this.userInfo.phone };
const res = await api.getApprovalDetail(params);
......@@ -91,6 +92,7 @@ export default {
this.status = Number(this.detail.approvalStatus);
}
} finally {
util.hideLoading();
this.detailLoaded = true;
}
},
......
......@@ -139,9 +139,14 @@ export default {
async getDetail() {
if (!this.id)
return;
const params = { id: this.id, phone: this.userInfo.phone };
const res = await api.getApprovalDetail(params);
this.detail = res.data || res || {};
util.showLoading();
try {
const params = { id: this.id, phone: this.userInfo.phone };
const res = await api.getApprovalDetail(params);
this.detail = res.data || res || {};
} finally {
util.hideLoading();
}
},
toNameList(value) {
if (Array.isArray(value))
......
......@@ -294,13 +294,18 @@ export default {
},
methods: {
async getDicts() {
await Promise.all([
this.getFlightSupervisors(),
this.getDict("scene"),
this.getDict("methodOnline"),
this.getDict("methodOffline"),
this.getDict("topic"),
]);
util.showLoading();
try {
await Promise.all([
this.getFlightSupervisors(),
this.getDict("scene"),
this.getDict("methodOnline"),
this.getDict("methodOffline"),
this.getDict("topic"),
]);
} finally {
util.hideLoading();
}
},
async getDict(key) {
const config = DICT_CONFIG[key];
......@@ -392,6 +397,7 @@ export default {
async loadCourseList() {
if (this.dicts.course.length)
return;
util.showLoading();
this.courseLoading = true;
try {
const res = await api.getAllCoursePage({
......@@ -407,6 +413,7 @@ export default {
} catch (error) {
Toast("课程加载失败");
} finally {
util.hideLoading();
this.courseLoading = false;
}
},
......@@ -471,6 +478,7 @@ export default {
Toast(emptyItem.message || `请填写${emptyItem.label}`);
return;
}
util.showLoading("提交中...");
this.submitting = true;
api.submitApproval(this.buildParams()).then((res) => {
if (!res) {
......@@ -482,6 +490,7 @@ export default {
}).catch(() => {
Toast("提交失败");
}).finally(() => {
util.hideLoading();
this.submitting = false;
});
},
......
......@@ -104,6 +104,7 @@ export default {
this.getList();
},
getList() {
util.showLoading();
this.loading = true;
const params = { pageNum: this.pageNum, pageSize: 10, phone: this.userInfo?.phone || "" };
api.getApprovalPage(params).then((res) => {
......@@ -117,6 +118,7 @@ export default {
}).catch(() => {
this.finished = true;
}).finally(() => {
util.hideLoading();
this.loading = false;
this.refreshing = false;
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!