From 3ab330b8aefb3cd781c9b8730b4ab7ac65e7e9d7 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 07 三月 2025 09:14:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue |  175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 169 insertions(+), 6 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue
index 72cd1b7..7476340 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue
@@ -3,21 +3,61 @@
 import ComputeDetail from "@/views/pp/glassOptimize/page/ComputeDetail.vue";
 import Compute from "@/views/pp/glassOptimize/page/Compute.vue";
 import {onMounted, ref} from 'vue';
-import {ElMessage} from "element-plus";
+import {ElMessage, ElLoading} from "element-plus";
 import request from "@/utils/request";
 
 const props = defineProps({
   projectNo : String
 });
 
+const computed = ref(null);
+const computedCard = ref(null);
+const computedData = ref({
+  // 瑕佷紶閫掔粰瀛愮粍浠剁殑鏁版嵁
+});
+
+// 鐩戝惉瀛愮粍浠禖omputeCard鐨勬暟鎹�
+
+
+
+
+
+const handleCardData = (data) => {
+
+  computedCard.value = data;
+  // 灏� computed.value 鍚堝苟鍒� computedCard.value 鐨勬渶澶栧眰
+  computedCard.value = {
+    ...computed.value,
+    ...computedCard.value
+  };
+};
+
+// 鐩戝惉瀛愮粍浠禖omputeDetail鐨勬暟鎹�
+const handleData = (data) => {
+  computed.value = data;
+};
+
 onMounted(() => {
   if (props.projectNo) {
     handleFetchData(props.projectNo);
+    handleTableData(data);
+    handleDataReceive(data);
   }
 });
 
+// 鍦ㄧ埗缁勪欢涓畾涔夊鐞嗘帴鏀舵暟鎹殑鍑芥暟
+const handleDataReceive= async (data) => {
+  console.log('鎺ユ敹鍒板瓙缁勪欢鐨勬暟鎹�2:', data);
+  // 澶勭悊鏁版嵁锛屼緥濡傛洿鏂扮埗缁勪欢鐨勭姸鎬佹垨璋冪敤鍚庣API
+ 
+}
+
+
 // 鐢ㄤ簬瀛樺偍浠庡悗绔幏鍙栧埌鐨勬暟鎹紝鍒濆鍖栦负绌烘暟缁�
 const receivedData = ref([]);
+
+
+console.log(receivedData)
 const handleFetchData = async (projectNumber) => {
   try {
     const res = await request.post(`/glassOptimize/selectProjectCompute/${projectNumber}`);
@@ -39,6 +79,129 @@
   }
 };
 
