Compare commits
3 Commits
aeaeb9aec5
...
7ceed76d50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ceed76d50 | ||
|
|
bda06279df | ||
|
|
0b99801b26 |
@@ -102,25 +102,31 @@
|
||||
|
||||
.preview-shell {
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
padding: 0;
|
||||
background: #f4f7f9;
|
||||
display: grid;
|
||||
grid-template-columns: 180px 1fr;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.preview-process-panel {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: minmax(0, 1fr) auto;
|
||||
border-right: 1px solid #d8e0e8;
|
||||
background: #ffffff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.preview-process-section {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
||||
}
|
||||
|
||||
.preview-process-header {
|
||||
@@ -139,7 +145,9 @@
|
||||
|
||||
.preview-process-tree {
|
||||
min-height: 0;
|
||||
max-height: 100%;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 8px;
|
||||
@@ -178,9 +186,14 @@
|
||||
|
||||
.preview-process-tree button {
|
||||
width: 100%;
|
||||
min-height: 30px;
|
||||
display: block;
|
||||
text-align: left;
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview-process-tree li.is-active button {
|
||||
@@ -198,6 +211,9 @@
|
||||
}
|
||||
|
||||
.preview-process-status {
|
||||
min-height: 44px;
|
||||
max-height: 78px;
|
||||
overflow: auto;
|
||||
padding: 6px 8px 8px;
|
||||
border-top: 1px solid #eef2f5;
|
||||
color: #647586;
|
||||
@@ -206,6 +222,10 @@
|
||||
}
|
||||
|
||||
.preview-scene-section {
|
||||
min-height: 0;
|
||||
max-height: 236px;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
border-top: 1px solid #d8e0e8;
|
||||
}
|
||||
|
||||
@@ -255,13 +275,14 @@
|
||||
.preview-canvas-panel {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.preview-viewport {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 420px;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ export async function openProcessModelUploadDialog(input?: {
|
||||
await uploadModelToBackend({
|
||||
file: state.file,
|
||||
name,
|
||||
fileName: name || state.file.name,
|
||||
fileName: state.file.name,
|
||||
brandName: String(form.get("brandName") ?? ""),
|
||||
typeName: String(form.get("typeName") ?? ""),
|
||||
operationTree: String(form.get("operationTree") ?? ""),
|
||||
@@ -637,19 +637,38 @@ function normalizeOperationTreeInput(value?: string) {
|
||||
}
|
||||
|
||||
if (parsed && typeof parsed === "object" && "OperationTree" in parsed) {
|
||||
const operationTree = (parsed as { OperationTree: unknown }).OperationTree;
|
||||
const normalized = { ...(parsed as Record<string, unknown>) };
|
||||
const operationTree = normalized.OperationTree;
|
||||
if (typeof operationTree === "string") {
|
||||
JSON.parse(operationTree);
|
||||
return JSON.stringify({ OperationTree: operationTree });
|
||||
normalized.OperationTree = operationTree;
|
||||
normalizeOptionalJsonListField(normalized, "ModelProcess");
|
||||
normalizeOptionalJsonListField(normalized, "ProcesslLabelList");
|
||||
return JSON.stringify(normalized);
|
||||
}
|
||||
if (Array.isArray(operationTree)) {
|
||||
return JSON.stringify({ OperationTree: JSON.stringify(operationTree) });
|
||||
normalized.OperationTree = JSON.stringify(operationTree);
|
||||
normalizeOptionalJsonListField(normalized, "ModelProcess");
|
||||
normalizeOptionalJsonListField(normalized, "ProcesslLabelList");
|
||||
return JSON.stringify(normalized);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('工艺数据格式必须是 {"OperationTree":"[...]"} 或 OperationTree[] 数组');
|
||||
}
|
||||
|
||||
function normalizeOptionalJsonListField(target: Record<string, unknown>, field: string) {
|
||||
const value = target[field];
|
||||
if (value === undefined || value === null || value === "") return;
|
||||
if (typeof value === "string") {
|
||||
JSON.parse(value);
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
target[field] = JSON.stringify(value);
|
||||
}
|
||||
}
|
||||
|
||||
async function editModel(id: number) {
|
||||
const card = document.querySelector<HTMLButtonElement>(`button[data-id="${id}"]`)?.closest(".model-card");
|
||||
const oldName = card?.querySelector("strong")?.textContent ?? "";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 数据库存储的数据
|
||||
interface OperationTreeDB {
|
||||
OperationTree: string; // JSON字符串,格式化之后是 OperationTree[] 列表
|
||||
ModelProcess?: string; // JSON字符串,格式化之后是 ModelProcess[] 列表
|
||||
ProcesslLabelList?: string; // JSON字符串,格式化之后是 ProcesslLabelList[] 列表
|
||||
}
|
||||
|
||||
// 工艺数据机构
|
||||
|
||||
Reference in New Issue
Block a user