Selaa lähdekoodia

422数据流类型分类

tangjunhao 4 kuukautta sitten
vanhempi
säilyke
1efde6c359

+ 1 - 1
src/views/echart/tablelist.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="classtable" style="width:100%; height: 100%; overflow: auto;">
-    <div v-show="tableshow">
+    <div v-show="tableshow" style="height: 100%;">
     <el-table :data="tabledataliebiao"
     border
     style=" overflow: auto; height: 100%;"

+ 1 - 1
src/views/home.vue

@@ -2687,7 +2687,7 @@ const handleEditorChange = (value) => {
 let MathFuncxinjian = ref('ture')
 const MathFunctabchange = (val) => {
   // console.log('MathFunctabchange:',val);
-  if(val == '1'){
+  if(val == '1' || val == '0'){
     MathFuncxinjian.value = false;
   }else{
     MathFuncxinjian.value = true;

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

@@ -16,9 +16,9 @@
       <el-table :data="inParams" border style="width: 100%; " :header-cell-class-name="headerCellClassName">
           <el-table-column type="index" width="70" label="编号"/>
           <el-table-column prop="name" label="参数名称">
-            <!-- <template #default="{ row }">
+            <template #default="{ row }">
               <el-input v-model="row.name" />
-            </template> -->
+            </template>
           </el-table-column>
           <el-table-column prop="value" label="参数值">
             <template #default="{ row }">
@@ -46,9 +46,9 @@
         <el-table :data="outParams" border style="width: 100%; height: 280px" :header-cell-class-name="headerCellClassName">
           <el-table-column type="index" width="70" label="编号" />
           <el-table-column prop="name" label="参数名称">
-            <!-- <template #default="{ row }">
+            <template #default="{ row }">
               <el-input v-model="row.name" @change="handleEdit(row)" />
-            </template> -->
+            </template>
           </el-table-column>
           <el-table-column prop="value" label="参数值">
             <template #default="{ row }">

+ 3 - 1
src/views/titlecomponent/csts.vue

@@ -99,6 +99,7 @@
 import { ref, onMounted, reactive, provide, nextTick } from "vue"
 import { RouterView, RouterLink, useRouter, useRoute } from "vue-router"
 import myheader from "@/components/header.vue"
+import emitter from "@/utils/emitter"
 import { request, uploadFile } from "@/utils/request"
 import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus"
 import { Edit, CaretBottom } from "@element-plus/icons-vue"
@@ -244,7 +245,7 @@ const getcst = (id,nowid) => {
       if (res.hasOwnProperty('cstid')) {
 
         getcstAssign(res);
-        
+        emitter.emit("cstidFromCst",cstid)
 
       } else {
         
@@ -318,6 +319,7 @@ const getcstsave = (id,nowid) => {
         message: '保存成功',
         type: 'success',
       })
+      getcst(pid.value,wid.value)
     })
     .catch((err) => {
       ElMessage.error('保存失败')

+ 4 - 1
src/views/titlecomponent/ffds.vue

@@ -109,6 +109,7 @@ import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus"
 import { Edit, CaretBottom } from "@element-plus/icons-vue"
 import cloudChart from "../threejsView/index.vue" // 云图
 import axios from 'axios';
+import emitter from "@/utils/emitter"
 let formLabelWidth1 = ref("200")
 let xyzData = ref()
 let percentage = ref(0);
@@ -468,7 +469,8 @@ const getffds = (id,nowid) => {
         // initializeTableFromVars();
         // 默认加载ffd文件
         fetchXyzData(res.fid);
-        getffdsAssign(res)
+        getffdsAssign(res);
+        emitter.emit("ffdidFromFfd",ffdid)
       }
     })
     .catch((err) => {
@@ -515,6 +517,7 @@ const getffdsave = (id,nowid) => {
         message: '保存成功',
         type: "success"
       })
+      getffds(pid.value, wid.value);
     })
     .catch((err) => {
       ElMessage.error('保存失败')

+ 207 - 31
src/views/vuetree/index.vue

@@ -96,7 +96,7 @@
         </div>
       </template>
       <div style="margin-top: 5px;padding: 10px 35px;">
-        <div v-if="datacontent === '1'">
+        <!-- <div v-if="datacontent === '1'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -120,8 +120,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '2'">
+        </div> -->
+        <!-- <div v-if="datacontent === '2'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -145,8 +145,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '3'">
+        </div> -->
+        <!-- <div v-if="datacontent === '3'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -182,8 +182,69 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '4'">
+        </div> -->
+        <linetablecard v-if="datacontent === '1'"
+          v-model:check-all="checkAll"
+          v-model:table-data="youhuaFFDtable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '2'"
+          v-model:check-all="checkAll"
+          v-model:table-data="youhuaCSTtable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '3'"
+          v-model:check-all="checkAll"
+          v-model:table-data="ADflowyouhuatable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '4'"
+          v-model:check-all="checkAll"
+          v-model:table-data="Xfoilyouhuatable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '5'"
+          v-model:check-all="checkAll"
+          v-model:table-data="ADflowMathfunctable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '6'"
+          v-model:check-all="checkAll"
+          v-model:table-data="TacsMathFunctable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '7'"
+          v-model:check-all="checkAll"
+          v-model:table-data="youhuaTACStable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          :is-youhua="false"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <linetablecard v-if="datacontent === '8'"
+          v-model:check-all="checkAll"
+          v-model:table-data="MathFuncyouhuatable"
+          :steamtype-options="steamtypeoptions"
+          :is-indeterminate="isIndeterminate"
+          @check-flag-change="handlecheckFlagchange"
+        />
+        <!-- <div v-if="datacontent === '4'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -219,8 +280,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '5'">
+        </div> -->
+        <!-- <div v-if="datacontent === '5'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -256,8 +317,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '6'">
+        </div> -->
+        <!-- <div v-if="datacontent === '6'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -293,8 +354,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '7'">
+        </div> -->
+        <!-- <div v-if="datacontent === '7'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -318,8 +379,8 @@
             </el-table>
           </div>
           </el-card>
-        </div>
-        <div v-if="datacontent === '8'">
+        </div> -->
+        <!-- <div v-if="datacontent === '8'">
           <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
           <el-checkbox v-model="checkAll" 
           :indeterminate="isIndeterminate"
@@ -355,7 +416,7 @@
             </el-table>
           </div>
           </el-card>
-        </div>
+        </div> -->
 
       </div>
       <template #footer>
@@ -404,6 +465,7 @@ import html2canvas from 'html2canvas';
 import Icon from './Icon.vue'
 import { formatTime } from '@/js/lindex.js';
 import emitter from "@/utils/emitter";
+import linetablecard from '@/views/vuetree/linetablecard.vue'
 // import func from 'vue-temp/vue-editor-bridge.js';
 
 const dark = ref(false)
@@ -805,6 +867,7 @@ let Xfoilyouhuatable = ref([
 
 let checkAll = ref(false);
 let isIndeterminate = ref(false);
+
 const dataTables = {
   '1': youhuaFFDtable,
   '2': youhuaCSTtable,
@@ -841,7 +904,20 @@ const confirmselection=()=>{
   console.log('seledge:',seledge.value);
   seledge.value.label=checkedData.join('\n');
   // 保存数据流
-  dataFlowsave();
+  if(datacontent.value === '1'){
+    dataFlowsave1(ffdid.value,'2');
+  }else if(datacontent.value === '2'){
+    dataFlowsave1(cstid.value,'0');
+  }else if(datacontent.value === '7'){
+    dataFlowsave1(tacsid.value,'5');
+  }else if(datacontent.value === '5'){
+    dataFlowsave2(adid.value,'3',mfcid.value,'4');
+  }else if(datacontent.value === '6'){
+    dataFlowsave2(tacsid.value,'5',mfcid.value,'4');
+  }else{
+    dataFlowsave();
+  }
+  
   
   dataflowshow.value = false;
 }
@@ -852,6 +928,8 @@ const xfid = ref('')
 const adid = ref('')
 const mfcid = ref('')
 const tacsid = ref('')
+const ffdid = ref('')
+const cstid = ref('')
 // 监听组件xfoil返回的xfid
 const handleXfid = (xfidFromB) => {
   xfid.value = xfidFromB.value;
@@ -872,6 +950,19 @@ const handleTacsid = (tacsidFromB) => {
   noid.value.data.tacsid = tacsid.value;
 };
 
+const handleFfdid = (ffdidFromB) => {
+  // console.log('ffdidFromB:',ffdidFromB.value);
+  ffdid.value = ffdidFromB.value;
+  noid.value.data.ffdid = ffdid.value;
+  // console.log('noid.value.data.ffdid:',noid.value.data.ffdid);
+};
+
+const handleCstid = (cstidFromB) => {
+  cstid.value = cstidFromB.value;
+  noid.value.data.cstid = cstid.value;
+};
+
+
 
 let datacontent = ref('')
 // 判定是哪种线段
@@ -891,10 +982,21 @@ function onEdgeDoubleClick(e) {
   let youhualist = ['optimizer','optimizer3','optimizer1','optimizer2'];
   if( youhualist.includes(qidian) && zhongdian ==='FFD' ){
     datacontent.value = '1';
-    dataflowshow.value = true;
+    ffdid.value = e.edge.targetNode.data.ffdid;
+    if(ffdid.value) {
+      dataflowshow.value = true;
+    }else{
+      ElMessage.error('FFD未初始化!')
+    }
   }else if( youhualist.includes(qidian) && zhongdian ==='CST') {
     datacontent.value = '2';
-    dataflowshow.value = true;
+    cstid.value = e.edge.targetNode.data.cstid;
+    if(cstid.value) {
+      dataflowshow.value = true;
+    }else{
+      ElMessage.error('CST未初始化!')
+    }
+    // dataflowshow.value = true;
   }else if( qidian === 'ADflow' && youhualist.includes(zhongdian) ) {
     datacontent.value = '3';
     // emitter.emit('requestGetadid',pid.value);
@@ -920,24 +1022,30 @@ function onEdgeDoubleClick(e) {
   }else if ( qidian === 'ADflow' && zhongdian ==='MathFunc' ) {
     datacontent.value = '5';
     adid.value = e.edge.sourceNode.data.adid;
-    if(adid.value) {
+    if(adid.value&&mfcid.value) {
       querydataFlow(adid);
       dataflowshow.value = true;
     }else{
-      ElMessage.error('ADflow未初始化!')
+      ElMessage.error('ADflow或MathFunc未初始化!')
     }
   }else if ( qidian === 'TACS' && zhongdian ==='MathFunc' ) {
     datacontent.value = '6';
     tacsid.value = e.edge.sourceNode.data.tacsid;
-    if(tacsid.value) {
+    if(tacsid.value&&mfcid.value) {
       querydataFlow(tacsid);
       dataflowshow.value = true;
     }else{
-      ElMessage.error('TACS未初始化!')
+      ElMessage.error('TACS或MathFunc未初始化!')
     }
   }else if( youhualist.includes(qidian) && zhongdian ==='TACS') {
     datacontent.value = '7';
-    dataflowshow.value = true;
+    tacsid.value = e.edge.targetNode.data.tacsid;
+    if(tacsid.value) {
+      dataflowshow.value = true;
+    }else{
+      ElMessage.error('TACS未初始化!')
+    }
+    // dataflowshow.value = true;
   }else if( qidian ==='MathFunc' && youhualist.includes(zhongdian)) {
     datacontent.value = '8';
     mfcid.value = e.edge.sourceNode.data.mfcid;
@@ -989,16 +1097,13 @@ const querydataFlow = (comid) => {
   })
 }
 
+// 求解器到优化器的数据流保存
 const dataFlowsave = () => {
   let stringArray = '';
   if(datacontent.value === '3'){
     stringArray = convertToStringArray([],ADflowyouhuatable.value);
   }else if(datacontent.value === '4'){
     stringArray = convertToStringArray([],Xfoilyouhuatable.value);
-  }else if(datacontent.value === '5'){
-    stringArray = convertToStringArray([],ADflowMathfunctable.value);
-  }else if(datacontent.value === '6'){
-    stringArray = convertToStringArray([],TacsMathFunctable.value);
   }else if(datacontent.value === '8'){
     stringArray = convertToStringArray([],MathFuncyouhuatable.value);
   }else{
@@ -1020,7 +1125,7 @@ const dataFlowsave = () => {
 }
 
 const convertToStringArray = (result, Data) => {
-  console.log('Data:', Data);
+  // console.log('Data:', Data);
 
   // 安全检查 Data,确保它是一个数组
   if (!Array.isArray(Data)) {
@@ -1029,7 +1134,7 @@ const convertToStringArray = (result, Data) => {
   }
 
   result = Data.map(row => {
-    // 获取每一行的 `code`, `name`, `value` 和 `flag`
+    // 获取每一行的 `paramid`, `steamflag`, `steamtype`
     const paramid = row.paramid ?? ' ';
     const steamflag = row.steamflag ?? '';
     const steamtype = row.steamtype ?? ' ';
@@ -1041,6 +1146,74 @@ const convertToStringArray = (result, Data) => {
   return result;
 }
 
+// ffd、cst、tacs  等优化器到求解器的数据流保存
+const dataFlowsave1 = (comid,comtype) => {
+  const params = {
+    transCode: "MDO0073",
+    comid: comid,
+    comtype: comtype,
+  };
+  request(params).then((res) => {
+    ElMessage({
+        message: '数据流保存成功',
+        type: 'success',
+      })
+  })
+  .catch((err) => {
+      ElMessage.error('数据流保存失败')
+  })
+}
+
+// 求解器之间数据流保存
+const dataFlowsave2 = (fcomid,fcomtype,tcomid,tcomtype) => {
+  let stringArray = '';
+  if(datacontent.value === '5'){
+    stringArray = convertToStringArray2([],ADflowMathfunctable.value);
+  }else if(datacontent.value === '6'){
+    stringArray = convertToStringArray2([],TacsMathFunctable.value);
+  }else{
+    return;
+  }
+  const params = {
+    transCode: "MDO0074",
+    fcomid: fcomid,
+    fcomtype: fcomtype,
+    paramstr: stringArray,
+    tcomid: tcomid,
+    tcomtype: tcomtype,
+  };
+  request(params).then((res) => {
+    ElMessage({
+        message: '数据流保存成功',
+        type: 'success',
+      })
+  })
+  .catch((err) => {
+      ElMessage.error('数据流保存失败')
+  })
+}
+
+const convertToStringArray2 = (result, Data) => {
+  // console.log('Data:', Data);
+
+  // 安全检查 Data,确保它是一个数组
+  if (!Array.isArray(Data)) {
+    console.error('Data should be an array');
+    return result; // 返回原 result 或者根据需要返回其他默认值
+  }
+
+  result = Data.map(row => {
+    // 获取每一行的 `paramid`, `steamflag`
+    const paramid = row.paramid ?? ' ';
+    const steamflag = row.steamflag ?? '';
+
+    // 将字段连接为一个以逗号分隔的字符串
+    return `${paramid},${steamflag}`;
+  }).join(';');  // 每行之间用分号分隔
+
+  return result;
+}
+
 // 右键更改名字
 // const onContextMenu = (e) => {
 //       e.preventDefault();  // 阻止浏览器默认的右键菜单
@@ -1407,6 +1580,8 @@ onMounted(() => {
   emitter.on("adidFromadflow", handleAdid);
   emitter.on("mfcidFromMathFunc", handleMfcid);
   emitter.on("tacsidFromTACS", handleTacsid);
+  emitter.on("ffdidFromFfd", handleFfdid);
+  emitter.on("cstidFromCst", handleCstid);
 });
 
 const cleanEdgeselect = () => {
@@ -1438,7 +1613,8 @@ onUnmounted(() => {
   emitter.off("adidFromadflow", handleAdid);
   emitter.off("mfcidFromMathFunc", handleMfcid);
   emitter.off("tacsidFromTACS", handleTacsid);
-
+  emitter.off("ffdidFromFfd", handleFfdid);
+  emitter.off("cstidFromCst", handleCstid);
 });
 
 

+ 101 - 0
src/views/vuetree/linetablecard.vue

@@ -0,0 +1,101 @@
+<template>
+  <el-card  style="min-height: 240px; max-height: 480px;">
+    <el-checkbox 
+      v-model="localCheckAll" 
+      :indeterminate="isIndeterminate"
+      @change="handleCheckAllChange"
+    >
+      全选
+    </el-checkbox>
+    <div class="eldesign classtable">
+      <el-table :data="tableData" border :show-header="false">
+        <el-table-column type="index" />
+        <el-table-column prop="steamflag" width="55">
+          <template #default="{ row, $index }">
+            <el-checkbox
+              :false-label="0"
+              :true-label="1" 
+              v-model="row.steamflag" 
+              @change="handleItemCheckChange($index)"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" show-overflow-tooltip />
+        <el-table-column v-if="isYouhua" prop="steamtype">
+          <template #default="{ row }">
+            <el-select v-model="row.steamtype">
+              <el-option 
+                v-for="item in steamtypeOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </el-card>
+</template>
+
+<script setup>
+import { ref, watch, computed } from 'vue'
+
+const props = defineProps({
+  tableData: {
+    type: Array,
+    required: true
+  },
+  steamtypeOptions: {
+    type: Array,
+    required: true
+  },
+  checkAll: {
+    type: Boolean,
+    default: false
+  },
+  isIndeterminate: {  // 注意大小写一致
+    type: Boolean,
+    default: false
+  },
+  isYouhua: {
+    type: Boolean,
+    default: true
+  }
+})
+
+const emit = defineEmits(['update:checkAll', 'check-flag-change', 'update:tableData'])
+
+// 计算 indeterminate 状态
+const computedIndeterminate = computed(() => {
+  const checkedCount = props.tableData.filter(item => item.steamflag === 1).length
+  return checkedCount > 0 && checkedCount < props.tableData.length
+})
+
+// 使用计算属性处理双向绑定
+const localCheckAll = computed({
+  get: () => props.checkAll,
+  set: (val) => emit('update:checkAll', val)
+})
+
+// 全选/取消全选处理
+const handleCheckAllChange = (val) => {
+  const newData = props.tableData.map(item => ({
+    ...item,
+    steamflag: val ? 1 : 0
+  }))
+  emit('update:tableData', newData)
+  emit('check-flag-change')
+}
+
+// 单个选项变化处理
+const handleItemCheckChange = (index) => {
+  // 自动更新全选状态
+  const checkedCount = props.tableData.filter(item => item.steamflag === 1).length
+  const allChecked = checkedCount === props.tableData.length
+  const noneChecked = checkedCount === 0
+  
+  emit('update:checkAll', allChecked)
+  emit('check-flag-change')
+}
+</script>