|
@@ -84,23 +84,53 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
changeNum(v) {
|
|
changeNum(v) {
|
|
- console.log(v)
|
|
|
|
if (v.data.auditionMinute === 0) {
|
|
if (v.data.auditionMinute === 0) {
|
|
this.$message.warning("时长禁止为0,请重新设置");
|
|
this.$message.warning("时长禁止为0,请重新设置");
|
|
|
|
+ } else {
|
|
|
|
+ var arrays = this.$refs.trees;
|
|
|
|
+ //修改指定项的 auditionMinute
|
|
|
|
+ arrays.root.childNodes.forEach((item, index) => {
|
|
|
|
+ item.childNodes.forEach((items, indexs) => {
|
|
|
|
+ if (items.data.TypeId === v.data.TypeId) {
|
|
|
|
+ items.data.auditionMinute = v.data.auditionMinute;
|
|
|
|
+ }
|
|
|
|
+ if (items.childNodes.length) {
|
|
|
|
+ items.childNodes.forEach((ik) => {
|
|
|
|
+ if (ik.data.TypeId === v.data.TypeId) {
|
|
|
|
+ ik.data.auditionMinute = v.data.auditionMinute;
|
|
|
|
+ }
|
|
|
|
+ if (ik.childNodes.length) {
|
|
|
|
+ ik.childNodes.forEach((iks) => {
|
|
|
|
+ if (iks.data.TypeId === v.data.TypeId) {
|
|
|
|
+ iks.data.auditionMinute = v.data.auditionMinute;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.auditionListCope.forEach(items => {
|
|
|
|
+ if(items.TypeId === v.data.TypeId){
|
|
|
|
+ items.auditionMinute = v.data.auditionMinute
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
inits() {
|
|
inits() {
|
|
|
|
+ if (this.auditionList) {
|
|
|
|
+ this.auditionListCope = JSON.parse(JSON.stringify(this.auditionList));
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.audition = [];
|
|
|
|
+ });
|
|
|
|
+ }
|
|
this.datas = JSON.parse(JSON.stringify(this.copyData));
|
|
this.datas = JSON.parse(JSON.stringify(this.copyData));
|
|
},
|
|
},
|
|
openExpand() {
|
|
openExpand() {
|
|
if (this.auditionList) {
|
|
if (this.auditionList) {
|
|
this.auditionListCope = JSON.parse(JSON.stringify(this.auditionList));
|
|
this.auditionListCope = JSON.parse(JSON.stringify(this.auditionList));
|
|
- var arrays = [];
|
|
|
|
- this.auditionList.map((item) => {
|
|
|
|
- arrays.push(item.TypeId);
|
|
|
|
- });
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.audition = arrays;
|
|
|
|
|
|
+ this.audition = [];
|
|
});
|
|
});
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -108,80 +138,80 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
getCheckedKeys(item, node) {
|
|
getCheckedKeys(item, node) {
|
|
|
|
+ var self = this;
|
|
if (item.TypeId.split("-")[0] != "3") {
|
|
if (item.TypeId.split("-")[0] != "3") {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (node && this.audition.indexOf(item.TypeId) == -1) {
|
|
|
|
- this.audition.push(item.TypeId);
|
|
|
|
- }
|
|
|
|
- if (!node && this.audition.indexOf(item.TypeId) !== -1) {
|
|
|
|
- this.audition.splice(this.audition.indexOf(item.TypeId), 1);
|
|
|
|
- }
|
|
|
|
if (node) {
|
|
if (node) {
|
|
- var sta = this.auditionListCope.some((items) => {
|
|
|
|
- return items.TypeId == item.TypeId;
|
|
|
|
|
|
+ var ast = self.getAllSeNum.filter((items, indexs) => {
|
|
|
|
+ if (
|
|
|
|
+ items.split("-")[0] == item.courseId &&
|
|
|
|
+ items.split("-")[3] == item.menuId
|
|
|
|
+ ) {
|
|
|
|
+ return items;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ var st = ast.concat(self.audition);
|
|
|
|
+ self.audition = [...new Set(st)];
|
|
|
|
+ var pds = self.auditionListCope.some((items, indexs) => {
|
|
|
|
+ return (
|
|
|
|
+ items.courseId === item.courseId && items.menuId === item.menuId
|
|
|
|
+ );
|
|
});
|
|
});
|
|
- if (!sta) {
|
|
|
|
- this.auditionListCope.push({
|
|
|
|
|
|
+ if (!pds) {
|
|
|
|
+ var data = {
|
|
TypeId: item.TypeId,
|
|
TypeId: item.TypeId,
|
|
|
|
+ // typeId: item.onlyId,
|
|
auditionMinute: item.auditionMinute,
|
|
auditionMinute: item.auditionMinute,
|
|
courseId: item.courseId,
|
|
courseId: item.courseId,
|
|
menuId: item.menuId,
|
|
menuId: item.menuId,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ self.auditionListCope.push(data);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- this.auditionListCope.map((items, indexs) => {
|
|
|
|
- if (items.TypeId == item.TypeId) {
|
|
|
|
- this.auditionListCope.splice(indexs, 1);
|
|
|
|
|
|
+ self.audition = self.audition.filter((items, indexs) => {
|
|
|
|
+ if (items.split("-")[0] != item.courseId) {
|
|
|
|
+ return items;
|
|
|
|
+ } else {
|
|
|
|
+ if (items.split("-")[3] != item.menuId) {
|
|
|
|
+ return items;
|
|
|
|
+ } else {
|
|
|
|
+ self.$refs.trees.setChecked(items, node);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ var pds = self.auditionListCope.filter((itx, indx) => {
|
|
|
|
+ if (itx.courseId != item.courseId) {
|
|
|
|
+ return itx;
|
|
|
|
+ } else {
|
|
|
|
+ if (itx.menuId != item.menuId) {
|
|
|
|
+ return itx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ self.auditionListCope = pds;
|
|
}
|
|
}
|
|
- var a = item.TypeId.split("-").map(Number)[1]
|
|
|
|
- this.getAllSeNum.forEach(items => {
|
|
|
|
- var ast = items.split("-").map(Number)[3]
|
|
|
|
- if(a == ast){
|
|
|
|
- this.$refs.trees.setChecked(items, node);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
},
|
|
},
|
|
submitTable() {
|
|
submitTable() {
|
|
if (!this.auditionListCope.length) {
|
|
if (!this.auditionListCope.length) {
|
|
this.$message.warning("请勾选至少一节的试听时间");
|
|
this.$message.warning("请勾选至少一节的试听时间");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- var arrays = this.$refs.trees.getCheckedNodes();
|
|
|
|
- console.log(arrays);
|
|
|
|
- for (let i = 0; i < arrays.length; i++) {
|
|
|
|
- for (let j = 0; j < this.auditionListCope.length; j++) {
|
|
|
|
- if (arrays[i].TypeId === this.auditionListCope[j].TypeId) {
|
|
|
|
- this.auditionListCope[j].auditionMinute = arrays[i].auditionMinute;
|
|
|
|
- }
|
|
|
|
- if (this.auditionListCope[j].auditionMinute === 0) {
|
|
|
|
- this.$message.warning("不允许填写时长为0,请重新输入");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ this.auditionListCope.forEach((item) => {
|
|
|
|
+ if (!item.auditionMinute) {
|
|
|
|
+ this.$message.warning("不允许填写时长为0的节,请重新输入");
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // console.log(this.auditionListCope,321)
|
|
|
|
- // this.auditionListCope.map((item) => {
|
|
|
|
- // if (!item.auditionMinute) {
|
|
|
|
- // arrays.map((items) => {
|
|
|
|
- // if (items.TypeId == item.TypeId) {
|
|
|
|
- // item.auditionMinute = items.auditionMinute;
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- console.log(this.auditionListCope, 123123);
|
|
|
|
|
|
+ });
|
|
this.$emit("uploadArrays", this.auditionListCope);
|
|
this.$emit("uploadArrays", this.auditionListCope);
|
|
this.dialogVisible = false;
|
|
this.dialogVisible = false;
|
|
},
|
|
},
|
|
loadNode(node, resolve) {
|
|
loadNode(node, resolve) {
|
|
- console.log(node.data.onlyId)
|
|
|
|
var self = this;
|
|
var self = this;
|
|
|
|
+ console.log(self.auditionListCope);
|
|
if (node.level === 0) {
|
|
if (node.level === 0) {
|
|
this.tableData.map((item) => {
|
|
this.tableData.map((item) => {
|
|
- item.TypeId = item.courseId;
|
|
|
|
|
|
+ item.TypeId = "0-" + item.courseId;
|
|
item.disabled = true;
|
|
item.disabled = true;
|
|
item.hasChildren = true;
|
|
item.hasChildren = true;
|
|
});
|
|
});
|
|
@@ -208,10 +238,13 @@ export default {
|
|
.inquireCoursechaptersectionlist(node.data.menuId)
|
|
.inquireCoursechaptersectionlist(node.data.menuId)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
res.data.map((item) => {
|
|
res.data.map((item) => {
|
|
- item.onlyId = `${node.data.courseId}-${node.data.moduleId}-${item.chapterId}-${item.sectionId}`;
|
|
|
|
|
|
+ item.onlyId = `${node.data.courseId}-${
|
|
|
|
+ node.data.moduleId ? node.data.moduleId : 0
|
|
|
|
+ }-${item.chapterId}-${item.sectionId}`;
|
|
if (this.getAllSeNum.indexOf(item.onlyId) === -1) {
|
|
if (this.getAllSeNum.indexOf(item.onlyId) === -1) {
|
|
this.getAllSeNum.push(item.onlyId);
|
|
this.getAllSeNum.push(item.onlyId);
|
|
}
|
|
}
|
|
|
|
+ console.log(item.onlyId, 555555);
|
|
item.type = 3;
|
|
item.type = 3;
|
|
item.TypeId = "3" + "-" + item.sectionId;
|
|
item.TypeId = "3" + "-" + item.sectionId;
|
|
item.menuId = item.sectionId;
|
|
item.menuId = item.sectionId;
|
|
@@ -220,6 +253,9 @@ export default {
|
|
if (self.auditionListCope) {
|
|
if (self.auditionListCope) {
|
|
self.auditionListCope.map((items) => {
|
|
self.auditionListCope.map((items) => {
|
|
if (items.TypeId === item.TypeId) {
|
|
if (items.TypeId === item.TypeId) {
|
|
|
|
+ if (self.audition.indexOf(item.onlyId) === -1) {
|
|
|
|
+ self.audition.push(item.onlyId);
|
|
|
|
+ }
|
|
item.auditionMinute = items.auditionMinute;
|
|
item.auditionMinute = items.auditionMinute;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -253,6 +289,9 @@ export default {
|
|
if (self.auditionListCope) {
|
|
if (self.auditionListCope) {
|
|
self.auditionListCope.map((items) => {
|
|
self.auditionListCope.map((items) => {
|
|
if (items.TypeId === item.TypeId) {
|
|
if (items.TypeId === item.TypeId) {
|
|
|
|
+ if (self.audition.indexOf(item.onlyId) === -1) {
|
|
|
|
+ self.audition.push(item.onlyId);
|
|
|
|
+ }
|
|
item.auditionMinute = items.auditionMinute;
|
|
item.auditionMinute = items.auditionMinute;
|
|
}
|
|
}
|
|
});
|
|
});
|