|
@@ -52,11 +52,11 @@
|
|
|
<span>|</span>
|
|
|
<span>{{ getSemesterName(volume.semesterId) }}</span>
|
|
|
</p>
|
|
|
- <p class="volume-item-info" v-if="inShareView">
|
|
|
- <!-- <span style="display: flex;align-items: center;">
|
|
|
+ <p class="volume-item-info" v-if="inShareView && volume.isDel">
|
|
|
+ <span style="display: flex;align-items: center;" @click.stop="onDeleteShareVolume(volume)">
|
|
|
<Icon type="ios-remove-circle-outline" style="font-weight: bold;margin-right: 5px;"/>
|
|
|
- 忽略该分享
|
|
|
- </span> -->
|
|
|
+ 删除失效册别
|
|
|
+ </span>
|
|
|
<!-- <span class="volume-btn-agree" @click="onAgreeShare(volume,'agree')">
|
|
|
<Icon type="md-checkmark-circle-outline" size="20" color="#27c684" />
|
|
|
<span>接受</span>
|
|
@@ -436,7 +436,8 @@
|
|
|
this.volumeList = res.volumes.reverse()
|
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
this.myVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
- let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
|
+ // let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
|
+ let activeIndex = this.activeVolumeIndex || 0
|
|
|
// this.isEditVolume = false
|
|
|
res.volumes.length && this.onVolumeClick(res.volumes[activeIndex], activeIndex, needRefresh)
|
|
|
} else {
|
|
@@ -488,14 +489,31 @@
|
|
|
this.$Message.error(err);
|
|
|
})
|
|
|
},
|
|
|
- /* 是否接受分享的课纲 */
|
|
|
- onAgreeShare(volume,type){
|
|
|
- console.log(volume)
|
|
|
+ /* 删除已失效的册别 */
|
|
|
+ onDeleteShareVolume(volume){
|
|
|
+ let chapterIds = volume.children.length ? volume.children.map(i => i.id) : []
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: this.$t('syllabus.tree.removeTitle'),
|
|
|
+ content: '确认删除该失效册别吗?',
|
|
|
+ onOk: () => {
|
|
|
+ this.$api.syllabus.ShareAgree({
|
|
|
+ "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "ids": chapterIds,
|
|
|
+ "type": "share",
|
|
|
+ "opt": "ignore"
|
|
|
+ }).then(res => {
|
|
|
+ if(res.status === 200){
|
|
|
+ this.$Message.success('操作成功!')
|
|
|
+ this.getShareVolumeList(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
/* 点击某个册别 */
|
|
|
onVolumeClick(volume, volumeIndex, needRefresh) {
|
|
|
console.log(volume)
|
|
|
- if(volume.isDel){
|
|
|
+ if(volume && volume.isDel){
|
|
|
this.$Message.warning('该册别已被创建者移除!')
|
|
|
this.treeOrigin = []
|
|
|
this.curNode = {
|
|
@@ -511,6 +529,7 @@
|
|
|
this.activeVolumeIndex = volumeIndex
|
|
|
this.activeTab === 'fromCreate' ? this.getTreeByVolumeId(volume) : this.getShareTree(volume)
|
|
|
this.hasModify = false
|
|
|
+ this.modifyIdArr = []
|
|
|
},
|
|
|
/* 添加册别 */
|
|
|
doAddVolume() {
|
|
@@ -522,10 +541,6 @@
|
|
|
this.isEditVolume = false
|
|
|
this.isAddVolumeModal = true
|
|
|
},
|
|
|
- /* 复制副本 */
|
|
|
- doCopyVolume(){
|
|
|
- console.log('xxx')
|
|
|
- },
|
|
|
/* 搜索册别 */
|
|
|
doSearchVolume() {
|
|
|
this.isSearchVolume = true
|
|
@@ -555,32 +570,107 @@
|
|
|
/* 删除当前册别 */
|
|
|
doDeleteVolume() {
|
|
|
let curVolume = this.curVolume
|
|
|
+ let links = this.getVolumeRnodeLinks()
|
|
|
this.$Modal.confirm({
|
|
|
title: "删除册别",
|
|
|
content: "<p>确认移除该册别?</p>",
|
|
|
onOk: () => {
|
|
|
this.isLoading = true;
|
|
|
- this.$api.syllabus.DeleteVolume({
|
|
|
- id: curVolume.id,
|
|
|
- code: curVolume.code.replace('Volume-', ''),
|
|
|
- scope: curVolume.scope
|
|
|
- }).then((res) => {
|
|
|
- if (res) {
|
|
|
- this.volumeList.splice(this.activeVolumeIndex, 1);
|
|
|
- this.treeOrigin = []
|
|
|
- this.curNode.rnodes = []
|
|
|
- this.curNode.id = ''
|
|
|
- this.$Message.success("删除成功");
|
|
|
- this.onVolumeClick(this.volumeList.length ? this.volumeList[this
|
|
|
- .activeVolumeIndex] : null, this.activeVolumeIndex)
|
|
|
- this.isLoading = false;
|
|
|
- } else {
|
|
|
- this.$Message.error("删除失败");
|
|
|
- }
|
|
|
- });
|
|
|
+ this.doDeleteBlobResource(links).then(result => {
|
|
|
+ this.$api.syllabus.DeleteVolume({
|
|
|
+ id: curVolume.id,
|
|
|
+ code: curVolume.code.replace('Volume-', ''),
|
|
|
+ scope: curVolume.scope
|
|
|
+ }).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ this.volumeList.splice(this.activeVolumeIndex, 1);
|
|
|
+ this.treeOrigin = []
|
|
|
+ this.curNode.rnodes = []
|
|
|
+ this.curNode.id = ''
|
|
|
+ this.$Message.success("删除成功");
|
|
|
+ console.log(this.activeVolumeIndex);
|
|
|
+ this.onVolumeClick(this.volumeList.length ? this.volumeList[0] : null, 0,true)
|
|
|
+ this.isLoading = false;
|
|
|
+ } else {
|
|
|
+ this.$Message.error("删除失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error("删除失败," + err);
|
|
|
+ })
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ /* 删除对应关联的资源 */
|
|
|
+ doDeleteBlobResource(links){
|
|
|
+ return new Promise((r,j) => {
|
|
|
+ if(!links.length) r(200)
|
|
|
+ let syllabusLinks = links.filter(i => i.includes('/syllabus/'))
|
|
|
+ if(syllabusLinks.length){
|
|
|
+ this.$api.syllabus.CheckLink({
|
|
|
+ "links": syllabusLinks,
|
|
|
+ "code": this.curCode,
|
|
|
+ "scope": this.curScope
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ let needDeleteLink = []
|
|
|
+ let curVolumeId = this.curVolume.id
|
|
|
+ syllabusLinks.forEach(i => {
|
|
|
+ if(!res.links.filter(j => j.link === i && j.volumeId !== curVolumeId).length){
|
|
|
+ needDeleteLink.push(i)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(needDeleteLink.length){
|
|
|
+ let promiseArr = []
|
|
|
+ needDeleteLink.forEach(i => {
|
|
|
+ promiseArr.push(this.deleteBlobPrefix({
|
|
|
+ cntr:this.curCode,
|
|
|
+ title:i.replace('/syllabus/','')
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
+ r(result)
|
|
|
+ }).catch(err => {
|
|
|
+ j(err)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ r(200)
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ j(e)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ r(200)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 获取当前册别课纲下所有的资源link */
|
|
|
+ getVolumeRnodeLinks(){
|
|
|
+ let volumeRnodeLinks = []
|
|
|
+ if(this.treeOrigin.length){
|
|
|
+ this.treeOrigin.forEach(i => {
|
|
|
+ volumeRnodeLinks.push(...this.getAllRNodes(i.trees[0]).map(j => j.link))
|
|
|
+ })
|
|
|
+ return volumeRnodeLinks
|
|
|
+ }else{
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 获取章节下所有的资源节点 */
|
|
|
+ getAllRNodes(chapterNode){
|
|
|
+ let result = []
|
|
|
+ const fn = (source)=>{
|
|
|
+ result.push(...source.rnodes)
|
|
|
+ if(source.children.length){
|
|
|
+ console.log(JSON.stringify(source.children[0].rnodes));
|
|
|
+ source.children.forEach(i => {
|
|
|
+ fn(i)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ fn(chapterNode)
|
|
|
+ return result
|
|
|
+ },
|
|
|
/* 根据册别查询对应课纲树形结构 */
|
|
|
getTreeByVolumeId(volume) {
|
|
|
this.curNode.rnodes = []
|
|
@@ -675,9 +765,10 @@
|
|
|
let modifyChapters = modifyIdArr.length ? modifyIdArr.map(id => {
|
|
|
return {
|
|
|
id: id,
|
|
|
+ codeval: this.curCode,
|
|
|
volumeId: this.curVolume.id,
|
|
|
scope: this.curVolume.scope,
|
|
|
- trees: [allChapter.find(i => i.id === id)]
|
|
|
+ trees: allChapter.find(i => i.id === id) ? [allChapter.find(i => i.id === id)] : []
|
|
|
}
|
|
|
}) : [];
|
|
|
this.allChapterIds = allChapter.map(i => i.id)
|
|
@@ -698,7 +789,7 @@
|
|
|
onNodeClick(data) {
|
|
|
this.curChapter = this.getChapterByNode(data.node)
|
|
|
// 如果当前节点有关联试题资源 则需要去拿到试题完整信息 来给title赋值 保证为最新数据
|
|
|
- if(data.data.rnodes.length){
|
|
|
+ if(data.data.rnodes && data.data.rnodes.length){
|
|
|
let itemNodeArr = data.data.rnodes.filter(i => i.type === 'item')
|
|
|
if(itemNodeArr.length){
|
|
|
itemNodeArr.forEach(async item => {
|
|
@@ -1234,7 +1325,7 @@
|
|
|
}else{
|
|
|
sas = sasObj.sas
|
|
|
}
|
|
|
- item.link = item.link + sas
|
|
|
+ item.link = this.$evTools.getBlobHost() + '/' + item.cntr + item.link + sas
|
|
|
this.previewFile = item
|
|
|
this.previewStatus = true
|
|
|
break;
|
|
@@ -1324,7 +1415,9 @@
|
|
|
addVolumeParams.creatorId = this.curVolume.creatorId
|
|
|
}
|
|
|
if(this.isSaveSyllabus){
|
|
|
+ addVolumeParams.id = this.curVolume.id
|
|
|
addVolumeParams.name = this.curVolume.name
|
|
|
+ addVolumeParams.syllabusIds = this.allChapterIds || []
|
|
|
this.isSaveSyllabus = false
|
|
|
}
|
|
|
// 发送新增或者编辑册别请求
|
|
@@ -1332,7 +1425,7 @@
|
|
|
if (!res.error) {
|
|
|
this.isAddVolumeModal = false
|
|
|
this.$Message.success("操作成功");
|
|
|
- this.getVolumeList()
|
|
|
+ this.getVolumeList(true)
|
|
|
r(200)
|
|
|
} else {
|
|
|
this.$Message.warning(res.error === 4 ? '已存在相同册别!' : res.error);
|