index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  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. outside: {
  42. default: false
  43. },
  44. },
  45. data() {
  46. return {
  47. }
  48. },
  49. mounted() {
  50. },
  51. methods: {
  52. // 点击专利号
  53. handleClick(row, index) {
  54. var location = (index + 1) + ((this.queryParams.current - 1) * this.queryParams.size)
  55. this.$emit('clickPatentNo', row, location)
  56. },
  57. changeSelect(patent) {
  58. const index1 = this.patentNoList.indexOf(patent.patentNo)
  59. if (index1 === -1) {
  60. this.patentNoList.push(patent.patentNo)
  61. } else {
  62. this.patentNoList.splice(index1, 1)
  63. }
  64. this.$emit('addSelect', patent.patentNo)
  65. }
  66. },
  67. }
  68. import { mapGetters } from "vuex"
  69. export const handleData = {
  70. // mixins: [highlight],
  71. props: {
  72. },
  73. data() {
  74. return {
  75. //专利类型
  76. patentType: {
  77. 1: '发明',
  78. 8: '发明',
  79. 2: '实用新型',
  80. 9: '实用新型',
  81. 3: '外观',
  82. 4: '授权发明'
  83. },
  84. // 专利状态
  85. simpleStatus: {
  86. 1: '有效',
  87. 2: '无效',
  88. 3: '审中',
  89. },
  90. // 法律状态(暂定)
  91. legalStatus: {
  92. 1: '有效',
  93. 2: '无效',
  94. 3: '审中',
  95. },
  96. }
  97. },
  98. computed: {
  99. ...mapGetters(['highlight'])
  100. },
  101. mounted() {
  102. },
  103. methods: {
  104. getCustomView(row,field){
  105. var data = row.customFields
  106. if(data && data.length>0){
  107. var fieldId = field.value
  108. var fieldType = field.type
  109. var obj = data.find(item=>{
  110. return item.field == fieldId && item.fieldType == fieldType
  111. })
  112. if(obj){
  113. var arr = obj.fieldValueVOS
  114. var text = arr.map(item=>item.value).join('<br>')
  115. return this.getViewDom(text, null)
  116. }
  117. return ''
  118. }
  119. return ''
  120. },
  121. //获取标题以及摘要译文
  122. async getTranslateByTIAndAb(row,key){
  123. var patentField = {
  124. "title":1,
  125. "abstractStr":2
  126. }
  127. var params = {
  128. patentNo:row.patentNo,
  129. patentField:patentField[key]
  130. }
  131. this.$api.getTranslateByTIAndAb(params).then(response=> {
  132. if(response.code == 200){
  133. var obj = response.data
  134. row[key].push(
  135. {
  136. if_origin:false,
  137. language:'CN',
  138. text_content:obj.translationContent
  139. }
  140. )
  141. }
  142. })
  143. },
  144. //摘要以及原文的数据战术
  145. getTranslate(row,key,type){
  146. var arr = row[key]
  147. if (!arr) {
  148. return ''
  149. }
  150. var change = row.change
  151. if(key == 'abstractStr'){
  152. change = row.change2
  153. }
  154. var text = ''
  155. if (!change) {
  156. var obj = arr.find(item => {
  157. return item.if_origin
  158. })
  159. text = ''
  160. if (obj) {
  161. text = obj.text_content
  162. }
  163. } else {
  164. var obj = arr.find(item => {
  165. return !item.if_origin && item.language == 'CN'
  166. })
  167. text = ''
  168. if (obj) {
  169. text = obj.text_content
  170. }
  171. else{
  172. this.getTranslateByTIAndAb(row,key)
  173. }
  174. }
  175. return this.getViewDom(text,type)
  176. },
  177. getView(row, key, type, prop, data) {
  178. var obj = {
  179. type: type ? type : 'String',
  180. value: key
  181. }
  182. if (row) {
  183. if(key == 'title' || key == 'abstractStr'){
  184. return this.getTranslate(row,key,type)
  185. }
  186. switch (key) {
  187. case "mipc"://ipc
  188. // var ipcArr = []
  189. // for (let k in row[key]) {
  190. // ipcArr.push(row[key][k])
  191. // }
  192. // var text = ipcArr.join('<br>')
  193. var text = ''
  194. if(!row[key]){
  195. }else{
  196. if(row[key].level5){
  197. text = row[key].level5
  198. break
  199. }
  200. var arr = Object.keys(row[key])
  201. if(arr.length>0){
  202. text = row[key][arr[arr.length-1]]
  203. }else{
  204. }
  205. }
  206. break;
  207. case 'inventor'://发明人
  208. case 'applicant'://申请人
  209. case 'rightHolder'://权利人
  210. var text = row[key].join('<br>')
  211. break;
  212. case 'legalStatus'://法律状态
  213. case 'simpleStatus'://专利状态
  214. case 'patentType'://专利类型
  215. var text = this[key][row[key]]
  216. break;
  217. default:
  218. var text = this.$commonJS.getColumnData(row, obj, prop, data)
  219. break
  220. }
  221. // var text = this.$commonJS.getColumnData(row, obj, prop, data)
  222. // console.log(text,key);
  223. return this.getViewDom(text, type)
  224. }
  225. },
  226. getViewDom(text, field,) {
  227. if (!text) {
  228. return ""
  229. }
  230. var obj = null
  231. switch (field) {
  232. // case '权利要求原文':
  233. // obj = text.find(item => {
  234. // return item.if_origin
  235. // })
  236. // if(obj){
  237. // var currentText = obj.text_content
  238. // text = currentText.replace(/(\t)+/g,'<br/>')
  239. // }else{
  240. // text = ''
  241. // }
  242. // break;
  243. // case '权利要求译文':
  244. // obj = text.find(item => {
  245. // return item.if_origin == false
  246. // })
  247. // if(obj){
  248. // var currentText = obj.text_content
  249. // text = currentText.replace(/(\t)+/g,'<br/>')
  250. // }else{
  251. // text = ''
  252. // }
  253. // break;
  254. case '说明书文本原文':
  255. obj = text.find(item => {
  256. return item.if_origin
  257. })
  258. if(obj){
  259. text = obj.text_content.replace(/(\r\n)+/g,'<br/>').replace(/(\t)+/g,'<br/>')
  260. }else {
  261. text = ''
  262. }
  263. break;
  264. case '说明书文本译文':
  265. obj = text.find(item => {
  266. return item.if_origin == false
  267. })
  268. if(obj){
  269. text = obj.text_content.replace(/(\r\n){1}/g,'<br/>').replace(/(\t)+/g,'<br/>')
  270. }else {
  271. text = ''
  272. }
  273. break;
  274. default:
  275. break;
  276. }
  277. if (!text) {
  278. return ""
  279. }
  280. if (this.patent && this.patent.patentNo && field) {
  281. // SET_PATENT_OPINION_CONTRAST
  282. var arr = ['piZhuContrastList', 'contrastList', 'opinionContrastList']
  283. arr.forEach((item, index) => {
  284. if (this.highlight[item].length > 0) {
  285. text = this.getObject(item, index, text, field)
  286. }
  287. });
  288. }
  289. if (!this.highlight.patentHightLight.ifEnable || !text) {
  290. return text
  291. }
  292. try {
  293. this.highlight.patentHightLight.configs.map(item => {
  294. const keywords = item.keywords.split(/;|;/)
  295. for (let keyword of keywords) {
  296. if (!keyword) {
  297. continue
  298. }
  299. let sText = text
  300. let num = -1
  301. const rStr = new RegExp(keyword, "g")
  302. const rHtml = new RegExp("\<.*?\>", "ig")
  303. const sKey = `<span style="background: ${item.color};color: #fff">${keyword}</span>`
  304. const aHtml = sText.match(rHtml)
  305. sText = sText.replace(rHtml, '{~}')
  306. sText = sText.replace(rStr, sKey)
  307. sText = sText.replace(/{~}/g, () => {
  308. num++
  309. return aHtml[num]
  310. })
  311. text = sText
  312. }
  313. })
  314. } catch (e) {
  315. }
  316. // console.log(text);
  317. return text
  318. },
  319. getObject(key, index, text, field) {
  320. var arr1 = ['color', 'Type', 'Id', 'column', 'index', 'text', 'remark', 'temNode', 'selectType']
  321. var obj = {
  322. // 'piZhuContrastList': ['color', 'scratchType', 'id', 'scratchField', 'position', 'text', 'remark'],
  323. 'piZhuContrastList': ['markColor', 'markType', 'id', 'markSelectField', 'markSite', 'markSelectText', 'markNoteText'],
  324. 'contrastList': ['markColor', 'markType', 'id', 'fieldName', 'position', 'evidenceText'],
  325. // 'opinionContrastList': ['color', 'scratchType', 'id', 'scratchField', 'position', 'content'],
  326. 'opinionContrastList': ['markColor', 'markType', 'id', 'scratchField', 'position', 'content'],
  327. }
  328. var selectType = ['p', 'c', 'o']
  329. var row = this.highlight[key]
  330. if (row.length > 0) {
  331. for (let i = 0; i < row.length; i++) {
  332. if (row[i].patentNo == this.patent.patentNo || (key == 'contrastList'&& (this.patent.patentNo != this.signPatentNo) && this.evidence && row[i].literatureId == this.evidence.id)) {
  333. if (row[i][obj[key][3]].indexOf(field) != -1) {
  334. var a = {}
  335. a.Type = 1
  336. obj[key].forEach((item, index1) => {
  337. if (item) {
  338. if (arr1[index1] == 'index') {
  339. a[arr1[index1]] = Number(row[i][item])
  340. } else {
  341. a[arr1[index1]] = row[i][item]
  342. }
  343. }
  344. });
  345. a.temNode = text
  346. a.selectType = selectType[index]
  347. text = this.AddClass1(a);
  348. }
  349. }
  350. }
  351. return text
  352. }
  353. },
  354. //切换原文译文
  355. handleChange(row, key) {
  356. if(!this.haveTranslatedText(row, key)){
  357. this.$message.warning('无译文')
  358. return
  359. }
  360. switch (key) {
  361. case "title":
  362. this.$set(row, 'change', !row.change)
  363. break
  364. case "abstractStr":
  365. this.$set(row, 'change2', !row.change2)
  366. // row.change2 = !row.change2
  367. break
  368. }
  369. this.$nextTick(()=>{
  370. if(this.$refs.table){
  371. this.$refs.table.doLayout();
  372. }
  373. })
  374. },
  375. //判断是否有译文
  376. haveTranslatedText(row,key){
  377. if(row.appCountry == 'CN' || this.outside){
  378. return false
  379. }
  380. if(row.appNo && row.appNo.substring(0,2)== 'CN'){
  381. return false
  382. }
  383. // var arr = row[key]
  384. // if (!arr) {
  385. // return false
  386. // }
  387. // if(arr.constructor != Array){
  388. // return false
  389. // }
  390. // var obj = arr.find(item => {
  391. // return item.if_origin
  392. // })
  393. // if(obj){
  394. // var text = obj.text_content
  395. // // if(language && language == 'CN'){
  396. // // return false
  397. // // }
  398. // var len = text.length / 2
  399. // const reg = /[\u4e00-\u9fa5]/g
  400. // var arr = text.match(reg) || []
  401. // if(arr.length > 0 && arr.length>=len){
  402. // return false
  403. // }
  404. // }
  405. return true
  406. // var obj = arr.find(item => {
  407. // return !item.if_origin && item.language == 'CN'
  408. // })
  409. // var text = ''
  410. // if (obj) {
  411. // text = obj.text_content
  412. // }
  413. // return text
  414. },
  415. },
  416. }
  417. export const highlight = {
  418. data() {
  419. return {
  420. }
  421. },
  422. computed: {
  423. // piZhuContrastList() {
  424. // return this.$store.state.highlight.piZhuContrastList
  425. // },
  426. // contrastList() {
  427. // return this.$store.state.highlight.contrastList
  428. // },
  429. // opinionContrastList() {
  430. // return this.$store.state.highlight.opinionContrastList
  431. // },
  432. },
  433. mounted() {
  434. window.mouseenter1 = this.mouseenter1
  435. window.mouseleave1 = this.mouseleave1
  436. },
  437. methods: {
  438. mouseenter1(e, id, selectType) {
  439. var dom = document.getElementsByClassName(id)
  440. var message = this.getMessage(id, selectType)
  441. // 普通for循环可以拿到dom节点,forEach是拿不到dom节点
  442. for (let i = 0; i < dom.length - 1; i++) {
  443. dom[i].classList.add('greenColor')
  444. this.getChildNodesAdd(dom[i].childNodes)
  445. }
  446. // e.target是获取当前的,dom获取的是所有的class相同的节点
  447. e.target.parentNode.classList.add("pizhuLightHeigh");
  448. if (message.remark) {
  449. e.target.parentNode.appendChild(this.addPara(message.remark, e));
  450. }
  451. },
  452. getMessage(id, selectType) {
  453. var Id = id.substring(1, id.length)
  454. var messageItem = {}
  455. if (selectType == 'p') {//批注
  456. var messageItem = this.highlight.piZhuContrastList.find(item => {
  457. return item.id == Id
  458. })
  459. } else if (selectType == 'c') {//对比
  460. var messageItem = this.highlight.contrastList.find(item => {
  461. return item.id == Id
  462. })
  463. } else if (selectType == 'o') {//
  464. var messageItem = this.highlight.opinionContrastList.find(item => {
  465. return item.id == Id
  466. })
  467. }
  468. return messageItem
  469. },
  470. // 添加背景色
  471. getChildNodesAdd(dom) {
  472. if (dom.length > 0) {
  473. for (let m = 0; m < dom.length; m++) {
  474. if (dom[m].nodeType == 1) {
  475. dom[m].classList.add('greenColor')
  476. }
  477. if (dom[m].childNodes.length > 0) {
  478. this.getChildNodesAdd(dom[m].childNodes)
  479. }
  480. }
  481. }
  482. },
  483. addPara(val, e) {
  484. //创建div标签
  485. var p = document.createElement("div");
  486. //添加class
  487. p.classList.add('showPiZhu')
  488. if (e.clientY - 200 < 200 && e.clientX + 200 > document.documentElement.clientWidth) {
  489. p.setAttribute('style', 'left:-200px')
  490. } else if ((e.clientX + 200 > document.documentElement.clientWidth && e.clientY + 200 > document.documentElement.clientHeight) || e.clientX + 200 > document.documentElement.clientWidth) {
  491. p.setAttribute('style', 'bottom:25px;left:-200px;')
  492. } else if ((e.clientY + 200 > document.documentElement.clientHeight && e.clientX - 200 < 200) || (e.clientY + 200 > document.documentElement.clientHeight && e.clientX - 200 > 200)) {
  493. p.setAttribute('style', 'bottom:20px;left:10px')
  494. }
  495. //创建文本节点
  496. var text = document.createTextNode(val);
  497. //将文本节点追加到元素节点中
  498. p.appendChild(text);
  499. return p
  500. },
  501. mouseleave1(e, id, selectType) {
  502. var dom = document.getElementsByClassName(id)
  503. e.target.parentNode.classList.remove("pizhuLightHeigh");
  504. var message = this.getMessage(id, selectType)
  505. if (message.remark) {
  506. document.getElementsByClassName('showPiZhu')[0].remove()
  507. }
  508. for (let i = 0; i < dom.length - 1; i++) {
  509. dom[i].classList.remove('greenColor')
  510. this.getChildNodesRemove(dom[i].childNodes)
  511. }
  512. },
  513. // 删除背景色
  514. getChildNodesRemove(dom) {
  515. if (dom.length > 0) {
  516. for (let m = 0; m < dom.length; m++) {
  517. if (dom[m].nodeType == 1) {
  518. dom[m].classList.remove('greenColor')
  519. }
  520. if (dom[m].childNodes.length > 0) {
  521. this.getChildNodesRemove(dom[m].childNodes)
  522. }
  523. }
  524. }
  525. },
  526. AddClass1(selectObject) {
  527. let el = selectObject.temNode;
  528. // 将当前页面获取到的字符串进行处理,返回当前页面所有的标签及文本
  529. var splitStrings = this.SplitHtmlTag1(el);
  530. let bgColor = selectObject.color;
  531. if (!bgColor) {
  532. selectObject.color = 'yellow'
  533. }
  534. // 添加线及高亮(2:波浪线,0:下划线,1:高亮)
  535. var style = ''
  536. switch (selectObject.Type + '') {
  537. case '0'://下划线
  538. style = `text-decoration-line: underline;text-decoration-color: ${selectObject.color}`
  539. break;
  540. case '1'://高亮
  541. style = `background-color:${selectObject.color}`
  542. break;
  543. case '2'://波浪线
  544. style = `text-decoration-line: underline;text-decoration-style: wavy ;text-decoration-color: ${selectObject.color}`
  545. break;
  546. case '5'://加粗
  547. style = `font-weight: bold;`
  548. break;
  549. }
  550. let startTag = `<span class="${selectObject.selectType + selectObject.Id}" id="${selectObject.selectType + selectObject.Id}" style="${style}">`
  551. //图标
  552. var a = 'icon-xinxi3'
  553. switch (selectObject.selectType) {
  554. case 'p'://批注
  555. a = 'iconfont icon-xinxi3'
  556. break;
  557. case 'c'://对比
  558. a = 'el-icon-location-outline'
  559. break;
  560. case 'o'://陈述意见
  561. a = 'iconfont icon-xinxi2'
  562. break;
  563. case 'r'://特征
  564. break
  565. }
  566. var imgTag = `<span class="${selectObject.selectType + selectObject.Id}" style="background-color:white !important;"><i class="${a}" style="vertical-align: super;background-color:white !important;" onclick="vm.selectMark('${selectObject.selectType + selectObject.Id}','${selectObject.selectType}')" onmouseenter="mouseenter1(event,'${selectObject.selectType + selectObject.Id}','${selectObject.selectType}')" onmouseleave="mouseleave1(event,'${selectObject.selectType + selectObject.Id}','${selectObject.selectType}')"></i></span>`
  567. if (selectObject.selectType == 'r') {//特征
  568. imgTag = `<span class="${selectObject.selectType + selectObject.Id}" style="background-color:white !important;"><i class="el-icon-delete" style="vertical-align: super;background-color:white !important;" onclick="deleteFeature('${selectObject.selectType + selectObject.Id}','${selectObject.selectType}')"></i></span>`
  569. }
  570. if(!selectObject.selectType){
  571. imgTag = ''
  572. }
  573. let endTag = '</span>';
  574. let elText = '';
  575. splitStrings.forEach(function (item) {
  576. if (item.type == 'text') {
  577. elText = elText + item.text;
  578. }
  579. });
  580. let Indexs = [];
  581. let i = 0
  582. if (selectObject.index < 0) {
  583. let pattern = new RegExp(selectObject.text.replace(/[\r\n]/g, "").replace(/\ +/g, ""), "g");
  584. while ((match = pattern.exec(elText)) != null) {
  585. Indexs[i] = match;
  586. i++;
  587. }
  588. } else {
  589. Indexs[i] = [selectObject.text];
  590. Indexs[i].index = selectObject.index;
  591. }
  592. Indexs.forEach(function (match) {
  593. let currentIndex = 0;
  594. let temSplitStrings = new Array();
  595. splitStrings.forEach(function (item) {
  596. if (item.type == 'text') {
  597. if (item.text) {
  598. if (match.index >= currentIndex && match.index < (currentIndex + item.text.length)) {
  599. if ((match.index + match[0].length) <= (currentIndex + item.text.length) && item.text.indexOf(match[0]) != -1) {
  600. if (match.index > currentIndex) {
  601. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  602. }
  603. temSplitStrings.push({ text: startTag, type: 'tag' });
  604. temSplitStrings.push({ text: match[0], type: 'text' });
  605. temSplitStrings.push({ text: imgTag, type: 'tag' });
  606. // }
  607. temSplitStrings.push({ text: endTag, type: 'tag' });
  608. if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
  609. temSplitStrings.push({ text: item.text.substring((match.index + match[0].length) - currentIndex), type: 'text' });
  610. }
  611. } else {
  612. if (item.text.indexOf(match[0]) != -1) {
  613. if (match.index > currentIndex) {
  614. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  615. }
  616. if (temSplitStrings.length > 1) {
  617. temSplitStrings.push({ text: startTag, type: 'tag' });
  618. } else {
  619. temSplitStrings.push({ text: startTag, type: 'tag' });
  620. }
  621. temSplitStrings.push({ text: item.text.substring(match.index - currentIndex), type: 'text' });
  622. temSplitStrings.push({ text: endTag, type: 'tag' });
  623. } else {
  624. // console.log(temSplitStrings,match.index,item.text,currentIndex,match[0])
  625. // debugger
  626. temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
  627. temSplitStrings.push({ text: startTag, type: 'tag' });
  628. temSplitStrings.push({ text: item.text.substring(match.index - currentIndex, item.text.length), type: 'text' });
  629. // temSplitStrings.push({ text: imgTag, type: 'tag' });
  630. temSplitStrings.push({ text: endTag, type: 'tag' });
  631. // return false
  632. // temSplitStrings.push(item);
  633. }
  634. }
  635. } else {
  636. if ((match.index + match[0].length) <= (currentIndex + item.text.length) && (match.index + match[0].length) > currentIndex) {
  637. temSplitStrings.push({ text: startTag, type: 'tag' });
  638. temSplitStrings.push({ text: item.text.substring(0, match.index + match[0].length - currentIndex), type: 'text' });
  639. temSplitStrings.push({ text: imgTag, type: 'tag' });
  640. temSplitStrings.push({ text: endTag, type: 'tag' });
  641. if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
  642. temSplitStrings.push({ text: item.text.substring((match.index + match[0].length - currentIndex)), type: 'text' });
  643. }
  644. } else {
  645. if (match.index < currentIndex && (match.index + match[0].length) >= (currentIndex + item.text.length)) {
  646. temSplitStrings.push({ text: startTag, type: 'tag' });
  647. temSplitStrings.push(item);
  648. temSplitStrings.push({ text: endTag, type: 'tag' });
  649. } else {
  650. temSplitStrings.push(item);
  651. }
  652. }
  653. }
  654. currentIndex = currentIndex + item.text.length;
  655. } else {
  656. temSplitStrings.push(item);
  657. }
  658. } else {
  659. temSplitStrings.push(item);
  660. }
  661. });
  662. splitStrings = temSplitStrings;
  663. });
  664. let temInnerHtml = '';
  665. splitStrings.forEach(function (item) {
  666. temInnerHtml = temInnerHtml + item.text;
  667. });
  668. return temInnerHtml;
  669. },
  670. SplitHtmlTag1(el) {
  671. let temInnerHtml = el.trim();
  672. let pattern = /<[^>]+>/g;
  673. let Indexs = [];
  674. let i = 0
  675. var match = null
  676. while ((match = pattern.exec(temInnerHtml)) != null) {
  677. Indexs[i] = match;
  678. i++;
  679. }
  680. var splitStrings = new Array();
  681. i = 0;
  682. var currentIndex = 0;
  683. for (var index = 0; index < Indexs.length; index++) {
  684. if (Indexs[index].index > currentIndex) {
  685. splitStrings[i] = { "text": temInnerHtml.substring(currentIndex, Indexs[index].index), "type": "text" };
  686. i++;
  687. splitStrings[i] = { "text": Indexs[index][0], "type": "tag" };
  688. i++;
  689. } else {
  690. splitStrings[i] = { "text": Indexs[index][0], "type": "tag" };
  691. i++;
  692. }
  693. currentIndex = Indexs[index].index + Indexs[index][0].length;
  694. }
  695. if (currentIndex < temInnerHtml.length) {
  696. splitStrings[i] = { "text": temInnerHtml.substring(currentIndex, temInnerHtml.length), "type": "text" };
  697. }
  698. return splitStrings;
  699. },
  700. },
  701. }