+const  handleTableData= async (data) => {
+  // 澶勭悊鎺ユ敹鍒扮殑琛ㄦ牸鏁版嵁
+  console.log('鐖剁粍浠舵帴鏀跺埌鐨勬暟鎹�1:', data);
+}
+
+const handleSimulation = async () => {
+  const loading = ElLoading.service({
+      lock: true,
+      text: '姝e湪璁$畻涓紝璇风◢鍊�...',
+      background: 'rgba(0, 0, 0, 0.7)'
+    });
+   console.log('鍙戦�佸埌鍚庣鐨勬暟鎹�',computedCard.value)
+  const mockData = {
+      code: 200,
+      data: [
+        {
+          "glass_details": [
+            {
+              "angle": 0.0,
+              "glass_type": 3,
+              "height": 862,
+              "layers_number": 2,
+              "order_number": 33,
+              "process_id": "NG24120028A005",
+              "technology_number": 2,
+              "tempering_feed_sequence": 14,
+              "tempering_layout_id": 15,
+              "width": 814,
+              "x_coordinate": 1582.0,
+              "y_coordinate": 3768.0
+            },
+            {
+              "angle": 0.1,
+              "glass_type": 4,
+              "height": 862,
+              "layers_number": 2,
+              "order_number": 33,
+              "process_id": "NG24120028A005",
+              "technology_number": 2,
+              "tempering_feed_sequence": 14,
+              "tempering_layout_id": 15,
+              "width": 814,
+              "x_coordinate": 1582.0,
+              "y_coordinate": 3768.0
+            }
+          ],
+          "guidance": 15,
+          "rackinfos": [
+            "NG24120026A003-2",
+            "NG24120027A003-2",
+            "NG24120028A005-2"
+          ],
+          "ratioResult": [
+            {
+              "area": 10.53,
+              "glass_total": 15,
+              "ratio": 0.74,
+              "tempering_layout_id": "13"
+            },
+            {
+              "area": 10.53,
+              "glass_total": 15,
+              "ratio": 0.74,
+              "tempering_layout_id": "14"
+            },
+            {
+              "area": 9.82,
+              "glass_total": 14,
+              "ratio": 0.69,
+              "tempering_layout_id": "15"
+            }
+          ],
+          "resultSum": [15.0, 0.74]
+        }
+      ]
+    };
+    if (mockData.code === 200) {
+    loading.close();
+    ElMessage.success('妯℃嫙璁$畻鎴愬姛!');
+    }
+    // 鏇存柊computedData
+    computedData.value = mockData;
+  // try {
+  //   if (!computed.value ) {
+  //     ElMessage.warning('璇峰厛鍔犺浇鏁版嵁鍐嶈繘琛屾ā鎷熻绠�');
+  //     return;
+  //   }
+
+  //   // 鏄剧ず鍔犺浇鎻愮ず
+  //   const loading = ElLoading.service({
+  //     lock: true,
+  //     text: '姝e湪璁$畻涓紝璇风◢鍊�...',
+  //     background: 'rgba(0, 0, 0, 0.7)'
+  //   });
+
+  //   try {
+  //     // 灏嗘暟鎹彁浜ゅ埌鍚庣
+  //     const response = await request.post('/glassOptimize/simulationCalculate', {
+        
+  //       data: computedCard.value
+
+  //     });
+
+  //     if (response.code === 200) {
+  //       ElMessage.success('妯℃嫙璁$畻鎴愬姛!');
+  //     } else {
+  //       ElMessage.error(response.msg || '妯℃嫙璁$畻澶辫触');
+  //     }
+  //   } catch (error) {
+  //     console.error('璇锋眰澶辫触:', error);
+  //     ElMessage.error('缃戠粶寮傚父锛岃绋嶅悗鍐嶈瘯');
+  //   } finally {
+  //     // 鍏抽棴鍔犺浇鎻愮ず
+  //     loading.close();
+  //   }
+  // } catch (error) {
+  //   console.error('璇锋眰澶辫触:', error);
+  //   ElMessage.error('缃戠粶寮傚父锛岃绋嶅悗鍐嶈瘯');
+  // }
+};
+
+
+
 //鎺ュ彈瀛愮粍浠禖omputeCard鐨勬祦绋嬪崱鍙�
 let projectRow = ref({
   processId:null,
@@ -52,22 +215,22 @@
 
 <template>
   <div style="width: 100%; height: 100%;">
-
+   
     <div id="compute">
-      <compute @fetch-data="handleFetchData" :project-no="props.projectNo"/>
+      <compute  :data="computedData" @fetch-data="handleFetchData" :project-no="props.projectNo"  @sendData="handleData"  @simulate-click="handleSimulation" />
     </div>
 
     <div id="computeCard">
       <compute-card :table-data="receivedData"
                     :process-id="projectRow.processId===null?null:projectRow.processId"
-                    @upProcessId="handleUpdateProcessId"
+                    @upProcessId="handleUpdateProcessId" @sendData="handleCardData"
       />
     </div>
 
     <div id="computeDetail">
-      <compute-detail :process-id="projectRow.processId===null?null:projectRow.processId" />
+      <compute-detail :process-id="projectRow.processId===null?null:projectRow.processId"   />
     </div>
-
+   
   </div>
 </template>
 

--
Gitblit v1.8.0