Bladeren bron

327uid修改,连线bug解决

tangjunhao 5 maanden geleden
bovenliggende
commit
0ef6f48a2b

+ 2 - 2
src/views/echart/echartLine.vue

@@ -161,7 +161,7 @@ const getshuju = (dataheader, data) => {
   vars.value = dataheader;  // dataheader 是包含 label 和 prop 的数组
   vals.value = data; 
 
-  // 生成 x 轴数据(这里假设 x 轴是从 0 开始递增的索引)
+  // 生成 x 轴数据
   for (let i = 0; i < vals.value.length; i++) {
     xdata.value.push(i);  // x 轴数据为行索引
   }
@@ -284,7 +284,7 @@ const selectshuju = (listcbval,listcbval2,dataheader, data) => {
       data: yColumns,  // 图例数据使用 Y 轴的列名
     },
     xAxis: {
-      type: "value",  // 设置为 "category" 表示 x 轴为分类数据
+      type: "value",  
       data: xdata.value, // x 轴数据为 X 轴数据
       scale: true,
     },

+ 69 - 0
src/views/echart/tablelist.vue

@@ -0,0 +1,69 @@
+<template>
+  <div class="classtable" style="width:100%; height: 100%;">
+    <el-table :data="tabledataliebiao"
+    border
+    style=" overflow: auto; height: 100%;"
+    
+    :key="tableKey"
+    >
+    <el-table-column type="index" label="编号" width="100"></el-table-column>
+      <el-table-column v-for="(header, index) in tableHeaders" :key="index" :prop="header.prop" show-overflow-tooltip
+        :label="header.label" >
+      </el-table-column>
+    </el-table>
+
+  </div>
+</template>
+
+<script setup>
+import { ref, onMounted, reactive } from "vue"
+import { request, uploadFile } from "@/utils/request"
+import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus"
+
+const props = defineProps({
+  tabledataliebiao: {
+    type: Array,
+    default: []
+  },
+  tableHeaders: {
+    type: Array,
+    default: []
+  },
+  tablelistshow: {
+    type: Boolean,
+    default: false
+  }
+})
+
+// 引用 ElTable 组件
+const tableKey = ref(0);
+
+watch(
+  () => props.tablelistshow,
+  (newValue) => {
+    if (newValue) {
+      nextTick(() => {
+        tableKey.value++;
+        console.log("tableKey:", tableKey.value);
+      })
+    }
+  },
+  { immediate: true }
+)
+
+const lbjkheaderCellClassName = ({ columnIndex }) => {
+  if( columnIndex === 0 ) return '';
+  let dynamicColumnIndex = columnIndex - 1;
+  let totalColumns = tableHeaders.value.length;
+  let partsize = Math.ceil( totalColumns/3 );
+
+  if( dynamicColumnIndex < partsize ) {
+    return 'header-first';
+  }else if( dynamicColumnIndex < partsize*2 ) {
+    return 'header-second';
+  }else {
+    return 'header-third';
+  }
+}
+
+</script>

+ 55 - 27
src/views/home.vue

@@ -820,7 +820,7 @@
               <div class="dialog-footer">
                 
                 <el-button @click="dialog.echartLinedialog = false">取消</el-button>
-                <el-button type="primary" @click="selectshujuto2();dialog.echartLinedialog = false">
+                <el-button type="primary" @click="selectshujuto();dialog.echartLinedialog = false">
                   确定
                 </el-button>
               </div>
@@ -1361,6 +1361,8 @@
                   </div>
                   <!-- 可视化开始 -->
                   <div class="conter_mian classtable echartcont" v-show="echartzongshow">
+                    <tablelist ref="tablelistref" v-show="tablelistshow" :tablelistshow="tablelistshow" 
+                        :tabledataliebiao="datatotabledata" :tableHeaders="datatotableheader"/>
                     <echartarea ref="arearef" v-show="areashow" :areashow="areashow"/>
                     <bargraph ref="bargraphref" v-show="bargraphshow" :bargraphshow="bargraphshow"/>
                     <echartLine ref="echartLineref" v-show="echartLineshow" :echartLineshow="echartLineshow"/>
@@ -1633,6 +1635,7 @@ import sixchine from './demo/chine.vue'
 import vuefindex from './vuetree/index.vue'
 import Sidebar from './vuetree/Sidebar.vue'
 // 可视化echart
+import tablelist from './echart/tablelist.vue'
 import echartarea from './echart/area.vue'
 import bargraph from './echart/bargraph.vue'
 import echartLine from './echart/echartLine.vue'
@@ -1712,6 +1715,7 @@ let flowshow = ref(true);
 let jiankong = ref(false);
 let echartshow = ref(false);
 let echartshow2 = ref(false);
+let tablelistshow = ref(false);
 let areashow = ref(false);
 let echartLineshow = ref(false);
 let BarChartshow = ref(false);
@@ -1730,18 +1734,8 @@ let scatterref = ref();
 let echartzongshow = ref(false);
 const router = useRouter();
 const route = useRoute();
-let youhua = ref({
-  algorithm: 'GA',
-  popsize: 100,
-  epoch: 100,
-  probcrossover: 0.1,
-  probmut: 0.1,
-  proboperator: 'SBX交叉',
-  probscale: 1,
-  strategy: '最佳保留策略',
-  operator: '倒位变异',
-  gpu: 'YES'
-})
+
+let tablelistref = ref();
 let echartdata = ref(null);
 let optmonitor1 = ref();
 let processMonitor1ref = ref()
@@ -2269,7 +2263,7 @@ const handleClick = (tab, event) => {
   // 可视化标签页
   if (tabactive.value == 'Config') {
     echartzongshow.value = true;
-    // curveLine();
+    curveLine4();
   } else {
     echartzongshow.value = false;
   }
@@ -2717,13 +2711,20 @@ const dialogbolen = () => {
     case "折线图":
       dialog.value.echartLinedialog = true;
       echatsfunc();
-      curveLine4();
+      // curveLine4();
+      nextTick(() => {
+        initListSe();
+      });
+      
       break;
     case "散点图":
       // logsget();
       dialog.value.scatterdialog = true;
       echatsfunc();
-      curveLine4();
+      // curveLine4();
+      nextTick(() => {
+        initListSe();
+      });
       break;
     case "横条图":
       echatsfunc();
@@ -2765,7 +2766,19 @@ const echatsfunc = () => {
   //echartzongshow.value=true;
   // echartclear();
   switch (tabactive.value) {
+    case "列表":
+      tablelistshow.value = true;
+      areashow.value = false;
+      bargraphshow.value = false;
+      echartLineshow.value = false;
+      BarChartshow.value = false;
+      radarshow.value = false;
+      scattershow.value = false;
+      pieshow = false;
+      paretoshow =false;
+      break;
     case "面积图":
+      tablelistshow.value = false;
       areashow.value = true;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2776,6 +2789,7 @@ const echatsfunc = () => {
       paretoshow =false;
       break;
     case "柱状图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = true;
       echartLineshow.value = false;
@@ -2786,6 +2800,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break;
     case "饼状图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2796,6 +2811,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break;
     case "折线图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = true;
@@ -2806,6 +2822,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break;
     case "散点图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2816,6 +2833,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break
     case "横条图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2826,6 +2844,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break
     case "雷达图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2836,6 +2855,7 @@ const echatsfunc = () => {
       paretoshow = false;
       break
     case "帕雷托图":
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -2846,6 +2866,7 @@ const echatsfunc = () => {
       paretoshow = true;
       break
     default:
+      tablelistshow.value = false;
       areashow.value = false;
       bargraphshow.value = false;
       echartLineshow.value = false;
@@ -3066,8 +3087,8 @@ const curveLine4 = () => {
       }
       console.log("表格数据:", datatotabledata.value);
       console.log("表头数据:", datatotableheader.value);
-      emitter.emit('update:datatotableheader', datatotableheader.value);
-      emitter.emit('update:datatotabledata', datatotabledata.value);
+      // emitter.emit('update:datatotableheader', datatotableheader.value);
+      // emitter.emit('update:datatotabledata', datatotabledata.value);
       // scatterref.value.getshuju(datatotableheader.value,datatotabledata.value);
       // echartLineref.value.getshuju(datatotableheader.value,datatotabledata.value);
     })
@@ -3075,6 +3096,12 @@ const curveLine4 = () => {
       ElMessage.error(err.returnMsg)
     })
 }
+
+const initListSe = () => {
+  emitter.emit('update:datatotableheader', datatotableheader.value);
+  emitter.emit('update:datatotabledata', datatotabledata.value);
+}
+
 let datatotableheader = ref([]);
 let datatotabledata = ref([]);
 // 解析数据到表格
@@ -3143,6 +3170,7 @@ const datatotable = (vars, vals) => {
 let listcbval = ref([]);
 let listcbval2 = ref([]);
 
+// 选择框值更新
 const handleUpdate = (name, value) => {
   if (name === 'listcbval') {
     listcbval.value = value;
@@ -3153,14 +3181,14 @@ const handleUpdate = (name, value) => {
   }
 };
 
+// 列表,散点,折线图选择数据==>曲线绘制
 const selectshujuto = () => {
-  console.log("选择数据");
-  scatterref.value.selectshuju(listcbval.value,listcbval2.value,datatotableheader.value,datatotabledata.value);
-}
-
-const selectshujuto2 = () => {
-  console.log("选择数据");
-  echartLineref.value.selectshuju(listcbval.value,listcbval2.value,datatotableheader.value,datatotabledata.value);
+  console.log("确认:",tabactive.value);
+  if(tabactive.value === '散点图'){
+    scatterref.value.selectshuju(listcbval.value,listcbval2.value,datatotableheader.value,datatotabledata.value);
+  }else if(tabactive.value === '折线图'){
+    echartLineref.value.selectshuju(listcbval.value,listcbval2.value,datatotableheader.value,datatotabledata.value);
+  }
 }
 
 
@@ -3782,7 +3810,7 @@ const scdelete = (index, row) => {
       })
   }
 }
-// 表格
+// 用于实时更新表格数据
 function tablefun(vars, vals) {
     console.log('表格更新');
     
@@ -3801,7 +3829,7 @@ function tablefun(vars, vals) {
     // 更新表格数据
     tableDatalieb.value.push(rowData);
   }
-
+// 用于更新表格数据
 const tablefun1 = (vars, vals) => {
   console.log('表格更新');
   

+ 4 - 4
src/views/titlecomponent/ADflow.vue

@@ -195,7 +195,7 @@
           </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="特征长度:" :label-width="formLabelWidth1">
+      <el-form-item label="特征长度(m):" :label-width="formLabelWidth1">
         <el-input
           v-model="adflowvalue.length"
           :step="100"
@@ -204,7 +204,7 @@
           controls-position="right"
         />
       </el-form-item>
-      <el-form-item label="参考温度:" :label-width="formLabelWidth1">
+      <el-form-item label="参考温度(K):" :label-width="formLabelWidth1">
         <el-input
           v-model="adflowvalue.temperature"
           :step="1"
@@ -213,7 +213,7 @@
           controls-position="right"
         />
       </el-form-item>
-      <el-form-item label="参考面积:" :label-width="formLabelWidth1">
+      <el-form-item label="参考面积(m²):" :label-width="formLabelWidth1">
         <el-input
           v-model="adflowvalue.area"
           :step="100"
@@ -222,7 +222,7 @@
           controls-position="right"
         />
       </el-form-item>
-      <el-form-item label="力矩中心:" :label-width="formLabelWidth1">
+      <el-form-item label="力矩中心(m):" :label-width="formLabelWidth1">
         <div style="display: flex">
           <el-input
             style="margin-right: 10px"

+ 2 - 2
src/views/titlecomponent/Xfoil.vue

@@ -88,12 +88,12 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="计算完成:" :label-width="formLabelWidth1">
+        <!-- <el-form-item label="计算完成:" :label-width="formLabelWidth1">
           <el-radio-group v-model="analyzed">
             <el-radio label="1" value="1">是</el-radio>
             <el-radio label="0" value="0">否</el-radio>
           </el-radio-group>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="迭代次数:" :label-width="formLabelWidth1">
           <el-input
             v-model="xfoilvalue.iter"

+ 3 - 3
src/views/vuetree/eltree.vue

@@ -23,10 +23,10 @@ onMounted(() => {
     <img v-if="props.node.data.label!='模块化'" :src="props.node.data.image"/>
     <span>{{props.node.data.label }}</span>
   </div>
-  <Handle  v-if="props.node.data.label!='模块化'"  type="source" :position="Position.Right"  />
+  <Handle  v-if="props.node.data.label!='模块化'"  type="source" id="target-a" :position="Position.Right"  />
   <Handle id="target-c" type="source" :position="Position.Top"  /> 
-  <Handle  v-if="props.node.data.label!='模块化'"  id="target-b" type="target"  :position="Position.Left" /> 
-  <Handle id="target-d" type="target" :position="Position.Bottom"  /> 
+  <Handle  v-if="props.node.data.label!='模块化'"  id="target-b" type="source"  :position="Position.Left" /> 
+  <Handle id="target-d" type="source" :position="Position.Bottom"  /> 
   </div>
 <!-- </div> -->
 </template>

+ 4 - 4
src/views/vuetree/index.vue

@@ -478,9 +478,9 @@ function onNodeDoubleClick(e) {
   noid.value = e.node;
   const nowid = e.node.data.wid;
   console.log( e.node.data.name);
-  if (e.node.data.name == '优化器') {
+  if (e.node.data.name == 'optimizer') {
     emit('optimizerfalse',{name:'优化器',wid:nowid});
-  }else if(e.node.data.name=="进化优化器"){
+  }else if(e.node.data.name=="optimizer1"){
     emit('optimizerfalse',{name:'进化优化器',wid:nowid});
 
   }else if(e.node.data.name=="optimizer3"){
@@ -488,7 +488,7 @@ function onNodeDoubleClick(e) {
 
   }else if(e.node.data.name=="Xfoil"){
     emit('optimizerfalse',{name:'Xfoil',wid:nowid});
-  }else if(e.node.data.name=="梯度优化器"){
+  }else if(e.node.data.name=="optimizer2"){
     emit('optimizerfalse',{name:'梯度优化器',wid:nowid});
   }else if(e.node.data.name=="CST"){
     emit('optimizerfalse',{name:'CST',wid:nowid});
@@ -650,7 +650,7 @@ function onEdgeDoubleClick(e) {
   console.log('zhongdian:',e.edge.targetNode.data.name);
   let qidian = e.edge.sourceNode.data.name;
   let zhongdian = e.edge.targetNode.data.name;
-  let youhualist = ['优化器','optimizer3','进化优化器','梯度优化器'];
+  let youhualist = ['optimizer','optimizer3','optimizer1','optimizer2'];
   if( youhualist.includes(qidian) && zhongdian ==='FFD' ){
     datacontent.value = '1';
     dataflowshow.value = true;

+ 4 - 4
src/views/vuetree/useDnD.js

@@ -51,7 +51,7 @@ function imagefun(){
   //     return datas = {label:'优化器', image:gc3}
     // }else
      if(nid=='2-1'){
-      return datas = {label:'优化问题', image:wen,name:'优化问题'}
+      return datas = {label:'优化问题', image:wen,name:'Project'}
     }else if(nid=='3-1'){
       return datas = {label:'CATIA', image:xuek1,name:'CATIA'}
     }else if(nid=='3-0'){
@@ -86,13 +86,13 @@ function imagefun(){
     }else if(nid=='3-9'){
       return datas = {label:'Xfoil', image:xuek9,name:'Xfoil'}
     }else if(nid=='4-1'){
-      return datas = {label:'进化优化器', image:xuek10,name:'进化优化器'}
+      return datas = {label:'进化优化器', image:xuek10,name:'optimizer1'}
     }else if(nid=='4-2'){
       return datas = {label:'代理优化器', image:xuek11,name:'optimizer3'}
     }else if(nid=='4-3'){
-      return datas = {label:'梯度优化器', image:xuek12,name:'梯度优化器'}
+      return datas = {label:'梯度优化器', image:xuek12,name:'optimizer2'}
     }else if(nid=='3-01'){
-      return datas = {label:'优化器', image:r2,name:'优化器'}
+      return datas = {label:'优化器', image:r2,name:'optimizer'}
     }else if(nid=='3-02'){
       return datas = {label:'参数化', image:csh,name:'参数化'}
     }else if(nid=='3-03'){