|
@@ -1109,68 +1109,96 @@ export default {
|
|
// );
|
|
// );
|
|
// }
|
|
// }
|
|
let params = this.queryParams;
|
|
let params = this.queryParams;
|
|
- params.needItemStr = JSON.stringify(this.queryParams.needItemStr)
|
|
|
|
|
|
+ params.needItemStr = JSON.stringify(this.queryParams.needItemStr.length > 0 ? this.queryParams.needItemStr : [])
|
|
const treeArr = this.$refs.itemTree.getCheckedNodes();
|
|
const treeArr = this.$refs.itemTree.getCheckedNodes();
|
|
const treeQ = document.getElementsByClassName('el-tree cy-item-tree el-tree--highlight-current')[0]
|
|
const treeQ = document.getElementsByClassName('el-tree cy-item-tree el-tree--highlight-current')[0]
|
|
.getElementsByClassName('el-tree-node__content');
|
|
.getElementsByClassName('el-tree-node__content');
|
|
let seTreeArr = []
|
|
let seTreeArr = []
|
|
if (treeArr.length > 0) {
|
|
if (treeArr.length > 0) {
|
|
- for (let i = 0; i < treeArr.length; i++) {
|
|
|
|
- console.log()
|
|
|
|
- if (treeArr[i].label.indexOf(this.queryParams.nextItemStr) != -1) {
|
|
|
|
- seTreeArr.push(treeArr[i].label)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
for (let i = 0; i < treeQ.length; i++) {
|
|
for (let i = 0; i < treeQ.length; i++) {
|
|
- let name = treeQ[i].textContent;
|
|
|
|
- if (seTreeArr.indexOf(name) != -1) {
|
|
|
|
- if (treeQ[i].nextElementSibling) {
|
|
|
|
- seTreeArr.splice(seTreeArr.indexOf(name), 1)
|
|
|
|
|
|
+ if (treeQ[i].parentElement.classList.contains('is-current')) {
|
|
|
|
+ // 选择的层级
|
|
|
|
+ let treechild = treeQ[i].nextElementSibling.getElementsByClassName('el-tree-node__content');
|
|
|
|
+ for (let j = 0; j < treechild.length; j++) {
|
|
|
|
+ if (treechild[j].parentElement.classList.contains('is-checked')) {
|
|
|
|
+ seTreeArr.push(treechild[j].textContent)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
params.nextItemStr = JSON.stringify(seTreeArr)
|
|
params.nextItemStr = JSON.stringify(seTreeArr)
|
|
getCompositeScreen(params).then((res) => {
|
|
getCompositeScreen(params).then((res) => {
|
|
- console.log(res);
|
|
|
|
|
|
+ console.log(this.chooseItemDataListByTree);
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- this.chooiseItemData = res.data;
|
|
|
|
|
|
+ // this.chooiseItemData = res.data;
|
|
// this.chooseItemDataListByTree.push(...res.data);
|
|
// this.chooseItemDataListByTree.push(...res.data);
|
|
-
|
|
|
|
- let chooseChannelNameList = [];
|
|
|
|
- // 去重
|
|
|
|
- let arr = JSON.parse(JSON.stringify(this.chooseItemDataListByTree));
|
|
|
|
- if (arr.length == 0) {
|
|
|
|
- arr = chooseChannelNameList;
|
|
|
|
- } else {
|
|
|
|
- let status = false;
|
|
|
|
- for (let i in this.chooiseItemData) {
|
|
|
|
- let flag = false;
|
|
|
|
- for (let j in arr) {
|
|
|
|
- let tName = arr[j].label ? arr[j].label : arr[j].itemName;
|
|
|
|
- if (this.chooiseItemData[i].label == tName) {
|
|
|
|
- flag = true;
|
|
|
|
- if (!status) {
|
|
|
|
- status = true;
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
|
|
+ let treeData = this.chooseItemDataListByTree ? this.chooseItemDataListByTree : [];
|
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
|
+ let lodArr = [];
|
|
|
|
+ for (let j = 0; j < res.data.length; j++) {
|
|
|
|
+ lodArr.push(res.data[j].label ? res.data[j].label : res.data[j].itemName);
|
|
|
|
+ }
|
|
|
|
+ console.log(lodArr)
|
|
|
|
+ let status = false;
|
|
|
|
+ let idArr = {}
|
|
|
|
+ for (let i = 0; i < treeData.length; i++) {
|
|
|
|
+ if (lodArr.indexOf(treeData[i].label) !== -1) {
|
|
|
|
+ idArr[lodArr.indexOf(treeData[i].label)] = '1'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(idArr)
|
|
|
|
+ for (let j = 0; j < res.data.length; j++) {
|
|
|
|
+ if (!idArr[j]) {
|
|
|
|
+ treeData.push(res.data[j])
|
|
|
|
+ } else {
|
|
|
|
+ status = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(treeData)
|
|
|
|
+ if (status) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '请注意,选择的数据项中含有重复的项',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if (!flag) {
|
|
|
|
- arr.push(this.chooiseItemData[i]);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- if (status) {
|
|
|
|
- //
|
|
|
|
- this.$message({
|
|
|
|
- message: '请注意,选择的数据项中含有重复的项',
|
|
|
|
- type: 'warning'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ // let chooseChannelNameList = [];
|
|
|
|
+ // // 去重
|
|
|
|
+ // let arr = JSON.parse(JSON.stringify(this.chooseItemDataListByTree));
|
|
|
|
+ // if (arr.length == 0) {
|
|
|
|
+ // arr = chooseChannelNameList;
|
|
|
|
+ // } else {
|
|
|
|
+ // let status = false;
|
|
|
|
+ // for (let i in this.chooiseItemData) {
|
|
|
|
+ // let flag = false;
|
|
|
|
+ // for (let j in arr) {
|
|
|
|
+ // let tName = arr[j].label ? arr[j].label : arr[j].itemName;
|
|
|
|
+ // if (this.chooiseItemData[i].label == tName) {
|
|
|
|
+ // flag = true;
|
|
|
|
+ // if (!status) {
|
|
|
|
+ // status = true;
|
|
|
|
+ // }
|
|
|
|
+ // break;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // if (!flag) {
|
|
|
|
+ // arr.push(this.chooiseItemData[i]);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // if (status) {
|
|
|
|
+ // //
|
|
|
|
+ // this.$message({
|
|
|
|
+ // message: '请注意,选择的数据项中含有重复的项',
|
|
|
|
+ // type: 'warning'
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
this.handleCheckAllChange(false);
|
|
this.handleCheckAllChange(false);
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.chooseItemDataListByTree = arr;
|
|
|
|
|
|
+ this.chooseItemDataListByTree = treeData;
|
|
this.isSelectAllItem = false;
|
|
this.isSelectAllItem = false;
|
|
this.isSelectAllItemData = false;
|
|
this.isSelectAllItemData = false;
|
|
this.leavesChooseList = [];
|
|
this.leavesChooseList = [];
|