董国庆
2025-04-11 aa6ab634ff987ad35d960efcad6eb0f7c6af6ea7
1
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!-- 左侧日历 -->
      <el-col :span="12">
        <el-card class="calendar-card">
          <div class="calendar-header">
            <span>日历</span>
            <div class="calendar-controls">
              <el-date-picker v-model="selectedMonth" type="month" :format="'yyyy年MM月'" placeholder="选择月份"
                @change="handleMonthChange" />
            </div>
          </div>
          <el-calendar v-model="currentDate"  />
        </el-card>
      </el-col>
 
      <!-- 右侧预警通知 -->
      <el-col :span="12">
        <el-card class="notification-card">
          <div class="notification-header">预警通知</div>
          <div class="notification-list">
            <div v-for="(notification, index) in alwaysMessages" :key="index" class="notification-item"
              @click="handleNotificationClick(notification)">
              <div class="notification-item-header">
                <div class="notification-dot"></div>
                <span class="notification-time">{{ notification.createTime }}</span>
              </div>
              <div class="notification-content">
                <div class="notification-text">{{ notification.noticeTitle }}</div>
                <div v-if="notification.createBy" class="notification-submitter">提交人:{{ notification.createBy }}</div>
              </div>
            </div>
            <div v-for="(notification, index) in noticeMessage" :key="index" class="notification-item"
              @click="handleNotificationClick(notification)">
              <div class="notification-item-header">
                <div class="notification-dot"></div>
                <span class="notification-time">{{ notification.createTime }}</span>
              </div>
              <div class="notification-content">
                <div class="notification-text">{{ notification.noticeTitle }}</div>
                <div v-if="notification.createBy" class="notification-submitter">提交人:{{ notification.createBy }}</div>
              </div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
 
<script>
import { getMessage } from "@/api/menu";
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "3.8.9",
      currentDate: new Date(),
      selectedMonth: new Date(),
      alwaysMessages: [],
      noticeMessage: []
    };
  },
  watch: {
    currentDate(newDate) {
      this.selectedMonth = new Date(newDate);
    }
  },
  created() {
    getMessage().then(res => {
      this.alwaysMessages = res.data.alwaysMessages
      this.noticeMessage = res.data.noticeMessage
      console.log(res);
    });
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    handleMonthChange(date) {
      if (date) {
        this.currentDate = new Date(date);
      }
    },
    // 处理通知点击
    handleNotificationClick(notification) {
      // 根据id类型进行不同的路由跳转
      const id = notification.noticeId;
      switch (id) {
        case 1:
          // 自主购房安置申请批次表
          this.$router.push('/applicationBatchList/list');
          break;
        case 2:
          // 自主购房安置申请批次表
          this.$router.push('/applicationBatchList/list');
          break;
        case 3:
          // 付款明细
          this.$router.push('/payment-details/list');
          break;
        default:
          if (id > 4) {
            // 付款明细
            this.$router.push('/payment-details/list');
          }
      }
    }
  }
};
</script>
 
<style scoped lang="scss">
.app-container {
  padding: 20px;
 
  .calendar-card,
  .notification-card {
    min-height: 600px;
  }
 
  .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #24465c;
 
    .calendar-controls {
      :deep(.el-input__wrapper) {
        width: 160px;
      }
    }
  }
 
  .notification-header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #24465c;
  }
 
  .notification-list {
    .notification-item {
      padding: 12px 16px;
      border-bottom: 1px solid #ebeef5;
      cursor: pointer;
 
      &:hover {
        background-color: #f5f7fa;
      }
 
      &:last-child {
        border-bottom: none;
      }
 
      .notification-item-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
 
        .notification-dot {
          width: 8px;
          height: 8px;
          border-radius: 50%;
          background-color: #f56c6c;
        }
 
        .notification-time {
          color: #909399;
          font-size: 12px;
        }
      }
 
      .notification-content {
        padding-left: 16px;
 
        .notification-text {
          color: #333;
          margin: 4px 0;
          font-size: 14px;
        }
 
        .notification-submitter {
          font-size: 12px;
          color: #999;
        }
      }
    }
 
    &.unread {
      .notification-dot {
        display: block;
      }
    }
 
    &.read {
      .notification-dot {
        display: none;
      }
    }
  }
}
</style>