Commit 6c753560 by chenwq

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

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