一、载入即挂载dom树方法
二、动态拼接label
refresh(treeDeptId) {
listTempl().then(rsn => {
listsNape().then(res => {
let object = rsn.data.data;
for (let e = 0; e < object.length; e++) {
if (treeDeptId === object[e].detectionCatalogueCode) {
this.jsonObj = res.data.data;
for (let k = 0; k < this.data.length; k++) {
for (let j = 0; j < this.data[k].detectionResultDetailVOLists.length; j++) {
this.$set(this.data[k], this.data[k].detectionResultDetailVOLists[j].detectionItemDetectionCategoryId,
this.data[k].detectionResultDetailVOLists[j].dataValue)
if (this.data[k].detectionResultDetailVOLists[j].dataValue === -1) {
this.data[k].detectionResultDetailVOLists[j].dataValue = '';
}
}
}
for (let i = 0; i < this.jsonObj.length; i++) {
if (object[e].detectionItemDetectionCategoryId === this.jsonObj[i].id) {
this.mark.push(this.jsonObj[i].id)
this.price.push(this.jsonObj[i].detectionItemName);
this.opo.push({
label: this.jsonObj[i].detectionItemName,
prop: this.jsonObj[i].id,
width: 100,
cell: true,
slot: true,
rules: [{
required: false,
message: "请选择",
trigger: "blur"
}]
},
)
this.jsonObj = res.data.data;
this.loading = false;
}
this.$refs.crud.toggleSelection();
}
this.isDisable = true;
}
}
})
})
this.mark = []
this.price = []
},
三、实时获取动态拼接值为红色显示
cellStyle({row, column, rowIndex, columnIndex} , params ={}) {
for (let k = 0; k < this.data.length; k++) {
for (let j = 0; j < this.data[k].detectionResultDetailVOLists.length; j++) {
if (this.data[k].detectionResultDetailVOLists[j].qualified === 1) {
let adj = document.getElementsByClassName("cell");
let span = document.getElementsByTagName("span");
for (let u = 0; u < adj.length; u++) {
if (adj[u].innerHTML == "<span>" + this.data[k].detectionResultDetailVOLists[j].dataValue + "</span>") {
adj[u].style.color = "red";
}
let span = adj[u].getElementsByTagName("span");
for (let p = 0; p < span.length; p++) {
}
}
}
}
}
},