|
@@ -11,7 +11,8 @@ import {
|
|
|
changeBusinessGroupStatus,
|
|
|
delBusinessGroupById,
|
|
|
getBusinessgroupList,
|
|
|
- updateBusinessGroup
|
|
|
+ updateBusinessGroup,
|
|
|
+ getClientSourceList
|
|
|
} from '@/services/user/api'
|
|
|
import type { ColumnsType } from 'antd/lib/table'
|
|
|
import { Delete } from '@icon-park/react'
|
|
@@ -56,21 +57,23 @@ const defaultData = [
|
|
|
|
|
|
const Contact: React.FC = () => {
|
|
|
const { department, fetchDepartment } = useModel('department')
|
|
|
- useEffect(() => {
|
|
|
- if (!department.length) {
|
|
|
- fetchDepartment()
|
|
|
- }
|
|
|
- }, [])
|
|
|
const formRef = useRef<FormInstance>(null)
|
|
|
|
|
|
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>()
|
|
|
|
|
|
const [state, setState] = useState({
|
|
|
id: '',
|
|
|
+ menuId: 1,
|
|
|
dataSource: [],
|
|
|
+ clientSourceList: [],
|
|
|
visible: false,
|
|
|
type: modalType.CREATE
|
|
|
})
|
|
|
+ console.log(state.clientSourceList)
|
|
|
+
|
|
|
+ const onSelect = (menuId: string) => {
|
|
|
+ setState({ ...state, menuId })
|
|
|
+ }
|
|
|
|
|
|
const columns: ProFormColumnsType<StageSettingsType>[] = [
|
|
|
{
|
|
@@ -168,6 +171,21 @@ const Contact: React.FC = () => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ const { run: tryGetClientSourceList } = useRequest(getClientSourceList, {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: result => {
|
|
|
+ setState({ ...state, clientSourceList: result })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (!department.length) {
|
|
|
+ fetchDepartment()
|
|
|
+ }
|
|
|
+ if (state.id) {
|
|
|
+ tryGetClientSourceList(state.id)
|
|
|
+ }
|
|
|
+ }, [state.id])
|
|
|
const mainColumns: ColumnsType<API.BusinessgroupItem> = [
|
|
|
{
|
|
|
dataIndex: 'name',
|
|
@@ -237,25 +255,65 @@ const Contact: React.FC = () => {
|
|
|
)
|
|
|
}
|
|
|
]
|
|
|
+ const clientSource: ColumnsType<API.ClientSourceList> = [
|
|
|
+ {
|
|
|
+ dataIndex: 'name',
|
|
|
+ title: '来源名称'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dataIndex: 'opreate',
|
|
|
+ title: '操作'
|
|
|
+ }
|
|
|
+ ]
|
|
|
return (
|
|
|
<div className="h-full w-full flex flex-row">
|
|
|
- <ShowTitleMenu options={[{ label: '商机状态组', value: 1 }]} defaultValue={1} />
|
|
|
+ <ShowTitleMenu
|
|
|
+ onSelect={onSelect}
|
|
|
+ options={[
|
|
|
+ { label: '商机状态组', value: 1 },
|
|
|
+ { label: '来源设置', value: 2 }
|
|
|
+ ]}
|
|
|
+ defaultValue={1}
|
|
|
+ />
|
|
|
<div className="w-max-3/4">
|
|
|
<div className="ml-8 bg-white p-4 shadow-md shadow-hex-3e2c5a relative">
|
|
|
- <div className="pb-3 border-b border-b-black border-opacity-8 mb-3 flex items-center justify-between">
|
|
|
- <div>商机状态组</div>
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- onClick={() => setState({ ...state, visible: true, type: modalType.CREATE })}>
|
|
|
- 添加新组
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- <Table
|
|
|
- columns={mainColumns}
|
|
|
- dataSource={state.dataSource}
|
|
|
- bordered
|
|
|
- rowKey={row => row.id}
|
|
|
- />
|
|
|
+ {state.menuId === 1 ? (
|
|
|
+ <>
|
|
|
+ <div className="pb-3 border-b border-b-black border-opacity-8 mb-3 flex items-center justify-between">
|
|
|
+ <div>商机状态组</div>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={() => setState({ ...state, visible: true, type: modalType.CREATE })}>
|
|
|
+ 添加新组
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <Table
|
|
|
+ columns={mainColumns}
|
|
|
+ dataSource={state.dataSource}
|
|
|
+ bordered
|
|
|
+ rowKey={row => row.id}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
+ {state.menuId === 2 ? (
|
|
|
+ <>
|
|
|
+ <div className="pb-3 border-b border-b-black border-opacity-8 mb-3 flex items-center justify-between">
|
|
|
+ <div>来源设置</div>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={() => setState({ ...state, visible: true, type: modalType.CREATE })}>
|
|
|
+ 添加来源
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <Table
|
|
|
+ columns={clientSource}
|
|
|
+ dataSource={state.clientSourceList}
|
|
|
+ bordered
|
|
|
+ rowKey={row => row.id}
|
|
|
+ params={{ msgType: 'notification' }}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
<ModalForm
|