|
@@ -198,7 +198,7 @@
|
|
|
<Modal v-model="isRelateContentModal" width="900" class="tree-modal add-volume-modal choose-content-modal">
|
|
|
<ChooseContent v-if="isRelateContentModal" ref="chooseContentRef" :showSyllabus="false"
|
|
|
@previewPaper="onPreviewPaper"></ChooseContent>
|
|
|
- <Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn">确认</Button>
|
|
|
+ <Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn" :loading="isRelateLoading">确认</Button>
|
|
|
</Modal>
|
|
|
|
|
|
<!-- 选择共编、分享弹窗 -->
|
|
@@ -273,6 +273,7 @@
|
|
|
isLoading: false,
|
|
|
isSearchVolume: false,
|
|
|
isAddLoading: false,
|
|
|
+ isRelateLoading:false,
|
|
|
isShowLinkModal: false,
|
|
|
isUploadModal: false,
|
|
|
isAddTreeModal: false,
|
|
@@ -885,15 +886,12 @@
|
|
|
res => {
|
|
|
if (res.error == null) {
|
|
|
r(res)
|
|
|
- this.$Message.success('保存成功!')
|
|
|
} else {
|
|
|
r(res.error)
|
|
|
- this.$Message.error(this.$t('evaluation.paperList.saveFail'))
|
|
|
}
|
|
|
},
|
|
|
err => {
|
|
|
j(err)
|
|
|
- this.$Message.error(this.$t('evaluation.paperList.saveFail'))
|
|
|
}
|
|
|
)
|
|
|
})
|
|
@@ -925,102 +923,110 @@
|
|
|
})
|
|
|
},
|
|
|
/* 获取关联的试卷数据 */
|
|
|
- async onSelectPaper() {
|
|
|
- let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
|
|
|
- if (!list.length) return
|
|
|
- let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
- // 拿到关联的个人试卷
|
|
|
- let privatePapers = list.filter(i => i.scope === 'private')
|
|
|
- let privateSas = await this.$tools.getPrivateSas()
|
|
|
- // 如果是在校本课纲关联的个人试卷 则需要进行入库操作
|
|
|
- if (this.isSchool && privatePapers.length) {
|
|
|
- let schoolPaperList = await this.getSchoolPaperList()
|
|
|
- console.log(privatePapers)
|
|
|
- let promiseArr = []
|
|
|
- privatePapers.forEach(async paper => {
|
|
|
- if(schoolPaperList.map(i => i.name).includes(paper.name)){
|
|
|
- this.$Modal.confirm({
|
|
|
- title: '提示',
|
|
|
- content: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
|
|
|
- onOk: async () => {
|
|
|
- // 继续进行操作完成试卷覆盖
|
|
|
- // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
- let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
- let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
- paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
- paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
- paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
|
|
|
- paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
- paperIndexJson.scope = 'school'
|
|
|
- paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
- console.log(paperIndexJson)
|
|
|
- promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring,true))
|
|
|
- },
|
|
|
- onCancel: () => {
|
|
|
- // 取消则无法关联当前试卷到节点
|
|
|
- curResourceArr.splice(curResourceArr.map(i => i.id).indexOf(paper.id),1)
|
|
|
+ onSelectPaper() {
|
|
|
+ return new Promise(async (r,j) => {
|
|
|
+ let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
|
|
|
+ if (!list.length) return
|
|
|
+ let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
+ // 拿到关联的个人试卷
|
|
|
+ let privatePapers = list.filter(i => i.scope === 'private')
|
|
|
+ let privateSas = await this.$tools.getPrivateSas()
|
|
|
+ // 如果是在校本课纲关联的个人试卷 则需要进行入库操作
|
|
|
+ if (this.isSchool && privatePapers.length) {
|
|
|
+ let schoolPaperList = await this.getSchoolPaperList()
|
|
|
+ console.log(privatePapers)
|
|
|
+ let promiseArr = []
|
|
|
+ privatePapers.forEach(async paper => {
|
|
|
+ if(schoolPaperList.map(i => i.name).includes(paper.name)){
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
|
|
|
+ onOk: async () => {
|
|
|
+ // 继续进行操作完成试卷覆盖
|
|
|
+ // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
+ let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
+ let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
+ paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
+ paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
+ paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
|
|
|
+ paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
+ paperIndexJson.scope = 'school'
|
|
|
+ paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
+ console.log(paperIndexJson)
|
|
|
+ promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring,true))
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ // 取消则无法关联当前试卷到节点
|
|
|
+ curResourceArr.splice(curResourceArr.map(i => i.id).indexOf(paper.id),1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
+ let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
+ let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
+ paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
+ paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
+ paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
|
|
|
+ paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
+ paperIndexJson.scope = 'school'
|
|
|
+ paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
+ console.log(paperIndexJson)
|
|
|
+ promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring))
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
+ console.log(result)
|
|
|
+ list.forEach(i => {
|
|
|
+ if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
|
|
|
+ curResourceArr.push({
|
|
|
+ type: 'paper',
|
|
|
+ title: i.name,
|
|
|
+ id: i.id,
|
|
|
+ code: 'Paper-' + this.$store.state.userInfo.schoolCode,
|
|
|
+ scope: 'school',
|
|
|
+ cntr:this.$store.state.userInfo.schoolCode,
|
|
|
+ link: [i.blob]
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
- // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
- let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
- let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
- paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
- paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
- paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
|
|
|
- paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
- paperIndexJson.scope = 'school'
|
|
|
- paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
- console.log(paperIndexJson)
|
|
|
- promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring))
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- Promise.all(promiseArr).then(result => {
|
|
|
- console.log(result)
|
|
|
+ r(200)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
list.forEach(i => {
|
|
|
if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
|
|
|
curResourceArr.push({
|
|
|
type: 'paper',
|
|
|
title: i.name,
|
|
|
id: i.id,
|
|
|
- code: 'Paper-' + this.$store.state.userInfo.schoolCode,
|
|
|
- scope: 'school',
|
|
|
- cntr:this.$store.state.userInfo.schoolCode,
|
|
|
+ code: i.code,
|
|
|
+ scope: i.scope,
|
|
|
+ cntr: i.scope === 'school' ? this.$store.state.userInfo.schoolCode : this
|
|
|
+ .$store.state
|
|
|
+ .userInfo.TEAMModelId,
|
|
|
link: [i.blob]
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- })
|
|
|
- }else{
|
|
|
- list.forEach(i => {
|
|
|
- if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
|
|
|
- curResourceArr.push({
|
|
|
- type: 'paper',
|
|
|
- title: i.name,
|
|
|
- id: i.id,
|
|
|
- code: i.code,
|
|
|
- scope: i.scope,
|
|
|
- cntr: i.scope === 'school' ? this.$store.state.userInfo.schoolCode : this
|
|
|
- .$store.state
|
|
|
- .userInfo.TEAMModelId,
|
|
|
- link: [i.blob]
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ r(200)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
/* 点击确认 去获取关联的内容数据、试题试卷数据 */
|
|
|
onRelateContent() {
|
|
|
+ this.isRelateLoading = true
|
|
|
let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
this.onSelectFile().then(res => {
|
|
|
this.onSelectQuestion()
|
|
|
- this.onSelectPaper()
|
|
|
- // this.$refs.treeRef.curData.rnodes = this.relateFiles
|
|
|
- console.log(this.curNode)
|
|
|
- this.isRelateContentModal = false
|
|
|
- this.hasModify = true
|
|
|
- this.modifyIdArr.push(this.curChapter.data.id)
|
|
|
+ this.onSelectPaper().then(result => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isRelateLoading = false
|
|
|
+ this.isRelateContentModal = false
|
|
|
+ this.hasModify = true
|
|
|
+ this.modifyIdArr.push(this.curChapter.data.id)
|
|
|
+ },500)
|
|
|
+ })
|
|
|
}).catch(err => {
|
|
|
this.$Message.error(err)
|
|
|
})
|