|
@@ -66,7 +66,7 @@ export const commonMixins = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export const addContrast = {
|
|
|
+export const addContrast1 = {
|
|
|
props:['isTrue','type1','reportType'],
|
|
|
data() {
|
|
|
return {
|
|
@@ -88,7 +88,7 @@ export const addContrast = {
|
|
|
mounted() {
|
|
|
document.onselectionchange = () => {
|
|
|
this.isSelecting=true;
|
|
|
- };
|
|
|
+ };
|
|
|
},
|
|
|
watch:{
|
|
|
isTrue(val){
|
|
@@ -700,4 +700,270 @@ export const addContrast = {
|
|
|
|
|
|
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+export const addContrast = {
|
|
|
+ props:['reportId','activeName'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ mX: 0,
|
|
|
+ mY: 0,
|
|
|
+ isSelecting: false,
|
|
|
+ anchorOffset: 0,
|
|
|
+ currentSelectObj:{},
|
|
|
+ contrast: {},
|
|
|
+ currentColor:null,
|
|
|
+ duiBiCurrentSelectObj: {},
|
|
|
+ name:this.activeName,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ index() {
|
|
|
+ return JSON.stringify(this.$store.state.patent.index)
|
|
|
+ },
|
|
|
+ contrastList() {
|
|
|
+ return this.$store.state.report.contrastList
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ index(val) {
|
|
|
+ var index1 = JSON.parse(val)
|
|
|
+ this.currentColor = index1.color
|
|
|
+ },
|
|
|
+ activeName(val) {
|
|
|
+ this.name = val
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ window.pizhu = this.pizhu
|
|
|
+ window.hiddenPizhu = this.hiddenPizhu
|
|
|
+ window.selectMark = this.selectMark
|
|
|
+ window.addDuiBi = this.addDuiBi
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 点击对比按钮
|
|
|
+ addDuiBi() {
|
|
|
+ this.duiBiCurrentSelectObj=this.$store.state.patent.index
|
|
|
+ // open打开弹窗
|
|
|
+ if (this.duiBiCurrentSelectObj.Id) {
|
|
|
+ this.$emit('openContrast',this.duiBiCurrentSelectObj)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //点击图标回显数据
|
|
|
+ selectMark(Id, selectType) {
|
|
|
+ if (selectType==0) {
|
|
|
+ var index = this.pizhucontrastList.findIndex(item => {
|
|
|
+ if (item.id == Id) {
|
|
|
+ // 清空currentSelectObj,否则Id与id同时存在
|
|
|
+ this.currentSelectObj = {}
|
|
|
+ this.$store.commit("SET_PATENT_INDEX", this.currentSelectObj)
|
|
|
+ this.contrast = item
|
|
|
+ this.$store.commit('SET_PATENT_INDEX', this.contrast)
|
|
|
+ }
|
|
|
+ return item.id == Id
|
|
|
+ })
|
|
|
+ if (index != -1) {
|
|
|
+ this.showPizhu()
|
|
|
+ }
|
|
|
+ } else if (selectType == 1) {
|
|
|
+ let a=this.contrastList.find(item => {
|
|
|
+ return item.id==Id
|
|
|
+ })
|
|
|
+ this.$emit('openContrast', a)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ mousemove(e) {
|
|
|
+ this.mX = e.pageX;
|
|
|
+ this.mY = e.pageY;
|
|
|
+ },
|
|
|
+ mouseup(e) {
|
|
|
+ sessionStorage.mY = this.mY
|
|
|
+ sessionStorage.mX = this.mX
|
|
|
+ this.isSelecting = true;
|
|
|
+ if (this.isSelecting) {
|
|
|
+ this.isSelecting = false;
|
|
|
+ let selectObj = document.getSelection();
|
|
|
+ this.anchorOffset = 0;
|
|
|
+ let temSelectObj = this.getSelectobj(selectObj);
|
|
|
+ var tempdt = this.getColumnName(selectObj.anchorNode);
|
|
|
+ if (tempdt != undefined && selectObj.toString() != '') {
|
|
|
+ this.currentSelectObj = temSelectObj;
|
|
|
+ this.currentSelectObj.color = this.currentColor;
|
|
|
+ this.currentSelectObj.Type = 0;
|
|
|
+ this.currentSelectObj.patentNo = this.patent.publicNo
|
|
|
+ // rangeId(专题库id/报告id)
|
|
|
+ this.currentSelectObj.rangeId = this.reportId
|
|
|
+ // 创建来源(默认0/专题库1/报告2)
|
|
|
+ this.currentSelectObj.createFrom = 2
|
|
|
+ // this.showPizhu();
|
|
|
+ this.currentSelectObj.remark = ''
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.currentSelectObj = {};
|
|
|
+ }
|
|
|
+ if (this.currentSelectObj.Id) {
|
|
|
+ var a = JSON.parse(this.index)
|
|
|
+ a.Id = this.currentSelectObj.Id
|
|
|
+ a.patentNo = this.currentSelectObj.patentNo
|
|
|
+ a.text = this.currentSelectObj.text
|
|
|
+ a.rangeId = this.reportId
|
|
|
+ a.scratchField = this.currentSelectObj.column
|
|
|
+ a.position = this.currentSelectObj.index
|
|
|
+ a.id = null
|
|
|
+ a.remark = null
|
|
|
+ // a.color = this.currentSelectObj.color
|
|
|
+ a.createFrom = 2
|
|
|
+ a.Type = 0
|
|
|
+ this.$store.commit("SET_PATENT_INDEX", a)
|
|
|
+ this.showPizhu()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 打开批注框
|
|
|
+ pizhu() {
|
|
|
+ if (this.contrast.id == undefined) {
|
|
|
+ this.currentSelectObj = JSON.parse(this.index)
|
|
|
+ }
|
|
|
+ if (this.currentSelectObj.Id != undefined || this.contrast.id != undefined) {
|
|
|
+ // 划词进入
|
|
|
+ // if (this.currentSelectObj.Id != undefined) {
|
|
|
+ // console.log(2,this.currentSelectObj);
|
|
|
+ // this.$store.commit('SET_PATENT_INDEX', this.currentSelectObj)
|
|
|
+ // }
|
|
|
+ this.currentSelectObj.Type = 2;
|
|
|
+ this.hiddenPizhu();
|
|
|
+ this.showPizhu2()
|
|
|
+ this.contrast = {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showPizhu2() {//展示批注
|
|
|
+ let dl = document.getElementsByClassName("pizhu");
|
|
|
+ let mX = sessionStorage.mX
|
|
|
+ let mY = sessionStorage.mY
|
|
|
+ console.log(document.body.clientHeight , mY);
|
|
|
+ if ((document.body.clientWidth - mX - 380) < 0) {
|
|
|
+ mX = document.body.clientWidth - 390;
|
|
|
+ }
|
|
|
+ if ((document.body.clientHeight - mY - 40) < 0) {
|
|
|
+ mY = document.body.clientHeight - 40;
|
|
|
+ }
|
|
|
+ if ((document.body.clientHeight - mY) < 420) {
|
|
|
+ mY = mY - 410
|
|
|
+ }
|
|
|
+ if ((document.body.clientWidth - mX) < 330) {
|
|
|
+ mX = mX - 330
|
|
|
+ }
|
|
|
+ dl[0].setAttribute("style", "user-select:none;box-shadow: 10px 10px 5px #888888;display:block;position:absolute;left:" + mX.toString() + "px;top:" + mY.toString() + "px;background-color: #F7EED6;border-radius: 15px 15px;padding: 10px;width:380px;z-index: 2;");
|
|
|
+ },
|
|
|
+ showPizhu() {//展示菜单
|
|
|
+ // this.AddClass1(this.currentSelectObj)
|
|
|
+ let mX = sessionStorage.mX
|
|
|
+ let mY = sessionStorage.mY
|
|
|
+ let dl = document.getElementsByClassName("caidan");
|
|
|
+ if ((document.body.clientWidth - mX - 420) < 0) {
|
|
|
+ mX = document.body.clientWidth - 420;
|
|
|
+ }
|
|
|
+ if ((document.body.clientHeight - mY - 40) < 0) {
|
|
|
+ mY = document.body.clientHeight - 40;
|
|
|
+ }
|
|
|
+ dl[0].setAttribute("style", "opacity:0.95;box-shadow: 10px 10px 5px #888888;display:block;position:absolute;left:" + mX.toString() + "px;top:" + mY.toString() + "px;background-color: white;border-radius: 15px 15px;height:30px;display: flex;align-items: center;padding: 10px;user-select:none");
|
|
|
+ },
|
|
|
+ // 关闭菜单
|
|
|
+ hiddenPizhu() {
|
|
|
+ let dl = document.getElementsByClassName("caidan");
|
|
|
+ dl[0].setAttribute("style", "display:none;");
|
|
|
+ },
|
|
|
+ getSelectobj(selectObj) {
|
|
|
+ var temNode = selectObj.anchorNode;
|
|
|
+ var a = temNode.parentElement
|
|
|
+ NotIncludeDataType(a)
|
|
|
+ function NotIncludeDataType(node) {
|
|
|
+ if (node.getAttribute("data-type") != null) {
|
|
|
+ temNode = node
|
|
|
+ } else {
|
|
|
+ NotIncludeDataType(node.parentElement);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getColumn(temNode, selectObj);
|
|
|
+ this.isFirst = true
|
|
|
+ return { "Id": this.uuid(), "column": temNode.getAttribute("data-type"), "index": this.anchorOffset, "text": selectObj.toString(), 'temNode': temNode.innerHTML };
|
|
|
+ },
|
|
|
+ getColumn(node, selectObj) {
|
|
|
+ var baseNode = this.getColumnNode(node);
|
|
|
+ var anchorNodePosition = this.getPosition(baseNode, selectObj.anchorNode, selectObj.anchorOffset);
|
|
|
+ var focusNodePosition = this.getPosition(baseNode, selectObj.focusNode, selectObj.focusOffset);
|
|
|
+ var num = Math.min(anchorNodePosition, focusNodePosition)
|
|
|
+ this.anchorOffset = num
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ getColumnNode(node) {
|
|
|
+ //获取节点所在的栏位节点
|
|
|
+ if (node != null) {
|
|
|
+ if (node.nodeType != 3 && node.getAttribute("data-type") != null) {
|
|
|
+ return node;
|
|
|
+ } else {
|
|
|
+ if (node == document.root) {
|
|
|
+ return node;
|
|
|
+ } else {
|
|
|
+ return this.getColumnNode(node.parentNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getNodes(baseNode, path) {
|
|
|
+ // 拿到所有类型的节点
|
|
|
+ var temPath = path;
|
|
|
+ if (baseNode != null) {
|
|
|
+ temPath.push(baseNode);
|
|
|
+ if (baseNode.childNodes.length > 0) {
|
|
|
+ for (let i = 0; i < baseNode.childNodes.length; i++) {
|
|
|
+ this.getNodes(baseNode.childNodes[i], temPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPosition(baseNode, node, offset) {
|
|
|
+ //根据节点获取给定node中offset位置在栏位中的实际位置
|
|
|
+ let path = [];
|
|
|
+ this.getNodes(baseNode, path);
|
|
|
+ let retIdx = 0;
|
|
|
+ for (let i = 0; i < path.length; i++) {
|
|
|
+ if (path[i] == node) {
|
|
|
+ retIdx += offset;
|
|
|
+ return retIdx;
|
|
|
+ } else {
|
|
|
+ if (path[i].nodeType == 3) {
|
|
|
+ retIdx += path[i].nodeValue.length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uuid() {
|
|
|
+ var s = [];
|
|
|
+ var hexDigits = "0123456789abcdef";
|
|
|
+ for (var i = 0; i < 36; i++) {
|
|
|
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
|
+ }
|
|
|
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
|
|
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
|
|
+ s[8] = s[13] = s[18] = s[23] = "-";
|
|
|
+ var uuid = s.join("");
|
|
|
+ return uuid;
|
|
|
+ },
|
|
|
+ getColumnName(el) {
|
|
|
+ let root = el;
|
|
|
+ if (el == undefined) {
|
|
|
+ return undefined;
|
|
|
+ }
|
|
|
+ if (!(el instanceof HTMLElement)) {
|
|
|
+ root = el.parentElement;
|
|
|
+ }
|
|
|
+ let dt = root.getAttribute("data-Type");
|
|
|
+ if (dt != undefined) {
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+ return dt = this.getColumnName(root.parentElement);
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|