|
@@ -6,18 +6,20 @@ import { fetchStaffList } from '@/services/user/api'
|
|
|
import { linkAttendance, addAttendance } from '@/services/user/system'
|
|
|
import '@/pages/Role/System/components/ConnectModal/index.less'
|
|
|
import { LoadingOutlined, MoreOutlined } from '@ant-design/icons'
|
|
|
-import { modalType } from '../..'
|
|
|
+import { modalType } from '@/pages/Business/Attendance/index.tsx'
|
|
|
|
|
|
interface ConnectModalProps extends PropsWithChildren {
|
|
|
dataId: string
|
|
|
visible: boolean
|
|
|
onCancel: () => void
|
|
|
+ onRefresh: () => void
|
|
|
}
|
|
|
const ConnectModal: React.FC<ConnectModalProps> = ({
|
|
|
type,
|
|
|
dataId,
|
|
|
visible,
|
|
|
onCancel,
|
|
|
+ onRefresh,
|
|
|
children
|
|
|
}) => {
|
|
|
const containerRef = useRef<HTMLDivElement>(null)
|
|
@@ -44,13 +46,15 @@ const ConnectModal: React.FC<ConnectModalProps> = ({
|
|
|
refreshDeps: [searchVal]
|
|
|
}
|
|
|
)
|
|
|
+
|
|
|
const { run: tryLinkAttendance } = useRequest(
|
|
|
(params: API.LinkAttendance) => linkAttendance(params),
|
|
|
{
|
|
|
manual: true,
|
|
|
onSuccess: () => {
|
|
|
- message.success('关联成功')
|
|
|
+ message.success('添加申请对象成功')
|
|
|
onCancel()
|
|
|
+ onRefresh()
|
|
|
},
|
|
|
onError: e => {
|
|
|
message.error(e.message)
|
|
@@ -62,8 +66,9 @@ const ConnectModal: React.FC<ConnectModalProps> = ({
|
|
|
{
|
|
|
manual: true,
|
|
|
onSuccess: () => {
|
|
|
- message.success('关联成功')
|
|
|
+ message.success('添加申请人成功')
|
|
|
onCancel()
|
|
|
+ onRefresh()
|
|
|
},
|
|
|
onError: e => {
|
|
|
message.error(e.message)
|
|
@@ -73,9 +78,9 @@ const ConnectModal: React.FC<ConnectModalProps> = ({
|
|
|
|
|
|
const connectHandler = (staffId: string) => {
|
|
|
if (type === modalType.addobjectModal) {
|
|
|
- tryLinkAttendance({ id: dataId, staffId })
|
|
|
- } else {
|
|
|
tryAddAttendance({ applicantStaffId: staffId })
|
|
|
+ } else {
|
|
|
+ tryLinkAttendance({ id: dataId, staffId })
|
|
|
}
|
|
|
}
|
|
|
const handleSearch = (value: string) => {
|