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