增加删除笔记的事件

This commit is contained in:
daihh
2022-10-13 16:24:49 +08:00
parent 1be54fedef
commit f9bca259bc

View File

@@ -4,17 +4,14 @@
<h3>我的笔记</h3>
<div>
<el-dropdown style="margin-left:15px" @command="exportCommand">
<el-button>
导出<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-button>导出<i class="el-icon-arrow-down el-icon--right"></i></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="1">PDF</el-dropdown-item>
<el-dropdown-item command="2">Excel</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown style="margin-left:15px" @command="importCommand">
<el-button>
导入<i class="el-icon-arrow-down el-icon--right"></i>
<el-button>导入<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="3">图片</el-dropdown-item>
@@ -36,9 +33,7 @@
end-placeholder="结束">
</el-date-picker>
<el-dropdown @command="handleCommand">
<el-button>
全部课程<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-button>全部课程<i class="el-icon-arrow-down el-icon--right"></i></el-button>
<el-dropdown-menu slot="dropdown" style="height: 150px;overflow-y: auto !important;">
<el-dropdown-item command="">全部</el-dropdown-item>
<el-dropdown-item v-for="cou in couresna" :command="cou.courseId">{{cou.courseName}}</el-dropdown-item>
@@ -81,13 +76,11 @@
</div>
<div class="all-footer">
<div>
<div class="textbut-box">
<interactBar v-if="item.type == 1" nodeWidth="60px" :readonly="true" :type="6" :data="item" :shares="false" :comments="false" :answers="true" :clickAnswer="true" :views="false"></interactBar>
<el-button @click="open(item)" style=" margin-right: 10px;" class="textbut" type="text">
<svg-icon icon-class="notedel" ></svg-icon>删除</el-button>
<el-button @click="edit(item)" class="textbut" type="text">
<svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button>
</div>
<div class="textbut-box">
<interactBar v-if="item.type == 1" nodeWidth="60px" :readonly="true" :type="6" :data="item" :shares="false" :comments="false" :answers="true" :clickAnswer="true" :views="false"></interactBar>
<el-button @click="deleteNote(item)" style=" margin-right: 10px;" class="textbut" type="text"><svg-icon icon-class="notedel" ></svg-icon>删除</el-button>
<el-button @click="edit(item)" class="textbut" type="text"><svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button>
</div>
</div>
</div>
</div>
@@ -148,7 +141,7 @@
<p>累计导出{{datalist.length}}</p>
<p style="margin-top:10px">导出时间{{formatDate(new Date())}}</p>
</div>
</div>
<div class="export-dialog-body">
<div class="Export-info" style="" v-for="(item,idx) in datalist" :key="idx">
@@ -287,7 +280,7 @@ export default {
document.body.removeChild(link);
this.dialogVisible = false;
}
})
} else {
apiNote.exportExcel(ids).then(res=>{
@@ -304,7 +297,7 @@ export default {
document.body.removeChild(link);
this.dialogVisible = false;
}
})
}
},
@@ -386,25 +379,43 @@ export default {
}
this.noteData(this.num);
},
open(item) {
this.$confirm('移除后将不在笔记列表中展示', '确定要删除您的笔记吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiNote.del(item.id).then(res=>{
this.noteData(this.num);
this.$message({
type: 'success',
message: '删除成功!'
});
deleteNote(item) {
let $this=this;
this.$confirm('移除后将不在笔记列表中展示', '确定要删除您的笔记吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiNote.del(item.id).then(res=>{
if(res.status==200){
this.noteData(this.num);
this.$message({type:'success', message: '删除成功!'});
//删除事件
let event = {
key: "DeleteNote",//
title: "删除笔记",//
parameters:"author",//
content: "删除了笔记",//事件的内容
source:'page',
objId: item.id,//关联的id
objType: "6",//关联的类型
objInfo: "",
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
this.$store.dispatch("userTrigger", event);
}else{
this.$message({type:'success', message: '删除失败!'+res.message});
}
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
couresitem(item){
this.courseId = item.courseId;
@@ -487,7 +498,7 @@ export default {
}
::v-deep .note-sift{
.el-dropdown-menu{
}
}
::v-deep .export-dialog{
@@ -594,7 +605,7 @@ export default {
}
.Export-info:last-child{
border: none;
}
::v-deep.dr-dialog{
max-width: 870px !important;