@@ -287,10 +287,10 @@ export default function TableBox(props: ITableProps) {
287287
288288 // 编辑数据失焦
289289 const editDataOnBlur = ( type : 'blur' | 'set' , _editingData ?: string | null ) => {
290- if ( type === 'blur' ) {
291- setEditingCell ( null ) ;
292- setEditingData ( '' ) ;
293- }
290+ // if (type === 'blur') {
291+ // setEditingCell(null);
292+ // setEditingData('');
293+ // }
294294 // 写入的数据
295295 const value : any = type === 'blur' ? editingData : _editingData ;
296296 const [ colIndex , rowNo ] = editingCell ! ;
@@ -795,6 +795,18 @@ export default function TableBox(props: ITableProps) {
795795 } ,
796796 } ;
797797
798+ const viewData = {
799+ key : AllSupportedMenusType . ViewData ,
800+ callback : ( ) => {
801+ setViewTableCellData ( {
802+ name : columns [ editingCell ! [ 0 ] ] . name ,
803+ value : editingData ,
804+ colIndex : editingCell ! [ 0 ] ,
805+ rowNo : editingCell ! [ 1 ] ,
806+ } ) ;
807+ } ,
808+ }
809+
798810 // 表格的列配置
799811 const columns : ArtColumn [ ] = useMemo ( ( ) => {
800812 return ( queryResultData . headerList || [ ] ) . map ( ( item , colIndex ) => {
@@ -848,7 +860,7 @@ export default function TableBox(props: ITableProps) {
848860 // title: <div>{name}</div>,
849861 render : ( value : any , rowData ) => {
850862 const rowNo = rowData [ `${ preCode } 0No.` ] ;
851- let cellRightClickMenu = [ copyCell , copyRow , cloneRow , setNull , setDefault , deleteRow ] ;
863+ let cellRightClickMenu = [ viewData , copyCell , copyRow , cloneRow , setNull , setDefault , deleteRow ] ;
852864 // 判断是否有默认值,如果没有默认值,则不显示设置默认值的菜单
853865 const hasDefaultValue = queryResultData . headerList . find ( ( i ) => i . name === name ) ?. defaultValue !== null ;
854866 if ( ! hasDefaultValue ) {
@@ -885,7 +897,7 @@ export default function TableBox(props: ITableProps) {
885897 ) : (
886898 < >
887899 < div className = { styles . tableItemContent } > { renderTableCellValue ( value ) } </ div >
888- < div className = { styles . tableHoverBox } >
900+ { /* <div className={styles.tableHoverBox}>
889901 <Iconfont
890902 code=""
891903 onClick={viewTableCell.bind(null, { name: item.name, value, colIndex, rowNo })}
@@ -894,7 +906,7 @@ export default function TableBox(props: ITableProps) {
894906 code=""
895907 onClick={copyTableCell.bind(null, { name: item.name, value, colIndex, rowNo })}
896908 />
897- </ div >
909+ </div> */ }
898910 </ >
899911 ) }
900912 </ div >
@@ -1098,7 +1110,7 @@ export default function TableBox(props: ITableProps) {
10981110 width = "60vw"
10991111 maskClosable = { false }
11001112 destroyOnClose = { true }
1101- footer = { [
1113+ footer = { queryResultData . canEdit && [
11021114 < Button key = "1" type = "primary" onClick = { monacoEditorEditData } >
11031115 { i18n ( 'common.button.modify' ) }
11041116 </ Button > ,
@@ -1115,7 +1127,9 @@ export default function TableBox(props: ITableProps) {
11151127 } }
11161128 options = { {
11171129 lineNumbers : 'off' ,
1130+ readOnly : ! queryResultData . canEdit ,
11181131 } }
1132+
11191133 />
11201134 </ div >
11211135 </ >
0 commit comments