|
@@ -213,7 +213,7 @@ export default {
|
|
this.getImportPaperData(),
|
|
this.getImportPaperData(),
|
|
questionInfoField
|
|
questionInfoField
|
|
);
|
|
);
|
|
- console.log(cacheData);
|
|
|
|
|
|
+ // console.log(cacheData);
|
|
this.paperData = this.assignCachePaperData(res.data, cacheData);
|
|
this.paperData = this.assignCachePaperData(res.data, cacheData);
|
|
this.questionKey = randomCode();
|
|
this.questionKey = randomCode();
|
|
},
|
|
},
|
|
@@ -237,15 +237,22 @@ export default {
|
|
return cachePaperInfo;
|
|
return cachePaperInfo;
|
|
},
|
|
},
|
|
assignCachePaperData(paperData, cacheData) {
|
|
assignCachePaperData(paperData, cacheData) {
|
|
- paperData.forEach((detail, dIndex) => {
|
|
|
|
- detail.questions.forEach((question) => {
|
|
|
|
- Object.assign(
|
|
|
|
|
|
+ return paperData.map((detail, dIndex) => {
|
|
|
|
+ detail.questions.map((question) => {
|
|
|
|
+ return this.mergeObjData(
|
|
question,
|
|
question,
|
|
cacheData[`${dIndex + 1}_${question.number}`] || {}
|
|
cacheData[`${dIndex + 1}_${question.number}`] || {}
|
|
);
|
|
);
|
|
});
|
|
});
|
|
|
|
+ return detail;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ mergeObjData(targetObj, cacheObj) {
|
|
|
|
+ let data = { ...targetObj };
|
|
|
|
+ Object.keys(cacheObj).forEach((k) => {
|
|
|
|
+ data[k] = cacheObj[k] || targetObj[k];
|
|
});
|
|
});
|
|
- return paperData;
|
|
|
|
|
|
+ return data;
|
|
},
|
|
},
|
|
getImportPaperData() {
|
|
getImportPaperData() {
|
|
let paperData = deepCopy(this.$refs.QuestionImportPaperEdit.getData());
|
|
let paperData = deepCopy(this.$refs.QuestionImportPaperEdit.getData());
|