tangjunhao 5 місяців тому
батько
коміт
7bbeaf417a

BIN
src/assets/flowimg/MathFunc.png


BIN
src/assets/img/mathfuncFx.png


BIN
src/assets/img/mathfuncX.png


BIN
src/assets/img/mathfuncY.png


+ 45 - 0
src/views/home.vue

@@ -1269,6 +1269,33 @@
               </div>
             </template>
           </el-dialog>
+          <!-- MathFunc -->
+          <el-dialog v-model="dialog.MathFuncdialog" align-center :modal="false" :close-on-click-modal="false"
+            :append-to-body="true" draggable :fullscreen="false" :modal-append-to-body="false" modal-class="summary-dlg"
+            :before-close="handleClose" width="500" class="dialog_class bgcolor colortext tianjia sel">
+
+            <template #header="{ titleId, titleClass }">
+              <div class="my-header ">
+                <!-- <el-image :src="getImgPath('xuek0.png')" fit="contain"></el-image> -->
+                <h4 :id="titleId" :class="titleClass">MathFunc</h4>
+              </div>
+            </template>
+            <MathFunc ref="MathFuncref" @selectTab="MathFunctabchange"/>
+            <template #footer>
+              <div style="display: flex;justify-content: space-between;">
+                <div>
+                  <el-button v-show="MathFuncxinjian">新建</el-button>
+                </div>
+                <div class="dialog-footer">
+                  <el-button @click="dialog.MathFuncdialog = false">取消</el-button>
+                  <el-button type="primary" @click="; dialog.MathFuncdialog = false">
+                    确定
+                  </el-button>
+                </div>
+              </div>
+              
+            </template>
+          </el-dialog>
           <!-- FSI -->
            <el-dialog v-model="dialog.fsidialog" align-center :modal="false" :close-on-click-modal="false"
             :append-to-body="true" draggable :fullscreen="false" :modal-append-to-body="false" modal-class="summary-dlg"
@@ -1662,6 +1689,7 @@ import ffds from './titlecomponent/ffds.vue'
 import cloudsecond from "./titlecomponent/Cloudsecond.vue";
 import FSI from './titlecomponent/FSI.vue'
 import Flight from './titlecomponent/Flight.vue'
+import MathFunc from './titlecomponent/MathFunc.vue'
 import ListSE from "./titlecomponent/ListSE.vue";
 import TACS from "./titlecomponent/TACS.vue";
 
@@ -1699,6 +1727,7 @@ let Doptimizeref=ref();
 let Toptimizeref=ref();
 let Fsiref=ref();
 let Flightref=ref();
+let MathFuncref=ref();
 let f4ce = ref("优化问题组件");
 let modelban = ref("学科分析组件");
 let undmodel=ref('优化器组件');
