|
@@ -172,6 +172,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import {getInfoPage,saveConditionSet,getConditionSet } from "@/api/ruleManage/fileRule.js";
|
|
export default {
|
|
export default {
|
|
name: 'ConditionsSet',
|
|
name: 'ConditionsSet',
|
|
data() {
|
|
data() {
|
|
@@ -198,15 +199,10 @@ export default {
|
|
codeNameId: ''
|
|
codeNameId: ''
|
|
},
|
|
},
|
|
sampleOptions: [
|
|
sampleOptions: [
|
|
- { value: '1', label: '试验值水泥' }
|
|
|
|
- // 添加更多选项...
|
|
|
|
- ],
|
|
|
|
- basicOptions: [
|
|
|
|
- { value: '1', label: '矿渣硅酸盐水泥' },
|
|
|
|
- { value: '2', label: '普通酸盐水泥' },
|
|
|
|
- { value: '3', label: '普通酸盐水泥' },
|
|
|
|
|
|
+
|
|
// 添加更多选项...
|
|
// 添加更多选项...
|
|
],
|
|
],
|
|
|
|
+ basicOptions: [],
|
|
linkListData: [
|
|
linkListData: [
|
|
{paramName:'<0.75',codeList:[
|
|
{paramName:'<0.75',codeList:[
|
|
{codeName: 'C3A', codeValue: [
|
|
{codeName: 'C3A', codeValue: [
|
|
@@ -248,27 +244,50 @@ export default {
|
|
]},
|
|
]},
|
|
|
|
|
|
], // 关联关系数据
|
|
], // 关联关系数据
|
|
|
|
+ id:'', // 传入的ID规范文件id
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- show(val) {
|
|
|
|
- console.log(val,'val');
|
|
|
|
-
|
|
|
|
|
|
+ show(val,id) {
|
|
|
|
+ this.id = id
|
|
|
|
+ this.getSampleOptions(id)
|
|
this.visible = true
|
|
this.visible = true
|
|
if(val.length > 0&&val[0].name) {
|
|
if(val.length > 0&&val[0].name) {
|
|
- console.log(val,'val');
|
|
|
|
this.paramList = val.map(item => {
|
|
this.paramList = val.map(item => {
|
|
return {
|
|
return {
|
|
- paramName: item.select + item.name,
|
|
|
|
- codeList: []
|
|
|
|
|
|
+ paramName: item.symbolName,
|
|
|
|
+ codeList: [],
|
|
|
|
+ id: item.id
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
}else{
|
|
}else{
|
|
this.paramList = []
|
|
this.paramList = []
|
|
}
|
|
}
|
|
|
|
+ this.getConditionSetData(this.id);
|
|
},
|
|
},
|
|
|
|
+ //获取样品信息列表
|
|
|
|
+ getSampleOptions(id){
|
|
|
|
+ getInfoPage({
|
|
|
|
+ current:1,
|
|
|
|
+ size:100,
|
|
|
|
+ type: 1,
|
|
|
|
+ standardId: id,
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ this.ruleLoading = false;
|
|
|
|
+ if (res.data.code === 200) {
|
|
|
|
+ this.sampleOptions= res.data.data.records.map(item => ({
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name,
|
|
|
|
+ info:item.info
|
|
|
|
+ }));
|
|
|
|
+ //
|
|
|
|
+ } else {
|
|
|
|
+ this.sampleOptions = [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
hide() {
|
|
hide() {
|
|
this.visible = false
|
|
this.visible = false
|
|
},
|
|
},
|
|
@@ -283,6 +302,7 @@ export default {
|
|
addCondition() {
|
|
addCondition() {
|
|
// 添加条件逻辑
|
|
// 添加条件逻辑
|
|
this.addDialogVisible = true
|
|
this.addDialogVisible = true
|
|
|
|
+ this.addForm = {}
|
|
},
|
|
},
|
|
addOperation() {
|
|
addOperation() {
|
|
// 添加操作逻辑
|
|
// 添加操作逻辑
|
|
@@ -316,6 +336,13 @@ export default {
|
|
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ const selectedOption = this.sampleOptions.find(option => option.value === value);
|
|
|
|
+ console.log(selectedOption,'selectedOption');
|
|
|
|
+ this.basicOptions = selectedOption ? selectedOption.info.map(item => ({
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name
|
|
|
|
+ })) : [];
|
|
|
|
+
|
|
},
|
|
},
|
|
handleDeleteItem(item, index) {
|
|
handleDeleteItem(item, index) {
|
|
this.paramList[this.activeIndex].codeList.splice(index, 1)
|
|
this.paramList[this.activeIndex].codeList.splice(index, 1)
|
|
@@ -336,10 +363,57 @@ export default {
|
|
}
|
|
}
|
|
this.$message.success('添加成功')
|
|
this.$message.success('添加成功')
|
|
},
|
|
},
|
|
- //保存条件
|
|
|
|
- saveCondition() {
|
|
|
|
- // 这里可以添加保存条件的逻辑
|
|
|
|
- this.$message.success('条件已保存')
|
|
|
|
|
|
+ //保存条件
|
|
|
|
+ saveCondition() {
|
|
|
|
+ let resArr = this.paramList.map(item => {
|
|
|
|
+ // 收集所有 codeValue 的 value,不需要额外的数组包装
|
|
|
|
+ const rightIds = item.codeList.reduce((acc, codeItem) => {
|
|
|
|
+ // codeItem.codeValue[0].value 是一个数组,直接展开到 acc 中
|
|
|
|
+ return [...acc, ...codeItem.codeValue[0].value];
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ leftId: item.id, // leftId 保持数组形式
|
|
|
|
+ rightIds // rightIds 是展开后的一维数组
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 调用保存接口
|
|
|
|
+ if (resArr.length === 0) {
|
|
|
|
+ this.$message.warning('请先设置关联关系');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ console.log(resArr,'resArr');
|
|
|
|
+
|
|
|
|
+ saveConditionSet(resArr).then((res) => {
|
|
|
|
+ if(res.data.code == 200) {
|
|
|
|
+ this.$message.success(res.data.msg);
|
|
|
|
+ this.getConditionSetData(this.id);
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ this.saveYpLoad = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 获取条件设置
|
|
|
|
+ getConditionSetData(id) {
|
|
|
|
+ getConditionSet({id}).then((res) => {
|
|
|
|
+ if (res.data.code === 200) {
|
|
|
|
+ console.log(res.data.data, '获取的条件设置数据');
|
|
|
|
+
|
|
|
|
+ // this.paramList = res.data.data.map(item => ({
|
|
|
|
+ // paramName: item.symbolName,
|
|
|
|
+ // codeList: item.codeList.map(codeItem => ({
|
|
|
|
+ // codeName: codeItem.codeName,
|
|
|
|
+ // codeValue: codeItem.codeValue.map(val => ({ name: val.name, value: val.value }))
|
|
|
|
+ // })),
|
|
|
|
+ // id: item.id
|
|
|
|
+ // }));
|
|
|
|
+ } else {
|
|
|
|
+ // this.$message.error(res.data.msg);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|