Commit 9eabe2e4 by Jaxon

fix(任务详情页): 完善加载状态和空值异常处理

为页面添加加载状态管理,确保请求结束后加载状态正确重置;校验任务ID参数存在性,避免无效接口请求;新增条件渲染逻辑,仅在有描述数据时展示详情区域。
1 parent ffedd710
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{{ detail.title }} {{ detail.title }}
</span> </span>
</div> </div>
<div class="description-wrapper"> <div v-if="descriptionSchema.length" class="description-wrapper">
<Descriptions :data="detail" <Descriptions :data="detail"
:schema="descriptionSchema"> :schema="descriptionSchema">
</Descriptions> </Descriptions>
...@@ -53,8 +53,13 @@ export default { ...@@ -53,8 +53,13 @@ export default {
}, },
async mounted() { async mounted() {
this.pageLoading = true;
try {
const { query } = this.$route; const { query } = this.$route;
this.taskId = query.taskId; if (!query?.taskId) {
return;
}
this.taskId = query?.taskId;
await this.getData(query.taskId); await this.getData(query.taskId);
const schema = await getTaskCenterTaskDescriptionSchema(); const schema = await getTaskCenterTaskDescriptionSchema();
...@@ -82,12 +87,14 @@ export default { ...@@ -82,12 +87,14 @@ export default {
meta: item, meta: item,
...cover2Descriptions?.[toUpper(item.fieldType)]?.(), ...cover2Descriptions?.[toUpper(item.fieldType)]?.(),
}))); })));
console.log("descriptionSchema", schema);
this.descriptionSchema = schema; this.descriptionSchema = schema;
} else { } else {
// 如果是空的, 去除两条横线 // 如果是空的, 去除两条横线
this.descriptionSchema = schema.filter(item => !item.divider); this.descriptionSchema = schema.filter(item => !item.divider);
} }
} finally {
this.pageLoading = false;
}
}, },
methods: { methods: {
async getData(taskId) { async getData(taskId) {
......
...@@ -249,18 +249,15 @@ export default { ...@@ -249,18 +249,15 @@ export default {
}, },
// 查看 // 查看
async handleDetail({ taskId, bizTypeName, bizType }) { async handleDetail({ taskId, bizTypeName, bizType }) {
console.log("123123"); try {
this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType });
} finally {
this.$router.push({ this.$router.push({
path: "/resident-manage/task-center-detail", name: "residentManageTaskCenterDetail",
query: { query: {
taskId, taskId,
}, },
}); });
try {
console.log("3333333");
this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType });
} catch (err) {
console.log(err);
} }
}, },
handleChangeSort(command) { handleChangeSort(command) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!