Commit 9eabe2e4 by Jaxon

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

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