|
|
|
@ -7,6 +7,11 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="name" width="300">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span :style="{ color: scope.row.isRead === 2 ? '#ccc' : 'inherit' }">
|
|
|
|
|
{{ scope.row.name }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="date" width="100">
|
|
|
|
|
</el-table-column>
|
|
|
|
@ -25,7 +30,6 @@
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { getAllMessagestwo } from '@/api/ManageApi/index';
|
|
|
|
|
import { markSmartReminderAsRead } from '@/api/ManageApi/index';
|
|
|
|
@ -52,15 +56,28 @@ export default {
|
|
|
|
|
const response = await getAllMessagestwo();
|
|
|
|
|
if (response && response.code === 200 && response.data) {
|
|
|
|
|
this.tableData = this.processData(response.data);
|
|
|
|
|
this.sortTableData(); // 添加排序方法
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
processData(data) {
|
|
|
|
|
return data.map(item => ({
|
|
|
|
|
id: item.id, // 确保包含 id 字段
|
|
|
|
|
id: item.id,
|
|
|
|
|
name: item.content,
|
|
|
|
|
date: this.formatDate(item.createTime)
|
|
|
|
|
date: this.formatDate(item.createTime),
|
|
|
|
|
isRead: item.isRead // 确保包含 isRead 字段
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
sortTableData() {
|
|
|
|
|
this.tableData.sort((a, b) => {
|
|
|
|
|
if (a.isRead === 2 && b.isRead !== 2) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else if (a.isRead !== 2 && b.isRead === 2) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getIcon(index) {
|
|
|
|
|
return index === 0 ? require('@/assets/images/new@2x.png') : require('@/assets/images/other.png');
|
|
|
|
|
},
|
|
|
|
@ -88,7 +105,6 @@ export default {
|
|
|
|
|
if (response && response.code === 200) {
|
|
|
|
|
this.$message.success('消息已标记为已读');
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
// 可以选择刷新数据或更新消息状态
|
|
|
|
|
this.getData(); // 刷新数据
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('标记为已读失败');
|
|
|
|
|