@@ -2122,6 +2151,7 @@ let dialog = ref({
   guanli: false,
   optgroup:false,
   Pythonshow:false,
+  MathFuncdialog:false,
   listdialog:false,
   scatterdialog:false,
   echartLinedialog:false,
@@ -2420,6 +2450,8 @@ const optimizerfalse = (val) => {
   }else if(name == 'Flight'){
     dialog.value.flightdialog = true;
     
+  }else if(name == 'MathFunc'){
+    dialog.value.MathFuncdialog = true;
   }
    else {
     dialog.value.optimizer = false;
@@ -2431,6 +2463,7 @@ const optimizerfalse = (val) => {
     dialog.value.XfAD = false;
     dialog.value.cstffd = false;
     dialog.value.Pythonshow = false;
+    dialog.value.MathFuncdialog = false;
     dialog.value.fsidialog = false;
     dialog.value.flightdialog = false;
   }
@@ -2613,6 +2646,18 @@ const handleEditorChange = (value) => {
   console.log('Editor content changed in parent component:', value);
 };
 
+let MathFuncxinjian = ref('ture')
+const MathFunctabchange = (val) => {
+  // console.log('MathFunctabchange:',val);
+  if(val == '1'){
+    MathFuncxinjian.value = false;
+  }else{
+    MathFuncxinjian.value = true;
+  }
+}
+
+
+
 // 模块选择
 const clickgeometry = (e, index, key, name) => {
   // console.log(key);

+ 141 - 0
src/views/titlecomponent/MathFunc.vue

@@ -0,0 +1,141 @@
+<template>
+  <div class="XFpdding" style="height: 350px;">
+    <ul>
+      <li
+        class="item"
+        v-for="(tab, index) in tabslist1"
+        :key="index"
+        :class="{ active: currentTab1 === index }"
+        @click="selectTab1(index)"
+      >
+        <img :src="tab.imgSrc" style="width: 22px;"/>
+        {{ tab.name }}
+      </li>
+    </ul>
+    <div v-show="currentTab1 == '0'" class="eldesign classtable" style="margin-top: 10px">
+      <el-table :data="xvaluelist" 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 }">
+              <el-input v-model="row.name" />
+            </template> -->
+          </el-table-column>
+          <el-table-column prop="value" label="参数值">
+            <template #default="{ row }">
+              <el-input v-model="row.value" type="number" />
+            </template>
+          </el-table-column>
+          <el-table-column prop="flag" label="启用" width="100">
+            <template v-slot="scope">
+              <el-checkbox
+                :false-label="-1"
+                :true-label="1"
+                :label="false"
+                v-model="scope.row.flag"
+              />
+            </template>
+          </el-table-column>
+        </el-table>
+    </div>
+
+      <div v-show="currentTab1 == '1'" style="margin-top: 10px">
+        <PythonEdit :value="textarea" language="python" />
+      </div> 
+
+      <div v-show="currentTab1 == '2'" class="eldesign classtable" style="margin-top: 10px">
+        <el-table :data="yvaluelist" 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 }">
+              <el-input v-model="row.name" @change="handleEdit(row)" />
+            </template> -->
+          </el-table-column>
+          <el-table-column prop="value" label="参数值">
+            <template #default="{ row }">
+              <el-input v-model="row.value" type="number" />
+            </template>
+          </el-table-column>
+          <el-table-column prop="flag" label="启用" width="100">
+            <template v-slot="scope">
+              <el-checkbox
+                :false-label="0"
+                :true-label="1"
+                :label="false"
+                v-model="scope.row.flag"
+              />
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+
+  </div>
+</template>
+<script  setup>
+import { ref, onMounted, reactive, provide, nextTick } from "vue"
+import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus"
+import { request, uploadFile } from "@/utils/request"
+
+import PythonEdit from '@/components/PythonEditor/index.vue'; 
+import configParams from "@/assets/img/configParams.png";
+import MathFuncX from "@/assets/img/MathFuncX.png";
+import MathFuncFx from "@/assets/img/MathFuncFx.png";
+import MathFuncY from "@/assets/img/MathFuncY.png";
+
+let currentTab1 = ref(0)
+
+let tabslist1 = ref([
+  { id: "0", name: "自变量x", imgSrc: MathFuncX },
+  { id: "1", name: "表达式y=F(x)", imgSrc: MathFuncFx },
+  { id: "2", name: "因变量y", imgSrc: MathFuncY },
+])
+
+let xvaluelist = ref([
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+])
+
+let textarea = ref(`import os
+import numpy as np
+from surromdao.solver import BaseSolver
+
+class Branin(BaseSolver):
+    def __init__(self, filename=os.path):
+        super().__init__(filename)
+
+    def compute(self, xdict):
+        x = np.zeros(2)
+        # x[1] = x[2]`);
+
+let yvaluelist = ref([
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+  { name: "00", value: 0, flag: 1 },
+])
+
+let emit = defineEmits(['selectTab']);
+const selectTab1 = (index) => {
+  // console.log('dayin',index);
+  currentTab1.value = index;
+  // console.log('currentTab1',currentTab1.value);
+  emit('selectTab', index);
+}
+
+const headerCellClassName = ({ column }) => {
+  // console.log('列:',column.property)
+  if (column.property === 'name') {
+    console.log('yanse',column.property)
+    return 'header-blue';
+  } else if (column.property === 'value') {
+    return 'header-green';
+  } else if (column.property === 'flag') {
+    return 'header-yellow';
+  }
+  return '';
+};
+
+
+</script>

+ 8 - 2
src/views/vuetree/Sidebar.vue

@@ -57,7 +57,7 @@ const datatree = ref([
           id:'2-1',
           label: '优化问题',
           img:"wen.png",
-          name:'优化问题'
+          name:'Project'
          
         },
       ],
@@ -71,7 +71,7 @@ const datatree = ref([
           id:'3-01',
           label: '优化器',
           img:'mob.png',
-          name:'优化器'
+          name:'optimizer'
         },
         {
           id:'3-02',
@@ -110,6 +110,12 @@ const datatree = ref([
           img:'TACS.png',
           name:'TACS'
         },
+        {
+          id:'3-14',
+          label: 'MathFunc',
+          img:'MathFunc.png',
+          name:'MathFunc'
+        },
         {
           id:'3-1',
           label: 'CATIA',

+ 2 - 0
src/views/vuetree/index.vue

@@ -560,6 +560,8 @@ function onNodeDoubleClick(e) {
     emit('optimizerfalse',{name:'FSI',wid:nowid});
   }else if(e.node.data.name=="Flight"){
     emit('optimizerfalse',{name:'Flight',wid:nowid});
+  }else if(e.node.data.name=="MathFunc"){
+    emit('optimizerfalse',{name:'MathFunc',wid:nowid});
   }
 
 }

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

@@ -27,7 +27,7 @@ import ffd from '@/assets/flowimg/ffd.png'
 import ADflow from '@/assets/flowimg/ADflow.png'
 import tacs from '@/assets/flowimg/TACS.png'
 import fsi from '@/assets/flowimg/fsi.png'
-import catia from '@/assets/flowimg/catia.png'
+import mathfunc from '@/assets/flowimg/MathFunc.png'
 import flight from '@/assets/flowimg/flight.png'
 let nid = 0;
 let id=0
@@ -65,7 +65,7 @@ function imagefun(){
     }else if(nid=='3-13'){
       return datas = {label:'FUM to FEM', image:fsi,name:'FSI'}
     }else if(nid=='3-14'){
-      return datas = {label:'CATIA', image:catia,name:'CATIA'}
+      return datas = {label:'MathFunc', image:mathfunc,name:'MathFunc'}
     }else if(nid=='3-15'){
       return datas = {label:'Flight', image:flight,name:'Flight'}
     }