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,40 +53,47 @@ export default { ...@@ -53,40 +53,47 @@ export default {
}, },
async mounted() { async mounted() {
const { query } = this.$route; this.pageLoading = true;
this.taskId = query.taskId; try {
const { query } = this.$route;
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();
const dynamicSchema = this?.detail?.bizDisplayInfo || []; const dynamicSchema = this?.detail?.bizDisplayInfo || [];
// dynamicSchema.push({ // dynamicSchema.push({
// fieldId: "100", // fieldId: "100",
// fieldName: "枚举", // fieldName: "枚举",
// fieldType: "ENUM", // fieldType: "ENUM",
// fieldValue: ["男", "女","男", "女",], // fieldValue: ["男", "女","男", "女",],
// linkAlias: null, // linkAlias: null,
// }); // });
if (dynamicSchema && dynamicSchema.length) { if (dynamicSchema && dynamicSchema.length) {
schema.splice(6, 0, ...(this?.detail?.bizDisplayInfo || []).map(item => ({ schema.splice(6, 0, ...(this?.detail?.bizDisplayInfo || []).map(item => ({
name: item.fieldId, name: item.fieldId,
label: item.fieldName, label: item.fieldName,
col: 24, col: 24,
parentProps: { parentProps: {
className: "", className: "",
}, },
labelWidth: "120px", labelWidth: "120px",
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: {
......
...@@ -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");
this.$router.push({
path: "/resident-manage/task-center-detail",
query: {
taskId,
},
});
try { try {
console.log("3333333");
this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType }); this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType });
} catch (err) { } finally {
console.log(err); this.$router.push({
name: "residentManageTaskCenterDetail",
query: {
taskId,
},
});
} }
}, },
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!