feat(oa/project/report): add last report memory function when add report
当新增项目报工的时候,如果今日还未报工,自动回填上次报工的项目信息,提升用户填报体验
This commit is contained in:
@@ -292,6 +292,7 @@
|
|||||||
import {
|
import {
|
||||||
addProjectReport,
|
addProjectReport,
|
||||||
delProjectReport,
|
delProjectReport,
|
||||||
|
getLastReport,
|
||||||
getProjectReport,
|
getProjectReport,
|
||||||
getTodayProjectReport,
|
getTodayProjectReport,
|
||||||
listProjectReport,
|
listProjectReport,
|
||||||
@@ -557,6 +558,10 @@ export default {
|
|||||||
this.suppVisible = false;
|
this.suppVisible = false;
|
||||||
this.title = "添加项目报工";
|
this.title = "添加项目报工";
|
||||||
this.checkTodayReport().finally(() => {
|
this.checkTodayReport().finally(() => {
|
||||||
|
// 如果今天还没报过工,尝试加载上次报工记录回填
|
||||||
|
if (!this.hasTodayReport) {
|
||||||
|
this.loadLastReport();
|
||||||
|
}
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (!this.form.reportId) {
|
if (!this.form.reportId) {
|
||||||
@@ -565,6 +570,16 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 加载上次报工记录,回填项目选择(记忆功能) */
|
||||||
|
loadLastReport() {
|
||||||
|
getLastReport().then(response => {
|
||||||
|
if (response.data && response.data.projectId) {
|
||||||
|
this.form.projectId = response.data.projectId;
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 加载失败不影响正常使用
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.suppVisible = false;
|
this.suppVisible = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user