index.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Input, Modal } from 'antd';
  2. import type { CommandItem } from '@/pages/device/Command/typings';
  3. import MonacoEditor from 'react-monaco-editor';
  4. interface Props {
  5. close: () => void;
  6. data: CommandItem | undefined;
  7. visible: boolean;
  8. }
  9. const Cat = (props: Props) => {
  10. const { close, data, visible } = props;
  11. return (
  12. <Modal
  13. maskClosable={false}
  14. width="40vw"
  15. visible={visible}
  16. onCancel={() => close()}
  17. footer={null}
  18. title="查看指令"
  19. >
  20. 下发指令:
  21. <MonacoEditor
  22. height={300}
  23. language={'json'}
  24. editorDidMount={(editor) => {
  25. editor.onDidContentSizeChange?.(() => {
  26. editor.getAction('editor.action.formatDocument').run();
  27. // .finally(() => {
  28. // editor.updateOptions({ readOnly: true });
  29. // });
  30. });
  31. }}
  32. value={JSON.stringify(data?.downstream)}
  33. />
  34. 回复结果:
  35. <Input.TextArea rows={3} />
  36. </Modal>
  37. );
  38. };
  39. export default Cat;