| | |
| | | // 查询数据 |
| | | const getList = async () => { |
| | | loading.value = true |
| | | let resp = await getMeetingPublish({ ...searchForm, ...queryParams }) |
| | | meetingList.value = resp.data.records.map(it => { |
| | | let room = roomEnum.value.find(room => it.roomId === room.id) |
| | | it.location = `${room.name}(${room.location})` |
| | | let staffs = JSON.parse(it.participants) |
| | | it.staffCount = staffs.size |
| | | it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}` |
| | | it.participants = staffList.value.filter(staff => staffs.some(id => id === staff.id)).map(staff => { |
| | | return { |
| | | id: staff.id, |
| | | name: `${staff.staffName}(${staff.postJob})` |
| | | try { |
| | | const resp = await getMeetingPublish({ ...searchForm, ...queryParams }) |
| | | const records = resp && resp.data && resp.data.records ? resp.data.records : [] |
| | | meetingList.value = records.map(it => { |
| | | const room = (roomEnum.value || []).find(r => r.id === it.roomId) |
| | | it.location = room ? `${room.name}(${room.location})` : (it.location || '—') |
| | | let staffIds = [] |
| | | const rawParticipants = it.participants |
| | | if (Array.isArray(rawParticipants)) { |
| | | staffIds = rawParticipants |
| | | } else if (rawParticipants) { |
| | | const s = String(rawParticipants).trim() |
| | | if (s.startsWith('[')) { |
| | | try { |
| | | staffIds = JSON.parse(s) |
| | | } catch (e) { |
| | | staffIds = [] |
| | | } |
| | | } else { |
| | | // 兼容 "130,131,132" 逗号分隔格式 |
| | | staffIds = s.split(',').map(v => v.trim()).filter(Boolean) |
| | | } |
| | | } |
| | | if (!Array.isArray(staffIds)) staffIds = [] |
| | | staffIds = staffIds.map(v => String(v)) |
| | | it.staffCount = staffIds.length |
| | | const s = it.startTime ? dayjs(it.startTime).format('HH:mm:ss') : '' |
| | | const e2 = it.endTime ? dayjs(it.endTime).format('HH:mm:ss') : '' |
| | | it.meetingTime = `${it.meetingDate || ''} ${s} ~ ${e2}`.trim() |
| | | it.participants = (staffList.value || []) |
| | | .filter(staff => staffIds.some(id => String(id) === String(staff.id))) |
| | | .map(staff => ({ id: staff.id, name: `${staff.staffName}(${staff.postJob})` })) |
| | | return it |
| | | }) |
| | | |
| | | return it |
| | | }) |
| | | total.value = resp.data.total |
| | | loading.value = false |
| | | total.value = (resp && resp.data && resp.data.total) || 0 |
| | | } catch (err) { |
| | | console.error('会议纪要列表加载失败', err) |
| | | meetingList.value = [] |
| | | total.value = 0 |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | // 搜索按钮操作 |
| | |
| | | |
| | | // 页面加载时获取数据 |
| | | onMounted(async () => { |
| | | const [resp1, resp2] = await Promise.all([getRoomEnum(), getStaffOnJob()]) |
| | | roomEnum.value = resp1.data |
| | | staffList.value = resp2.data |
| | | |
| | | try { |
| | | const [resp1, resp2] = await Promise.all([ |
| | | getRoomEnum().catch(() => ({ data: [] })), |
| | | getStaffOnJob().catch(() => ({ data: [] })) |
| | | ]) |
| | | roomEnum.value = (resp1 && resp1.data) || [] |
| | | staffList.value = (resp2 && resp2.data) || [] |
| | | } catch (e) { |
| | | roomEnum.value = [] |
| | | staffList.value = [] |
| | | } |
| | | await getList() |
| | | }) |
| | | </script> |