|
@@ -1,4 +1,4 @@
|
|
|
-import { Button, message } from 'antd'
|
|
|
+import { Button, message, Tooltip } from 'antd'
|
|
|
import LeftMenu from './Components/LeftMenu'
|
|
|
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'
|
|
|
import { arrayMoveImmutable } from 'array-move'
|
|
@@ -8,9 +8,12 @@ import { useEffect, useRef, useState } from 'react'
|
|
|
import { useRequest } from 'umi'
|
|
|
import type { ProFormInstance } from '@ant-design/pro-form'
|
|
|
import { addDataSourceItem, queryDataSource, updateDataSourceItem } from '@/services/api/schema'
|
|
|
-import { MenuOutlined, PlusOutlined } from '@ant-design/icons'
|
|
|
+import { CopyOutlined, MenuOutlined, PlusOutlined } from '@ant-design/icons'
|
|
|
+import { CopyToClipboard } from 'react-copy-to-clipboard'
|
|
|
+import { isEmpty, isNullOrUnDef } from '@/utils/is'
|
|
|
import classNames from 'classnames'
|
|
|
import './index.less'
|
|
|
+import styles from './index.less'
|
|
|
import { ModalForm, ProFormRadio, ProFormText } from '@ant-design/pro-form'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
import { ModalType } from '@/utils/enum'
|
|
@@ -47,7 +50,8 @@ const Option = () => {
|
|
|
modalType: OptionModalType.ADD,
|
|
|
menuDataItems: [],
|
|
|
current: null,
|
|
|
- menuDataTitle: null
|
|
|
+ menuDataTitle: null,
|
|
|
+ menuTitleUrl: null
|
|
|
})
|
|
|
|
|
|
const { run: tryFetchList } = useRequest(queryDataSource, {
|
|
@@ -168,12 +172,15 @@ const Option = () => {
|
|
|
)
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ const menuTitleCopyUrl =
|
|
|
+ `/api/form/v1/ds/items?ID=` + state.menuData.find(i => i.ID === state.activeID)?.ID
|
|
|
+ if (isNullOrUnDef(menuTitleCopyUrl) || isEmpty(menuTitleCopyUrl)) return null
|
|
|
if (state.activeID) {
|
|
|
setState({
|
|
|
...state,
|
|
|
menuDataTitle:
|
|
|
- state.menuData.find(i => i.ID === state.activeID)?.name +
|
|
|
- `:/api/form/v1/ds/items?ID=${state.menuData.find(i => i.ID === state.activeID)?.ID}`
|
|
|
+ state.menuData.find(i => i.ID === state.activeID)?.name + `:` + menuTitleCopyUrl,
|
|
|
+ menuTitleUrl: menuTitleCopyUrl
|
|
|
})
|
|
|
}
|
|
|
}, [state.activeID])
|
|
@@ -197,7 +204,11 @@ const Option = () => {
|
|
|
options={state.menuData}
|
|
|
initFn={() => tryFetchList()}
|
|
|
/>
|
|
|
- <div className="w-6/7 ml-8 bg-white p-4 rounded-20px shadow-hex-3e2c5a relative">
|
|
|
+ <div
|
|
|
+ className={classNames(
|
|
|
+ 'w-6/7 ml-8 bg-white p-4 rounded-20px shadow-hex-3e2c5a relative',
|
|
|
+ styles.copyWrap
|
|
|
+ )}>
|
|
|
<ProTable<API.DataSourceItem>
|
|
|
columns={columns}
|
|
|
search={false}
|
|
@@ -206,8 +217,17 @@ const Option = () => {
|
|
|
}}
|
|
|
dataSource={state.menuDataItems || []}
|
|
|
rowKey="index"
|
|
|
- headerTitle={state.activeID ? state.menuDataTitle : null}
|
|
|
toolbar={{
|
|
|
+ title: state.activeID ? state.menuDataTitle : null,
|
|
|
+ subTitle: state.activeID ? (
|
|
|
+ <CopyToClipboard
|
|
|
+ onCopy={() => message.success('复制成功')}
|
|
|
+ text={state.menuTitleUrl}>
|
|
|
+ <Tooltip placement="right" title="复制" className="ml-5px">
|
|
|
+ <CopyOutlined />
|
|
|
+ </Tooltip>
|
|
|
+ </CopyToClipboard>
|
|
|
+ ) : null,
|
|
|
actions: [
|
|
|
<Button
|
|
|
key="btn-key"
|