|
@@ -162,19 +162,20 @@
|
|
<script>
|
|
<script>
|
|
import QuestionAnswer from "./QuestionAnswer.vue";
|
|
import QuestionAnswer from "./QuestionAnswer.vue";
|
|
import { auditQuestionApi } from "../api";
|
|
import { auditQuestionApi } from "../api";
|
|
|
|
+import { cloneDeep } from "lodash";
|
|
export default {
|
|
export default {
|
|
name: "QuestionPreviewLoopDialog",
|
|
name: "QuestionPreviewLoopDialog",
|
|
components: { QuestionAnswer },
|
|
components: { QuestionAnswer },
|
|
computed: {
|
|
computed: {
|
|
prevDisabled() {
|
|
prevDisabled() {
|
|
- let id = this.propQuestion.id;
|
|
|
|
- return this.tableData.findIndex((item) => item.id == id) == 0;
|
|
|
|
|
|
+ let id = this.question.id;
|
|
|
|
+ return this.privateTableData.findIndex((item) => item.id == id) == 0;
|
|
},
|
|
},
|
|
nextDisabled() {
|
|
nextDisabled() {
|
|
- let id = this.propQuestion.id;
|
|
|
|
|
|
+ let id = this.question.id;
|
|
return (
|
|
return (
|
|
- this.tableData.findIndex((item) => item.id == id) ==
|
|
|
|
- this.tableData.length - 1
|
|
|
|
|
|
+ this.privateTableData.findIndex((item) => item.id == id) ==
|
|
|
|
+ this.privateTableData.length - 1
|
|
);
|
|
);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -215,6 +216,7 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
+ privateTableData: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -224,22 +226,25 @@ export default {
|
|
modalIsShow(val) {
|
|
modalIsShow(val) {
|
|
val && (this.modalForm.auditRemark = "");
|
|
val && (this.modalForm.auditRemark = "");
|
|
},
|
|
},
|
|
|
|
+ tableData(val) {
|
|
|
|
+ this.privateTableData = cloneDeep(val);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
toPrev() {
|
|
toPrev() {
|
|
- let index = this.tableData.findIndex(
|
|
|
|
|
|
+ let index = this.privateTableData.findIndex(
|
|
(item) => item.id == this.question.id
|
|
(item) => item.id == this.question.id
|
|
);
|
|
);
|
|
if (index != -1) {
|
|
if (index != -1) {
|
|
- this.question = this.tableData[index - 1];
|
|
|
|
|
|
+ this.question = this.privateTableData[index - 1];
|
|
}
|
|
}
|
|
},
|
|
},
|
|
toNext() {
|
|
toNext() {
|
|
- let index = this.tableData.findIndex(
|
|
|
|
|
|
+ let index = this.privateTableData.findIndex(
|
|
(item) => item.id == this.question.id
|
|
(item) => item.id == this.question.id
|
|
);
|
|
);
|
|
if (index != -1) {
|
|
if (index != -1) {
|
|
- this.question = this.tableData[index + 1];
|
|
|
|
|
|
+ this.question = this.privateTableData[index + 1];
|
|
}
|
|
}
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
@@ -274,8 +279,33 @@ export default {
|
|
if (!res) return;
|
|
if (!res) return;
|
|
|
|
|
|
this.$message.success("操作成功!");
|
|
this.$message.success("操作成功!");
|
|
- this.cancel();
|
|
|
|
|
|
+ this.$emit("update");
|
|
|
|
+ // this.cancel();
|
|
this.$bus.emit("updateBadge");
|
|
this.$bus.emit("updateBadge");
|
|
|
|
+
|
|
|
|
+ let index = this.privateTableData.findIndex(
|
|
|
|
+ (item) => item.id == this.question.id
|
|
|
|
+ );
|
|
|
|
+ if (index == -1) {
|
|
|
|
+ if (!this.privateTableData.length) {
|
|
|
|
+ this.question = {};
|
|
|
|
+ this.cancel();
|
|
|
|
+ } else {
|
|
|
|
+ this.question = this.privateTableData[0];
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (index === this.privateTableData.length - 1) {
|
|
|
|
+ this.question = {};
|
|
|
|
+ this.cancel();
|
|
|
|
+ } else {
|
|
|
|
+ this.privateTableData.splice(index, 1);
|
|
|
|
+ this.question = this.privateTableData[index];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.modalForm.auditRemark = "";
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.modalFormComp.clearValidate();
|
|
|
|
+ });
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|