| | |
| | | <template> |
| | | <div > |
| | | <RectRenderer |
| | | :layoutData="layoutData" |
| | | :gw="1400" |
| | | :gh="1100" |
| | | style="width: 1500px; height: 800px; position: relative;" |
| | | v-if="dataLoaded" |
| | | /> |
| | | |
| | | |
| | | </div> |
| | | <button @click="submitLayouts" style="position: fixed; bottom: 20px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;"> |
| | | 保存OPT |
| | | </button> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref,onMounted } from 'vue'; |
| | | import RectRenderer from './page/RectRenderer.vue'; |
| | | import mockLayoutData from '../../../components/pp/MockData'; |
| | | import request from "@/utils/request"; |
| | | <div> |
| | | <RectRenderer :layoutData="layoutData" :gw="1400" :gh="1100" |
| | | style="width: 1500px; height: 800px; position: relative;" v-if="dataLoaded" /> |
| | | |
| | | |
| | | </div> |
| | | <button @click="submitLayouts" |
| | | style="position: fixed; bottom: 20px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;"> |
| | | 保存OPT |
| | | </button> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted } from 'vue'; |
| | | import RectRenderer from './page/RectRenderer.vue'; |
| | | import mockLayoutData from '../../../components/pp/MockData'; |
| | | import request from "@/utils/request"; |
| | | import { useI18n } from "vue-i18n"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | const { t } = useI18n(); |
| | | // const layoutData = ref(mockLayoutData); |
| | | // const layoutData = ref(mockLayoutData); |
| | | |
| | | const savedProjectNo = localStorage.getItem('projectNo'); |
| | | const savedProjectNo = localStorage.getItem('projectNo'); |
| | | const processId = savedProjectNo; |
| | | const layoutData = ref(null); |
| | | const dataLoaded = ref(false); |
| | | |
| | | |
| | | const selectLayout = () => { |
| | | request.post(`/glassOptimize/selectOptimizeResult/${processId}`) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | try { |
| | | const parsedData = JSON.parse(res.data.data[0].Layouts); |
| | | layoutData.value = parsedData; |
| | | dataLoaded.value = true; |
| | | } catch (error) { |
| | | |
| | | |
| | | } |
| | | } else { |
| | | request.post(`/glassOptimize/selectOptimizeResult/${processId}`) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | try { |
| | | const parsedData = JSON.parse(res.data.data[0].Layouts); |
| | | layoutData.value = parsedData; |
| | | dataLoaded.value = true; |
| | | } catch (error) { |
| | | |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("请求失败:", error); |
| | | ElMessage.error(t('basicData.msg.requestFailed')); |
| | | }); |
| | | |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | console.error("请求失败:", error); |
| | | ElMessage.error(t('basicData.msg.requestFailed')); |
| | | }); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | selectLayout(); |
| | | |
| | | }); |
| | | |
| | | const submitLayouts = async () => { |
| | | |
| | | const submitLayouts = async () => { |
| | | try { |
| | | const response = await request.post('/glassOptimize/generateOpt', { |
| | | Layouts: layoutData.value.Layouts |
| | | Layouts: layoutData.value.Layouts |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | </script> |