feat 根据作用域获取不同范围的测试数据
parent
76190e433c
commit
01afda9dc5
|
@ -221,7 +221,6 @@
|
|||
<el-card class="box-card" v-if="assets != null">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>选择资产模型</span>
|
||||
|
||||
<el-button style="float: right; padding: 3px 0" type="text" @click="dataModelRandom">随机数据</el-button>
|
||||
</div>
|
||||
{{dataModelList}}
|
||||
|
@ -300,20 +299,13 @@ 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)
|
||||
selectDataStructureTableName(newVal).then(res => {
|
||||
this.dataModelList = res.data
|
||||
this.dataName=[]
|
||||
for (let resKey in res.data) {
|
||||
console.log("resKey",resKey)
|
||||
this.dataName.push(res.data[resKey].name)
|
||||
|
@ -326,6 +318,7 @@ export default {
|
|||
selectDataDisplayName(newVal).then(res => {
|
||||
console.log("pp", res)
|
||||
this.dataModeMapList = res.data
|
||||
this.dataVal=[]
|
||||
for (let resKey in res.data) {
|
||||
this.dataVal.push({
|
||||
key: res.data[resKey].fieldName,
|
||||
|
@ -333,17 +326,9 @@ export default {
|
|||
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) {
|
||||
this.newData=[]
|
||||
let keys = this.dataName
|
||||
let count = keys.length
|
||||
const newData = this.dataVal.reduce((acc, curr, index) => {
|
||||
|
@ -353,7 +338,7 @@ export default {
|
|||
// 使用 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;
|
||||
tempObj[keys[i]] = (i === 0) ? parseInt(this.dataVal[index + i].value, 10) : this.dataVal[index + i].value;
|
||||
}
|
||||
|
||||
// 将临时对象添加到 acc 数组中
|
||||
|
@ -362,13 +347,13 @@ export default {
|
|||
|
||||
// 始终返回累加器数组
|
||||
return acc;
|
||||
|
||||
}, []);
|
||||
this.newData=newData
|
||||
}
|
||||
|
||||
this.dataModeMapList = this.newData
|
||||
console.log("ss", this.dataModeMapList)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -610,6 +595,9 @@ export default {
|
|||
dataRecordSelectKeyList: [],
|
||||
// 选择行记录List
|
||||
changeDataList: [],
|
||||
dataField: {},
|
||||
recording:{},
|
||||
dataSet:[]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -650,6 +638,67 @@ export default {
|
|||
// selectDataDisplayName,
|
||||
// 测试
|
||||
dataTest(){
|
||||
console.log("test",this.dataMode)
|
||||
console.log("aaaa", this.ruleEngineInfo.level)
|
||||
//数据字段
|
||||
this.dataField=[]
|
||||
if(this.ruleEngineInfo.level === "data-field"){
|
||||
console.log( this.dataModeMapList[this.dataModeMapIndex])
|
||||
for (let dataModeMapListElementKey in this.dataModeMapList[this.dataModeMapIndex]) {
|
||||
if (dataModeMapListElementKey == this.dataMode){
|
||||
const ss= this.dataModeMapList[this.dataModeMapIndex][dataModeMapListElementKey]
|
||||
this.dataField=ss
|
||||
}
|
||||
}
|
||||
}
|
||||
//数据集
|
||||
if(this.ruleEngineInfo.level==="data-set") {
|
||||
console.log("数据集this.dataRecordSelectKeyList", this.dataRecordSelectKeyList)
|
||||
console.log("changeDataList",this.changeDataList)
|
||||
// this.changeDataList.forEach((dataModelListElementKey) => {
|
||||
// this.dataRecordSelectKeyList.forEach((dataRecordSelectKeyListElementKey) => {
|
||||
// if (dataRecordSelectKeyListElementKey === dataModelListElementKey){
|
||||
// this.dataSet.push(dataModelListElementKey[dataRecordSelectKeyListElementKey])
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
this.dataSet=[]
|
||||
this.changeDataList.forEach((ElementKey) => {
|
||||
console.log("ElementKey",ElementKey)
|
||||
this.dataRecordSelectKeyList.forEach((KeyListElementKey) => {
|
||||
console.log("KeyListElementKey",KeyListElementKey)
|
||||
console.log("Object.key(dataRecordSelectKeyListElementKey)",)
|
||||
Object.keys(ElementKey).forEach((dataRecordSelectKeyListElementKey) => {
|
||||
if (dataRecordSelectKeyListElementKey === KeyListElementKey ){
|
||||
const ss= ElementKey[dataRecordSelectKeyListElementKey]
|
||||
let aa={}
|
||||
aa.key= KeyListElementKey
|
||||
aa.value = ss
|
||||
this.dataSet.push(aa)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
console.log("this,dataSet", this.dataSet)
|
||||
}
|
||||
//记录
|
||||
if(this.ruleEngineInfo.level ==="recording"){
|
||||
console.log("记录this.dataRecordSelectKeyList",this.dataRecordSelectKeyList)
|
||||
console.log("记录this.dataRecordSelectData",this.dataRecordSelectData)
|
||||
this.recording=[]
|
||||
for (let dataRecordSelectDataKey in this.dataRecordSelectData) {
|
||||
this.dataRecordSelectKeyList.forEach((dataRecordSelectKeyListElementKey) => {
|
||||
if (dataRecordSelectDataKey == dataRecordSelectKeyListElementKey){
|
||||
const ss= this.dataRecordSelectData[dataRecordSelectDataKey]
|
||||
this.recording=ss
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(this.recording)
|
||||
}
|
||||
|
||||
|
||||
let number = Math.floor(Math.random()*3);
|
||||
if (number === 0){
|
||||
this.testResult = "测试正常,无异常数据返回";
|
||||
|
@ -662,11 +711,13 @@ export default {
|
|||
// 选择数据行
|
||||
changeDataRow(val){
|
||||
this.changeDataList = val;
|
||||
console.log("this.changeDataList",this.changeDataList)
|
||||
},
|
||||
// 记录选中
|
||||
dataRecordSelect(row){
|
||||
this.dataRecordSelectKeyList = [];
|
||||
this.dataRecordSelectData = row;
|
||||
console.log("row",row)
|
||||
},
|
||||
// 单条随机数据
|
||||
dataModelRandom(){
|
||||
|
|
Loading…
Reference in New Issue