廖井涛
2025-03-25 768e16999a8ce4bb500490ee76c659aa61ea1783
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
  <div>
    <RectRenderer 
      :layoutData="layoutData" 
      :gw="1150" 
      :gh="850" 
      style="width: 1000px; height: 800px; position: relative;"
    />
  </div>
</template>
 
<script setup>
import { ref,onMounted } from 'vue';
import RectRenderer from './page/OptimizationRect.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 processId = "P25030309";
const savedProjectNo = localStorage.getItem('projectNo');
const processId = savedProjectNo;
console.log(processId)
const layoutData = ref(null);
 
const selectLayout = () => {
request.post(`/glassOptimize/selectOptimizeResult/${processId}`)
.then((res) => {
  if (res.code == 200) {
    try {
      // 将字符串数据转换为对象
      // console.log("原始数据:", res.data.data[0].Layouts);
 
      const parsedData = JSON.parse(res.data.data[0].Layouts);
      layoutData.value = parsedData;
      // console.log("解析后的数据:", layoutData.value);
      // console.log("数据类型:", typeof parsedData);
      ElMessage.success("打开版图成功")
    } catch (error) {
      ElMessage.error("解析数据时出错:", error);
     
    }
  } else {
 
  }
})
.catch((error) => {
  console.error("请求失败:", error);
  ElMessage.error(t('basicData.msg.requestFailed'));
});
}
 
onMounted(() => {
  selectLayout();
 
});
</script>