123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- export const projectData = {
- props: {
- // 视图数据源
- tableData: {
- type: Array,
- default: () => {
- return []
- }
- },
- // 分页信息
- queryParams: {
- type: Object,
- default: () => {
- return {
- current: 1,
- size:10
- }
- }
- },
- // 栏位
- column: {
- type: Array,
- default: () => {
- return []
- }
- }
- },
- data() {
- return {
-
- }
- },
- mounted() {
-
- },
- methods: {
- // 点击专利号
- handleClick(row,key){},
- },
- }
- export const handleData = {
- // mixins: [highlight],
- props: {
- selected: {
- type: Array
- },
- patentNoList:{
- type: Array
- }
- },
- data() {
- return {
- refresh: true,
- click: false,
- projectId:''
- }
- },
- mounted() {
-
- },
- methods: {
- getViewDom2(row, key, field) {
- let text = ""
- const change = row.change
- text = !change ? row[key][0].text_content : row[key][1].text_content
- return this.getViewDom(text,field)
- },
- getView(row,key,type,prop,data) {
- var obj = {
- type: type?type:'String',
- value: key
- }
- var text = this.$commonJS.getColumnData(row, obj,prop,data)
- return this.getViewDom(text,key)
- },
- getViewDom(text, field) {
- if(!text){
- return ""
- }
- // if (this.contrastList.length > 0) {
- // for (let i = 0; i < this.contrastList.length; i++) {
- // if (this.contrastList[i].patentNo == this.patent.patentNo) {
- // if (this.contrastList[i].scratchField.indexOf(field) != -1) {
- // var a = {
- // color: this.contrastList[i].color,
- // Type: this.contrastList[i].scratchType,
- // Id: this.contrastList[i].id,
- // column: this.contrastList[i].scratchField,
- // index: Number(this.contrastList[i].position),
- // text: this.contrastList[i].text,
- // remark: this.contrastList[i].remark,
- // temNode: text
- // }
- // text = this.AddClass1(a);
- // }
- // }
- // }
- // }
- // if (!this.highlight.enable || !text) {
- // return text
- // }
- // try {
- // this.highlight.configs.map(item => {
- // const keywords = item.keywords.split(';')
- // for (let keyword of keywords) {
- // if (!keyword) {
- // continue
- // }
- // let sText = text
- // let num = -1
- // const rStr = new RegExp(keyword, "g")
- // const rHtml = new RegExp("\<.*?\>", "ig")
- // const sKey = `<span style="background: ${item.color};color: #fff">${keyword}</span>`
- // const aHtml = sText.match(rHtml)
- // sText = sText.replace(rHtml, '{~}')
- // sText = sText.replace(rStr, sKey)
- // sText = sText.replace(/{~}/g, () => {
- // num++
- // return aHtml[num]
- // })
- // text = sText
- // }
- // })
- // } catch (e) {
- // }
- return text
- },
- //切换原文译文
- handleChange(row, key) {
- switch (key) {
- case "name":
- row.change = !row.change
- break
- case "abstractStr":
- row.change2 = !row.change2
- break
- }
- },
- // 点击专利号进行跳转
- handleLink(row) {
-
- // window.open(router.href, '_blank');
- },
- // 勾选中专利进行处理
- changeSelect(patent) {
- this.click = true
- const index1 = this.patentNoList.indexOf(patent.patentNo)
- if (index1 === -1) {
- if(this.projectId){
- this.patentNoList.push(patent.patentNo)
- }else{
- this.patentNoList.push(patent.applicationNo)
- }
-
- } else {
- this.patentNoList.splice(index1, 1)
- }
- if(patent.id){
- const index = this.selected.indexOf(patent.id)
- if (index === -1) {
- this.selected.push(patent.id)
- } else {
- this.selected.splice(index, 1)
- }
- }
-
- this.$emit('select-change', this.selected)
- this.$emit('addSelect',patent.applicationNo)
- },
- },
- }
- export const highlight = {
-
- data() {
- return {
-
- }
- },
- methods: {
- AddClass1(selectObject) {
- let el = selectObject.temNode;
- // 将当前页面获取到的字符串进行处理,返回当前页面所有的标签及文本
- var splitStrings = this.SplitHtmlTag1(el);
- let bgColor = selectObject.color;
- // 添加线及高亮
- let startTag = '<span class="' + selectObject.Id + '" id="' + selectObject.Id + '" style="background-color:' + selectObject.color + '">';
- if (selectObject.Type == 0) {
- startTag = '<span class="' + selectObject.Id + '" id="' + selectObject.Id + '" style="border-bottom:2px solid ' + selectObject.color + '">';
- }
- if (selectObject.Type == 2) {
- startTag = '<span class = "' + selectObject.Id + '" id="' + selectObject.Id + '" style = "text-decoration-line: underline;text-decoration-style: wavy ;text-decoration-color: ' + selectObject.color + '">';
- }
- // 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>';
- 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>';
- let endTag = '</span>';
- let elText = '';
- splitStrings.forEach(function (item) {
- if (item.type == 'text') {
- elText = elText + item.text;
- }
- });
- let Indexs = [];
- let i = 0
- if (selectObject.index < 0) {
- let pattern = new RegExp(selectObject.text.replace(/[\r\n]/g, "").replace(/\ +/g, ""), "g");
- while ((match = pattern.exec(elText)) != null) {
- Indexs[i] = match;
- i++;
- }
- } else {
- Indexs[i] = [selectObject.text];
- Indexs[i].index = selectObject.index;
- }
- Indexs.forEach(function (match) {
- let currentIndex = 0;
- let temSplitStrings = new Array();
- splitStrings.forEach(function (item) {
- if (item.type == 'text') {
- if (item.text) {
- if (match.index >= currentIndex && match.index < (currentIndex + item.text.length)) {
- if (selectObject.column.indexOf('权利要求') != -1) {
- item.text = item.text.replace(/\r/g, ' ')
- if (item.text.match(/\r/g)) {
- match.index -= 1
- }
- }
- if (selectObject.column.indexOf('说明书') != -1) {
- item.text = item.text.replace(/\r/g, "")
- }
-
- if ((match.index + match[0].length) <= (currentIndex + item.text.length) && item.text.indexOf(match[0]) != -1) {
- if (match.index > currentIndex) {
- temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
- }
- temSplitStrings.push({ text: startTag, type: 'tag' });
- temSplitStrings.push({ text: match[0], type: 'text' });
- temSplitStrings.push({ text: imgTag, type: 'tag' });
- // }
- temSplitStrings.push({ text: endTag, type: 'tag' });
- if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
- temSplitStrings.push({ text: item.text.substring((match.index + match[0].length) - currentIndex), type: 'text' });
- }
- } else {
- if (item.text.indexOf(match[0]) != -1) {
- if (match.index > currentIndex) {
- temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
- }
- if (temSplitStrings.length > 1) {
- temSplitStrings.push({ text: startTag, type: 'tag' });
- } else {
- temSplitStrings.push({ text: startTag, type: 'tag' });
- }
- temSplitStrings.push({ text: item.text.substring(match.index - currentIndex), type: 'text' });
- temSplitStrings.push({ text: endTag, type: 'tag' });
- } else {
- temSplitStrings.push({ text: item.text.substring(0, match.index - currentIndex), type: 'text' });
- temSplitStrings.push({ text: startTag, type: 'tag' });
- temSplitStrings.push({ text: item.text.substring( match.index - currentIndex,item.text.length), type: 'text' });
- temSplitStrings.push({ text: endTag, type: 'tag' });
- }
- }
- } else {
- if ((match.index + match[0].length) <= (currentIndex + item.text.length) && (match.index + match[0].length) > currentIndex) {
- temSplitStrings.push({ text: startTag, type: 'tag' });
- temSplitStrings.push({ text: item.text.substring(0, match.index + match[0].length - currentIndex), type: 'text' });
- temSplitStrings.push({ text: imgTag, type: 'tag' });
- temSplitStrings.push({ text: endTag, type: 'tag' });
- if ((match.index + match[0].length) < (currentIndex + item.text.length)) {
- temSplitStrings.push({ text: item.text.substring((match.index + match[0].length - currentIndex)), type: 'text' });
- }
- } else {
- if (match.index < currentIndex && (match.index + match[0].length) >= (currentIndex + item.text.length)) {
- temSplitStrings.push({ text: startTag, type: 'tag' });
- temSplitStrings.push(item);
- temSplitStrings.push({ text: endTag, type: 'tag' });
- } else {
- temSplitStrings.push(item);
- }
- }
- }
- currentIndex = currentIndex + item.text.length;
- } else {
- temSplitStrings.push(item);
- }
- } else {
- temSplitStrings.push(item);
- }
- });
- splitStrings = temSplitStrings;
- });
- let temInnerHtml = '';
- splitStrings.forEach(function (item) {
- temInnerHtml = temInnerHtml + item.text;
- });
- return temInnerHtml;
- },
- },
- }
|