|
@@ -28,11 +28,11 @@
|
|
<div v-if="!isSearchVolume">
|
|
<div v-if="!isSearchVolume">
|
|
<span>册别清单</span>
|
|
<span>册别清单</span>
|
|
<span class="syllabus-content-header-tools">
|
|
<span class="syllabus-content-header-tools">
|
|
- <Icon type="md-search" title="搜索" @click="doSearchVolume" />
|
|
|
|
- <Icon type="md-copy" title="复制副本" @click="doCopyVolume" v-if="hasSyllabusAuth && inShareView" />
|
|
|
|
- <Icon type="md-create" title="编辑" @click="doEditVolume" v-if="hasSyllabusAuth" />
|
|
|
|
- <Icon type="md-trash" title="删除" @click="doDeleteVolume" v-if="hasSyllabusAuth && !inShareView" />
|
|
|
|
- <Icon type="md-add" title="新建册别" @click="doAddVolume" v-if="hasSyllabusAuth" />
|
|
|
|
|
|
+ <Icon type="md-search" title="搜索" @click="doSearchVolume" v-if="volumeList.length"/>
|
|
|
|
+ <!-- <Icon type="md-copy" title="复制副本" @click="doCopyVolume" v-if="hasSyllabusAuth && inShareView" /> -->
|
|
|
|
+ <Icon type="md-create" title="编辑" @click="doEditVolume" v-if="hasSyllabusAuth && !inShareView && volumeList.length" />
|
|
|
|
+ <Icon type="md-trash" title="删除" @click="doDeleteVolume" v-if="hasSyllabusAuth && !inShareView && volumeList.length" />
|
|
|
|
+ <Icon type="md-add" title="新建册别" @click="doAddVolume" v-if="hasSyllabusAuth && !inShareView" />
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div style="width: 90%;" v-else>
|
|
<div style="width: 90%;" v-else>
|
|
@@ -46,7 +46,7 @@
|
|
<div v-for="(volume,volumeIndex) in volumeList" :key="volumeIndex"
|
|
<div v-for="(volume,volumeIndex) in volumeList" :key="volumeIndex"
|
|
:class="['volume-item',activeVolumeIndex === volumeIndex ? 'volume-active' : '']"
|
|
:class="['volume-item',activeVolumeIndex === volumeIndex ? 'volume-active' : '']"
|
|
@click="onVolumeClick(volume,volumeIndex)">
|
|
@click="onVolumeClick(volume,volumeIndex)">
|
|
- <p class="volume-item-name">{{ volume.name }}</p>
|
|
|
|
|
|
+ <p class="volume-item-name">{{ volume.name }} <span class="status-idDel" v-if="volume.isDel">已失效</span> </p>
|
|
<p class="volume-item-info" v-if="isSchool">
|
|
<p class="volume-item-info" v-if="isSchool">
|
|
<span>{{ getGradeName(volume.gradeId) }}</span>
|
|
<span>{{ getGradeName(volume.gradeId) }}</span>
|
|
<span>|</span>
|
|
<span>|</span>
|
|
@@ -74,7 +74,7 @@
|
|
<div class="syllabus-mid">
|
|
<div class="syllabus-mid">
|
|
<div class="syllabus-content-header">
|
|
<div class="syllabus-content-header">
|
|
<span>课纲目录</span>
|
|
<span>课纲目录</span>
|
|
- <span class="syllabus-content-header-tools">
|
|
|
|
|
|
+ <span class="syllabus-content-header-tools" v-if="volumeList.length && curVolume.id && !inShareView">
|
|
<Icon type="md-add" @click="isAddTreeModal = true" v-if="hasSyllabusAuth" />
|
|
<Icon type="md-add" @click="isAddTreeModal = true" v-if="hasSyllabusAuth" />
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
@@ -133,7 +133,7 @@
|
|
<Icon type="md-eye" />
|
|
<Icon type="md-eye" />
|
|
<span>查看</span>
|
|
<span>查看</span>
|
|
</div>
|
|
</div>
|
|
- <div class="node-resource-tool" @click="onDeleteResource(item,index)">
|
|
|
|
|
|
+ <div class="node-resource-tool" @click="onDeleteResource(item,index)" v-if="(hasSyllabusAuth || hasEditAuth(curNode)) && !inShareView">
|
|
<Icon type="md-trash" />
|
|
<Icon type="md-trash" />
|
|
<span>删除</span>
|
|
<span>删除</span>
|
|
</div>
|
|
</div>
|
|
@@ -396,12 +396,12 @@
|
|
this.gradeList = this.periodList[val].grades;
|
|
this.gradeList = this.periodList[val].grades;
|
|
this.semesterList = this.periodList[val].semesters;
|
|
this.semesterList = this.periodList[val].semesters;
|
|
this.activeSubjectIndex = 0
|
|
this.activeSubjectIndex = 0
|
|
- this.getVolumeList()
|
|
|
|
|
|
+ this.getVolumeList(true)
|
|
},
|
|
},
|
|
/* 切换科目的操作 */
|
|
/* 切换科目的操作 */
|
|
onSubjectChange(subject, index) {
|
|
onSubjectChange(subject, index) {
|
|
this.activeSubjectIndex = index
|
|
this.activeSubjectIndex = index
|
|
- this.getVolumeList()
|
|
|
|
|
|
+ this.getVolumeList(true)
|
|
},
|
|
},
|
|
/* 切换个人创建的课纲和他人分享的课纲 */
|
|
/* 切换个人创建的课纲和他人分享的课纲 */
|
|
onChangeSyllabusTab(type) {
|
|
onChangeSyllabusTab(type) {
|
|
@@ -467,6 +467,11 @@
|
|
status: 1
|
|
status: 1
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ shareList.forEach(i => {
|
|
|
|
+ if(i.children.length && !i.children.filter(j => j.agree !== -1).length){
|
|
|
|
+ i.isDel = true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
this.volumeList = shareList.reverse()
|
|
this.volumeList = shareList.reverse()
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
@@ -490,6 +495,15 @@
|
|
/* 点击某个册别 */
|
|
/* 点击某个册别 */
|
|
onVolumeClick(volume, volumeIndex, needRefresh) {
|
|
onVolumeClick(volume, volumeIndex, needRefresh) {
|
|
console.log(volume)
|
|
console.log(volume)
|
|
|
|
+ if(volume.isDel){
|
|
|
|
+ this.$Message.warning('该册别已被创建者移除!')
|
|
|
|
+ this.treeOrigin = []
|
|
|
|
+ this.curNode = {
|
|
|
|
+ id:'',
|
|
|
|
+ rnodes:[]
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume && !needRefresh)) return
|
|
if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume && !needRefresh)) return
|
|
this.isLoading = true
|
|
this.isLoading = true
|
|
this.curVolume = volume
|
|
this.curVolume = volume
|
|
@@ -648,13 +662,14 @@
|
|
},
|
|
},
|
|
/* 有章节发生变化记录章节ID */
|
|
/* 有章节发生变化记录章节ID */
|
|
addModifyId(id) {
|
|
addModifyId(id) {
|
|
|
|
+ console.log(id)
|
|
this.modifyIdArr.push(id)
|
|
this.modifyIdArr.push(id)
|
|
},
|
|
},
|
|
/* 存储变更保存最新课纲数据 */
|
|
/* 存储变更保存最新课纲数据 */
|
|
onSaveSyllabus() {
|
|
onSaveSyllabus() {
|
|
this.isSaveSyllabus = true
|
|
this.isSaveSyllabus = true
|
|
// 拿到有修改变动的章节ID集合
|
|
// 拿到有修改变动的章节ID集合
|
|
- let modifyIdArr = [...new Set(this.modifyIdArr)].filter(i => i !== this.curVolume.id)
|
|
|
|
|
|
+ let modifyIdArr = [...new Set(this.modifyIdArr)].filter(i => i !== this.curVolume.id && i)
|
|
console.log(modifyIdArr)
|
|
console.log(modifyIdArr)
|
|
let allChapter = this.$refs.treeRef ? this.$refs.treeRef.treeDatas : [];
|
|
let allChapter = this.$refs.treeRef ? this.$refs.treeRef.treeDatas : [];
|
|
let modifyChapters = modifyIdArr.length ? modifyIdArr.map(id => {
|
|
let modifyChapters = modifyIdArr.length ? modifyIdArr.map(id => {
|
|
@@ -831,19 +846,21 @@
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/* 校本课纲关联个人试题试卷要进行入库操作 */
|
|
/* 校本课纲关联个人试题试卷要进行入库操作 */
|
|
- saveItemToSchoolBlob(pItem) {
|
|
|
|
|
|
+ saveItemToBlob(pItem,privateToSchool) {
|
|
return new Promise(async (r, j) => {
|
|
return new Promise(async (r, j) => {
|
|
pItem = await this.$editorTools.doRemoveMideaHost(pItem)
|
|
pItem = await this.$editorTools.doRemoveMideaHost(pItem)
|
|
console.log(pItem)
|
|
console.log(pItem)
|
|
let path = 'item/' + pItem.id + '/'
|
|
let path = 'item/' + pItem.id + '/'
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
- let privareBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,'private')
|
|
|
|
|
|
+ let privateBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,'private')
|
|
|
|
+ let toClient = privateToSchool ? this.containerClient : privateBlobTool
|
|
|
|
+ let fromClient = privateToSchool ? privateBlobTool : this.containerClient
|
|
const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {type: "",});
|
|
let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {type: "",});
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
- this.containerClient.copyFolder(path,path.slice(0,path.length - 1),privareBlobTool).then(async res => {
|
|
|
|
|
|
+ toClient.copyFolder(path,path.slice(0,path.length - 1),fromClient).then(async res => {
|
|
try{
|
|
try{
|
|
- let blobFile = await this.containerClient.upload(file, "item/" + pItem.id);
|
|
|
|
|
|
+ let blobFile = await toClient.upload(file, "item/" + pItem.id);
|
|
if(blobFile.blob){
|
|
if(blobFile.blob){
|
|
this.saveExercise(pItem).then(result => {
|
|
this.saveExercise(pItem).then(result => {
|
|
console.log(result)
|
|
console.log(result)
|
|
@@ -867,8 +884,9 @@
|
|
r(200)
|
|
r(200)
|
|
}else{
|
|
}else{
|
|
let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
- // 拿到关联的个人试题
|
|
|
|
|
|
+ // 拿到关联的个人试题和校本试题
|
|
let privateItems = list.filter(i => i.scope === 'private')
|
|
let privateItems = list.filter(i => i.scope === 'private')
|
|
|
|
+ let schoolItems = list.filter(i => i.scope === 'school')
|
|
// 如果是在校本课纲关联的个人试题 则需要进行入库操作
|
|
// 如果是在校本课纲关联的个人试题 则需要进行入库操作
|
|
if (this.isSchool && privateItems.length) {
|
|
if (this.isSchool && privateItems.length) {
|
|
let promiseArr = []
|
|
let promiseArr = []
|
|
@@ -879,7 +897,7 @@
|
|
pItem.gradeIds = [this.curVolume.gradeId + '']
|
|
pItem.gradeIds = [this.curVolume.gradeId + '']
|
|
pItem.scope = 'school'
|
|
pItem.scope = 'school'
|
|
pItem.code = this.$store.state.userInfo.schoolCode
|
|
pItem.code = this.$store.state.userInfo.schoolCode
|
|
- promiseArr.push(this.saveItemToSchoolBlob(pItem))
|
|
|
|
|
|
+ promiseArr.push(this.saveItemToBlob(pItem,false))
|
|
})
|
|
})
|
|
Promise.all(promiseArr).then(result => {
|
|
Promise.all(promiseArr).then(result => {
|
|
list.forEach(i => {
|
|
list.forEach(i => {
|
|
@@ -900,7 +918,37 @@
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
this.$Message.error(err)
|
|
this.$Message.error(err)
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
|
|
+ }else if(!this.isSchool && schoolItems.length){
|
|
|
|
+ let promiseArr = []
|
|
|
|
+ // 个人试题入库前需要补充必要的学段科目年级信息
|
|
|
|
+ schoolItems.forEach(pItem => {
|
|
|
|
+ pItem.periodId = null
|
|
|
|
+ pItem.subjectId = null
|
|
|
|
+ pItem.gradeIds = null
|
|
|
|
+ pItem.scope = 'private'
|
|
|
|
+ pItem.code = this.$store.state.userInfo.TEAMModelId
|
|
|
|
+ promiseArr.push(this.saveItemToBlob(pItem,true))
|
|
|
|
+ })
|
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
|
+ list.forEach(i => {
|
|
|
|
+ if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(i
|
|
|
|
+ .id)) {
|
|
|
|
+ curResourceArr.push({
|
|
|
|
+ type: 'item',
|
|
|
|
+ title: i.question,
|
|
|
|
+ id: i.id,
|
|
|
|
+ code: 'Item-' + this.$store.state.userInfo.TEAMModelId,
|
|
|
|
+ scope: 'private',
|
|
|
|
+ cntr: this.$store.state.userInfo.TEAMModelId,
|
|
|
|
+ link: i.blob
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ r(200)
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.$Message.error(err)
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
list.forEach(i => {
|
|
list.forEach(i => {
|
|
if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(i.id)) {
|
|
if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(i.id)) {
|
|
curResourceArr.push({
|
|
curResourceArr.push({
|
|
@@ -1269,11 +1317,14 @@
|
|
"scope": this.curScope,
|
|
"scope": this.curScope,
|
|
"syllabusIds": []
|
|
"syllabusIds": []
|
|
}
|
|
}
|
|
- if ((this.isEditVolume && this.curVolume) || this.isSaveSyllabus) {
|
|
|
|
|
|
+ if ((this.isEditVolume && this.curVolume)) {
|
|
addVolumeParams.id = this.curVolume.id
|
|
addVolumeParams.id = this.curVolume.id
|
|
- // addVolumeParams.name = this.curVolume.name
|
|
|
|
|
|
+ addVolumeParams.name = this.addVolumeForm.name
|
|
addVolumeParams.syllabusIds = this.allChapterIds || []
|
|
addVolumeParams.syllabusIds = this.allChapterIds || []
|
|
addVolumeParams.creatorId = this.curVolume.creatorId
|
|
addVolumeParams.creatorId = this.curVolume.creatorId
|
|
|
|
+ }
|
|
|
|
+ if(this.isSaveSyllabus){
|
|
|
|
+ addVolumeParams.name = this.curVolume.name
|
|
this.isSaveSyllabus = false
|
|
this.isSaveSyllabus = false
|
|
}
|
|
}
|
|
// 发送新增或者编辑册别请求
|
|
// 发送新增或者编辑册别请求
|
|
@@ -1383,6 +1434,20 @@
|
|
return !this.isSchool && this.activeTab === 'fromShare'
|
|
return !this.isSchool && this.activeTab === 'fromShare'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ watch:{
|
|
|
|
+ volumeList:{
|
|
|
|
+ handler(n,o){
|
|
|
|
+ if(n.length === 0){
|
|
|
|
+ this.treeOrigin = []
|
|
|
|
+ this.curNode = {
|
|
|
|
+ id:'',
|
|
|
|
+ rnodes:[]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ immediate:true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|