fix: 表结构编辑在 HTTP 访问时不再因缺少 randomUUID 报错
This commit is contained in:
@@ -632,6 +632,8 @@ interface TableDataLoadOptions {
|
||||
const workbenchTabs = ref<WorkbenchTab[]>([]);
|
||||
const activeTabKey = ref("");
|
||||
const temporaryScriptCounter = ref(0);
|
||||
// crypto.randomUUID only exists on HTTPS/localhost; the platform is often opened over plain HTTP.
|
||||
let draftKeySeq = 0;
|
||||
const exportOptions = [
|
||||
{ label: "CSV", key: "csv" },
|
||||
{ label: "XLSX", key: "xlsx" },
|
||||
@@ -1944,10 +1946,15 @@ function activeDesignerIndexes(tab: TableDesignerTab) {
|
||||
return tab.indexes.filter((index) => !index.drop && index.name.trim() && splitIndexColumns(index.columns).length);
|
||||
}
|
||||
|
||||
function nextDraftKey() {
|
||||
draftKeySeq += 1;
|
||||
return `draft-${draftKeySeq}`;
|
||||
}
|
||||
|
||||
function columnDraft(column: ColumnDefinition, existing: boolean): TableColumnDraft {
|
||||
const parsedType = parseColumnType(column.type);
|
||||
return {
|
||||
key: crypto.randomUUID(),
|
||||
key: nextDraftKey(),
|
||||
existing,
|
||||
original: { ...column },
|
||||
name: column.name,
|
||||
@@ -1967,7 +1974,7 @@ function columnDraft(column: ColumnDefinition, existing: boolean): TableColumnDr
|
||||
|
||||
function indexDraft(index: IndexDefinition, existing: boolean): TableIndexDraft {
|
||||
return {
|
||||
key: crypto.randomUUID(),
|
||||
key: nextDraftKey(),
|
||||
existing,
|
||||
original: { ...index, columns: [...index.columns] },
|
||||
name: index.name,
|
||||
|
||||
Reference in New Issue
Block a user