调整模型库上传模型的字段
This commit is contained in:
@@ -115,18 +115,18 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||||
align-content: start;
|
align-content: start;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-card {
|
.model-card {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 8px;
|
gap: 5px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border: 1px solid #d7e0e8;
|
border: 1px solid #d7e0e8;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 8px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumb {
|
.thumb {
|
||||||
|
|||||||
@@ -365,10 +365,11 @@ function requestSceneModelImport() {
|
|||||||
type: requestSceneModelMessageType,
|
type: requestSceneModelMessageType,
|
||||||
requestId
|
requestId
|
||||||
}, resolveParentPostMessageOrigin());
|
}, resolveParentPostMessageOrigin());
|
||||||
notify("已请求主程序导出当前选中模型");
|
// notify("已请求主程序导出当前选中模型");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleSceneModelMessage(data: SceneModelMessage) {
|
async function handleSceneModelMessage(data: SceneModelMessage) {
|
||||||
|
console.log("Received scene model message:", data);
|
||||||
if (pendingSceneModelRequestId && data.requestId && data.requestId !== pendingSceneModelRequestId) return;
|
if (pendingSceneModelRequestId && data.requestId && data.requestId !== pendingSceneModelRequestId) return;
|
||||||
pendingSceneModelRequestId = "";
|
pendingSceneModelRequestId = "";
|
||||||
clearSceneModelRequestTimer();
|
clearSceneModelRequestTimer();
|
||||||
@@ -554,40 +555,20 @@ export async function openProcessModelUploadDialog(input?: {
|
|||||||
await loadDictionaries();
|
await loadDictionaries();
|
||||||
const initialName = input?.modelName || (input?.file ? modelNameFromFile(input.file.name) : "");
|
const initialName = input?.modelName || (input?.file ? modelNameFromFile(input.file.name) : "");
|
||||||
const result = await formDialog<boolean>({
|
const result = await formDialog<boolean>({
|
||||||
title: "上传工艺模型",
|
title: `上传工艺模型-【${appState.selectedFolderName || "当前目录"}】`,
|
||||||
width: 640,
|
width: 400,
|
||||||
height: 650,
|
height: 300,
|
||||||
blockPage: false,
|
blockPage: false,
|
||||||
body: `
|
body: `
|
||||||
<form id="processModelUploadPopupForm" class="popup-form upload-popup-form">
|
<form id="processModelUploadPopupForm" class="popup-form upload-popup-form">
|
||||||
<div class="upload-target-path">
|
|
||||||
<span>上传目录</span>
|
|
||||||
<strong>${escapeHtml(appState.selectedFolderName || "当前目录")}</strong>
|
|
||||||
</div>
|
|
||||||
<label>
|
|
||||||
<span>模型文件</span>
|
|
||||||
<div id="processModelDropZone" class="drop-zone">
|
|
||||||
<input id="processModelUploadFile" type="file" accept=".glb" />
|
|
||||||
<strong>选择模型</strong>
|
|
||||||
<em>或拖拽 .glb 模型到这里</em>
|
|
||||||
<small id="processSelectedFileName">${escapeHtml(input?.file?.name ?? "未选择文件")}</small>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<span>模型名称</span>
|
|
||||||
<input id="processModelUploadName" name="name" placeholder="例如 AA.glb" value="${escapeHtml(initialName)}" />
|
|
||||||
</label>
|
|
||||||
<div class="popup-form-grid">
|
<div class="popup-form-grid">
|
||||||
<label><span>品牌</span><input name="brandName" list="brandOptions" /></label>
|
<label><span>模型名称</span><input id="processModelUploadName" name="name" value="${escapeHtml(initialName)}" autocomplete="off" /></label>
|
||||||
<label><span>类型</span><input name="typeName" list="typeOptions" /></label>
|
<label><span>品牌</span><input name="brandName" list="brandOptions" autocomplete="off" /></label>
|
||||||
<label><span>型号</span><input name="model" /></label>
|
<label><span>类型</span><input name="typeName" list="typeOptions" autocomplete="off" /></label>
|
||||||
<label><span>价钱</span><input name="price" /></label>
|
<label><span>型号</span><input name="model" autocomplete="off" /></label>
|
||||||
<label><span>重量</span><input name="weight" /></label>
|
<label><span>价钱</span><input name="price" autocomplete="off" /></label>
|
||||||
|
<label><span>重量</span><input name="weight" autocomplete="off" /></label>
|
||||||
</div>
|
</div>
|
||||||
<label>
|
|
||||||
<span>工艺数据 JSON</span>
|
|
||||||
<textarea id="processOperationTreeJson" name="operationTree" placeholder='可以粘贴 {"OperationTree":"[...]"} 或 OperationTree[] 数组 JSON'>${escapeHtml(input?.operationTreeJson ?? "")}</textarea>
|
|
||||||
</label>
|
|
||||||
${dictionaryDatalistHtml()}
|
${dictionaryDatalistHtml()}
|
||||||
</form>
|
</form>
|
||||||
`,
|
`,
|
||||||
@@ -664,52 +645,52 @@ function bindUploadDialogEvents(state: UploadFormState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bindProcessUploadDialogEvents(state: UploadFormState) {
|
function bindProcessUploadDialogEvents(state: UploadFormState) {
|
||||||
const dropZone = document.querySelector<HTMLDivElement>("#processModelDropZone")!;
|
// const dropZone = document.querySelector<HTMLDivElement>("#processModelDropZone")!;
|
||||||
const fileInput = document.querySelector<HTMLInputElement>("#processModelUploadFile")!;
|
// const fileInput = document.querySelector<HTMLInputElement>("#processModelUploadFile")!;
|
||||||
const nameInput = document.querySelector<HTMLInputElement>("#processModelUploadName")!;
|
// const nameInput = document.querySelector<HTMLInputElement>("#processModelUploadName")!;
|
||||||
const selectedFileName = document.querySelector<HTMLElement>("#processSelectedFileName")!;
|
// const selectedFileName = document.querySelector<HTMLElement>("#processSelectedFileName")!;
|
||||||
|
|
||||||
const selectFile = (file: File) => {
|
// const selectFile = (file: File) => {
|
||||||
if (!file.name.toLowerCase().endsWith(".glb")) {
|
// if (!file.name.toLowerCase().endsWith(".glb")) {
|
||||||
notify("当前阶段只允许上传 .glb 模型");
|
// notify("当前阶段只允许上传 .glb 模型");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
state.file = file;
|
// state.file = file;
|
||||||
selectedFileName.textContent = file.name;
|
// selectedFileName.textContent = file.name;
|
||||||
if (!nameInput.value.trim()) {
|
// if (!nameInput.value.trim()) {
|
||||||
nameInput.value = file.name;
|
// nameInput.value = file.name;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
if (state.file) {
|
// if (state.file) {
|
||||||
selectedFileName.textContent = state.file.name;
|
// selectedFileName.textContent = state.file.name;
|
||||||
if (!nameInput.value.trim()) {
|
// if (!nameInput.value.trim()) {
|
||||||
nameInput.value = state.file.name;
|
// nameInput.value = state.file.name;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fileInput.addEventListener("change", () => {
|
// fileInput.addEventListener("change", () => {
|
||||||
const file = fileInput.files?.[0];
|
// const file = fileInput.files?.[0];
|
||||||
if (file) selectFile(file);
|
// if (file) selectFile(file);
|
||||||
});
|
// });
|
||||||
|
|
||||||
dropZone.addEventListener("click", (event) => {
|
// dropZone.addEventListener("click", (event) => {
|
||||||
if (event.target !== fileInput) fileInput.click();
|
// if (event.target !== fileInput) fileInput.click();
|
||||||
});
|
// });
|
||||||
|
|
||||||
dropZone.addEventListener("dragover", (event) => {
|
// dropZone.addEventListener("dragover", (event) => {
|
||||||
event.preventDefault();
|
// event.preventDefault();
|
||||||
dropZone.classList.add("is-dragover");
|
// dropZone.classList.add("is-dragover");
|
||||||
});
|
// });
|
||||||
dropZone.addEventListener("dragleave", () => {
|
// dropZone.addEventListener("dragleave", () => {
|
||||||
dropZone.classList.remove("is-dragover");
|
// dropZone.classList.remove("is-dragover");
|
||||||
});
|
// });
|
||||||
dropZone.addEventListener("drop", (event) => {
|
// dropZone.addEventListener("drop", (event) => {
|
||||||
event.preventDefault();
|
// event.preventDefault();
|
||||||
dropZone.classList.remove("is-dragover");
|
// dropZone.classList.remove("is-dragover");
|
||||||
const file = event.dataTransfer?.files?.[0];
|
// const file = event.dataTransfer?.files?.[0];
|
||||||
if (file) selectFile(file);
|
// if (file) selectFile(file);
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeOperationTreeInput(value?: string) {
|
function normalizeOperationTreeInput(value?: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user