|
@@ -3,9 +3,9 @@
|
|
|
<div style="height: 100%;">
|
|
|
<el-card class="custom-card">
|
|
|
<template #header>
|
|
|
- <span>优化问题</span>
|
|
|
+ <span>{{ opDataObj.header?.name }}</span>
|
|
|
</template>
|
|
|
- <div class="opProblem-container">
|
|
|
+ <div class="opProblem-container" :class="currentClass">
|
|
|
<div class="first-container">
|
|
|
<div class="content-container">
|
|
|
<div class="content-aside">
|
|
@@ -13,26 +13,50 @@
|
|
|
<img src="@/assets/img/yhwt.png" class="content-aside-img" alt="Experiment Icon" />
|
|
|
</el-row>
|
|
|
<el-row justify="center" align="middle">
|
|
|
- <el-col style="text-align: center;line-height: 32px;">
|
|
|
- <span style="font-size: 10px;">设计变量</span>
|
|
|
- </el-col>
|
|
|
+ <span style="font-size: 10px;line-height: 32px;">{{ opDataObj1.header?.name }}</span>
|
|
|
+ <el-switch v-if="opDataObj1.swich" v-model="opDataObj1.swich.val" active-value="1" inactive-value="0" class="custom-switch custom-switch-colors" />
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="content-form content-form-right">
|
|
|
- <div class="content-form-top">
|
|
|
- <el-form class="custom-form" :label-width="Labelwidth" label-position="left">
|
|
|
- <el-form-item label="扭曲分布">
|
|
|
- <el-input v-model="qitanOPData1.distortion" size="small"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="上限">
|
|
|
- <el-input-number v-model="qitanOPData1.upperLimit" size="small" controls-position="right"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="下限">
|
|
|
- <el-input-number v-model="qitanOPData1.lowerLimit" size="small" controls-position="right"></el-input-number>
|
|
|
+
|
|
|
+ <el-form class="custom-form" :label-width="Labelwidth" label-position="left">
|
|
|
+ <template v-for="(item, index) in opDataObj1.body" :key="index">
|
|
|
+ <!-- 下拉框和输入框(带 label) -->
|
|
|
+ <el-form-item
|
|
|
+ v-if="item.vo.valCodeType !== 'swithType'"
|
|
|
+ :label="item.vo.name"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-if="item.vo.valType === 1"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in valoption[item.vo.valCodeType]"
|
|
|
+ :key="option.val"
|
|
|
+ :label="option.tag"
|
|
|
+ :value="option.val"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.vo.valType === 2"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- <div class="content-form-bottom">
|
|
|
+
|
|
|
+ <!-- 复选框(无 label、不占位) -->
|
|
|
+ <el-checkbox
|
|
|
+ v-else-if="item.vo.valType === 1 && item.vo.valCodeType === 'swithType'"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ class="custom-checkbox"
|
|
|
+ >
|
|
|
+ {{ item.vo.name }}
|
|
|
+ </el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <!-- <div class="content-form-bottom">
|
|
|
<el-form class="custom-form" :label-width="Labelwidth" label-position="left">
|
|
|
<el-form-item label="厚度分布">
|
|
|
<el-input v-model="qitanOPData1.thickness" size="small"></el-input>
|
|
@@ -44,7 +68,7 @@
|
|
|
<el-input-number v-model="qitanOPData1.lowerLimit" size="small" controls-position="right"></el-input-number>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -56,24 +80,46 @@
|
|
|
<img src="@/assets/img/yhwt.png" class="content-aside-img" alt="Experiment Icon" />
|
|
|
</el-row>
|
|
|
<el-row justify="center" align="middle" >
|
|
|
- <el-col :span="14" :push="4">
|
|
|
- <span style="font-size: 10px;">约束条件</span>
|
|
|
- </el-col>
|
|
|
- <el-col :span="10">
|
|
|
- <el-switch v-model="qitanOPData2.isConstraint" class="custom-switch custom-switch-colors" />
|
|
|
- </el-col>
|
|
|
+ <span style="font-size: 10px;line-height: 32px;">{{ opDataObj2.header?.name }}</span>
|
|
|
+ <el-switch v-if="opDataObj2.swich" v-model="opDataObj2.swich.val" active-value="1" inactive-value="0" class="custom-switch custom-switch-colors" />
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="content-form content-form-right">
|
|
|
<el-form class="custom-form" :label-width="Labelwidth" label-position="left">
|
|
|
- <el-form-item label="约束参数">
|
|
|
- <el-select v-model="qitanOPData2.constraintParameter" size="small">
|
|
|
- <el-option label="失效应力" value="1"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="输入数值">
|
|
|
- <el-input-number v-model="qitanOPData2.inputValue" size="small" controls-position="right"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
+ <template v-for="(item, index) in opDataObj2.body" :key="index">
|
|
|
+ <!-- 下拉框和输入框(带 label) -->
|
|
|
+ <el-form-item
|
|
|
+ v-if="item.vo.valCodeType !== 'swithType'"
|
|
|
+ :label="item.vo.name"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-if="item.vo.valType === 1"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in valoption[item.vo.valCodeType]"
|
|
|
+ :key="option.val"
|
|
|
+ :label="option.tag"
|
|
|
+ :value="option.val"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.vo.valType === 2"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 复选框(无 label、不占位) -->
|
|
|
+ <el-checkbox
|
|
|
+ v-else-if="item.vo.valType === 1 && item.vo.valCodeType === 'swithType'"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ class="custom-checkbox"
|
|
|
+ >
|
|
|
+ {{ item.vo.name }}
|
|
|
+ </el-checkbox>
|
|
|
+ </template>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -86,21 +132,46 @@
|
|
|
<img src="@/assets/img/yhwt.png" class="content-aside-img" alt="Experiment Icon" />
|
|
|
</el-row>
|
|
|
<el-row justify="center" align="middle">
|
|
|
- <el-col style="text-align: center;line-height: 32px;">
|
|
|
- <span style="font-size: 10px;">优化目标</span>
|
|
|
- </el-col>
|
|
|
+ <span style="font-size: 10px;line-height: 32px;">{{ opDataObj3.header?.name }}</span>
|
|
|
+ <el-switch v-if="opDataObj3.swich" v-model="opDataObj3.swich.val" active-value="1" inactive-value="0" class="custom-switch custom-switch-colors" />
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<div class="content-form content-form-right">
|
|
|
<el-form class="custom-form" :label-width="Labelwidth" label-position="left">
|
|
|
- <el-form-item label="约束参数">
|
|
|
- <el-select v-model="qitanOPData2.constraintParameter" size="small">
|
|
|
- <el-option label="失效应力" value="1"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="输入数值">
|
|
|
- <el-input-number v-model="qitanOPData2.inputValue" size="small" controls-position="right"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
+ <template v-for="(item, index) in opDataObj3.body" :key="index">
|
|
|
+ <!-- 下拉框和输入框(带 label) -->
|
|
|
+ <el-form-item
|
|
|
+ v-if="item.vo.valCodeType !== 'swithType'"
|
|
|
+ :label="item.vo.name"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-if="item.vo.valType === 1"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in valoption[item.vo.valCodeType]"
|
|
|
+ :key="option.val"
|
|
|
+ :label="option.tag"
|
|
|
+ :value="option.val"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input
|
|
|
+ v-else-if="item.vo.valType === 2"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 复选框(无 label、不占位) -->
|
|
|
+ <el-checkbox
|
|
|
+ v-else-if="item.vo.valType === 1 && item.vo.valCodeType === 'swithType'"
|
|
|
+ v-model="item.vo.val"
|
|
|
+ class="custom-checkbox"
|
|
|
+ >
|
|
|
+ {{ item.vo.name }}
|
|
|
+ </el-checkbox>
|
|
|
+ </template>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -113,23 +184,54 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { analysisJson } from '../js/analysisData.js'
|
|
|
+
|
|
|
+import { useValOptionsStore } from '@/store/valoptions'
|
|
|
+
|
|
|
+const valOptionsStore = useValOptionsStore()
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ opDatajson: {
|
|
|
+ type: Object
|
|
|
+ },
|
|
|
+ runtype: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
+const currentClass = computed(() => {
|
|
|
+ if (props.runtype === 0) return 'class-qidong'
|
|
|
+ if (props.runtype === 1) return 'class-jiegou'
|
|
|
+ return 'class-qitan'
|
|
|
+})
|
|
|
|
|
|
const Labelwidth = '70px';
|
|
|
|
|
|
-const qitanOPData1 = ref({
|
|
|
- distortion: 0,
|
|
|
- upperLimit: 100,
|
|
|
- lowerLimit: 0,
|
|
|
- thickness: 0,
|
|
|
+const valoption = computed(() => valOptionsStore.valOptionsMap)
|
|
|
+
|
|
|
+const opDataObj = ref({})
|
|
|
+const opDataObj1 = ref({})
|
|
|
+const opDataObj2 = ref({})
|
|
|
+const opDataObj3 = ref({})
|
|
|
+
|
|
|
+// 监听 opDatajson 变化
|
|
|
+watch(
|
|
|
+ () => props.opDatajson,
|
|
|
+ (newVal) => {
|
|
|
+ getdatainit()
|
|
|
+ },
|
|
|
+ { deep: true } // 深度监听
|
|
|
+);
|
|
|
|
|
|
-});
|
|
|
+const getdatainit = () => {
|
|
|
+ opDataObj.value = analysisJson(props.opDatajson);
|
|
|
+ opDataObj1.value = analysisJson(props.opDatajson.svo[0]);
|
|
|
+ opDataObj2.value = analysisJson(props.opDatajson.svo[1]);
|
|
|
+ opDataObj3.value = analysisJson(props.opDatajson.svo[2]);
|
|
|
+ console.log('opDataObj1',opDataObj1.value);
|
|
|
+}
|
|
|
|
|
|
-const qitanOPData2 = ref({
|
|
|
- isConstraint: true,
|
|
|
- constraintParameter: '1',
|
|
|
- inputValue: 0
|
|
|
-});
|
|
|
|
|
|
</script>
|
|
|
|
|
@@ -139,7 +241,39 @@ const qitanOPData2 = ref({
|
|
|
height: 100%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
+}
|
|
|
+
|
|
|
+.class-qidong {
|
|
|
+ .first-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 33%;
|
|
|
+ }
|
|
|
+ .second-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 33%;
|
|
|
+ }
|
|
|
+ .third-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 33%;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.class-jiegou {
|
|
|
+ .first-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 48%;
|
|
|
+ }
|
|
|
+ .second-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 25%;
|
|
|
+ }
|
|
|
+ .third-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 25%;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+.class-qitan {
|
|
|
.first-container {
|
|
|
width: 100%;
|
|
|
height: 48%;
|