| | |
| | | fileList: [] |
| | | }); |
| | | |
| | | const { |
| | | searchForm, |
| | | tableLoading, |
| | | page, |
| | | tableData, |
| | | const { |
| | | searchForm, |
| | | tableLoading, |
| | | page, |
| | | tableData, |
| | | selectedIds, |
| | | form, |
| | | dialogVisible, |
| | |
| | | employeesLoading.value = true; |
| | | // 优先使用系统用户接口(按租户获取) |
| | | const userResponse = await userListNoPageByTenantId(); |
| | | |
| | | |
| | | if (userResponse.data) { |
| | | employees.value = userResponse.data.map(user => ({ |
| | | label: user.nickName || user.userName || '未知姓名', |
| | |
| | | })).filter(user => user.status === '0'); // 只显示正常状态的用户 |
| | | } else { |
| | | // 如果系统用户接口失败,使用员工台账接口 |
| | | const response = await staffOnJobListPage({ |
| | | pageNum: 1, |
| | | pageSize: 1000, |
| | | const response = await staffOnJobListPage({ |
| | | pageNum: 1, |
| | | pageSize: 1000, |
| | | staffState: 1 // 在职状态 |
| | | }); |
| | | |
| | | |
| | | if (response.data && response.data.records) { |
| | | employees.value = response.data.records.map(employee => ({ |
| | | label: employee.staffName || employee.name || '未知姓名', |
| | |
| | | } |
| | | groups[dept].push(employee); |
| | | }); |
| | | |
| | | |
| | | // 按部门名称排序,确保显示顺序一致 |
| | | return Object.keys(groups) |
| | | .sort() |
| | |
| | | const filterEmployees = (query) => { |
| | | if (query !== '') { |
| | | const lowerQuery = query.toLowerCase(); |
| | | return employees.value.filter(employee => |
| | | return employees.value.filter(employee => |
| | | employee.label.toLowerCase().includes(lowerQuery) || |
| | | employee.dept.toLowerCase().includes(lowerQuery) || |
| | | (employee.phone && employee.phone.includes(query)) || |
| | |
| | | const refreshEmployees = async () => { |
| | | ElMessage.info("正在刷新员工列表..."); |
| | | await getEmployeesList(); |
| | | |
| | | |
| | | // 统计各部门人数 |
| | | const deptStats = {}; |
| | | employees.value.forEach(emp => { |
| | | const dept = emp.dept || '其他部门'; |
| | | deptStats[dept] = (deptStats[dept] || 0) + 1; |
| | | }); |
| | | |
| | | |
| | | const deptInfo = Object.entries(deptStats) |
| | | .map(([dept, count]) => `${dept}: ${count}人`) |
| | | .join(', '); |
| | | |
| | | |
| | | ElMessage.success(`员工列表刷新完成,共 ${employees.value.length} 人 (${deptInfo})`); |
| | | }; |
| | | |
| | |
| | | const getEmployeeInfo = (employeeId) => { |
| | | const employee = employees.value.find(emp => emp.value === employeeId); |
| | | if (!employee) return null; |
| | | |
| | | |
| | | return { |
| | | name: employee.label, |
| | | dept: employee.dept, |
| | |
| | | const now = new Date(); |
| | | const randomType = notificationTypes[Math.floor(Math.random() * notificationTypes.length)]; |
| | | const randomDept = departments[Math.floor(Math.random() * departments.length)]; |
| | | |
| | | |
| | | // 生成随机标题 |
| | | let title = titleTemplates[Math.floor(Math.random() * titleTemplates.length)]; |
| | | title = title |
| | |
| | | .replace('{company}', ['公司', '集团', '总部'][Math.floor(Math.random() * 4)]) |
| | | .replace('{project}', ['数字化转型', '产品升级', '市场拓展', '人才培养'][Math.floor(Math.random() * 4)]) |
| | | .replace('{policy}', ['考勤', '薪酬', '福利', '晋升'][Math.floor(Math.random() * 4)]); |
| | | |
| | | |
| | | // 随机状态 |
| | | const statuses = ['draft', 'published']; |
| | | const randomStatus = statuses[Math.floor(Math.random() * statuses.length)]; |
| | | |
| | | |
| | | // 随机优先级 |
| | | const priorities = ['low', 'medium', 'high']; |
| | | const randomPriority = priorities[Math.floor(Math.random() * priorities.length)]; |
| | | |
| | | |
| | | const newNotification = { |
| | | id: newId, |
| | | title: title, |
| | |
| | | syncMethods: ["wechat", "dingtalk"], |
| | | createTime: now.toLocaleString() |
| | | }; |
| | | |
| | | |
| | | // 添加到数据开头 |
| | | mockData.unshift(newNotification); |
| | | |
| | | |
| | | // 保持数据量在合理范围内(最多保留20条) |
| | | if (mockData.length > 20) { |
| | | mockData = mockData.slice(0, 20); |
| | | } |
| | | |
| | | |
| | | console.log(`[${new Date().toLocaleString()}] 自动生成新通知: ${title}`); |
| | | }; |
| | | |
| | |
| | | const submitForm = async () => { |
| | | try { |
| | | await formRef.value.validate(); |
| | | |
| | | |
| | | if (dialogType.value === "add") { |
| | | // 新增通知 |
| | | addNotification({...form.value}).then(res => { |
| | |
| | | const createMeeting = async () => { |
| | | try { |
| | | await meetingFormRef.value.validate(); |
| | | |
| | | |
| | | // 模拟创建会议 |
| | | const meetingInfo = { |
| | | title: meetingForm.value.title, |
| | |
| | | ElMessage.error(err.msg); |
| | | }) |
| | | // 模拟发送到企业微信/钉钉 |
| | | // const platformName = meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "未知平台"; |
| | | // const platformName = meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "未知平台"; |
| | | // ElMessage.success(`会议创建成功!会议ID: ${meetingInfo.meetingId},将通过${platformName}发送通知`); |
| | | |
| | | // 获取参会人员信息 |
| | |
| | | const employee = employees.value.find(emp => emp.value === participantId); |
| | | return employee ? employee.label : '未知人员'; |
| | | }).join('、'); |
| | | |
| | | |
| | | // 获取参会人员详细信息 |
| | | const participantDetails = meetingForm.value.participants.map(participantId => { |
| | | const employee = employees.value.find(emp => emp.value === participantId); |
| | |
| | | email: employee.email |
| | | } : null; |
| | | }).filter(Boolean); |
| | | |
| | | |
| | | // 将会议信息添加到通知列表 |
| | | const meetingNotification = { |
| | | title: `[会议通知] ${meetingInfo.title}`, |
| | |
| | | ElMessage.error("上传文件大小不能超过 10MB!"); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | const fileInfo = { |
| | | name: file.name, |
| | | size: file.size, |
| | | type: file.type, |
| | | uid: file.uid |
| | | }; |
| | | |
| | | |
| | | fileList.value.push(fileInfo); |
| | | fileShareForm.value.files.push(fileInfo.name); |
| | | return false; // 阻止自动上传 |
| | |
| | | const shareFiles = async () => { |
| | | try { |
| | | await fileShareFormRef.value.validate(); |
| | | |
| | | |
| | | if (fileShareForm.value.files.length === 0) { |
| | | ElMessage.warning("请至少选择一个文件"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 模拟文件共享 |
| | | const shareInfo = { |
| | | title: fileShareForm.value.title, |
| | |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }) |
| | | |
| | | |
| | | // ElMessage.success(`文件共享成功!共享ID: ${shareInfo.shareId},已通知相关部门`); |
| | | |
| | | |
| | | |
| | | |
| | | // 将文件共享信息添加到通知列表 |
| | | const fileShareNotification = { |
| | | title: `[文件共享] ${shareInfo.title}`, |
| | |
| | | }).catch(err => { |
| | | ElMessage.error(err.msg); |
| | | }) |
| | | |
| | | |
| | | // mockData.unshift(fileShareNotification); |
| | | // getList(); |
| | | } catch (error) { |