提交 168298f1 authored 作者: 龙菲's avatar 龙菲

修复新增笔记自动清空的问题;修复新增笔记时tag为id的问题

上级 b82bdfd8
......@@ -48,7 +48,7 @@
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
:value="item.label"
>
</el-option>
</el-select>
......@@ -207,12 +207,14 @@ export default {
const formData = new FormData();
const { jsonStr } = this.form;
const annotation = new Annotation(jsonStr);
this.form.jsonStr.color = this.currentColor; //回填颜色
this.form.jsonStr.subtype = this.subtype; //回填下划线类型
this.form.jsonStr.annotationType = annotation.getType(this.subtype); //回填annotationType
// console.log("this.form", this.form);
this.form.jsonStr = JSON.stringify(this.form.jsonStr); //字符串化jsonStr,传给后台的是json字符串
// return;
const { currentColor, subtype } = this;
let jsonStrCopy = JSON.parse(JSON.stringify(this.form.jsonStr));
jsonStrCopy = Object.assign(jsonStrCopy, {
color: currentColor,
annotationType: annotation.getType(subtype),
subtype,
});
this.form.jsonStr = JSON.stringify(jsonStrCopy); //字符串化jsonStr,传给后台的是json字符串
for (const key in this.form) {
if (key == "tagsArr") {
formData.append("tags", this.form.tagsArr.join(","));
......@@ -231,9 +233,7 @@ export default {
this.$message.success("操作成功!");
this.dialogVisible = false;
this.$emit("update");
setTimeout(() => {
this.$refs.form.resetFields();
}, 500);
this.$refs.form.resetFields();
}
// 清空表单项
}
......@@ -270,6 +270,7 @@ export default {
// 点击选择颜色
handleClickColor(color) {
this.currentColor = color;
console.log("this.currentColor", this.currentColor);
},
},
};
......
......@@ -12,6 +12,7 @@
clearable
></el-input>
<el-select
v-if="!currrentFileOnly"
size="mini"
v-model="searchParams.tagId"
filterable
......@@ -36,7 +37,11 @@
<i class="el-icon-refresh"></i>
<span>{{ noteList.records.length }}条数据</span>
</div>
<div class="note-list" v-if="noteList.records.length > 0" v-loading="loading">
<div
class="note-list"
v-if="noteList.records.length > 0"
v-loading="loading"
>
<el-card
class="note-item"
v-for="(item, index) in noteList.records"
......@@ -139,18 +144,34 @@
<script>
// import { notes } from "./mockData";
import { getNoteByTag, getNoteAllTagList } from "@/api/doc/index";
import {
getNoteByTag,
getNoteAllTagList,
getNoteByFile,
} from "@/api/doc/index";
import noteOperationMixins from "@/views/mine/myNote/components/noteOperationMixins";
export default {
//noteOperationMixins主要混入属性form、handleNoteOperation方法、AddOrUpdateNoteDialog组件
mixins: [noteOperationMixins],
props: {
// 是否只读,若只读可以新建笔记和查看笔记列表,若可以编辑则只能查看笔记列表
readOnly: {
type: Boolean,
default: true,
},
// // 是否只读,若只读可以新建笔记和查看笔记列表,若可以编辑则只能查看笔记列表
// readOnly: {
// type: Boolean,
// default: true,
// },
// // 是否只看当前文件的笔记,创作时可以看全部的笔记,pdf时只看当前文件的笔记
// currrentFileOnly: {
// type: Boolean,
// default: true,
// },
// //若只能看当前文件的笔记,需传此
// fileId:{
// type: String | Number,
// default: '',
// }
},
// 子/孙组件中用inject接收父组件传来的值,全部返回的都是函数来确保响应式,需要调用才能获取值
inject: ["readOnly", "currrentFileOnly", "fileId"],
data() {
return {
searchParams: {
......@@ -191,28 +212,49 @@ export default {
};
},
mounted() {
this.loadNoteList();
this.$nextTick(() => {
this.loadNoteList();
});
},
methods: {
// 加载笔记列表
async loadNoteList() {
this.loading = true;
const { current, size } = this.noteList;
const { content, tagId } = this.searchParams;
const { content } = this.searchParams;
const fileId = this.fileId();
const params = {
currentPage: current,
pageCount: size,
id: tagId,
fileId,
content,
};
let res = await getNoteByTag(params);
let res = await getNoteByFile(params);
this.oldContent = content;
this.loading = false;
if (res.code == 200) {
this.noteList = res.data;
this.loadTagList();
}
},
// 加载笔记列表
// async loadNoteList() {
// this.loading = true;
// const { current, size } = this.noteList;
// const { content, tagId } = this.searchParams;
// const params = {
// currentPage: current,
// pageCount: size,
// id: tagId,
// content,
// };
// let res = await getNoteByTag(params);
// this.oldContent = content;
// this.loading = false;
// if (res.code == 200) {
// this.noteList = res.data;
// this.loadTagList();
// }
// },
// 搜索
handleSearch() {
this.loadNoteList();
......
......@@ -6,6 +6,7 @@
<NoteList
ref="NoteList"
:readOnly="readOnly"
:currrentFileOnly="currrentFileOnly"
@insertText="handleInsertText"
@handleOpenAddUpdateDialog="handleOpenAddUpdateDialog"
/>
......@@ -29,13 +30,20 @@ export default {
components: {
NoteList,
},
props: {
// 是否只读,若只读可以新建笔记和查看笔记列表,若可以编辑则只能查看笔记列表
readOnly: {
type: Boolean,
default: true,
},
},
// props: {
// // 是否只读,若只读可以新建笔记和查看笔记列表,若可以编辑则只能查看笔记列表
// readOnly: {
// type: Boolean,
// default: true,
// },
// // 是否只看当前文件的笔记,创作时可以看全部的笔记,pdf时只看当前文件的笔记
// currrentFileOnly: {
// type: Boolean,
// default: true,
// },
// },
// 子/孙组件中用inject接收父组件传来的值
inject: ["readOnly", "currrentFileOnly", "fileId"],
data() {
return {
visible: false, //面板的可见性,用于控制按钮是否是悬浮
......@@ -43,13 +51,10 @@ export default {
currentTab: "新建笔记",
};
},
mounted(){
console.log('this.readOnly',this.readOnly);
},
methods: {
// 获取笔记
loadNoteData() {
this.$refs.NoteList.NoteList();
this.$refs.NoteList.loadNoteList();
},
//插入文字
handleInsertText(value) {
......
......@@ -15,7 +15,9 @@
/>
</div>
<RightPanel
ref="RightPanel"
readOnly
currrentFileOnly
:class="[
'right-panel',
panelVisible ? 'translateXLeft' : 'translateXRight',
......@@ -44,6 +46,20 @@ export default {
RightPanel,
AddOrUpdateNoteDialog,
},
// 向子/孙组件注入依赖,不论组件层次有多深,并在其上下游关系成立的时间里始终生效。
provide() {
return {
currrentFileOnly: () => {
return true; //使用方法返回保证响应式
},
readOnly: () => {
return true; //使用方法返回保证响应式
},
fileId: () => {
return this.form.docId; //使用方法返回保证响应式
},
};
},
data() {
return {
// url: "http://192.168.1.5:5432/files/upload/20230919/1008502f32c92041fee8d248981770d1.pdf",
......@@ -106,7 +122,7 @@ export default {
}
});
this.pdfAnnotInstance.renderAnnots(annotsMap);
this.pdfAnnotInstance.switchPage(3);
// this.pdfAnnotInstance.switchPage(3);
},
// 复制文本
copyText(value) {
......
<template>
<div class="table">
<div class="mb8">
<el-button
<!-- <el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiCollect"
>批量收藏</el-button
>
> -->
<el-button
type="primary"
plain
......
......@@ -35,8 +35,8 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.1.4:5236`,
// target: `http://192.168.1.5:5236`,
// target: `http://192.168.1.4:5236`,
target: `http://192.168.1.5:5236`,
// target: `http://222.85.214.245:9600`,
// target: `http://222.85.214.245:9558`,
// target: `http://172.24.100.246:9600`,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论