| | |
| | | |
| | | onMounted(() => { |
| | | if (props.project) { |
| | | console.log(props.project) |
| | | handleFetchData(props.project.projectNumber); |
| | | //handleTableData(data); |
| | | //handleDataReceive(data); |
| | |
| | | |
| | | const handleSimulation = async () => { |
| | | const data=computeCardRef.value.selectFullData(); |
| | | console.log(data) |
| | | if(props.project!=null){ |
| | | computed.value.glass_thickness=props.project.glass_thickness |
| | | computed.value.glass_type=props.project.glass_type |
| | | } |
| | | data.forEach(item=>{ |
| | | const processCard = { |
| | | process_no: item.processId, |
| | | layers: item.technologyNumber, |
| | | total_layers: item.total_layers, |
| | | total_num: item.total_num, |
| | | total_area: item.total_area, |
| | | is_must: true, |
| | | allow_rotate: item.allow_rotate, |
| | | priority_level: 0, |
| | | tempering: item.tempering, |
| | | curtain_wall: item.curtain_wall, |
| | | patch_state: item.patch_state, |
| | | merge: item.merge, |
| | | glass_details: [] |
| | | }; |
| | | request.post(`/glassOptimize/selectComputeDetail/${item.processId}/${item.technologyNumber}/${item.patch_state}`).then((res) => { |
| | | if(Number(res.code) === 200){ |
| | | processCard.glass_details=res.data.data |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | computed.value.process_cards.push(processCard) |
| | | }) |
| | | console.log(computed.value) |
| | | /*try { |
| | | const responses = await Promise.all(requests); |
| | | |
| | | // 整合数据 |
| | | const processData = responses.reduce((acc, res, index) => { |
| | | |
| | | // 检查res.data是否为对象,并且包含'data'字段 |
| | | if (typeof res.data === 'object' && res.data !== null && 'data' in res.data) { |
| | | |
| | | // 检查data是否为数组 |
| | | if (!Array.isArray(data)) { |
| | | console.error(`响应数据中的'data'字段不是数组,process_id:`); |
| | | return acc; |
| | | } |
| | | |
| | | // 初始化process_card对象 |
| | | const processCard = { |
| | | process_no: data.processId, |
| | | layers: data.technologyNumber, |
| | | total_layers: data.total_layers, |
| | | total_num: data.total_num, |
| | | total_area: data.total_area, |
| | | is_must: true, |
| | | allow_rotate: data.allow_rotate, |
| | | priority_level: 0, |
| | | tempering: data.tempering, |
| | | curtain_wall: data.curtain_wall, |
| | | patch_state: data.patch_state, |
| | | merge: data.merge, |
| | | glass_details: [] |
| | | }; |
| | | |
| | | |
| | | // 整合glass_details |
| | | data.forEach(detail => { |
| | | const matchedNewData = data.find( |
| | | item => item.technology_number === detail.technology_number |
| | | ); |
| | | |
| | | processCard.glass_details.push({ |
| | | process_id: data.processId, |
| | | technology_number: detail.technology_number, |
| | | order_number: detail.order_number, |
| | | layers_number: detail.layers_number, |
| | | max_width: detail.width, |
| | | max_height: detail.height, |
| | | child_width: detail.child_width, |
| | | child_height: detail.child_height, |
| | | quantity: matchedNewData ? matchedNewData.quantity : 0, |
| | | patch_state: 0 |
| | | }); |
| | | }); |
| | | |
| | | // 将processCard添加到acc中 |
| | | if (!acc.process_cards) { |
| | | acc.process_cards = []; |
| | | } |
| | | acc.process_cards.push(processCard); |
| | | // 设置其他字段的值 |
| | | |
| | | } else { |
| | | console.error(`响应数据格式不正确,process_id: ${processId}`); |
| | | } |
| | | return acc; |
| | | }, {}); |
| | | if (data.length > 0) { |
| | | // 假设所有条目的thickness和glassType相同 |
| | | processData.glass_thickness = data[0].thickness; |
| | | processData.glass_type = data[0].glassType; |
| | | } else { |
| | | processData.glass_thickness = ""; |
| | | processData.glass_type = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | // 发送整合后的数据到父组件 |
| | | emit('sendData', processData); |
| | | } catch (error) { |
| | | console.error('请求失败:', error); |
| | | }*/ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '正在计算中,请稍候...', |