| | |
| | |
|
| | | </div>
|
| | |
|
| | | <button @click="submitLayouts" style="position: fixed; top: 90px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
|
| | | <button @click="submitLayouts" style="position: fixed; top: 90px; right: 20px; padding: 10px; background: #409eff; color: white; border: none; border-radius: 5px; cursor: pointer;">
|
| | | 保存OPT
|
| | | </button>
|
| | | </template>
|
| | |
| | | import RectRenderer from './page/RectRenderer.vue';
|
| | | import request from "@/utils/request";
|
| | | import { useI18n } from "vue-i18n";
|
| | | import { ElMessage } from "element-plus";
|
| | | import {ElMessage, ElMessageBox} from "element-plus";
|
| | | import requestOptimize from "@/utils/requestOptimize";
|
| | | import useUserInfoStore from "@/stores/userInfo";
|
| | |
|
| | |
| | |
|
| | | const optimizeLayouts = ref(null);
|
| | |
|
| | | const fileSaveMode = ref(1);
|
| | |
|
| | | // const fileSaveMode = ref(1);
|
| | | const fileMode = ref();
|
| | | const haveMark = ref();
|
| | | const haveOptimaMark = ref();
|
| | | const haveQMark = ref();
|
| | | const glassIdMode = ref();
|
| | | const optimaMarkPosition = ref();
|
| | | const optimaMarkName = ref();
|
| | | const optimaMarkWidth = ref();
|
| | | const optimaMarkHeight = ref();
|
| | |
|
| | | const userStore = useUserInfoStore()
|
| | | const username = userStore.user.userName;
|
| | |
| | | }
|
| | | const parsedData = JSON.parse(response.data);
|
| | | console.log('设置内容:', parsedData);
|
| | | if (parsedData.server && parsedData.server.fileMode) {
|
| | | fileMode.value = parsedData.server.fileMode;
|
| | | }
|
| | | fileMode.value = parsedData.server.fileMode;
|
| | | haveMark.value = parsedData.server.haveMark;
|
| | | haveOptimaMark.value = parsedData.server.haveOptimaMark;
|
| | | haveQMark.value = parsedData.server.haveQMark;
|
| | | glassIdMode.value = parsedData.server.glassIdMode;
|
| | | optimaMarkPosition.value = parsedData.server.optimaMarkPosition;
|
| | | optimaMarkName.value = parsedData.server.optimaMarkName;
|
| | | optimaMarkWidth.value = parsedData.server.optimaMarkWidth;
|
| | | optimaMarkHeight.value = parsedData.server.optimaMarkHeight;
|
| | | } else {
|
| | | console.error('请求失败,状态码:', response.code);
|
| | | }
|
| | |
| | | };
|
| | |
|
| | | onMounted(() => {
|
| | | // 读取库存数据
|
| | | // 读取库存数据和参数设置
|
| | | loadInventoryData();
|
| | | selectLayout();
|
| | | selectOptimizeInfo();
|
| | |
| | | console.log("提交数据:", optimizeLayouts);
|
| | | const response = await requestOptimize.post('api/cutFiles', {
|
| | | fileName: processId,
|
| | | glassThickness:inventoryData.value[0].thickness,
|
| | | glassType:inventoryData.value[0].model,
|
| | | projectNo: processId,
|
| | | glassThickness: inventoryData.value[0].thickness,
|
| | | glassType: inventoryData.value[0].model,
|
| | | quantity: inventoryData.value[0].processingQuantity,
|
| | | fileType:"OPT",
|
| | | fileSaveMode:fileMode.value,
|
| | | glassIdMode:1,
|
| | | fileType: "OPT",
|
| | | fileSaveMode: fileMode.value,
|
| | | glassIdMode: glassIdMode.value,
|
| | | haveMark: haveMark.value,
|
| | | haveOptimaMark: haveOptimaMark.value,
|
| | | haveQMark: haveQMark.value,
|
| | | optimaMarkPosition: optimaMarkPosition.value,
|
| | | optimaMarkName: optimaMarkName.value,
|
| | | optimaMarkWidth: optimaMarkWidth.value,
|
| | | optimaMarkHeight: optimaMarkHeight.value,
|
| | | layouts: optimizeLayouts.value.layouts
|
| | | }, {
|
| | | headers: {
|
| | | 'Content-Type': 'application/json'
|
| | | },
|
| | | responseType: 'blob'
|
| | | }
|
| | | });
|
| | |
|
| | | // 处理下载
|
| | | const downloadUrl = window.URL.createObjectURL(response);
|
| | | const a = document.createElement('a');
|
| | | a.href = downloadUrl;
|
| | | a.download = 'output.opt';
|
| | | document.body.appendChild(a);
|
| | | a.click();
|
| | | document.body.removeChild(a);
|
| | | window.URL.revokeObjectURL(downloadUrl);
|
| | | ElMessage.success('OPT文件保存成功');
|
| | | // 使用 MessageBox 显示文件保存位置信息
|
| | | if (response.data && response.data.length > 0) {
|
| | | const filePath = response.data[0];
|
| | | ElMessageBox.alert(`OPT文件保存成功,位置:${filePath}`, '保存成功', {
|
| | | confirmButtonText: '确定',
|
| | | type: 'success',
|
| | | dangerouslyUseHTMLString: true
|
| | | });
|
| | | } else {
|
| | | ElMessageBox.alert('OPT文件保存成功', '保存成功', {
|
| | | confirmButtonText: '确定',
|
| | | type: 'success'
|
| | | });
|
| | | }
|
| | | } catch (error) {
|
| | | console.error('保存失败:', error);
|
| | | ElMessage.error('保存失败,请稍后再试');
|
| | | }
|
| | | };
|
| | |
|
| | | </script>
|
| | | |