index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. export const projectData = {
  2. props: {
  3. // 视图数据源
  4. tableData: {
  5. type: Array,
  6. default: () => {
  7. return []
  8. }
  9. },
  10. // 分页信息
  11. queryParams: {
  12. type: Object,
  13. default: () => {
  14. return {
  15. current: 1,
  16. size:10
  17. }
  18. }
  19. },
  20. // 栏位
  21. column: {
  22. type: Array,
  23. default: () => {
  24. return []
  25. }
  26. },
  27. //专利号
  28. projectId:{
  29. default:0
  30. },
  31. //选择专利
  32. refresh:{
  33. default:false
  34. },
  35. patentNoList:{
  36. type: Array,
  37. default: () => {
  38. return []
  39. }
  40. }
  41. },
  42. data() {
  43. return {
  44. }
  45. },
  46. mounted() {
  47. },
  48. methods: {
  49. // 点击专利号
  50. handleClick(row, index) {
  51. var location = (index + 1) + ((this.queryParams.current - 1) * this.queryParams.size)
  52. this.$emit('clickPatentNo',row,location)
  53. },
  54. changeSelect(patent){
  55. const index1 = this.patentNoList.indexOf(patent.patentNo)
  56. if (index1 === -1) {
  57. if(this.projectId){
  58. this.patentNoList.push(patent.patentNo)
  59. }else{
  60. this.patentNoList.push(patent.appNo)
  61. }
  62. } else {
  63. this.patentNoList.splice(index1, 1)
  64. }
  65. }
  66. },
  67. }
  68. export const handleData = {
  69. // mixins: [highlight],
  70. props: {
  71. },
  72. data() {
  73. return {
  74. }
  75. },
  76. mounted() {
  77. },
  78. methods: {
  79. getView(row,key,type,prop,data) {
  80. var obj = {
  81. type: type?type:'String',
  82. value: key
  83. }
  84. const change = row.change
  85. const change2 = row.change2
  86. switch (key) {
  87. case "title":
  88. // prop = !change ? "content" : "contentOut"
  89. // obj.type = 'Object'
  90. var arr = row.title
  91. if(!arr){
  92. text = ''
  93. break
  94. }
  95. if(!change){
  96. var obj = arr.find(item=>{
  97. return item.if_origin
  98. })
  99. var text = ''
  100. if(obj){
  101. text = obj.text_content
  102. }
  103. }else{
  104. var obj = arr.find(item=>{
  105. return !item.if_origin && item.language == 'CN'
  106. })
  107. var text = ''
  108. if(obj){
  109. text = obj.text_content
  110. }
  111. }
  112. break
  113. case "abstractStr":
  114. // prop = !change2 ? "content" : "contentOut"
  115. // obj.type = 'Object'
  116. var arr = row.abstractStr
  117. if(!arr){
  118. text = ''
  119. break
  120. }
  121. if(!change2){
  122. var obj = arr.find(item=>{
  123. return item.if_origin
  124. })
  125. var text = ''
  126. if(obj){
  127. text = obj.text_content
  128. }
  129. }else{
  130. var obj = arr.find(item=>{
  131. return !item.if_origin && item.language == 'CN'
  132. })
  133. var text = ''
  134. if(obj){
  135. text = obj.text_content
  136. }
  137. }
  138. break;
  139. case "mipc":
  140. let ipcArr=[]
  141. for (let k in row[key]) {
  142. ipcArr.push(row[key][k])
  143. }
  144. row[`${key}2`] = ipcArr
  145. obj.value = `${key}2`
  146. obj.type = 'Array'
  147. var text = this.$commonJS.getColumnData(row, obj,prop,data)
  148. break;
  149. default:
  150. var text = this.$commonJS.getColumnData(row, obj,prop,data)
  151. break
  152. }
  153. // var text = this.$commonJS.getColumnData(row, obj, prop, data)
  154. // console.log(text,key);
  155. return this.getViewDom(text,key)
  156. },
  157. getViewDom(text, field) {
  158. if(!text){
  159. return ""
  160. }
  161. // if (this.contrastList.length > 0) {
  162. // for (let i = 0; i < this.contrastList.length; i++) {
  163. // if (this.contrastList[i].patentNo == this.patent.patentNo) {
  164. // if (this.contrastList[i].scratchField.indexOf(field) != -1) {
  165. // var a = {
  166. // color: this.contrastList[i].color,
  167. // Type: this.contrastList[i].scratchType,
  168. // Id: this.contrastList[i].id,
  169. // column: this.contrastList[i].scratchField,
  170. // index: Number(this.contrastList[i].position),
  171. // text: this.contrastList[i].text,
  172. // remark: this.contrastList[i].remark,
  173. // temNode: text
  174. // }
  175. // text = this.AddClass1(a);
  176. // }
  177. // }
  178. // }
  179. // }
  180. // if (!this.highlight.enable || !text) {
  181. // return text
  182. // }
  183. // try {
  184. // this.highlight.configs.map(item => {
  185. // const keywords = item.keywords.split(';')
  186. // for (let keyword of keywords) {
  187. // if (!keyword) {
  188. // continue
  189. // }
  190. // let sText = text
  191. // let num = -1
  192. // const rStr = new RegExp(keyword, "g")
  193. // const rHtml = new RegExp("\<.*?\>", "ig")
  194. // const sKey = `<span style="background: ${item.color};color: #fff">${keyword}</span>`
  195. // const aHtml = sText.match(rHtml)
  196. // sText = sText.replace(rHtml, '{~}')
  197. // sText = sText.replace(rStr, sKey)
  198. // sText = sText.replace(/{~}/g, () => {
  199. // num++
  200. // return aHtml[num]
  201. // })
  202. // text = sText
  203. // }
  204. // })
  205. // } catch (e) {
  206. // }
  207. // console.log(text);
  208. return text
  209. },
  210. //切换原文译文
  211. handleChange(row, key) {
  212. switch (key) {
  213. case "title":
  214. this.$set(row,'change',!row.change)
  215. break
  216. case "abstractStr":
  217. this.$set(row,'change2',!row.change2)
  218. // row.change2 = !row.change2
  219. break
  220. }
  221. },
  222. },
  223. }
  224. export const highlight = {
  225. data() {
  226. return {
  227. }
  228. },
  229. methods: {
  230. AddClass1(selectObject) {
  231. let el = selectObject.temNode;
  232. // 将当前页面获取到的字符串进行处理,返回当前页面所有的标签及文本
  233. var splitStrings = this.SplitHtmlTag1(el);
  234. let bgColor = selectObject.color;
  235. // 添加线及高亮
  236. let startTag = '<span class="' + selectObject.Id + '" id="' + selectObject.Id + '" style="background-color:' + selectObject.color + '">';
  237. if (selectObject.Type == 0) {
  238. startTag = '<span class="' + selectObject.Id + '" id="' + selectObject.Id + '" style="border-bottom:2px solid ' + selectObject.color + '">';
  239. }
  240. if (selectObject.Type == 2) {
  241. startTag = '<span class = "' + selectObject.Id + '" id="' + selectObject.Id + '" style = "text-decoration-line: underline;text-decoration-style: wavy ;text-decoration-color: ' + selectObject.color + '">';
  242. }
  243. // let imgTag = '<span class="' + selectObject.Id + '" style="background-color:white !important;"><i class="el-icon-location-outline" style="vertical-align: super;background-color:white !important;" onclick="selectMark(\'' + selectObject.Id + '\')" onmouseenter="mouseenter1(event,\'' + selectObject.Id + '\')" onmouseleave="mouseleave1(event,\'' + selectObject.Id + '\')"></i></span>';
  244. let imgTag = '<span class="' + selectObject.Id + '" style="background-color:white !important;"><i class="iconfont icon-xinxi3" style="vertical-align: super;background-color:white !important;" onclick="selectMark(\'' + selectObject.Id + '\')" onmouseenter="mouseenter1(event,\'' + selectObject.Id + '\')" onmouseleave="mouseleave1(event,\'' + selectObject.Id + '\')"></i></span>';
  245. let endTag = '</span>';
  246. let elText = '';
  247. splitStrings.forEach(function (item) {
  248. if (item.type == 'text') {
  249. elText = elText + item.text;
  250. }
  251. });
  252. let Indexs = [];
  253. let i = 0
  254. if (selectObject.index < 0) {
  255. let pattern = new RegExp(selectObject.text.replace(/[\r\n]/g, "").replace(/\ +/g, ""), "g");
  256. while ((match = pattern.exec(elText)) != null) {
  257. Indexs[i] = match;
  258. i++;
  259. }
  260. } else {
  261. Indexs[i] = [selectObject.text];
  262. Indexs[i].index = selectObject.index;
  263. }
  264. Indexs.forEach(function (match) {
  265. let currentIndex = 0;
  266. let temSplitStrings = new Array();
  267. splitStrings.forEach(function (item) {
  268. if (item.type == 'text') {
  269. if (item.text) {
  270. if (match.index >= currentIndex && match.index < (currentIndex + item.text.length)) {
  271. if (selectObject.column.indexOf('权利要求') != -1) {
  272. item.text = item.text.replace(/\r/g, ' ')
  273. if (item.text.match(/\r/g)) {
  274. match.index -= 1
  275. }
  276. }
  277. if (selectObject.column.indexOf('说明书') != -1) {
  278. item.text = item.text.replace(/\r/g, "")
  279. }
  280. if ((match.index + match[0].length) <= (currentIndex + item.text.length) && item.text.indexOf(match[0]) != -1) {
  281. if (match.index > currentIndex) {
  282. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  283. }
  284. temSplitStrings.push({ text: startTag, type: 'tag' });
  285. temSplitStrings.push({ text: match[0], type: 'text' });
  286. temSplitStrings.push({ text: imgTag, type: 'tag' });
  287. // }
  288. temSplitStrings.push({ text: endTag, type: 'tag' });
  289. if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
  290. temSplitStrings.push({ text: item.text.substring((match.index + match[0].length) - currentIndex), type: 'text' });
  291. }
  292. } else {
  293. if (item.text.indexOf(match[0]) != -1) {
  294. if (match.index > currentIndex) {
  295. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  296. }
  297. if (temSplitStrings.length > 1) {
  298. temSplitStrings.push({ text: startTag, type: 'tag' });
  299. } else {
  300. temSplitStrings.push({ text: startTag, type: 'tag' });
  301. }
  302. temSplitStrings.push({ text: item.text.substring(match.index - currentIndex), type: 'text' });
  303. temSplitStrings.push({ text: endTag, type: 'tag' });
  304. } else {
  305. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  306. temSplitStrings.push({ text: startTag, type: 'tag' });
  307. temSplitStrings.push({ text: item.text.substring( match.index - currentIndex,item.text.length), type: 'text' });
  308. temSplitStrings.push({ text: endTag, type: 'tag' });
  309. }
  310. }
  311. } else {
  312. if ((match.index + match[0].length) <= (currentIndex + item.text.length) && (match.index + match[0].length) > currentIndex) {
  313. temSplitStrings.push({ text: startTag, type: 'tag' });
  314. temSplitStrings.push({ text: item.text.substring(0, match.index + match[0].length - currentIndex), type: 'text' });
  315. temSplitStrings.push({ text: imgTag, type: 'tag' });
  316. temSplitStrings.push({ text: endTag, type: 'tag' });
  317. if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
  318. temSplitStrings.push({ text: item.text.substring((match.index + match[0].length - currentIndex)), type: 'text' });
  319. }
  320. } else {
  321. if (match.index < currentIndex && (match.index + match[0].length) >= (currentIndex + item.text.length)) {
  322. temSplitStrings.push({ text: startTag, type: 'tag' });
  323. temSplitStrings.push(item);
  324. temSplitStrings.push({ text: endTag, type: 'tag' });
  325. } else {
  326. temSplitStrings.push(item);
  327. }
  328. }
  329. }
  330. currentIndex = currentIndex + item.text.length;
  331. } else {
  332. temSplitStrings.push(item);
  333. }
  334. } else {
  335. temSplitStrings.push(item);
  336. }
  337. });
  338. splitStrings = temSplitStrings;
  339. });
  340. let temInnerHtml = '';
  341. splitStrings.forEach(function (item) {
  342. temInnerHtml = temInnerHtml + item.text;
  343. });
  344. return temInnerHtml;
  345. },
  346. },
  347. }