增加删除笔记的事件

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> <h3>我的笔记</h3>
<div> <div>
<el-dropdown style="margin-left:15px" @command="exportCommand"> <el-dropdown style="margin-left:15px" @command="exportCommand">
<el-button> <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-menu slot="dropdown">
<el-dropdown-item command="1">PDF</el-dropdown-item> <el-dropdown-item command="1">PDF</el-dropdown-item>
<el-dropdown-item command="2">Excel</el-dropdown-item> <el-dropdown-item command="2">Excel</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-dropdown style="margin-left:15px" @command="importCommand"> <el-dropdown style="margin-left:15px" @command="importCommand">
<el-button> <el-button>导入<i class="el-icon-arrow-down el-icon--right"></i>
导入<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="3">图片</el-dropdown-item> <el-dropdown-item command="3">图片</el-dropdown-item>
@@ -36,9 +33,7 @@
end-placeholder="结束"> end-placeholder="结束">
</el-date-picker> </el-date-picker>
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<el-button> <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" style="height: 150px;overflow-y: auto !important;"> <el-dropdown-menu slot="dropdown" style="height: 150px;overflow-y: auto !important;">
<el-dropdown-item command="">全部</el-dropdown-item> <el-dropdown-item command="">全部</el-dropdown-item>
<el-dropdown-item v-for="cou in couresna" :command="cou.courseId">{{cou.courseName}}</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>
<div class="all-footer"> <div class="all-footer">
<div> <div>
<div class="textbut-box"> <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> <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"> <el-button @click="deleteNote(item)" style=" margin-right: 10px;" class="textbut" type="text"><svg-icon icon-class="notedel" ></svg-icon>删除</el-button>
<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>
<el-button @click="edit(item)" class="textbut" type="text"> </div>
<svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -148,7 +141,7 @@
<p>累计导出{{datalist.length}}</p> <p>累计导出{{datalist.length}}</p>
<p style="margin-top:10px">导出时间{{formatDate(new Date())}}</p> <p style="margin-top:10px">导出时间{{formatDate(new Date())}}</p>
</div> </div>
</div> </div>
<div class="export-dialog-body"> <div class="export-dialog-body">
<div class="Export-info" style="" v-for="(item,idx) in datalist" :key="idx"> <div class="Export-info" style="" v-for="(item,idx) in datalist" :key="idx">
@@ -287,7 +280,7 @@ export default {
document.body.removeChild(link); document.body.removeChild(link);
this.dialogVisible = false; this.dialogVisible = false;
} }
}) })
} else { } else {
apiNote.exportExcel(ids).then(res=>{ apiNote.exportExcel(ids).then(res=>{
@@ -304,7 +297,7 @@ export default {
document.body.removeChild(link); document.body.removeChild(link);
this.dialogVisible = false; this.dialogVisible = false;
} }
}) })
} }
}, },
@@ -386,25 +379,43 @@ export default {
} }
this.noteData(this.num); this.noteData(this.num);
}, },
open(item) { deleteNote(item) {
this.$confirm('移除后将不在笔记列表中展示', '确定要删除您的笔记吗?', { let $this=this;
confirmButtonText: '确定', this.$confirm('移除后将不在笔记列表中展示', '确定要删除您的笔记吗?', {
cancelButtonText: '取消', confirmButtonText: '确定',
type: 'warning' cancelButtonText: '取消',
}).then(() => { type: 'warning'
apiNote.del(item.id).then(res=>{ }).then(() => {
this.noteData(this.num); apiNote.del(item.id).then(res=>{
this.$message({ if(res.status==200){
type: 'success', this.noteData(this.num);
message: '删除成功!' 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){ couresitem(item){
this.courseId = item.courseId; this.courseId = item.courseId;
@@ -487,7 +498,7 @@ export default {
} }
::v-deep .note-sift{ ::v-deep .note-sift{
.el-dropdown-menu{ .el-dropdown-menu{
} }
} }
::v-deep .export-dialog{ ::v-deep .export-dialog{
@@ -594,7 +605,7 @@ export default {
} }
.Export-info:last-child{ .Export-info:last-child{
border: none; border: none;
} }
::v-deep.dr-dialog{ ::v-deep.dr-dialog{
max-width: 870px !important; max-width: 870px !important;