廖井涛
6 小时以前 f7a2fcdda7f1120498c5c5f75c5a99955fc54b43
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue
@@ -41,7 +41,7 @@
onMounted(() => {
  if (props.project) {
    console.log(props.project)
    console.log('ceshiyixia',props.project)
    handleFetchData(props.project.projectNumber);
    //handleTableData(data);
    //handleDataReceive(data);
@@ -58,7 +58,7 @@
// 用于存储从后端获取到的数据,初始化为空数组
const receivedData = ref([]);
const emit = defineEmits(['update:project']);
const fetchProjectInfo = async (projectNumber) => {
  try {
    const res = await request.post(`/glassOptimize/getProjectByProjectNo/${projectNumber}`);
@@ -67,10 +67,21 @@
    if (Number(res.code) === 200 && res.data && res.data.data && res.data.data.length > 0) {
      // 正确访问嵌套的数据结构
      const projectData = res.data.data[0]; // 注意这里是 res.data.data[0]
      const updatedProject = {
        ...props.project,
        glass_thickness: projectData.glass_thickness || '',
        glass_type: projectData.glass_type || ''
      };
      console.log('获取到的glass_thickness:', projectData.glass_thickness);
      console.log('获取到的glass_type:', projectData.glass_type);
      // // 通过 emit 更新 project
      emit('update:project', updatedProject);
      // 更新 computed.value
      computed.value = {
        ...computed.value,
        glass_thickness: projectData.glass_thickness,
        glass_type: projectData.glass_type
      };
      // 确保computed.value已初始化
      if (!computed.value) {
        computed.value = {};
@@ -89,7 +100,7 @@
  }
};
console.log(receivedData)
const handleFetchData = async (projectNumber) => {
  try {
    const res = await request.post(`/glassOptimize/selectProjectCompute/${projectNumber}`);
@@ -314,7 +325,11 @@
  <div style="width: 100%; height: 100%;">
   
    <div id="compute">
      <compute  :data="computedData" :state="state"  @fetch-data="handleFetchData" :project="props.project"  @sendData="handleData"  @simulate-click="handleSimulation" />
      <compute  :data="computedData" :state="state"
                @fetch-data="handleFetchData"
                :project="props.project"
                @sendData="handleData"
                @simulate-click="handleSimulation" />
    </div>
    <div id="computeCard">