fix 修改了选择资产模型(完善)
parent
1690e8a676
commit
590221f5ce
|
@ -37,7 +37,7 @@
|
|||
<el-col :span="6" v-for="asset in assetShowList" style="margin-top: 20px">
|
||||
<el-descriptions :title="asset.key" direction="vertical" border :column="1">
|
||||
<el-descriptions-item label="Type">
|
||||
<el-tag size="small">{{asset.type}}</el-tag>
|
||||
<el-tag size="small">{{asset.fieldName}}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="Value">{{asset.value}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
|
|
@ -224,6 +224,9 @@
|
|||
|
||||
<el-button style="float: right; padding: 3px 0" type="text" @click="dataModelRandom">随机数据</el-button>
|
||||
</div>
|
||||
{{dataModelList}}
|
||||
<br>
|
||||
<br>
|
||||
{{dataModeMapList}}
|
||||
<el-descriptions direction="vertical" :column="3" border>
|
||||
<el-descriptions-item v-for="_dataModel in dataModelList"
|
||||
|
@ -282,6 +285,7 @@ import {
|
|||
selectDataAuthorization, selectDataDisplayName, selectDataDisplayVal, selectDataStructureTableName,
|
||||
selectKvt
|
||||
} from '@/api/kvt/kvt'
|
||||
import data from '@/views/system/dict/data.vue'
|
||||
|
||||
export default {
|
||||
name: "EngineVersion",
|
||||
|
@ -296,25 +300,84 @@ export default {
|
|||
this.assetsList = res.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
},// 我想讲 this.dataModeMapList这个数据按照2个一个对象
|
||||
//
|
||||
// if (item.fieldName === this.dataModelList.common){
|
||||
// this.dataModeMapList[index].value = this.dataModelList.name
|
||||
// }
|
||||
//
|
||||
|
||||
// this.dataModeMapList%this.dataModelList.size()并取出 this.dataModeMapList的每个对象中的this.dataModelList中的common的属性name
|
||||
|
||||
'assets': {
|
||||
handler(newVal){
|
||||
console.log("val",newVal)
|
||||
handler(newVal) {
|
||||
console.log("val", newVal)
|
||||
selectDataStructureTableName(newVal).then(res => {
|
||||
this.dataModelList = res.data
|
||||
console.log("ssssssssssssss", this.dataModelList)
|
||||
for (let resKey in res.data) {
|
||||
console.log("resKey",resKey)
|
||||
this.dataName.push(res.data[resKey].name)
|
||||
}
|
||||
|
||||
console.log("dataName",this.dataName)
|
||||
console.log("ssssssssssssss", this.dataModelList)
|
||||
})
|
||||
//查询数据展示值
|
||||
selectDataDisplayName(newVal).then(res =>{
|
||||
selectDataDisplayName(newVal).then(res => {
|
||||
console.log("pp", res)
|
||||
this.dataModeMapList = res.data
|
||||
console.log("ss",this.dataModeMapList)
|
||||
for (let resKey in res.data) {
|
||||
this.dataVal.push({
|
||||
key: res.data[resKey].fieldName,
|
||||
value: res.data[resKey].value,
|
||||
type: res.data[resKey].type
|
||||
}
|
||||
)
|
||||
// // 假设我们想要遍历 this.dataModeMapList 并基于某些条件将值推入 dd 数组
|
||||
// for (let i = 0; i < this.dataModeMapList.length; i+=this.dataModelList.size) { // 使用 i++ 而不是 i+=this.dataModelList.size
|
||||
// if (this.dataModelList.common == res.data[i].fieldName) { // 这里需要您定义 someConditionToCheck,比如与 this.dataModelList.common 进行比较
|
||||
// // 假设您想要将满足条件的项的 value 推入 dd 数组
|
||||
// dd.push({
|
||||
// [ res.data[i].fieldName]: this.dataModeMapList[i].value
|
||||
// }); // 使用 this.dataModeMapList[i].value 而不是 this.dataModeMapList.value
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (this.dataVal != null) {
|
||||
let keys = this.dataName
|
||||
let count = keys.length
|
||||
const newData = this.dataVal.reduce((acc, curr, index) => {
|
||||
if (index % count === 0 && index + count - 1 < this.dataVal.length) { // 确保不会超出数组边界
|
||||
// 创建一个临时对象来存储键值对
|
||||
const tempObj = {};
|
||||
// 使用 keys 数组来迭代并设置 tempObj 的属性
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
// 访问 kvt 数组中对应位置的元素
|
||||
tempObj[keys[i]] = (i === 0 || i === 2) ? parseInt(this.dataVal[index + i].value, 10) : this.dataVal[index + i].value;
|
||||
}
|
||||
|
||||
// 将临时对象添加到 acc 数组中
|
||||
acc.push(tempObj);
|
||||
}
|
||||
|
||||
// 始终返回累加器数组
|
||||
return acc;
|
||||
|
||||
}, []);
|
||||
this.newData=newData
|
||||
}
|
||||
|
||||
this.dataModeMapList = this.newData
|
||||
console.log("ss", this.dataModeMapList)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataName:[],
|
||||
dataVal:[],
|
||||
newData:[],
|
||||
ruleEngine: this.$route.params && this.$route.params.id,
|
||||
ruleEngineInfo: {},
|
||||
ruleEngineInfoList: [
|
||||
|
@ -607,8 +670,10 @@ export default {
|
|||
},
|
||||
// 单条随机数据
|
||||
dataModelRandom(){
|
||||
|
||||
this.dataModeMapIndex = Math.floor(Math.random()*this.dataModeMapList.length);
|
||||
console.log("thisth",this.dataModeMapIndex)
|
||||
console.log("thiss",this.dataModeMapList[this.dataModeMapIndex])
|
||||
},
|
||||
saveCoding(){
|
||||
updataEngineVersionStatus(this.ruleEngineVersionInfoAndTest).then(res => {
|
||||
|
|
Loading…
Reference in New Issue