Merge pull request #20 from FleyX/dev

fix:路径收藏增加删除
This commit is contained in:
FleyX 2022-08-22 14:34:09 +08:00 committed by GitHub
commit fe70be3206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -137,12 +137,14 @@ export default {
this.showSave = false; this.showSave = false;
this.$message.success("操作成功"); this.$message.success("操作成功");
}, },
//
async cancelSavePath() { async cancelSavePath() {
await HttpUtil.delete("/file/path/delete", { id: this.curSavePathId }); await HttpUtil.delete("/file/path/delete", { id: this.curSavePathId });
this.refreshSavePathList(); this.refreshSavePathList();
this.$emit("refreshSavePathList"); this.$emit("refreshSavePathList");
this.$message.success("操作成功"); this.$message.success("操作成功");
}, },
//
changePath(item) { changePath(item) {
this.pathList = JSON.parse(item.content); this.pathList = JSON.parse(item.content);
this.breadcrumbClick(this.pathList.length - 1); this.breadcrumbClick(this.pathList.length - 1);

View File

@ -12,7 +12,18 @@
<el-button type="primary" @click="showFileAdd" size="small">新增</el-button> <el-button type="primary" @click="showFileAdd" size="small">新增</el-button>
<el-button type="primary" size="small" @click="selectAllFiles">反选</el-button> <el-button type="primary" size="small" @click="selectAllFiles">反选</el-button>
<el-button type="danger" size="small" @click="deleteCheckedFiles">删除</el-button> <el-button type="danger" size="small" @click="deleteCheckedFiles">删除</el-button>
收藏路径:<el-button v-for="item in savePathList" :key="item.id" @click="clickSavePath(item)" type="primary" text>{{ item.name }}</el-button> 收藏路径:<el-tag
v-for="item in savePathList"
:round="true"
class="savePath"
closable
:key="item.id"
@click="clickSavePath(item)"
@close="deleteSavePath(item)"
type="primary"
text
>{{ item.name }}</el-tag
>
</div> </div>
<div class="fileBlock"> <div class="fileBlock">
<!-- 左侧原始文件名 --> <!-- 左侧原始文件名 -->
@ -177,6 +188,11 @@ export default {
this.$refs["fileChose"].changePath(item); this.$refs["fileChose"].changePath(item);
}); });
}, },
async deleteSavePath(item) {
console.log(item);
await HttpUtil.delete("/file/path/delete", { id: item.id });
await this.refreshSavePathList();
},
async refreshSavePathList() { async refreshSavePathList() {
this.savePathList = await HttpUtil.get("/file/path"); this.savePathList = await HttpUtil.get("/file/path");
}, },
@ -234,6 +250,10 @@ function readChar(a, i, n) {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.savePath {
cursor: pointer;
margin-right: 0.5em;
}
.fileList { .fileList {
margin-top: 20px; margin-top: 20px;
text-align: left; text-align: left;