|
@@ -9,14 +9,6 @@
|
|
|
<template #node-default="props">
|
|
|
<eltree :node="props" />
|
|
|
</template>
|
|
|
-
|
|
|
- <template #edge-default="props">
|
|
|
- <custom-edge :sourceX="props.sourceX"
|
|
|
- :sourceY="props.sourceY"
|
|
|
- :targetX="props.targetX"
|
|
|
- :targetY="props.targetY"
|
|
|
- :label="props.data.label" />
|
|
|
- </template>
|
|
|
|
|
|
<Background pattern-color="#aaa" :gap="16" />
|
|
|
|
|
@@ -97,30 +89,131 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<div style="margin-top: 5px;padding: 10px 35px;">
|
|
|
- <el-card>
|
|
|
+ <div v-if="datacontent === '1'">
|
|
|
+ <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
|
|
|
<el-checkbox v-model="checkAll"
|
|
|
:indeterminate="isIndeterminate"
|
|
|
@change="handlecheckAllchange">全选</el-checkbox>
|
|
|
<div class="eldesign classtable">
|
|
|
- <el-table :data="shujuliutable" border>
|
|
|
+ <el-table :data="youhuaFFDtable" border :show-header="false">
|
|
|
<el-table-column
|
|
|
type="index"
|
|
|
label=""
|
|
|
- :header-cell-style="{ display: 'none' }"
|
|
|
></el-table-column>
|
|
|
- <el-table-column prop="flag" width="55">
|
|
|
+ <el-table-column prop="steamflag" width="55">
|
|
|
<template #default="{ row }">
|
|
|
<el-checkbox
|
|
|
:false-label="0"
|
|
|
:true-label="1"
|
|
|
- v-model="row.flag"
|
|
|
+ v-model="row.steamflag"
|
|
|
@change="handlecheckFlagchange"></el-checkbox>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="data" label="" ></el-table-column>
|
|
|
+ <el-table-column prop="name" label="" ></el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
- </el-card>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ <div v-if="datacontent === '2'">
|
|
|
+ <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
|
|
|
+ <el-checkbox v-model="checkAll"
|
|
|
+ :indeterminate="isIndeterminate"
|
|
|
+ @change="handlecheckAllchange">全选</el-checkbox>
|
|
|
+ <div class="eldesign classtable">
|
|
|
+ <el-table :data="youhuaCSTtable" border :show-header="false">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label=""
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="steamflag" width="55">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-checkbox
|
|
|
+ :false-label="0"
|
|
|
+ :true-label="1"
|
|
|
+ v-model="row.steamflag"
|
|
|
+ @change="handlecheckFlagchange"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="" ></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ <div v-if="datacontent === '3'">
|
|
|
+ <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
|
|
|
+ <el-checkbox v-model="checkAll"
|
|
|
+ :indeterminate="isIndeterminate"
|
|
|
+ @change="handlecheckAllchange">全选</el-checkbox>
|
|
|
+ <div class="eldesign classtable">
|
|
|
+ <el-table :data="ADflowyouhuatable" border :show-header="false">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label=""
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="steamflag" width="55">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-checkbox
|
|
|
+ :false-label="0"
|
|
|
+ :true-label="1"
|
|
|
+ v-model="row.steamflag"
|
|
|
+ @change="handlecheckFlagchange"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="" ></el-table-column>
|
|
|
+ <el-table-column 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>
|
|
|
+ </div>
|
|
|
+ <div v-if="datacontent === '4'">
|
|
|
+ <el-card :shadow="none" style="min-height: 240px; max-height: 480px;">
|
|
|
+ <el-checkbox v-model="checkAll"
|
|
|
+ :indeterminate="isIndeterminate"
|
|
|
+ @change="handlecheckAllchange">全选</el-checkbox>
|
|
|
+ <div class="eldesign classtable">
|
|
|
+ <el-table :data="Xfoilyouhuatable" border :show-header="false">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label=""
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="steamflag" width="55">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-checkbox
|
|
|
+ :false-label="0"
|
|
|
+ :true-label="1"
|
|
|
+ v-model="row.steamflag"
|
|
|
+ @change="handlecheckFlagchange"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column 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>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
@@ -227,6 +320,7 @@ const changeName = ref({
|
|
|
|
|
|
})
|
|
|
|
|
|
+
|
|
|
onNodeContextMenu((e) => {
|
|
|
noid.value = e.node;
|
|
|
changeName.value.name = e.node.data.label;
|
|
@@ -258,9 +352,7 @@ emitter.on('child2Data', data => {
|
|
|
datatree.value = data;
|
|
|
console.log(datatree.value);
|
|
|
})
|
|
|
-onUnmounted(() => {
|
|
|
- emitter.off('child2Data');
|
|
|
-});
|
|
|
+
|
|
|
function onNodeClick(e) {
|
|
|
noid.value = e.node;
|
|
|
changeName.value.name=e.node.data.label;
|
|
@@ -367,8 +459,6 @@ function onNodeDoubleClick(e) {
|
|
|
emit('optimizerfalse','CST');
|
|
|
}else if(e.node.data.name=="ADflow"){
|
|
|
emit('optimizerfalse','ADflow');
|
|
|
- }else if(e.node.data.name=="CST"){
|
|
|
- emit('optimizerfalse','CST');
|
|
|
}else if(e.node.data.name=="FFD"){
|
|
|
emit('optimizerfalse','FFD');
|
|
|
}else if(e.node.data.name=="TACS"){
|
|
@@ -402,7 +492,7 @@ function onEdgeClick(e) {
|
|
|
previousEdge.style = {
|
|
|
...previousEdge.style,
|
|
|
stroke: previousEdge.originalColor, // 恢复原始颜色
|
|
|
- strokeWidth: 1, // 恢复原始宽度
|
|
|
+ strokeWidth: previousEdge.originalWidth,// 恢复原始宽度
|
|
|
};
|
|
|
}
|
|
|
}
|
|
@@ -413,6 +503,7 @@ function onEdgeClick(e) {
|
|
|
|
|
|
// 暂时更改当前选中边缘的样式
|
|
|
seledge.value.originalColor = seledge.value.style.stroke; // 保存当前边缘的原始颜色
|
|
|
+ seledge.value.originalWidth = seledge.value.style.strokeWidth; // 保存当前边缘的原始宽度
|
|
|
seledge.value.style = {
|
|
|
...seledge.value.style,
|
|
|
stroke: '#2267B1', // 设置选中边缘的颜色
|
|
@@ -421,38 +512,72 @@ function onEdgeClick(e) {
|
|
|
|
|
|
// 保存当前选中的边缘作为上一个选中边缘
|
|
|
previousEdge = seledge.value;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
let dataflowshow=ref(false);
|
|
|
|
|
|
-let shujuliutable = ref([
|
|
|
- {data: '升力系数Cl',flag:1},
|
|
|
- {data: '阻力系数Cd',flag:1},
|
|
|
- {data: '压阻力系数Cdp',flag:1},
|
|
|
- {data: '上表面转换点位置xtr-upper',flag:1},
|
|
|
- {data: '下表面转换点位置xtr-lower',flag:1},
|
|
|
+let youhuaFFDtable = ref([
|
|
|
+ { name:'FFD参数(sample)', steamflag:1 }
|
|
|
+])
|
|
|
+
|
|
|
+let youhuaCSTtable = ref([
|
|
|
+ { name:"上表面CST参数(upper)", steamflag:1 },
|
|
|
+ { name:'下表面CST参数(lower)', steamflag:1 }
|
|
|
+])
|
|
|
+
|
|
|
+let steamtypeoptions = ref([
|
|
|
+ { label:'约束条件', value:1 },
|
|
|
+ { label:'优化目标', value:1 }
|
|
|
])
|
|
|
|
|
|
+let ADflowyouhuatable = ref([
|
|
|
+ { code: "cl", name:'升力系数Cl', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code: "cd", name:'阻力系数Cd', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code: "cm", name:'力矩系数Cm', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code: " ", name:'体积', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+])
|
|
|
+
|
|
|
+let Xfoilyouhuatable = ref([
|
|
|
+ { code:'', name:'升力系数Cl', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code:'', name:'阻力系数Cd', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code:'', name:'压阻力系数Cdp', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code:'', name:'力矩系数Cm', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code:'', name:'上表面转换点位置xtr-upper', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+ { code:'', name:'下表面转换点位置xtr-lower', comtype:2 , steamflag:1, steamtype:1 },
|
|
|
+])
|
|
|
|
|
|
let checkAll = ref(false);
|
|
|
let isIndeterminate = ref(false);
|
|
|
-const handlecheckAllchange = (val) => {
|
|
|
- shujuliutable.value.forEach((item) => {
|
|
|
- item.flag = val;
|
|
|
- });
|
|
|
- isIndeterminate.value = false;
|
|
|
+const dataTables = {
|
|
|
+ '1': youhuaFFDtable,
|
|
|
+ '2': youhuaCSTtable,
|
|
|
+ '3': ADflowyouhuatable,
|
|
|
+ '4': Xfoilyouhuatable
|
|
|
};
|
|
|
|
|
|
const handlecheckFlagchange = () => {
|
|
|
- let checkedCount = shujuliutable.value.filter((item) => item.flag).length;
|
|
|
- checkAll.value = checkedCount === shujuliutable.value.length;
|
|
|
- isIndeterminate.value = checkedCount > 0 && checkedCount < shujuliutable.value.length;
|
|
|
+ const table = dataTables[datacontent.value];
|
|
|
+ if (!table) return;
|
|
|
+
|
|
|
+ let checkedCount = table.value.filter(item => Boolean(item.steamflag)).length;
|
|
|
+ checkAll.value = checkedCount === table.value.length;
|
|
|
+ isIndeterminate.value = checkedCount > 0 && checkedCount < table.value.length;
|
|
|
+};
|
|
|
+
|
|
|
+const handlecheckAllchange = (val) => {
|
|
|
+ const table = dataTables[datacontent.value];
|
|
|
+ if (!table) return;
|
|
|
+
|
|
|
+ table.value.forEach(item => item.steamflag = val ? 1 : 0);
|
|
|
+ isIndeterminate.value = false;
|
|
|
};
|
|
|
|
|
|
|
|
|
const confirmselection=()=>{
|
|
|
- let checkedData = shujuliutable.value.filter((item) => item.flag).map((item) => item.data);
|
|
|
+ const table = dataTables[datacontent.value];
|
|
|
+ let checkedData = table.value.filter((item) => item.steamflag).map((item) => item.name);
|
|
|
console.log('xuanzhongshuju:',checkedData);
|
|
|
console.log('seledge:',seledge.value);
|
|
|
seledge.value.label=checkedData.join('\n');
|
|
@@ -460,14 +585,68 @@ const confirmselection=()=>{
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+const xfid = ref('')
|
|
|
+// 监听组件xfoil返回的xfid
|
|
|
+const handleXfid = (xfidFromB) => {
|
|
|
+ xfid.value = xfidFromB.value;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+let datacontent = ref('')
|
|
|
function onEdgeDoubleClick(e) {
|
|
|
- handlecheckFlagchange();
|
|
|
+
|
|
|
console.log('Edge Double Click', e)
|
|
|
seledge.value = e.edge;
|
|
|
dataflowshow.value = true
|
|
|
+ console.log('qidian:',e.edge.sourceNode.data.name);
|
|
|
+ console.log('zhongdian:',e.edge.targetNode.data.name);
|
|
|
+ let qidian = e.edge.sourceNode.data.name;
|
|
|
+ let zhongdian = e.edge.targetNode.data.name;
|
|
|
+ let youhualist = ['优化器','代理优化器','进化优化器','梯度优化器'];
|
|
|
+ if( youhualist.includes(qidian) && zhongdian ==='FFD' ){
|
|
|
+ datacontent.value = '1';
|
|
|
+ }else if( youhualist.includes(qidian) && zhongdian ==='CST') {
|
|
|
+ datacontent.value = '2';
|
|
|
+ }else if( qidian === 'ADflow' && youhualist.includes(zhongdian) ) {
|
|
|
+ datacontent.value = '3';
|
|
|
+ }else if ( qidian === 'Xfoil' && youhualist.includes(zhongdian) ) {
|
|
|
+ datacontent.value = '4';
|
|
|
+ emitter.emit('requestGetxfid',pid.value);
|
|
|
+ console.log('xfid:',xfid.value)
|
|
|
+ if(xfid.value) {
|
|
|
+ querydataFlow(xfid);
|
|
|
+ }else{
|
|
|
+ ElMessage.error('Xfoil未初始化!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('leixing:',datacontent.value);
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ handlecheckFlagchange();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const querydataFlow = (comid) => {
|
|
|
+ const params = {
|
|
|
+ transCode: "MDO0052",
|
|
|
+ pid: pid.value,
|
|
|
+ comid: comid.value
|
|
|
+ }
|
|
|
+ request(params).then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: res.returnMsg,
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ ElMessage.error(err.returnMsg)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
function logEvent(name, event) {
|
|
|
console.log(2222)
|
|
|
}
|
|
@@ -649,10 +828,39 @@ function toggleDarkMode() {
|
|
|
onMounted(() => {
|
|
|
setTimeout(function() {
|
|
|
getroter();
|
|
|
-}, 1500);
|
|
|
+ }, 1500);
|
|
|
// childfun();
|
|
|
|
|
|
+ if (vueFlowRef.value) {
|
|
|
+ vueFlowRef.value.$el.addEventListener('click', (event) => {
|
|
|
+ // 确保点击的不是边缘
|
|
|
+ if (seledge.value && !event.target.closest('.vue-flow__edge')) {
|
|
|
+ // 恢复选中边缘的原始样式
|
|
|
+ seledge.value.style = {
|
|
|
+ ...seledge.value.style,
|
|
|
+ stroke: seledge.value.originalColor,
|
|
|
+ strokeWidth: previousEdge?.originalWidth || 1, // 恢复原始宽度
|
|
|
+ };
|
|
|
+
|
|
|
+ // 清空选中的边缘
|
|
|
+ seledge.value = null;
|
|
|
+ Edgeid.value = null;
|
|
|
+ previousEdge = null;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ emitter.on("xfidFromxfoil", handleXfid);
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ emitter.off('child2Data');
|
|
|
+
|
|
|
+ emitter.off("xfidFromxfoil", handleXfid);
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
// 获取链接
|
|
|
const getroter=()=>{
|
|
|
//datatree.value[0].children=[];
|
|
@@ -736,18 +944,16 @@ defineExpose({changeAllEdgesColor,linestrokeWidth,getroter,onSelection,bgcolorfu
|
|
|
/* 设置edges的左对齐 */
|
|
|
}
|
|
|
|
|
|
-.edge-label {
|
|
|
- position: absolute;
|
|
|
- background-color: rgba(0, 0, 0, 0.6);
|
|
|
- color: white;
|
|
|
- padding: 5px;
|
|
|
- border-radius: 4px;
|
|
|
- font-size: 14px;
|
|
|
- white-space: pre-line; /* 保证文本支持换行 */
|
|
|
+.vue-flow__edge-text {
|
|
|
+ transform: translateY(-10px); /* 将 label 向上偏移 */
|
|
|
+ background: transparent !important;
|
|
|
+ font-size: 8px;
|
|
|
+ font-family: 'Source Sans Pro-Regular';
|
|
|
+ color: #333333;
|
|
|
}
|
|
|
|
|
|
-.edge-label-line {
|
|
|
- margin-bottom: 4px; /* 控制每行的间距 */
|
|
|
+.vue-flow__edge-textbg {
|
|
|
+ fill: transparent !important; /* 将背景设置为透明 */
|
|
|
}
|
|
|
|
|
|
#contextMenu {
|
|
@@ -817,8 +1023,5 @@ panel {
|
|
|
.field{
|
|
|
display: flex;
|
|
|
}
|
|
|
-.node-label, .edge-label,.custom-node span {
|
|
|
- text-transform: none; /* 确保文本不转换为大写 */
|
|
|
- font-family: 'Inter-Regular';
|
|
|
-}
|
|
|
+
|
|
|
</style>
|