Newer
Older
KaiFengPC / src / views / system / user / profile / newsDiaLOG.vue
@鲁yixuan 鲁yixuan on 6 Aug 1 KB updata
  1. <template>
  2. <div class="publicContainer">
  3. <el-table v-loading="tableLoading" :data="tableData" max-height="350">
  4. <el-table-column label="序号" type="index" width="55" />
  5. <el-table-column label="通知消息" prop="noticeMsg" />
  6. <el-table-column label="接收人" prop="noticeUserName" />
  7. <el-table-column label="操作" width="100" class-name="small-padding fixed-width">
  8. <template #default="scope">
  9. <el-button v-if="scope.row.noticeState == 1" type="primary">已读</el-button>
  10. <el-button v-if="scope.row.noticeState == 0" type="warning" @click="handleUpdate(scope.row)">未读</el-button>
  11. </template>
  12. </el-table-column>
  13. </el-table>
  14. </div>
  15. </template>
  16. <script setup>
  17. import { projectNoticeUserEdit } from '@/api/publicService/index';
  18. const tableLoading = ref(false);
  19. const tableList = ref({});
  20. const emits = defineEmits();
  21. defineExpose({ closed });
  22. const { proxy } = getCurrentInstance();
  23. const props = defineProps({
  24. //数据
  25. tableData: {
  26. type: Object,
  27. default: {},
  28. },
  29. });
  30.  
  31. watch(
  32. () => props.tableData,
  33. value => {
  34. // console.log(props.tableData, 'props.tableData');
  35. tableList.value = props.tableData;
  36. },
  37. { immediate: true }
  38. );
  39. function handleUpdate(row) {
  40. let params = {
  41. noticeState: 1,
  42. id: row.id,
  43. };
  44. projectNoticeUserEdit(params).then(response => {
  45. proxy.$modal.msgSuccess('消息已读成功!');
  46. closed();
  47. });
  48. }
  49. function closed() {
  50. emits('handleClose');
  51. }
  52. </script>