|
@@ -5,7 +5,7 @@ import s from './index.module.css'
|
|
|
import cn from '@/utils/classnames'
|
|
|
import Modal from '@/app/components/base/modal'
|
|
|
import Button from '@/app/components/base/button'
|
|
|
-import { addKnowledge, editKnowledge, fetchDepts } from '@/service/common'
|
|
|
+import { addDept, editDept, fetchDepts } from '@/service/common'
|
|
|
import 'react-multi-email/dist/style.css'
|
|
|
import Input from '@/app/components/base/input'
|
|
|
import { TreeSelect as AntdTreeSelect } from 'antd'
|
|
@@ -15,11 +15,12 @@ const InviteModal = ({
|
|
|
onCancel,
|
|
|
onSend,
|
|
|
}: any) => {
|
|
|
- const [name, setName] = useState<string>(transfer.row?.name || '')
|
|
|
+ const [name, setName] = useState<string>(transfer.row?.dept_name || '')
|
|
|
+ const [parent, setParent] = useState<string>(transfer.row?.parent_id || '')
|
|
|
const [options, setOptions] = useState<any>([])
|
|
|
useEffect(() => {
|
|
|
fetchDepts({
|
|
|
- url: '/xxx',
|
|
|
+ url: '/dept',
|
|
|
params: {
|
|
|
page: 1,
|
|
|
limit: 99999,
|
|
@@ -32,15 +33,15 @@ const InviteModal = ({
|
|
|
try {
|
|
|
let res: any = () => {}
|
|
|
if (transfer.mode === 'add') {
|
|
|
- res = await addKnowledge({
|
|
|
- url: '/123',
|
|
|
- body: { name, status: false },
|
|
|
+ res = await addDept({
|
|
|
+ url: '/depts',
|
|
|
+ body: { dept_name: name, parent_id: parent },
|
|
|
})
|
|
|
}
|
|
|
else {
|
|
|
- res = await editKnowledge({
|
|
|
- url: `/123/${transfer.row.id}`,
|
|
|
- body: { name },
|
|
|
+ res = await editDept({
|
|
|
+ url: `/depts/${transfer.row.dept_id}`,
|
|
|
+ body: { dept_name: name, parent_id: parent },
|
|
|
})
|
|
|
}
|
|
|
const { id }: any = res
|
|
@@ -67,14 +68,14 @@ const InviteModal = ({
|
|
|
<AntdTreeSelect
|
|
|
showSearch
|
|
|
style={{ width: '100%' }}
|
|
|
- value={name}
|
|
|
+ value={parent}
|
|
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
placeholder="请选择上级部门"
|
|
|
allowClear
|
|
|
treeDefaultExpandAll
|
|
|
- onChange={v => setName(v || '')}
|
|
|
+ onChange={v => setParent(v || '')}
|
|
|
treeData={options}
|
|
|
- fieldNames={{ label: 'name', value: 'id' }}
|
|
|
+ fieldNames={{ label: 'dept_name', value: 'dept_id' }}
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={cn('flex flex-wrap items-center justify-between')}>
|