修复消息详情接口返回数据为空,会导致弹窗无法关闭
This commit is contained in:
parent
8fdb1078ae
commit
3522ef30ea
@ -38,15 +38,15 @@ const state = reactive({
|
|||||||
ruleForm: {
|
ruleForm: {
|
||||||
id: '',
|
id: '',
|
||||||
title: '',
|
title: '',
|
||||||
sendUserName: "",
|
sendUserName: '',
|
||||||
userName: "",
|
userName: '',
|
||||||
message: "",
|
message: '',
|
||||||
createtime: []
|
createtime: [],
|
||||||
},
|
},
|
||||||
dialog: {
|
dialog: {
|
||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
title: '',
|
title: '',
|
||||||
loading: false
|
loading: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,14 +58,27 @@ const dateFormatter = () => {
|
|||||||
if (state.ruleForm.createtime === null) return '暂无';
|
if (state.ruleForm.createtime === null) return '暂无';
|
||||||
let date = state.ruleForm.createtime;
|
let date = state.ruleForm.createtime;
|
||||||
return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5]}`;
|
return `${date[0]}-${date[1]}-${date[2]} ${date[3]}:${date[4]}:${date[5]}`;
|
||||||
}
|
};
|
||||||
|
|
||||||
// 获取信息详情
|
// 获取信息详情
|
||||||
const getDetail = async (id?: number) => {
|
const getDetail = async (id?: number) => {
|
||||||
try {
|
try {
|
||||||
state.dialog.loading = true;
|
state.dialog.loading = true;
|
||||||
let res = await mesApi.getMessagePushDetail(id);
|
let res = await mesApi.getMessagePushDetail(id);
|
||||||
|
console.log(res);
|
||||||
if (res?.success) {
|
if (res?.success) {
|
||||||
|
// 当res.data为null时,给state.ruleForm赋值为空对象
|
||||||
|
if (res.data === null) {
|
||||||
|
state.ruleForm = {
|
||||||
|
id: '',
|
||||||
|
title: '无',
|
||||||
|
sendUserName: '无',
|
||||||
|
userName: '无',
|
||||||
|
message: '无',
|
||||||
|
createtime: [],
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
state.ruleForm = res.data;
|
state.ruleForm = res.data;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('信息详情获取失败!');
|
ElMessage.error('信息详情获取失败!');
|
||||||
@ -74,18 +87,18 @@ const getDetail = async(id? : number) => {
|
|||||||
} finally {
|
} finally {
|
||||||
state.dialog.loading = false;
|
state.dialog.loading = false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (id?: any) => {
|
const openDialog = (id?: any) => {
|
||||||
console.log(id)
|
|
||||||
state.dialog.isShowDialog = true;
|
state.dialog.isShowDialog = true;
|
||||||
state.dialog.title = '人才信息';
|
|
||||||
getDetail(id);
|
getDetail(id);
|
||||||
};
|
};
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
|
console.log('close');
|
||||||
state.dialog.isShowDialog = false;
|
state.dialog.isShowDialog = false;
|
||||||
|
console.log(state.dialog.isShowDialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消
|
// 取消
|
||||||
|
Loading…
Reference in New Issue
Block a user