Skip to content

Commit 6fcd19c

Browse files
committed
fix: Edit data bug
1 parent 44bf16d commit 6fcd19c

7 files changed

Lines changed: 12 additions & 354 deletions

File tree

chat2db-client/src/blocks/Tree/TreeNodeRightClick/index.less

Lines changed: 0 additions & 9 deletions
This file was deleted.

chat2db-client/src/blocks/Tree/TreeNodeRightClick/index.tsx

Lines changed: 0 additions & 336 deletions
This file was deleted.

chat2db-client/src/components/MonacoEditor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export const appendMonacoValue = (editor: any, text: any, range: IRangeType = 'e
231231
// 创建编辑操作,将当前文档内容替换为新内容
232232
let newRange: IRangeType = range;
233233
if (range === 'reset') {
234-
editor.setValue(text);
234+
editor.setValue(text || '');
235235
return;
236236
}
237237
let newText = text;

chat2db-client/src/components/SearchResult/components/TableBox/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,10 @@ export default function TableBox(props: ITableProps) {
245245

246246
function monacoEditorEditData() {
247247
const editorData = monacoEditorRef?.current?.getAllContent();
248-
// 获取原始的该单元格的数据
249-
// let _oldData = '';
250248
const { rowId, colId } = viewTableCellData!;
251-
oldDataList.forEach((item) => {
252-
if (item[0] === rowId) {
249+
console.log('oldTableData', oldTableData);
250+
oldTableData.forEach((item) => {
251+
if (item[colNoCode] === rowId) {
253252
if (item[colId] !== editorData) {
254253
const newTableData = lodash.cloneDeep(tableData);
255254
let newRowDataList: any = [];
@@ -260,13 +259,12 @@ export default function TableBox(props: ITableProps) {
260259
}
261260
});
262261
setTableData(newTableData);
263-
264262
// 添加更新记录
265263
setUpdateData([
266264
...updateData,
267265
{
268266
type: CRUD.UPDATE,
269-
oldDataList: item,
267+
oldDataList: Object.keys(item).map((_i) => item[_i]),
270268
dataList: newRowDataList,
271269
rowId,
272270
},
@@ -1085,6 +1083,7 @@ export default function TableBox(props: ITableProps) {
10851083
text: transformInputValue(viewTableCellData?.value),
10861084
range: 'reset',
10871085
}}
1086+
language="plaintext"
10881087
options={{
10891088
lineNumbers: 'off',
10901089
readOnly: !queryResultData.canEdit,

chat2db-client/src/i18n/en-us/workspace.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ export default {
3232
'workspace.tree.delete.tip': 'I understand that this operation is permanently deleted',
3333
'workspace.tree.delete.table.tip': 'Are you sure you want to delete the table {1}?',
3434
'workspace.tips.noConnection': 'You have not created a connection yet',
35+
'workspace.tips.maxConsole': 'You can only open up to 20 consoles',
3536
};

0 commit comments

Comments
 (0)