| | |
| | | |
| | | <!-- 通知公告板 --> |
| | | <div class="notice-board"> |
| | | <!-- 放假通知区域 --> |
| | | <div class="notice-section" v-if="holidayNoticeCount > 0"> |
| | | <!-- 统一通知区域 --> |
| | | <div class="notice-section" v-if="totalNoticeCount > 0"> |
| | | <div class="section-header"> |
| | | <h3>📅 放假通知</h3> |
| | | <span class="section-count">{{ holidayNoticeCount }}条</span> |
| | | <h3>� 通知公告</h3> |
| | | <span class="section-count">{{ totalNoticeCount }}条</span> |
| | | </div> |
| | | <div class="notice-cards"> |
| | | <!-- 放假通知 --> |
| | | <div |
| | | v-for="notice in holidayNotices" |
| | | :key="notice.id" |
| | | :key="'holiday-' + notice.id" |
| | | class="notice-card holiday-card" |
| | | :class="{ 'urgent': notice.priority === '3' }" |
| | | > |
| | |
| | | </div> |
| | | <div class="card-footer"> |
| | | <div class="card-meta"> |
| | | <span class="type" :class="'type-' + notice.type"> |
| | | {{ notice.type }} |
| | | </span> |
| | | <span class="priority" :class="'priority-' + notice.priority"> |
| | | {{ getPriorityText(notice.priority) }} |
| | | </span> |
| | |
| | | <span>{{ notice.remark }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <pagination |
| | | v-if="holidayNoticePage.total > 0" |
| | | :total="holidayNoticePage.total" |
| | | :page="holidayNoticePage.current" |
| | | :limit="holidayNoticePage.size" |
| | | @pagination="handleHolidayNoticeCurrentChange" |
| | | /> |
| | | |
| | | <!-- 设备维修通知区域 --> |
| | | <div class="notice-section" v-if="maintenanceNoticeCount > 0"> |
| | | <div class="section-header"> |
| | | <h3>🔧 设备维修通知</h3> |
| | | <span class="section-count">{{ maintenanceNoticeCount }}条</span> |
| | | </div> |
| | | <div class="notice-cards"> |
| | | |
| | | <!-- 设备维修通知 --> |
| | | <div |
| | | v-for="notice in maintenanceNotices" |
| | | :key="notice.id" |
| | | :key="'maintenance-' + notice.id" |
| | | class="notice-card maintenance-card" |
| | | :class="{ 'urgent': notice.priority === '3' }" |
| | | > |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 统一分页 --> |
| | | <pagination |
| | | v-if="maintenanceNoticePage.total > 0" |
| | | :total="maintenanceNoticePage.total" |
| | | :page="maintenanceNoticePage.current" |
| | | :limit="maintenanceNoticePage.size" |
| | | @pagination="handleMaintenanceNoticeCurrentChange" |
| | | v-if="(holidayNoticePage.total + maintenanceNoticePage.total) > 0" |
| | | :total="holidayNoticePage.total + maintenanceNoticePage.total" |
| | | :page="Math.max(holidayNoticePage.current, maintenanceNoticePage.current)" |
| | | :limit="Math.max(holidayNoticePage.size, maintenanceNoticePage.size)" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | |
| | | <!-- 空状态 --> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="公告类型" prop="type"> |
| | | <el-select v-model="form.type" placeholder="请选择公告类型" style="width: 100%"> |
| | | <el-option label="放假通知" :value="1"/> |
| | | <el-option label="设备维修通知" :value="2"/> |
| | | </el-select> |
| | | <el-input v-model="form.type" placeholder="请输入公告标题"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | }); |
| | | }; |
| | | |
| | | const holidayNoticeCount = ref() |
| | | const maintenanceNoticeCount = ref() |
| | | const totalNoticeCount = ref(0) |
| | | const fetchCount = () => { |
| | | getCount().then(res => { |
| | | holidayNoticeCount.value = res.data.filter(item => { |
| | | return item.type === 1 |
| | | })[0].count; |
| | | maintenanceNoticeCount.value = res.data.filter(item => { |
| | | return item.type === 2 |
| | | })[0].count; |
| | | totalNoticeCount.value = res.data.reduce((total, item) => total + item.count, 0); |
| | | }); |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | const fetchHolidayNotices = () => { |
| | | listNotice({...holidayNoticePage.value, type: 1}).then(res => { |
| | | listNotice({...holidayNoticePage.value}).then(res => { |
| | | holidayNotices.value = res.data.records |
| | | holidayNoticePage.value.total = res.data.total |
| | | }); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const handleHolidayNoticeCurrentChange = (val) => { |
| | | const handleCurrentChange = (val) => { |
| | | holidayNoticePage.value.size = val.limit |
| | | holidayNoticePage.value.current = val.page |
| | | fetchHolidayNotices() |
| | | }; |
| | | |
| | | const handleMaintenanceNoticeCurrentChange = (val) => { |
| | | maintenanceNoticePage.value.size = val.limit |
| | | maintenanceNoticePage.value.current = val.page |
| | | fetchHolidayNotices() |
| | | fetchMaintenanceNotices() |
| | | }; |
| | | |
| | |
| | | gap: 8px; |
| | | } |
| | | |
| | | .priority, .status { |
| | | .type, .priority, .status { |
| | | padding: 2px 8px; |
| | | border-radius: 12px; |
| | | font-size: 12px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .type-1 { |
| | | background: #f0f9ff; |
| | | color: #0369a1; |
| | | } |
| | | |
| | | .type-2 { |
| | | background: #fef3c7; |
| | | color: #d97706; |
| | | } |
| | | |
| | | .priority-1 { |
| | | background: #f0f9ff; |
| | | color: #0369a1; |