annotation.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div>
  3. <el-dialog title="批注" v-draggable :visible.sync="visible" width="500px" custom-class="checkFile"
  4. :before-close="cancel" :modal="false" :close-on-click-modal="false" :modal-append-to-body="false">
  5. <div
  6. style="display:flex;justify-content: space-between;font-size:14px;border-bottom: 1px white solid;padding-bottom: 5px;">
  7. <p style="font-weight:800;margin:0">{{ userinfo.name }}</p>
  8. <p style="margin:0">{{ getDate() }}</p>
  9. </div>
  10. <div>
  11. <p style="display: flex;align-items: center;"><span style="width: 60px;">内容:</span><span
  12. style="width: 100%;"><el-input type="textarea" v-model="mark.markSelectText" readonly
  13. rows="2"></el-input></span></p>
  14. </div>
  15. <div>
  16. <p><span>颜色:</span>
  17. <span>
  18. <el-input type="color" size="small" class="changeColor" v-model="mark.markColor"
  19. style="user-select:none;width:100px"> </el-input>
  20. </span>
  21. </p>
  22. <p><span>类型:</span>
  23. <span>
  24. <el-radio-group v-model="mark.markType">
  25. <el-radio :label="2">波浪线</el-radio>
  26. <el-radio :label="0">下划线</el-radio>
  27. <el-radio :label="1">高亮</el-radio>
  28. </el-radio-group>
  29. </span>
  30. </p>
  31. </div>
  32. <div>
  33. <p style="display:flex">
  34. <!-- createFrom 0默认(专利)1专题库2报告 -->
  35. <span>可见范围:</span>
  36. <span>
  37. <el-radio-group v-model="mark.publicScope">
  38. <!-- <el-radio :label="1">{{ createFromText[mark.createFrom] }}</el-radio>
  39. <el-radio :label="0">非{{ createFromText[mark.createFrom] }}</el-radio> -->
  40. <el-radio :label="1">当前位置可见</el-radio>
  41. <el-radio :label="0">全部位置可见</el-radio>
  42. </el-radio-group>
  43. </span>
  44. </p>
  45. <p>
  46. <span>使用权限:</span>
  47. <span>
  48. <el-switch v-model="mark.isPublic" active-color="#13ce66" inactive-color="#ff4949" active-text="所有人可见">
  49. </el-switch>
  50. <!-- <el-radio-group v-model="mark.isPublic">
  51. <el-radio :label="1">所有人可见</el-radio>
  52. <el-radio :label="0">本人可见</el-radio>
  53. </el-radio-group> -->
  54. </span>
  55. </p>
  56. </div>
  57. <div style="user-select: none;">
  58. <p style="margin-bottom:5px">标注:</p>
  59. <el-input v-model="mark.markNoteText" type="textarea" class="my-input-preview"></el-input>
  60. </div>
  61. <div style="display:flex;justify-content: flex-end;align-items:center;">
  62. <el-button type="text" @click="cancel">取消</el-button>
  63. <el-button type="text" v-if="mark.id" @click="handleDelete">删除</el-button>
  64. <el-button type="text" @click="submit">确定</el-button>
  65. </div>
  66. </el-dialog>
  67. </div>
  68. </template>
  69. <script>
  70. import { mapGetters } from 'vuex'
  71. export default {
  72. data() {
  73. return {
  74. // 控制弹窗开关
  75. visible: false,
  76. // 批注的内容
  77. mark: {},
  78. // 可见范围
  79. createFromText: {
  80. '0': '本专利可见',
  81. '1': '本专利数据库可见',
  82. '2': '本报告可见',
  83. }
  84. }
  85. },
  86. computed: {
  87. ...mapGetters(['userinfo', 'contextMenu']),
  88. // 批注相关信息
  89. piZhuContrastList() {
  90. return this.$store.state.highlight.piZhuContrastList
  91. },
  92. },
  93. mounted() {
  94. },
  95. methods: {
  96. // 点击波浪线等样式直接调用
  97. submit2(markType) {
  98. this.getData(markType)
  99. this.submit()
  100. },
  101. // 查询批注
  102. queryScratchWords() {
  103. let params = {
  104. patentNo: this.contextMenu.mark.patentNo,
  105. projectId: this.contextMenu.mark.projectId
  106. }
  107. this.$api.queryScratchWords(params).then(response => {
  108. if (response.code == 200) {
  109. if (this.piZhuContrastList.length > 0) {
  110. var a = this.piZhuContrastList.filter(item => {
  111. return item.patentNo != params.patentNo
  112. }).concat(response.data.data)
  113. } else {
  114. var a = response.data.data
  115. }
  116. this.$store.commit('SET_PATENT_PIZHU_CONTRAST', a)
  117. }
  118. })
  119. },
  120. // 确定
  121. submit() {
  122. // console.log(this.mark.id);
  123. if (this.mark.id) {
  124. this.$api.updateDimension(this.mark).then(response => {
  125. if (response.code == 200) {
  126. this.$message.success('修改批注成功')
  127. let index = this.piZhuContrastList.findIndex(item => {
  128. return item.id == this.mark.id
  129. })
  130. if (index != -1) {
  131. this.piZhuContrastList.splice(index, 1, this.mark)
  132. }
  133. this.cancel()
  134. }
  135. }).catch(error => {
  136. this.$message.error('修改批注失败')
  137. })
  138. } else {
  139. this.$api.addScratchWords(this.mark).then(response => {
  140. if (response.code == 200) {
  141. this.$message.success('添加批注成功')
  142. var piZhuContrastList = this.piZhuContrastList
  143. this.mark.id = response.data.data
  144. piZhuContrastList.push(this.mark)
  145. this.$store.commit('SET_PATENT_PIZHU_CONTRAST', piZhuContrastList)
  146. this.cancel()
  147. }
  148. }).catch(error => {
  149. // this.$message.error('添加批注失败')
  150. })
  151. }
  152. },
  153. // 删除
  154. handleDelete() {
  155. let ids = [this.mark.id]
  156. this.$api.removeScratchWords(ids).then(response => {
  157. if (response.code == 200) {
  158. this.$message.success('删除批注成功')
  159. let index = this.piZhuContrastList.findIndex(item => {
  160. return item.id == this.mark.id
  161. })
  162. if (index != -1) {
  163. this.piZhuContrastList.splice(index, 1)
  164. }
  165. this.cancel()
  166. }
  167. }).catch(error => {
  168. this.$message.error('删除批注失败')
  169. })
  170. },
  171. // 取消
  172. cancel() {
  173. this.visible = false
  174. },
  175. // 显示时间
  176. getDate() {
  177. let date = new Date()
  178. var Y = date.getFullYear().toString()
  179. var m = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1).toString() : "0" + (date.getMonth() + 1)
  180. var d = date.getDate() > 9 ? date.getDate().toString() : "0" + date.getDate()
  181. var H = date.getHours() > 9 ? date.getHours().toString() : "0" + date.getHours()
  182. var M = date.getMinutes() > 9 ? date.getMinutes().toString() : "0" + date.getMinutes()
  183. var S = date.getSeconds() > 9 ? date.getSeconds().toString() : "0" + date.getSeconds()
  184. return Y + '-' + m + '-' + d + ' ' + H + ':' + M + ':' + S
  185. },
  186. // 处理数据
  187. getData(markType) {
  188. let mark = this.contextMenu.mark
  189. this.mark = {
  190. Id: mark.Id,
  191. id: mark.id,//已添加数据的id
  192. patentNo: mark.patentNo,//专利号
  193. isPublic: mark.id ? mark.isPublic : mark.permissionType,//是否所有人可见
  194. markColor: mark.markColor,//标注颜色
  195. markNoteText: mark.markNoteText,//标注备注
  196. markType: (markType ==0 ||markType)?markType:mark.markType,//标注方式(波浪线)
  197. markSelectField: mark.id ? mark.markSelectField : mark.column,//标注栏位
  198. markSelectText: mark.id ? mark.markSelectText : mark.text,//标注文本
  199. markSite: mark.id ? mark.markSite : mark.position,//选中文本的起始位置
  200. publicScope: mark.id ? mark.publicScope : 1,//标注的权限范围(本专利可见、本专题库可见、本报告可见都是传1,在所有地方可见是传0)
  201. createFrom: mark.createFrom,//是在哪里进行的标注
  202. projectId: mark.projectId,//项目id
  203. patentTitle:mark.patentTitle,//当前专利标题
  204. }
  205. },
  206. // 打开弹窗
  207. open() {
  208. // console.log(this.projectId, this.contextMenu, this.contextMenu.mark.createFrom);
  209. this.getData()
  210. // console.log(this.mark, this.contextMenu.mark.createFrom);
  211. this.visible = true
  212. },
  213. },
  214. }
  215. </script>
  216. <style lang="scss" scoped></style>