detail.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <el-dialog class="le-dialog" v-model="visibleDialog" title="查看详情" @close="handleCancel">
  3. <div>
  4. <!--title-->
  5. <div>
  6. <div class="content-title">{{ formOptions.title }}</div>
  7. <span>发布人:{{ formOptions.createBy }} 发布时间: {{ formOptions.createTime }}</span>
  8. <div class="content-title mbt20">
  9. <el-tag v-if="formOptions.category === 0" size="small" effect="plain">通知公告</el-tag>
  10. <el-tag v-if="formOptions.category === 1" size="small" type="info" effect="plain">系统消息</el-tag>
  11. <el-tag v-if="formOptions.category === 2" size="small" type="warning" effect="plain">待办通知</el-tag>
  12. </div>
  13. <span>通知时间: - </span>
  14. <br />
  15. <br />
  16. <span>通知内容:{{ formOptions.content }}</span>
  17. </div>
  18. <!--content-->
  19. </div>
  20. </el-dialog>
  21. </template>
  22. <script setup>
  23. import { computed, ref } from 'vue'
  24. import message from '@/api/system/message'
  25. // 同步值
  26. const $myEmit = defineEmits(['update:modelValue'])
  27. const myProps = defineProps({
  28. modelValue: {
  29. type: Boolean,
  30. default: false
  31. },
  32. messageId: {
  33. type: String,
  34. default: null
  35. }
  36. })
  37. const formOptions = ref({})
  38. const handleCancel = () => {
  39. $myEmit('update:modelValue', false)
  40. }
  41. const getMessageInfoDetail = async () => {
  42. const { messageId } = myProps
  43. const res = await message.getMessageInfoById(messageId)
  44. formOptions.value = res
  45. }
  46. getMessageInfoDetail()
  47. // computed
  48. const visibleDialog = computed({
  49. get() {
  50. return myProps.modelValue
  51. },
  52. set(val) {
  53. $myEmit('update:modelValue', val)
  54. }
  55. })
  56. </script>
  57. <style scoped lang="scss">
  58. .content-title {
  59. overflow: hidden;
  60. color: #000000d9;
  61. font-weight: 500;
  62. font-size: 16px;
  63. white-space: nowrap;
  64. text-overflow: ellipsis;
  65. margin-bottom: 20px;
  66. &.mbt20 {
  67. margin-top: 20px;
  68. }
  69. }
  70. </style>