|  | @@ -50,6 +50,8 @@
 | 
											
												
													
														|  |                  v-show="shouldShowItem(getNameVal(), item.vo.attId)"
 |  |                  v-show="shouldShowItem(getNameVal(), item.vo.attId)"
 | 
											
												
													
														|  |                  v-model="item.vo.val"
 |  |                  v-model="item.vo.val"
 | 
											
												
													
														|  |                  class="custom-checkbox"
 |  |                  class="custom-checkbox"
 | 
											
												
													
														|  | 
 |  | +                true-value = 1
 | 
											
												
													
														|  | 
 |  | +                false-value = 0
 | 
											
												
													
														|  |                >
 |  |                >
 | 
											
												
													
														|  |                  {{ item.vo.name }}
 |  |                  {{ item.vo.name }}
 | 
											
												
													
														|  |                </el-checkbox>
 |  |                </el-checkbox>
 | 
											
										
											
												
													
														|  | @@ -69,6 +71,10 @@ import { useValOptionsStore } from '@/store/valoptions'
 | 
											
												
													
														|  |  const valOptionsStore = useValOptionsStore()
 |  |  const valOptionsStore = useValOptionsStore()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const props = defineProps({
 |  |  const props = defineProps({
 | 
											
												
													
														|  | 
 |  | +  type: {
 | 
											
												
													
														|  | 
 |  | +    type: Number,
 | 
											
												
													
														|  | 
 |  | +    default:0
 | 
											
												
													
														|  | 
 |  | +  },
 | 
											
												
													
														|  |    exDatajson: {
 |  |    exDatajson: {
 | 
											
												
													
														|  |      type: Object,
 |  |      type: Object,
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
										
											
												
													
														|  | @@ -102,29 +108,57 @@ const handleNameChange = () => {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  // 试验设计
 |  |  // 试验设计
 | 
											
												
													
														|  | 
 |  | +// 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
 | 
											
												
													
														|  | 
 |  | +// }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +// 不同 type 下的 linkageRules
 | 
											
												
													
														|  | 
 |  | +const generateGeneratorRules = (prefix) => ({
 | 
											
												
													
														|  | 
 |  | +  LatinHypercubeGenerator: [`${prefix}11`, `${prefix}12`, `${prefix}141`, `${prefix}142`],
 | 
											
												
													
														|  | 
 |  | +  BoxBehnkenGenerator: [`${prefix}11`, `${prefix}12`, `${prefix}143`],
 | 
											
												
													
														|  | 
 |  | +  PlackettBurmanGenerator: [`${prefix}11`, `${prefix}12`],
 | 
											
												
													
														|  | 
 |  | +  FullFactorialGenerator: [`${prefix}11`, `${prefix}12`, `${prefix}144`],
 | 
											
												
													
														|  | 
 |  | +});
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +const linkageRulesMap = {
 | 
											
												
													
														|  | 
 |  | +  0: generateGeneratorRules('a'),
 | 
											
												
													
														|  | 
 |  | +  1: generateGeneratorRules('b'),
 | 
											
												
													
														|  | 
 |  | +  2: generateGeneratorRules('c'),
 | 
											
												
													
														|  | 
 |  | +};
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  const getNameVal = () => {
 |  |  const getNameVal = () => {
 | 
											
												
													
														|  | -  const target = exDataObj.value.body.find(item => item?.vo?.valCodeType === 'samplingMethod');
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const target = exDataObj.value.body.find(
 | 
											
												
													
														|  | 
 |  | +    item => item?.vo?.valCodeType === 'samplingMethod'
 | 
											
												
													
														|  | 
 |  | +  );
 | 
											
												
													
														|  |    return target?.vo?.val ?? null;
 |  |    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) => {
 |  |  const shouldShowItem = (currentValue = 'LatinHypercubeGenerator', targetCode) => {
 | 
											
												
													
														|  | -  return linkageRules[currentValue]?.includes(targetCode) ?? false
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const rules = linkageRulesMap[props.type] || {}; // 取当前 type 对应规则
 | 
											
												
													
														|  | 
 |  | +  return rules[currentValue]?.includes(targetCode) ?? false;
 | 
											
												
													
														|  | 
 |  | +};
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  // 保存前过滤
 |  |  // 保存前过滤
 | 
											
												
													
														|  |  const saveData = () => {
 |  |  const saveData = () => {
 | 
											
												
													
														|  |    // 获取当前选中的 选项value
 |  |    // 获取当前选中的 选项value
 | 
											
												
													
														|  |    const selectValue = getNameVal()
 |  |    const selectValue = getNameVal()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +  const rules = linkageRulesMap[props.type] || {};
 | 
											
												
													
														|  |    // 根据规则过滤出要保留的 attId
 |  |    // 根据规则过滤出要保留的 attId
 | 
											
												
													
														|  | -  const allowedAttIds = linkageRules[selectValue] || [];
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const allowedAttIds = rules[selectValue] || [];
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    // 过滤 body
 |  |    // 过滤 body
 | 
											
												
													
														|  |    const filteredBody = exDataObj.value.body
 |  |    const filteredBody = exDataObj.value.body
 | 
											
										
											
												
													
														|  | @@ -139,7 +173,7 @@ const saveData = () => {
 | 
											
												
													
														|  |    return saveArr;
 |  |    return saveArr;
 | 
											
												
													
														|  |  };
 |  |  };
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -defineExpose({saveData})
 |  | 
 | 
											
												
													
														|  | 
 |  | +defineExpose({exDataObj, saveData})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  </script>
 |  |  </script>
 | 
											
												
													
														|  |  
 |  |  
 |