|
@@ -4,8 +4,8 @@ import { useRequest } from 'umi'
|
|
|
import Icon from '@/components/IconPark'
|
|
|
import AddObjectModal from './components/AddObjectModal'
|
|
|
import ApplicantModal from './components/ApplicantModal'
|
|
|
-import { Table, Tag } from 'antd'
|
|
|
-import { fetchAttendanceList, deleteAttendance } from '@/services/user/system'
|
|
|
+import { Table, Tag, Popconfirm, Popover } from 'antd'
|
|
|
+import { fetchAttendanceList, unlinkAttendance, deleteAttendance } from '@/services/user/system'
|
|
|
|
|
|
const Attendance = () => {
|
|
|
const [state, setState] = useState({
|
|
@@ -19,7 +19,19 @@ const Attendance = () => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- const { run: trydeleteAttendance } = useRequest(
|
|
|
+ const { run: tryunlinkAttendance } = useRequest(
|
|
|
+ (params: API.LinkAttendance) => {
|
|
|
+ return unlinkAttendance(params)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: () => {
|
|
|
+ tryGetRoleStaffList(state.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ const { run: tryDeleteAttendance } = useRequest(
|
|
|
(params: API.DeleteAttendance) => {
|
|
|
return deleteAttendance(params)
|
|
|
},
|
|
@@ -58,7 +70,7 @@ const Attendance = () => {
|
|
|
<span key={item.staffId} className="zh-mg-bottom-5 zh-block">
|
|
|
<Tag
|
|
|
closable={true}
|
|
|
- onClose={() => trydeleteAttendance({ staffId: item.staffId, id: record.id })}>
|
|
|
+ onClose={() => tryunlinkAttendance({ staffId: item.staffId, id: record.id })}>
|
|
|
{item.staffName}
|
|
|
</Tag>
|
|
|
</span>
|
|
@@ -71,10 +83,19 @@ const Attendance = () => {
|
|
|
title: '操作',
|
|
|
dataIndex: 'opreate',
|
|
|
width: '10%',
|
|
|
- render: () => (
|
|
|
- <span className="hover:text-hex-e7026e cursor-pointer">
|
|
|
- <Icon type="delete" fill="#fd3995" />
|
|
|
- </span>
|
|
|
+ render: (_, record) => (
|
|
|
+ // console.log(record.id)
|
|
|
+ <Popover>
|
|
|
+ <Popconfirm
|
|
|
+ title="确认删除吗?"
|
|
|
+ okText="确认"
|
|
|
+ cancelText="取消"
|
|
|
+ onConfirm={() => tryDeleteAttendance({ id: record.id })}>
|
|
|
+ <span className="hover:text-hex-e7026e cursor-pointer">
|
|
|
+ <Icon type="delete" fill="#fd3995" />
|
|
|
+ </span>
|
|
|
+ </Popconfirm>
|
|
|
+ </Popover>
|
|
|
)
|
|
|
}
|
|
|
]
|