Blame view

src/views/oa/noticeDetailList.vue 3.71 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
ec9ec2ce   wuxw   开发完成物业公告问题
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    <div class="notice-detail-container">
      <el-card class="box-card">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('noticeDetail.title') }}</span>
          <el-button type="primary" size="small" @click="_goBack">
            <i class="el-icon-close"></i>
            {{ $t('noticeDetail.back') }}
          </el-button>
        </div>
  
        <el-row :gutter="20">
          <el-col :span="24">
            <el-card shadow="never">
              <el-form label-position="left" label-width="120px">
                <el-form-item :label="$t('noticeDetail.titleLabel')">
                  <el-input v-model="noticeDetailInfo.title" readonly class="readonly-input"></el-input>
                </el-form-item>
  
                <el-form-item :label="$t('noticeDetail.noticeType')">
                  <el-input v-model="noticeDetailInfo.noticeTypeCdName" readonly class="readonly-input"></el-input>
                </el-form-item>
  
                <el-form-item :label="$t('noticeDetail.startTime')">
                  <el-input v-model="noticeDetailInfo.startTime" readonly class="readonly-input"></el-input>
                </el-form-item>
  
                <el-form-item :label="$t('noticeDetail.endTime')">
                  <el-input v-model="noticeDetailInfo.endTime" readonly class="readonly-input"></el-input>
                </el-form-item>
  
                <el-form-item :label="$t('noticeDetail.createTime')">
                  <el-input v-model="noticeDetailInfo.createTime" readonly class="readonly-input"></el-input>
                </el-form-item>
  
                <el-form-item :label="$t('noticeDetail.content')">
                  <div class="notice-content" v-html="noticeDetailInfo.context"></div>
                </el-form-item>
              </el-form>
            </el-card>
          </el-col>
        </el-row>
      </el-card>
    </div>
  </template>
  
  <script>
  import { getNoticeDetail } from '@/api/oa/noticeDetailApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'NoticeDetailList',
    data() {
      return {
        noticeDetailInfo: {
          noticeId: '',
          title: '',
          context: '',
          startTime: '',
          endTime: '',
          noticeTypeCd: '',
          noticeTypeCdName: '',
          createTime: ''
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
      const noticeId = this.$route.query.noticeId
      if (noticeId) {
        this.noticeDetailInfo.noticeId = noticeId
        this._listNotices()
      }
    },
    methods: {
      async _listNotices() {
        try {
          const params = {
            page: 1,
            row: 1,
            communityId: this.communityId,
            noticeId: this.noticeDetailInfo.noticeId
          }
          const { notices } = await getNoticeDetail(params)
          if (notices && notices.length > 0) {
            // 过滤XSS攻击
            notices[0].context = this.filterXSS(notices[0].context)
            this.noticeDetailInfo =notices[0]
          }
        } catch (error) {
          this.$message.error(this.$t('noticeDetail.fetchError'))
        }
      },
      filterXSS(html) {
        // 这里应该实现XSS过滤逻辑
        // 实际项目中应该使用专门的XSS过滤库
        return html || ''
      },
      _goBack() {
        this.$router.go(-1)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .notice-detail-container {
    padding: 20px;
  
    .box-card {
      margin-bottom: 20px;
  
      .float-right {
        float: right;
      }
    }
  
    .readonly-input {
      ::v-deep .el-input__inner {
        background-color: #f5f7fa;
        border-color: #e4e7ed;
        color: #606266;
        cursor: not-allowed;
      }
    }
  
    .notice-content {
      padding: 10px;
      border: 1px solid #ebeef5;
      border-radius: 4px;
      min-height: 100px;
      background-color: #f5f7fa;
    }
  }
  </style>