diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 83ca9078..57ece769 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -273,7 +273,7 @@ const Crontab = ({ headerStyle, isPhone }: any) => { title: '操作', key: 'action', align: 'center' as const, - width: 90, + width: 100, render: (text: string, record: any, index: number) => { const isPc = !isPhone; return ( @@ -518,7 +518,7 @@ const Crontab = ({ headerStyle, isPhone }: any) => { }); }; - const pinOrunPinCron = (record: any, index: number) => { + const pinOrUnPinCron = (record: any, index: number) => { Modal.confirm({ title: `确认${record.isPinned === 1 ? '取消置顶' : '置顶'}`, content: ( @@ -575,7 +575,7 @@ const Crontab = ({ headerStyle, isPhone }: any) => { 编辑 @@ -590,7 +590,7 @@ const Crontab = ({ headerStyle, isPhone }: any) => { 删除 : } @@ -611,14 +611,14 @@ const Crontab = ({ headerStyle, isPhone }: any) => { case 'edit': editCron(record, index); break; - case 'enableordisable': + case 'enableOrDisable': enabledOrDisabledCron(record, index); break; case 'delete': delCron(record, index); break; - case 'pinOrunPin': - pinOrunPinCron(record, index); + case 'pinOrUnPin': + pinOrUnPinCron(record, index); break; default: break; diff --git a/src/pages/env/index.tsx b/src/pages/env/index.tsx index 0cd56e4a..eb76b75b 100644 --- a/src/pages/env/index.tsx +++ b/src/pages/env/index.tsx @@ -166,11 +166,12 @@ const Env = ({ headerStyle, isPhone, theme }: any) => { { title: '操作', key: 'action', + width: 100, align: 'center' as const, render: (text: string, record: any, index: number) => { const isPc = !isPhone; return ( - + editEnv(record, index)}> diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx index 63eb84f5..c52a5567 100644 --- a/src/pages/script/index.tsx +++ b/src/pages/script/index.tsx @@ -8,6 +8,8 @@ import { message, Typography, Tooltip, + Dropdown, + Menu, } from 'antd'; import config from '@/utils/config'; import { PageContainer } from '@ant-design/pro-layout'; @@ -21,10 +23,12 @@ import { DeleteOutlined, DownloadOutlined, EditOutlined, + EllipsisOutlined, FormOutlined, PlusOutlined, PlusSquareOutlined, SearchOutlined, + UserOutlined, } from '@ant-design/icons'; import EditScriptNameModal from './editNameModal'; @@ -65,6 +69,7 @@ const Script = ({ headerStyle, isPhone, theme }: any) => { const [isEditing, setIsEditing] = useState(false); const editorRef = useRef(null); const [isAddFileModalVisible, setIsAddFileModalVisible] = useState(false); + const [dropdownIsVisible, setDropdownIsVisible] = useState(false); const getScripts = () => { setLoading(true); @@ -133,7 +138,9 @@ const Script = ({ headerStyle, isPhone, theme }: any) => { ); const editFile = () => { - setIsEditing(true); + setTimeout(() => { + setIsEditing(true); + }, 300); }; const cancelEdit = () => { @@ -234,6 +241,7 @@ const Script = ({ headerStyle, isPhone, theme }: any) => { newData.unshift(_file); setData(newData); onSelect(_file.value, _file); + setIsEditing(true); } setIsAddFileModalVisible(false); }; @@ -273,6 +281,29 @@ const Script = ({ headerStyle, isPhone, theme }: any) => { } }, []); + const menu = isEditing ? ( + + } onClick={saveFile}> + 保存 + + } onClick={cancelEdit}> + 退出编辑 + + + ) : ( + + } onClick={addFile}> + 添加 + + } onClick={editFile}> + 编辑 + + } onClick={deleteFile}> + 删除 + + + ); + return ( { key="value" onSelect={onSelect} />, - , + setDropdownIsVisible(visible)} + > +