+
)
}
\ No newline at end of file
diff --git a/apps/web/src/components/models/daily/dailyMsgForm/DailyPersonMsg.tsx b/apps/web/src/components/models/daily/dailyMsgForm/DailyPersonMsg.tsx
new file mode 100644
index 0000000..961ecc7
--- /dev/null
+++ b/apps/web/src/components/models/daily/dailyMsgForm/DailyPersonMsg.tsx
@@ -0,0 +1,13 @@
+export default function DailyPersonMsg({selectedUserMsg}) {
+ return (
+
+ {selectedUserMsg?.showname ? selectedUserMsg?.showname : "暂无数据"}
+ {selectedUserMsg?.age ? selectedUserMsg?.age : "暂无数据"}
+ {selectedUserMsg?.sex ? selectedUserMsg?.sex : "暂无数据"}
+ {selectedUserMsg?.absent ? selectedUserMsg?.absent : "暂无数据"}
+ {selectedUserMsg?.department?.name ? selectedUserMsg?.department?.name : "暂无数据"}
+ {selectedUserMsg?.position?.type ? selectedUserMsg?.position?.type : "暂无数据"}
+ {selectedUserMsg?.avatar ? selectedUserMsg?.avatar : "暂无数据"}
+
+ )
+}
\ No newline at end of file
diff --git a/apps/web/src/components/models/daily/dailyMsgForm/DailyTrainMsg.tsx b/apps/web/src/components/models/daily/dailyMsgForm/DailyTrainMsg.tsx
new file mode 100644
index 0000000..7d8f73e
--- /dev/null
+++ b/apps/web/src/components/models/daily/dailyMsgForm/DailyTrainMsg.tsx
@@ -0,0 +1,7 @@
+export default function DailyTrainMsg() {
+ return (
+
+ 每日培训消息
+
+ )
+}
\ No newline at end of file
diff --git a/apps/web/src/components/models/staff/staff-select.tsx b/apps/web/src/components/models/staff/staff-select.tsx
index ee46458..761ef14 100755
--- a/apps/web/src/components/models/staff/staff-select.tsx
+++ b/apps/web/src/components/models/staff/staff-select.tsx
@@ -23,7 +23,7 @@ export default function StaffSelect({
onChange,
placeholder,
style,
- multiple,
+ multiple = false,
domainId,
staffsMsg,
}: StaffSelectProps) {
@@ -92,7 +92,7 @@ export default function StaffSelect({
options={options}
value={value}
onChange={onChange}
- style={{ minWidth: 200, ...style }}
+ style={{ minWidth: 600, ...style }}
/>{" "}
>
);
diff --git a/packages/common/src/models/select.ts b/packages/common/src/models/select.ts
index f97fdf2..96dc776 100755
--- a/packages/common/src/models/select.ts
+++ b/packages/common/src/models/select.ts
@@ -163,7 +163,41 @@ export const trainSituationDetailSelect: Prisma.TrainSituationSelect = {
select: {
id: true,
title: true,
-
+
},
},
};
+export const staffDetailSelect: Prisma.StaffSelect = {
+ id: true,
+ showname: true,
+ username: true,
+ deptId: true,
+ avatar: true,
+ age: true,
+ sex: true,
+ absent: true,
+ trainSituations:{
+ select:{
+ id: true,
+ trainContent:{
+ select:{
+ id: true,
+ title: true,
+ type: true,
+ }
+ }
+ }
+ },
+ department: {
+ select: {
+ id: true,
+ name: true,
+ }
+ },
+ position: {
+ select: {
+ id: true,
+ type: true,
+ }
+ }
+};
From 622aa0358a09ef7f52b5f297a8c5fd9c61c742f5 Mon Sep 17 00:00:00 2001
From: Rao <1227431568@qq.com>
Date: Wed, 12 Mar 2025 11:43:17 +0800
Subject: [PATCH 3/3] rht
---
apps/web/src/components/models/daily/DailyContext.tsx | 11 +++++++++--
.../daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx | 9 ++++++++-
.../models/daily/dailyMsgForm/DailyMsgFormLayout.tsx | 9 ++-------
.../models/daily/dailyMsgForm/DailyTrainMsg.tsx | 2 +-
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/apps/web/src/components/models/daily/DailyContext.tsx b/apps/web/src/components/models/daily/DailyContext.tsx
index 51fc184..ac9436b 100644
--- a/apps/web/src/components/models/daily/DailyContext.tsx
+++ b/apps/web/src/components/models/daily/DailyContext.tsx
@@ -1,7 +1,7 @@
import { api } from "@nice/client";
import { useAuth } from "@web/src/providers/auth-provider";
import { UserProfile } from "@nice/common";
-import { createContext, ReactNode, useContext, useEffect } from "react";
+import { createContext, ReactNode, useContext, useEffect, useState } from "react";
interface DailyContextProviderProps{
staffsMsg:{
@@ -9,7 +9,9 @@ interface DailyContextProviderProps{
showname:string,
username:string
}[],
- staffsLoading:boolean
+ staffsLoading:boolean,
+ selectedUserMsg:UserProfile,
+ setSelectedUserMsg:(userMsg:UserProfile)=>void
}
interface DailyContextProps{
@@ -20,6 +22,7 @@ const DailyContextProvider = createContext
(null)
export default function DailyContext({children}:DailyContextProps){
const {user} = useAuth()
+ const [selectedUserMsg,setSelectedUserMsg] = useState(null)
// 获取当前员工的单位下的所有staff的记录
const {data:staffs,isLoading:staffsLoading} = api.staff.findByDept.useQuery({
deptId:user.deptId
@@ -31,9 +34,13 @@ export default function DailyContext({children}:DailyContextProps){
username:staff.username
}
})
+
+
return
{children}
diff --git a/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx b/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx
index 48ce306..7357e23 100644
--- a/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx
+++ b/apps/web/src/components/models/daily/dailyMsgDisplay/DailyMsgDisplayLayout.tsx
@@ -1,5 +1,12 @@
+import DailyPersonMsg from "../dailyMsgForm/DailyPersonMsg";
+import DailyTrainMsg from "../dailyMsgForm/DailyTrainMsg";
+import { useDaily } from "../DailyContext";
export default function DailyMsgDisplayLayout(){
+ const {selectedUserMsg} = useDaily()
return (
-
+
+
+
+
)
}
\ No newline at end of file
diff --git a/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx b/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx
index 05f3d9a..a9f4de6 100644
--- a/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx
+++ b/apps/web/src/components/models/daily/dailyMsgForm/DailyMsgFormLayout.tsx
@@ -4,14 +4,11 @@ import { useDaily } from "../DailyContext";
import { useEffect, useState } from "react";
import { staffDetailSelect, UserProfile } from "@nice/common";
import { api } from "@nice/client";
-import DailyPersonMsg from "./DailyPersonMsg";
import { MonitorOutlined } from "@ant-design/icons";
-import DailyTrainMsg from "./DailyTrainMsg";
export function DailyMsgFormLayout() {
const [form] = Form.useForm()
- const { staffsMsg } = useDaily()
- const [selectedUserMsg, setSelectedUserMsg] = useState(null)
+ const { staffsMsg ,selectedUserMsg,setSelectedUserMsg} = useDaily()
const [selectedUserId, setSelectedUserId] = useState(null);
const { data: selectedUserData } = api.staff.findUnique.useQuery(
{
@@ -35,7 +32,7 @@ export function DailyMsgFormLayout() {
useEffect(() => {
if (selectedUserData) {
console.log(selectedUserData)
- setSelectedUserMsg(selectedUserData);
+ setSelectedUserMsg(selectedUserData as any as UserProfile);
}
}, [selectedUserData]);
@@ -53,8 +50,6 @@ export function DailyMsgFormLayout() {
>
-