|
@@ -18,14 +18,10 @@
|
|
|
<template slot="btn" slot-scope="props">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
- @click="addClick(props.scope.row, 0, props.scope.$index)"
|
|
|
+ @click="addClick(props.scope.row, 0, props.scope.row.index)"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- @click="del(props.scope.row, props.scope.$index)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
+ <el-button type="text" @click="del(props.scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</table-list>
|
|
|
<div class="centerStys">
|
|
@@ -1119,9 +1115,11 @@ export default {
|
|
|
this.$api
|
|
|
.inquirebankexamquestionList({ examId: this.$route.query.id })
|
|
|
.then((res) => {
|
|
|
- res.data.map((item) => {
|
|
|
+ res.data.forEach((item, index) => {
|
|
|
item.optionsList = JSON.parse(item.jsonStr);
|
|
|
+ item.index = index;
|
|
|
});
|
|
|
+ console.log(res.data);
|
|
|
this.copytableData = JSON.parse(JSON.stringify(res.data));
|
|
|
this.boxtableDataPags = JSON.parse(JSON.stringify(res.data));
|
|
|
this.tableData = res.data;
|
|
@@ -1134,7 +1132,7 @@ export default {
|
|
|
// init() {
|
|
|
// this.search();
|
|
|
// },
|
|
|
- del(v, index) {
|
|
|
+ del(v) {
|
|
|
this.$alert(
|
|
|
"确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
|
|
|
"提示",
|
|
@@ -1143,6 +1141,9 @@ export default {
|
|
|
}
|
|
|
)
|
|
|
.then(() => {
|
|
|
+ let index = this.tableData.findIndex((item) => {
|
|
|
+ return item.index === v.index;
|
|
|
+ });
|
|
|
this.tableData.splice(index, 1);
|
|
|
})
|
|
|
.catch(() => {
|
|
@@ -1223,12 +1224,18 @@ export default {
|
|
|
|
|
|
if (this.tableData.length) {
|
|
|
let maxIndex = 0;
|
|
|
+ let childrenIndex = 0;
|
|
|
this.tableData.forEach((item) => {
|
|
|
if (item.sort > maxIndex) {
|
|
|
maxIndex = item.sort;
|
|
|
}
|
|
|
+ if (item.index > childrenIndex) {
|
|
|
+ childrenIndex = item.index
|
|
|
+ }
|
|
|
});
|
|
|
this.activeLists.forEach((item, index) => {
|
|
|
+ childrenIndex++
|
|
|
+ item.index = childrenIndex
|
|
|
item.sort = maxIndex + index + 1;
|
|
|
item.optionsList = JSON.parse(item.jsonStr);
|
|
|
item.partScore = 0;
|
|
@@ -1237,6 +1244,7 @@ export default {
|
|
|
});
|
|
|
} else {
|
|
|
this.activeLists.forEach((item, index) => {
|
|
|
+ item.index = index
|
|
|
item.sort = index + 1;
|
|
|
item.optionsList = JSON.parse(item.jsonStr);
|
|
|
item.partScore = 0;
|
|
@@ -1304,12 +1312,15 @@ export default {
|
|
|
self.activeExam = [];
|
|
|
});
|
|
|
} else {
|
|
|
- self.tableData[indexZB].diff = true;
|
|
|
+ let newIndex = self.tableData.findIndex((item) => {
|
|
|
+ return item.index === indexZB;
|
|
|
+ });
|
|
|
+ self.tableData[newIndex].diff = true;
|
|
|
self.innerVisiblePaperTopic = true;
|
|
|
self.showHide = true;
|
|
|
self.statusPop = int;
|
|
|
var vres = JSON.parse(JSON.stringify(v));
|
|
|
- self.indexZB = indexZB;
|
|
|
+ self.indexZB = newIndex;
|
|
|
if (vres.knowledgeIds) {
|
|
|
var a = [];
|
|
|
vres.knowledgeIds
|
|
@@ -1585,14 +1596,20 @@ export default {
|
|
|
|
|
|
if (this.tableData.length) {
|
|
|
let maxIndex = 0;
|
|
|
+ let childrenIndex = 0;
|
|
|
this.tableData.forEach((item) => {
|
|
|
if (item.sort > maxIndex) {
|
|
|
maxIndex = item.sort;
|
|
|
}
|
|
|
+ if (item.index > childrenIndex) {
|
|
|
+ childrenIndex = item.index;
|
|
|
+ }
|
|
|
});
|
|
|
data.sort = maxIndex + 1;
|
|
|
+ data.index = childrenIndex + 1;
|
|
|
} else {
|
|
|
data.sort = 1;
|
|
|
+ data.index = 0;
|
|
|
}
|
|
|
this.tableData.push(data);
|
|
|
// this.$api.addbankquestion(data).then((res) => {
|
|
@@ -1603,7 +1620,10 @@ export default {
|
|
|
// });
|
|
|
}
|
|
|
if (this.statusPop === 0) {
|
|
|
- this.tableData.splice(this.indexZB, 1, data);
|
|
|
+ let indexy = this.tableData.findIndex((item) => {
|
|
|
+ return item.index === this.indexZB;
|
|
|
+ });
|
|
|
+ this.tableData.splice(indexy, 1, data);
|
|
|
// this.$api.editbankquestion(data).then((res) => {
|
|
|
self.$message.success("修改成功");
|
|
|
self.innerVisiblePaperTopic = false;
|