|
@@ -31,7 +31,7 @@
|
|
|
|
|
|
|
|
|
>
|
|
|
- {{ item.paramName }}
|
|
|
+ {{ item.symbolName }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -67,7 +67,7 @@
|
|
|
<div class="condition-list">
|
|
|
<div class="condition-item1">
|
|
|
<div
|
|
|
- v-for="(item, index) in paramList[activeIndex].codeList"
|
|
|
+ v-for="(item, index) in paramList[activeIndex].standardInfos"
|
|
|
:key="index"
|
|
|
|
|
|
>
|
|
@@ -75,13 +75,13 @@
|
|
|
<span>
|
|
|
<div class="condition-header-content">
|
|
|
<div style="color: black;">
|
|
|
- {{item.codeName}}
|
|
|
+ {{item.name}}
|
|
|
</div>
|
|
|
<i class="el-icon-close" @click.stop="handleDeleteItem(item,index)"></i>
|
|
|
</div>
|
|
|
<div class="code-list">
|
|
|
- <div v-for="(item1,index) in item.codeValue" :key="index" class="code-item">
|
|
|
- {{ item1.name }}
|
|
|
+ <div class="code-item">
|
|
|
+ {{ item.standardInfoGroupNameVO.name }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</span>
|
|
@@ -100,15 +100,15 @@
|
|
|
<div class="link-list">
|
|
|
<div v-for="(item, index) in linkListData" :key="index" class="link-item">
|
|
|
<div class="link-name">
|
|
|
- <span>{{ item.paramName }}</span>
|
|
|
+ <span>{{ item.name }}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<i class="el-icon-connection" style="color: black; font-size: larger;"></i>
|
|
|
</div>
|
|
|
<div class="code-list">
|
|
|
- <div v-for="(codeItem, codeIndex) in item.codeList" :key="codeIndex" class="code-item">
|
|
|
- <div class="code-title">{{ codeItem.codeName }}</div>
|
|
|
- <div class="code-detail">{{ codeItem.codeValueName }}</div>
|
|
|
+ <div v-for="(codeItem, codeIndex) in item.standardInfos" :key="codeIndex" class="code-item">
|
|
|
+ <div class="code-title">{{ codeItem.name }}</div>
|
|
|
+ <div class="code-detail">{{ codeItem.standardInfoGroupNameVO.name }}</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
@@ -180,11 +180,18 @@ export default {
|
|
|
visible: false,
|
|
|
paramList: [
|
|
|
{
|
|
|
- paramName: '<0.75',
|
|
|
- codeList:[
|
|
|
- {codeName: 'C3A', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥',value:'1'}
|
|
|
- ]},
|
|
|
+ symbolName: '<0.75',
|
|
|
+ standardInfos:[
|
|
|
+ {name: 'C3A',
|
|
|
+ rightStandardInfos: [
|
|
|
+ {name:'矿渣硅酸盐水泥',id:'1'}
|
|
|
+ ],
|
|
|
+ standardInfoGroupNameVO:{
|
|
|
+ name: '矿渣硅酸盐水泥'
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
{codeName: 'C3S', codeValue: []},
|
|
|
]
|
|
|
|
|
@@ -204,44 +211,7 @@ export default {
|
|
|
],
|
|
|
basicOptions: [],
|
|
|
linkListData: [
|
|
|
- {paramName:'<0.75',codeList:[
|
|
|
- {codeName: 'C3A', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2888'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥2888'},
|
|
|
- {codeName: 'C3A33', codeValue: [
|
|
|
- {name:'矿渣硅酸盐水泥77',value:'1'},
|
|
|
- {name:'矿渣硅酸盐水泥2',value:'1'}
|
|
|
- ],codeValueName: '矿渣硅酸盐水泥/矿渣硅酸盐水泥288899'},
|
|
|
- ]},
|
|
|
+
|
|
|
|
|
|
], // 关联关系数据
|
|
|
id:'', // 传入的ID规范文件id
|
|
@@ -253,19 +223,17 @@ export default {
|
|
|
this.id = id
|
|
|
this.getSampleOptions(id)
|
|
|
this.visible = true
|
|
|
- if(val.length > 0&&val[0].name) {
|
|
|
- this.paramList = val.map(item => {
|
|
|
- return {
|
|
|
- paramName: item.symbolName,
|
|
|
- codeList: [],
|
|
|
- id: item.id
|
|
|
- }
|
|
|
- })
|
|
|
+ if(val.length > 0&&val[0].symbolName) {
|
|
|
+ this.paramList=val
|
|
|
+ this.handleSelect(0)
|
|
|
+
|
|
|
|
|
|
}else{
|
|
|
this.paramList = []
|
|
|
}
|
|
|
- this.getConditionSetData(this.id);
|
|
|
+ //获取关联关系数据
|
|
|
+
|
|
|
+ this.getLinkSetData(this.id);
|
|
|
},
|
|
|
//获取样品信息列表
|
|
|
getSampleOptions(id){
|
|
@@ -307,8 +275,20 @@ export default {
|
|
|
addOperation() {
|
|
|
// 添加操作逻辑
|
|
|
},
|
|
|
- handleSelect(index) {
|
|
|
- this.activeIndex = index
|
|
|
+
|
|
|
+ async handleSelect(index) {
|
|
|
+ this.activeIndex = index;
|
|
|
+ let leftId = this.paramList[index].id;
|
|
|
+ let arr = await this.getConditionSetData(this.id, leftId);
|
|
|
+ let originalData = this.paramList[index].standardInfos;
|
|
|
+
|
|
|
+ if (arr.length > 0) {
|
|
|
+ const mergedData = [...originalData, ...arr[0]['standardInfos']];
|
|
|
+ this.paramList.splice(index, 1, { ...this.paramList[index], standardInfos: mergedData });
|
|
|
+ } else {
|
|
|
+ // 如果 arr 为空,您可能希望清空 standardInfos 或保持原样
|
|
|
+ this.paramList[index].standardInfos = originalData; // 清空
|
|
|
+ }
|
|
|
},
|
|
|
handleSelectCode(values) {
|
|
|
if (!values || values.length === 0) {
|
|
@@ -337,7 +317,6 @@ 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
|
|
@@ -350,11 +329,11 @@ export default {
|
|
|
},
|
|
|
confirmAdd() {
|
|
|
if (!this.addForm.codeName || !this.addForm.codeValue) return this.$message.error('请选择样品信息和基础信息')
|
|
|
- this.paramList[this.activeIndex].codeList.push(
|
|
|
- {codeName: this.addForm.codeName,
|
|
|
- codeValue: [
|
|
|
- {name:this.addForm.codeValueName,value:this.addForm.codeValue}
|
|
|
- ]},
|
|
|
+ this.paramList[this.activeIndex].standardInfos.push(
|
|
|
+ {name: this.addForm.codeName,
|
|
|
+ standardInfoGroupNameVO:
|
|
|
+ {name:this.addForm.codeValueName,ids:this.addForm.codeValue}
|
|
|
+ },
|
|
|
)
|
|
|
this.addDialogVisible = false
|
|
|
this.addForm = {
|
|
@@ -365,66 +344,58 @@ export default {
|
|
|
},
|
|
|
//保存条件
|
|
|
saveCondition() {
|
|
|
- console.log(this.paramList,'this.paramList');
|
|
|
+
|
|
|
+ console.log(this.paramList,'保存的条件');
|
|
|
|
|
|
- this.paramList.map(item => {
|
|
|
- return{
|
|
|
- id: item.id,
|
|
|
- standardInfos:item.codeList.map(codeItem => {
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- // 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');
|
|
|
+ // const filteredArr = this.paramList.filter(item => item.standardInfos.length !== 0);
|
|
|
+ // console.log(filteredArr,'filteredArr');
|
|
|
|
|
|
- saveConditionSet(resArr).then((res) => {
|
|
|
- if(res.data.code == 200) {
|
|
|
- this.$message.success(res.data.msg);
|
|
|
- this.getConditionSetData(this.id);
|
|
|
+ // saveConditionSet(filteredArr).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;
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ // 获取条件设置
|
|
|
+ async getConditionSetData(id, leftId) {
|
|
|
+ try {
|
|
|
+ const res = await getConditionSet({ id, leftId });
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ console.log(res.data.data, '获取的条件设置数据');
|
|
|
+ return res.data.data; // 直接返回数据
|
|
|
} else {
|
|
|
this.$message.error(res.data.msg);
|
|
|
+ throw new Error(res.data.msg); // 抛出错误,以便在调用处处理
|
|
|
}
|
|
|
- }).finally(() => {
|
|
|
- this.saveYpLoad = false;
|
|
|
- });
|
|
|
+ } catch (error) {
|
|
|
+ // 这里可以添加额外的错误处理逻辑,例如记录日志
|
|
|
+ throw error; // 重新抛出错误,以便在调用处捕获
|
|
|
+ }
|
|
|
},
|
|
|
- // 获取条件设置
|
|
|
- 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);
|
|
|
+ //获取关联关系数据
|
|
|
+
|
|
|
+ async getLinkSetData(id, leftId) {
|
|
|
+ try {
|
|
|
+ const res = await getConditionSet({ id, leftId });
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ console.log(res.data.data, '获取的关系数据');
|
|
|
+ this.linkListData = res.data.data; // 直接返回数据
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ throw new Error(res.data.msg); // 抛出错误,以便在调用处处理
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // 这里可以添加额外的错误处理逻辑,例如记录日志
|
|
|
+ throw error; // 重新抛出错误,以便在调用处捕获
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|