| | |
| | | ...searchForm.value, |
| | | }) |
| | | .then(res => { |
| | | console.log(res.data.records, "res.data.records"); |
| | | ledgerList.value = res.data.records.map(it => { |
| | | console.log(it, "it1"); |
| | | 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; |
| | | const records = res?.data?.records || []; |
| | | console.log(records, "res.data.records"); |
| | | |
| | | const parseStaffIds = value => { |
| | | if (!value) return []; |
| | | if (Array.isArray(value)) return value; |
| | | if (typeof value === "string") { |
| | | try { |
| | | const parsed = JSON.parse(value); |
| | | return Array.isArray(parsed) ? parsed : []; |
| | | } catch (e) { |
| | | return []; |
| | | } |
| | | } |
| | | return []; |
| | | }; |
| | | |
| | | ledgerList.value = records.map(raw => { |
| | | const it = { ...raw }; |
| | | |
| | | const room = roomEnum.value.find( |
| | | r => String(r?.id) === String(it.roomId) |
| | | ); |
| | | it.location = room ? `${room.name}(${room.location})` : ""; |
| | | |
| | | const staffIds = parseStaffIds(it.participants); |
| | | it.staffCount = staffIds.length; |
| | | |
| | | 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.postName})`, |
| | | }; |
| | | }); |
| | | console.log(it, "it2"); |
| | | .filter(staff => staffIds.some(id => String(id) === String(staff.id))) |
| | | .map(staff => ({ |
| | | id: staff.id, |
| | | name: `${staff.staffName}${ |
| | | staff.postName ? `(${staff.postName})` : "" |
| | | }`, |
| | | })); |
| | | |
| | | return it; |
| | | }); |
| | |
| | | line-height: 28px; |
| | | padding: 0 12px; |
| | | } |
| | | </style> |
| | | </style> |