|  | @@ -11,8 +11,8 @@
 | 
	
		
			
				|  |  |              <img src="@/assets/img/sysj.png" class="content-aside-img" alt="Experiment Icon" />
 | 
	
		
			
				|  |  |            </el-row>
 | 
	
		
			
				|  |  |            <el-row justify="center" align="middle" >
 | 
	
		
			
				|  |  | -            <span style="font-size: 10px;">{{ exDataObj.swich?.name }}</span>
 | 
	
		
			
				|  |  | -            <el-switch v-if="exDataObj.swich" v-model="exDataObj.swich.val" active-value="1" inactive-value="0" class="custom-switch custom-switch-colors" />
 | 
	
		
			
				|  |  | +            <span style="font-size: 10px;">{{ exDataObj.switch?.name }}</span>
 | 
	
		
			
				|  |  | +            <el-switch v-if="exDataObj.switch" v-model="exDataObj.switch.val" active-value="1" inactive-value="0" class="custom-switch custom-switch-colors" />
 | 
	
		
			
				|  |  |            </el-row>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div class="content-form content-form-right">
 | 
	
	
		
			
				|  | @@ -20,13 +20,15 @@
 | 
	
		
			
				|  |  |              <template v-for="(item, index) in exDataObj.body" :key="index">
 | 
	
		
			
				|  |  |                <!-- 下拉框和输入框(带 label) -->
 | 
	
		
			
				|  |  |                <el-form-item 
 | 
	
		
			
				|  |  | -                v-if="item.vo.valCodeType !== 'swithType'" 
 | 
	
		
			
				|  |  | +                v-if="item.vo.valCodeType !== 'swithType'"
 | 
	
		
			
				|  |  | +                v-show="shouldShowItem(getNameVal(), item.vo.attId)"
 | 
	
		
			
				|  |  |                  :label="item.vo.name"
 | 
	
		
			
				|  |  |                >
 | 
	
		
			
				|  |  |                  <el-select
 | 
	
		
			
				|  |  |                    v-if="item.vo.valType === 1"  
 | 
	
		
			
				|  |  |                    v-model="item.vo.val" 
 | 
	
		
			
				|  |  |                    size="small"
 | 
	
		
			
				|  |  | +                  v-on="item.vo.attId === 'a12' ? { change: handleNameChange } : {}"
 | 
	
		
			
				|  |  |                  >
 | 
	
		
			
				|  |  |                    <el-option
 | 
	
		
			
				|  |  |                      v-for="option in valoption[item.vo.valCodeType]"
 | 
	
	
		
			
				|  | @@ -45,6 +47,7 @@
 | 
	
		
			
				|  |  |                <!-- 复选框(无 label、不占位) -->
 | 
	
		
			
				|  |  |                <el-checkbox 
 | 
	
		
			
				|  |  |                  v-else-if="item.vo.valType === 1 && item.vo.valCodeType === 'swithType'"
 | 
	
		
			
				|  |  | +                v-show="shouldShowItem(getNameVal(), item.vo.attId)"
 | 
	
		
			
				|  |  |                  v-model="item.vo.val"
 | 
	
		
			
				|  |  |                  class="custom-checkbox"
 | 
	
		
			
				|  |  |                >
 | 
	
	
		
			
				|  | @@ -59,7 +62,7 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script setup>
 | 
	
		
			
				|  |  | -import { analysisJson } from '../js/analysisData.js'
 | 
	
		
			
				|  |  | +import { analysisJson, delChangeInfo } from '../js/analysisData.js'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import { useValOptionsStore } from '@/store/valoptions'
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -88,11 +91,55 @@ watch(
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const getdatainit = () => {
 | 
	
		
			
				|  |  |    exDataObj.value = analysisJson(props.exDatajson);
 | 
	
		
			
				|  |  | -  // console.log('exDataObj', exDataObj.value );
 | 
	
		
			
				|  |  | +  console.log('exDataObj', exDataObj.value );
 | 
	
		
			
				|  |  |    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// 删除项目属性
 | 
	
		
			
				|  |  | +const handleNameChange = () => {
 | 
	
		
			
				|  |  | +  delChangeInfo(exDataObj);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 试验设计
 | 
	
		
			
				|  |  | +const getNameVal = () => {
 | 
	
		
			
				|  |  | +  const target = exDataObj.value.body.find(item => item?.vo?.valCodeType === 'samplingMethod');
 | 
	
		
			
				|  |  | +  return target?.vo?.val ?? null;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const linkageRules = {
 | 
	
		
			
				|  |  | +  LatinHypercubeGenerator: ['a11','a12','a141', 'a142'], // 选拉丁超立方时显示
 | 
	
		
			
				|  |  | +  BoxBehnkenGenerator: ['a11','a12','a143'],              // 选BoxBehnken
 | 
	
		
			
				|  |  | +  PlackettBurmanGenerator: ['a11','a12'],                      // 选PlackettBurman
 | 
	
		
			
				|  |  | +  FullFactorialGenerator:['a11','a12','a144']                         //全因子设计
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const shouldShowItem = (currentValue = 'LatinHypercubeGenerator', targetCode) => {
 | 
	
		
			
				|  |  | +  return linkageRules[currentValue]?.includes(targetCode) ?? false
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// 保存前过滤
 | 
	
		
			
				|  |  | +const saveData = () => {
 | 
	
		
			
				|  |  | +  // 获取当前选中的 选项value
 | 
	
		
			
				|  |  | +  const selectValue = getNameVal()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // 根据规则过滤出要保留的 attId
 | 
	
		
			
				|  |  | +  const allowedAttIds = linkageRules[selectValue] || [];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // 过滤 body
 | 
	
		
			
				|  |  | +  const filteredBody = exDataObj.value.body
 | 
	
		
			
				|  |  | +  .filter(item => allowedAttIds.includes(item.vo?.attId))
 | 
	
		
			
				|  |  | +  .map(item => item.vo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const switchObj = exDataObj.value.switch
 | 
	
		
			
				|  |  | +  const saveArr = switchObj ? [...filteredBody, switchObj] : filteredBody;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  console.log("ex保存数据:", saveArr);
 | 
	
		
			
				|  |  | +  // 这里执行你的上传或保存逻辑
 | 
	
		
			
				|  |  | +  return saveArr;
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +defineExpose({saveData})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 |