feat 根据作用域获取不同范围的测试数据

master
rouchen 2024-05-14 22:39:56 +08:00
parent 76190e433c
commit 01afda9dc5
1 changed files with 164 additions and 113 deletions

View File

@ -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.dataModeMapList2
//
// if (item.fieldName === this.dataModelList.common){
// this.dataModeMapList[index].value = this.dataModelList.name
// }
//
// this.dataModeMapList%this.dataModelList.size() this.dataModeMapListthis.dataModelListcommonname
},
'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(){