diff --git a/src/views/Customer/label.vue b/src/views/Customer/label.vue index fc12fb6..92b0252 100644 --- a/src/views/Customer/label.vue +++ b/src/views/Customer/label.vue @@ -63,6 +63,7 @@ 编辑 + 编辑模型 @@ -81,14 +82,15 @@ + 编辑模型 + + 编辑 删除 - - @@ -166,8 +168,6 @@ - -
确 定 + + + +
+

匹配距离:关键字匹配字数距离,主要针对near/after/w- 生效,w- 的字数统计从挖掘话术后,客户的第一句话开始统计;

+

例如:设置为10,面积 after 140
+ 命中话术:"想买一个面积在140平的"
+ 超出10个字,有关键字不命中话术参考:“房屋面积啊,你们这边有多大的,有没有140平左右的”;

+

or(或):多个关键词,匹配上1个就行

+

例如标签:自住
+ 匹配模型:自己住 or 给自己
+ 命中话术:我们自己住/给自己买的

+

and not(非):排除反面意思

+

例如:北京户口,
+ 匹配模型:是北京户口 and not 不是北京户口
+ 命中话术:我是北京户口;
+ 反面话术:我不是北京户口

+

near ( 临近):1个关键词前后一定范围出现过另一个关键词就算命中,有距离限制

+

例如标签:购房预算 140w
+ 匹配模型:预算 near 140
+ 命中话术:我的预算是140w或大概140w的购房预算

+

after(后面):一段文本出现2个关键词,并且按照先后的顺序即算命中,有距离限制

+

例如标签:意向面积 140平
+ 匹配模型: 面积 after 140 ,140在面积后面才算生效;
+ 命中话术:想买一个面积在140平的;

+

w-(挖掘话术业务):顾问执行了挖掘话术,客户回答结果,有距离限制,从客户话术文本开始

+

例如标签:北京户口
+ 匹配模型:(w-是 or w-有) and not (w-不是 or w-没有) + 命中话术:销售:你有北京户口吗?
+ 客户:有的;

+

-n(命中距离):near/after-n ,单个near/after的匹配距离,n大于0,小于500

+

例如 :面积 after-10 140
+ 10个字内,命中话术参考:"想买一个面积在140平的"
+ 超出10个字,有关键字不命中话术参考:“房屋面积啊,你们这边有多大的,有没有140平左右的”;

+

注意:-n 与 near/after/answer 之间不能有空格


+

注意:优先匹配关键词可以排在前面;

+
+
+ + +
{{form.keywordsName}}
+
+ +
{{form.sceneDesc}}
+
暂无描述
+
+ + *请输入0~500内的整数 规则说明 + +
+
+
需求挖掘匹配:
+
+
+ +
+
+
+ + {{item.label}} + +
+ + 取 消 + 保 存 + +
@@ -274,6 +354,39 @@ import { mapGetters } from "vuex"; export default { data() { return { + dynamiclist: [], + taglist:[ + { + label: 'or (或)', + value: 'or' + }, + { + label: 'near (临近)', + value: 'near' + }, + { + label: 'after (后面)', + value: 'after' + }, + { + label: 'and not (非)', + value: 'and not' + }, + // { + // label: '~ (至)', + // value: '~' + // }, + ], + moxingVisible: false, + innerVisible: false, + form: { + keywordsName: '', + id: '', + keywordsId: '', + distance: 10, + sceneDesc:'', + originalExpression: '' + }, formLabelWidth: "120px", dialogFormVisible: false, dialogVisible: false, @@ -320,6 +433,222 @@ export default { this.zkhousePage(); }, methods: { + // 基于保存的光标插入内容 --用于失去焦点后再继续插入内容 + insertContent(str) { + let selection, range = window._range;// 当前光标位置对象 + if (!window.getSelection) { + range.pasteHTML(str); + range.collapse(false); + range.select(); + } else { + selection = window.getSelection ? window.getSelection() : document.selection; + range.collapse(false); + let hasR = range.createContextualFragment(str); + let hasR_lastChild = hasR.lastChild; + while (hasR_lastChild && hasR_lastChild.nodeName.toLowerCase() == "br" && hasR_lastChild.previousSibling && hasR_lastChild.previousSibling.nodeName.toLowerCase() == "br") { + let e = hasR_lastChild; + hasR_lastChild = hasR_lastChild.previousSibling; + hasR.removeChild(e); + } + range.insertNode(hasR); + if (hasR_lastChild) { + range.setEndAfter(hasR_lastChild); + range.setStartAfter(hasR_lastChild); + } + selection.removeAllRanges(); + selection.addRange(range); + } + }, + // 失去焦点时保存光标位置 + saveRange: () => { + let selection = window.getSelection ? window.getSelection() : document.selection; + if (!selection.rangeCount) return; + let range = selection.createRange ? selection.createRange() : selection.getRangeAt(0); + window._range = range; + }, + // 回显模型数据,Dialog 的内容是懒渲染的,即在第一次被打开之前,传入的默认 slot 不会被渲染到 DOM 上,so在 open 事件回调中进行 + openModel(){ + // this.$nextTick(()=>{ + // let huashuModel = document.getElementById('huashuModel') + // huashuModel.innerHTML = this.form.originalExpression + // }) + }, + //格式化粘贴文本方法 + onPaste(event) { + var e = event || window.event + // 阻止默认粘贴 + e.preventDefault(); + // 粘贴事件有一个clipboardData的属性,提供了对剪贴板的访问 + // clipboardData的getData(fomat) 从剪贴板获取指定格式的数据 + var text = (e.originalEvent || e).clipboardData.getData('text/plain') || prompt('在这里输入文本'); + //清除回车 + text = text.replace(/\[\d+\]|\n|\r/ig,"") + // 插入 + document.execCommand("insertText", false, text); + }, + myeditorenter(e) { + e.preventDefault(); + }, + // 插入节点 + insertHtmlAtCaret(html) { + document.getElementById('huashuModel').focus(); + var sel, range; + if (window.getSelection) { + // IE9 and non-IE + sel = window.getSelection(); + if (sel.getRangeAt && sel.rangeCount) { + range = sel.getRangeAt(0); + range.deleteContents(); + // Range.createContextualFragment() would be useful here but is + // non-standard and not supported in all browsers (IE9, for one) + var el = document.createElement("div"); + el.innerHTML = html; + var frag = document.createDocumentFragment(), + node, lastNode; + while ((node = el.firstChild)) { + lastNode = frag.appendChild(node); + } + range.insertNode(frag); + // Preserve the selection + if (lastNode) { + range = range.cloneRange(); + range.setStartAfter(lastNode); + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + } + } else if (document.selection && document.selection.type != "Control") { + // IE < 9 + document.selection.createRange().pasteHTML(html); + } + }, + // 点击插入标签 + insertTag(item,index){ + if(window._range){ + this.insertContent(""+item.value+" "); + }else{ + this.insertHtmlAtCaret(""+item.value+" "); + } + }, + // 处理标签,删除不需要的标签格式 + delMark(str) { + const hasStr = (str) => { + let index = str.indexOf('<') + let index1 = str.indexOf('>') + if(index>0&&index1>0){ + let replaceStr= str.substring(index, index1+1) + str= str.replace(replaceStr,'') + hasStr(str) + } + } + hasStr(str) + }, + // 处理模型 关键词加#号 + replaceFun(str){ + let temp = str + temp = temp.replace(/\ \;<\/text>/g,''); + temp = temp.replace(/\ \;/g,''); + temp = temp.replace(//g,''); + temp = temp.replace(/<\/text>/g,''); + temp = temp.replace(//g,' #');// 后台返回是这样的,变了,需要也处理一下 + temp = temp.replace(//g,' #'); + temp = temp.replace(/<\/span>/g,'#') + // console.log(temp); + this.delMark(temp); + return temp + }, + // 模型保存 + saveFun(){ + let text = document.getElementById('huashuModel'); + // console.log(text.innerHTML); + // console.log(text.innerText); + let temp = text.innerHTML + if(this.form.distance=='') {this.$message.error('请输入距离'); return;} + if(text.innerText=='') {this.$message.error('请输入标签模型'); return;} + + axios({ + url: `${jypath}/zk/keymodel/updateKeywordsModel`, + method: 'post', + data: { + id: this.form.id, + houseId: this.houseId, + level: this.level, + keywordsId: this.form.keywordsId, + keywordsName: this.form.keywordsName, + answerList: [], + keyType: 2, + formatExpression: this.replaceFun(temp),// 问题表达式 + originalExpression: temp,// html数据 + showFormatExpression: text.innerText, + distance: this.form.distance // * 距离 + } + }).then(data => { + this.moxingVisible = false + if(data.data.res==1){ + this.$message.success(data.data.obj) + this.getorgCode() + }else{ + this.$message.error(data.data.resMsg) + } + }).catch((e)=>{ + this.moxingVisible = false + }) + + }, + moxingEdit(node, data){ + // console.log(data) + this.level = data.level + this.form.keywordsName = data.endName?data.name+'~'+data.endName:data.name + this.form.keywordsId = data.keywordsId + this.form.sceneDesc = data.desc ||'' + // 获取模型数据回显 + axios({ + url: `${jypath}/zk/keymodel/findById`, + method: 'get', + params: { + houseId: this.houseId, + level: this.level, + keyType: 2, + keywordsId: data.keywordsId + } + }).then(res => { + this.moxingVisible = true + if (res.data.res == 1) { + let obj = res.data.obj + if(obj!=null){ + this.form.distance=obj.distance||10 + this.form.originalExpression= obj.originalExpression + this.form.id =obj.id + // 回显标签模型数据 + if(obj.answerList&&obj.answerList.length){ + this.dynamiclist = obj.answerList.map(cont=>{ + return { + question: cont.question, + editValue: cont.originalExpression + } + }) + // console.log(this.dynamiclist) + }else{ + this.dynamiclist = [] + } + }else{ + this.form.distance=10 + this.form.originalExpression= this.form.keywordsName + this.form.id ='' + } + }else{ + this.form.distance = 10 + this.form.originalExpression = this.form.keywordsName + } + this.$nextTick(()=>{ + let huashuModel = document.getElementById('huashuModel') + huashuModel.innerHTML = this.form.originalExpression + }) + }).catch((e)=>{ + this.moxingVisible = true + }) + }, addclick(){ var orgCode=''; if(localStorage.getItem("orgType") == 3){ @@ -656,6 +985,17 @@ export default { /deep/.el-tree-node__content{ overflow: hidden; } +.editDiv{ + width:100%; + min-height:60px; + max-height:120px; + overflow:auto; + margin-bottom:10px; + padding: 15px; + outline: none; + border:1px solid #409EFF; + border-radius: 10px; +} .box-center { width: 100%; padding: 15px 15px 20px; diff --git a/src/views/Receive/index copy.vue b/src/views/Receive/index copy.vue deleted file mode 100644 index 921b4c8..0000000 --- a/src/views/Receive/index copy.vue +++ /dev/null @@ -1,3078 +0,0 @@ - - - - - diff --git a/src/views/Receive/index.vue b/src/views/Receive/index.vue index da94499..e4ad27a 100644 --- a/src/views/Receive/index.vue +++ b/src/views/Receive/index.vue @@ -310,6 +310,18 @@ style="flex-shrink: 0; width: 24px; height: 24px" /> + +
+ +
+ +

dcdc

+
+ +
@@ -463,52 +475,17 @@ height: 100px; display: flex; flex-direction: column; - justify-content: space-between; border-bottom: 1px solid #e0e0e0; " > -
-
- 销讲执行 -
-
- -
- 销讲总执行率{{ userinformationlist.fraction || 0 }}% - 禁忌执行 -
+
销讲执行
+ + 销讲总执行率{{ userinformationlist.fraction || 0 }}% + 禁忌执行 + 需求挖掘率 + +
@@ -630,6 +608,105 @@ {{ index + 1 }}、{{ item }}
+ +
+
+
指标
+
执行
+
+ 匹配标签 +
+
+
+
+
+
+ {{ item.name }} +
+
+
+
+ {{ + ( + (item.ratepercent / item.rate).toFixed(2) * 100 + ).toFixed() + }}% +
+
+ + +
+
+
+
+
+ {{ subitem.name }} +
+
+
已执行
+
未执行
+
+
+
+
+
@@ -1105,6 +1182,7 @@ import { saveAs } from "file-saver"; export default { data() { return { + imgArr: ['', 'https://static.quhouse.com/37e0de3f8d1c421dac8bf699d5e7992d.png', 'https://static.quhouse.com/b106e8e75db24a59a579a15a78830a76.png', 'https://static.quhouse.com/8443a2ecb81d4639991ab29c422e9949.png', 'https://static.quhouse.com/1cd794cb6c974d9dad948a6dd444518b.png',], mg: 0, recordsText: [], roleVisible: false, @@ -1259,6 +1337,26 @@ export default { }, methods: { + // 对话加命中标签 + dealTypes(type){ + if(type){ + let tem = type.substring(1).split(',') + return tem + }else{ + return [] + } + }, + // 对话加命中标签 + dealword(type){ + if(type){ + let a = type.split('-') + let rest = type.substring(2).split('-').join(',') + let arr =[a[0],rest] + return arr + }else{ + return [] + } + }, chooseRoles(index) { this.roleFlag = index; }, @@ -1972,10 +2070,6 @@ export default { console.log(this.mistakenList, this.correctList); }); }, - // 销讲词禁忌tab - recordclick(i) { - this.zhixingcenterindex = i; - }, // 销讲词折叠 changeshow(index) { this.ratelist[index].show = !this.ratelist[index].show; @@ -2272,7 +2366,7 @@ export default { // // 使用获取到的blob对象创建的url // const url = window.URL.createObjectURL(res); // a.href = url; - // // 指定下载的文件名,就‘’写默认的下载名字。不指定他就根据上传名直接下载了宝。 + // // 指定下载的文件名,就‘’写默认的下载名字。不指定他就根据上传名直接下载了。 // a.download = ''; // a.click(); // document.body.removeChild(a) @@ -2289,6 +2383,36 @@ export default { diff --git a/src/views/Template/requireminingAnalysis.vue b/src/views/Template/requireminingAnalysis.vue new file mode 100644 index 0000000..e334b55 --- /dev/null +++ b/src/views/Template/requireminingAnalysis.vue @@ -0,0 +1,1286 @@ + + + diff --git a/src/views/Template/taboo.vue b/src/views/Template/taboo.vue index 409d9c4..011aa85 100644 --- a/src/views/Template/taboo.vue +++ b/src/views/Template/taboo.vue @@ -64,15 +64,12 @@ > - @@ -96,6 +93,16 @@ clearable > + + +
+ + +
+

匹配距离:关键字匹配字数距离,主要针对near/after/w- 生效,w- 的字数统计从挖掘话术后,客户的第一句话开始统计;

+

例如:设置为10,面积 after 140
+ 命中话术:"想买一个面积在140平的"
+ 超出10个字,有关键字不命中话术参考:“房屋面积啊,你们这边有多大的,有没有140平左右的”;

+

or(或):多个关键词,匹配上1个就行

+

例如标签:自住
+ 匹配模型:自己住 or 给自己
+ 命中话术:我们自己住/给自己买的

+

and not(非):排除反面意思

+

例如:北京户口,
+ 匹配模型:是北京户口 and not 不是北京户口
+ 命中话术:我是北京户口;
+ 反面话术:我不是北京户口

+

near ( 临近):1个关键词前后一定范围出现过另一个关键词就算命中,有距离限制

+

例如标签:购房预算 140w
+ 匹配模型:预算 near 140
+ 命中话术:我的预算是140w或大概140w的购房预算

+

after(后面):一段文本出现2个关键词,并且按照先后的顺序即算命中,有距离限制

+

例如标签:意向面积 140平
+ 匹配模型: 面积 after 140 ,140在面积后面才算生效;
+ 命中话术:想买一个面积在140平的;

+

answer(挖掘话术业务):顾问执行了挖掘话术,客户回答结果,有距离限制,从客户话术文本开始

+

例如标签:北京户口
+ 匹配模型:(w-是 or w-有) and not (w-不是 or w-没有)
+ 命中话术:销售:你有北京户口吗?
+ 客户:有的;

+

-n(命中距离):near/after-n ,单个near/after的匹配距离,n大于0,小于500

+

例如 :面积 after-10 140
+ 10个字内,命中话术参考:"想买一个面积在140平的"
+ 超出10个字,有关键字不命中话术参考:“房屋面积啊,你们这边有多大的,有没有140平左右的”;

+

注意:-n 与 near/after/answer 之间不能有空格


+

注意:优先匹配关键词可以排在前面;

+
+
+ + +
{{form.keywordsName||'XXX'}}
+
+ +
{{form.sceneDesc}}
+
暂无描述
+
+ + + *请输入0~500内的整数 + 规则说明 + +
+
+ + {{item.label}} + +
+ + 取 消 + 保 存 + +
@@ -122,6 +204,41 @@ import { exportMethodPost } from "@/util/util"; export default { data() { return { + dynamiclist: [], + taglist:[ + { + label: 'or (或)', + value: 'or' + }, + { + label: 'near (临近)', + value: 'near' + }, + { + label: 'after (后面)', + value: 'after' + }, + { + label: 'and not (非)', + value: 'andnot' + }, + // { + // label: '~ (至)', + // value: '~' + // }, + ], + form: { + keywordsName: '', + id: '', + keywordsId: '', + distance: 10, + sceneDesc:'', + originalExpression: '' + }, + modelVisible:false, + innerVisible:false, + innerVisible1:false, + dialogVisible: false, tableIdName: "TemplateTaboo", // 当前页面需要的变量 tableOption: this.$tableOption.TemplateTaboo, // 当前table配置项 tableLoading: false, // 是否显示加载中 @@ -137,11 +254,11 @@ export default { input: "", tableData: [], multipleSelection: [], - dialogVisible: false, loadingFlag: false, orgType: localStorage.getItem("orgType"), ruleForm: { words: "", + sceneDesc: '', id: "", }, houseId: "", @@ -180,6 +297,345 @@ export default { this.zkhousePage(); }, methods: { + // 插入节点 + insertTag(item,index){ + if(window._range){ + this.insertContent(""+item.value+" "); + }else{ + this.insertHtmlAtCaret(""+item.value+" "); + } + }, + // 处理标签,删除不需要的标签格式 + delMark(str) { + const hasStr = (str) => { + let index = str.indexOf('<') + let index1 = str.indexOf('>') + if(index>0&&index1>0){ + let replaceStr= str.substring(index, index1+1) + str= str.replace(replaceStr,'') + hasStr(str) + } + } + hasStr(str) + }, + // 确认插入选择的话术 + clickOK(){ + this.innerVisible1 = false + if(!this.huashu) {this.$message.error('请选择话术'); return ;} + this.insertContent(""+this.huashu+"answer "); + }, + + //点击编辑按钮 + editFun(id){ + this.form.keywordsId = id + this.form.keywordsName = '' + this.form.id = '' + // 获取模型数据回显 + axios({ + url: `${jypath}/zk/keymodel/findById`, + method: 'get', + params: { + houseId: this.houseId, + keyType: 3, + keywordsId: id + } + }).then(res => { + this.modelVisible = true + if (res.data.res == 1) { + let obj = res.data.obj + console.log(obj) + if(obj!=null){ + this.form.distance = obj.distance||10 + this.form.originalExpression = obj.originalExpression + this.form.id = obj.id + this.form.sceneDesc = obj.desc||'' + this.form.keywordsName = obj.level1Name + }else{ + this.form.distance=10 + this.form.id = '' + this.form.originalExpression='' + } + }else{ + this.form.distance = 10 + this.form.originalExpression = '' + this.form.id = '' + } + this.$nextTick(()=>{ + let huashuModel = document.getElementById('huashuModel') + huashuModel.innerHTML = this.form.originalExpression + }) + }).catch((e)=>{ + this.modelVisible = true + }) + }, + + // 处理模型 关键词加#号 + replaceFun(str){ + let temp = str + temp = temp.replace(/\ \;<\/text>/g,''); + temp = temp.replace(/\ \;/g,''); + temp = temp.replace(//g,''); + temp = temp.replace(/<\/text>/g,''); + temp = temp.replace(//g,' #');// 后台返回是这样的,变了,需要也处理一下 + temp = temp.replace(//g,' #'); + temp = temp.replace(/<\/br>/g,'') + temp = temp.replace(/
/g,'') + temp = temp.replace(/<\/span>/g,'#') + // console.log('处理前temp',temp); + this.delMark(temp); + // console.log(temp); + return temp + }, + // 模型保存 + saveFun(){ + let text = document.getElementById('huashuModel'); + // console.log(text.innerHTML); + // console.log(text.innerText); + let temp = text.innerHTML + if(this.form.distance=='') {this.$message.error('请输入距离'); return;} + if(text.innerText=='') {this.$message.error('请输入标签模型'); return;} + + axios({ + url: `${jypath}/zk/keymodel/updateKeywordsModel`, + method: 'post', + data: { + id: this.form.id||"", + houseId: this.houseId, + level: 1, + keywordsId: this.form.keywordsId, + keywordsName: this.form.keywordsName, + answerList: [], + keyType: 3, + formatExpression: this.replaceFun(temp),// 问题表达式 + originalExpression: temp,// html数据 + showFormatExpression: text.innerText, + distance: this.form.distance, // * 距离 + desc: this.form.sceneDesc//场景描述 + } + }).then(data => { + this.dialogVmodelVisibleisible = false + if(data.data.res==1){ + this.$message.success(data.data.obj) + this.getorgCode() + }else{ + this.$message.error(data.data.resMsg) + } + }).catch((e)=>{ + this.modelVisible = false + }) + }, + // 失去焦点时保存光标位置,记录光标位置 + saveRange: () => { + let selection = window.getSelection ? window.getSelection() : document.selection; + if (!selection.rangeCount) return; + let range = selection.createRange ? selection.createRange() : selection.getRangeAt(0); + window._range = range; + }, + // 回显模型数据,Dialog 的内容是懒渲染的,即在第一次被打开之前,传入的默认 slot 不会被渲染到 DOM 上,so在 open 事件回调中进行 + openModel(){ + this.$nextTick(()=>{ + let huashuModel = document.getElementById('huashuModel') + huashuModel.innerHTML = this.form.originalExpression + }) + }, + //格式化粘贴文本方法 + onPaste(event) { + // var e = event || window.event + // // 阻止默认粘贴 + // e.preventDefault(); + // // 粘贴事件有一个clipboardData的属性,提供了对剪贴板的访问 + // // clipboardData的getData(fomat) 从剪贴板获取指定格式的数据 + // var text = (e.originalEvent || e).clipboardData.getData('text/plain') || prompt('在这里输入文本'); + // //清除回车 + // text = text.replace(/\[\d+\]|\n|\r/ig,"") + // // 插入 + // document.execCommand("insertText", false, text); + let e = event || window.event + let types = event.clipboardData.types + // 粘贴事件有一个clipboardData的属性,提供了对剪贴板的访问 + let flag = false + if (types && types.length > 0) { + types.forEach(ele => { + if (ele == 'Files') { + flag = true + } + }) + } + if (flag) { + event.preventDefault() + } + }, + myeditorenter(e) { + e.preventDefault(); + }, + // 插入节点 + insertHtmlAtCaret(html) { + document.getElementById('huashuModel').focus(); + var sel, range; + if (window.getSelection) { + // IE9 and non-IE + sel = window.getSelection(); + if (sel.getRangeAt && sel.rangeCount) { + range = sel.getRangeAt(0); + range.deleteContents(); + // Range.createContextualFragment() would be useful here but is + // non-standard and not supported in all browsers (IE9, for one) + var el = document.createElement("div"); + el.innerHTML = html; + var frag = document.createDocumentFragment(), + node, lastNode; + while ((node = el.firstChild)) { + lastNode = frag.appendChild(node); + } + range.insertNode(frag); + // Preserve the selection + if (lastNode) { + range = range.cloneRange(); + range.setStartAfter(lastNode); + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + } + } else if (document.selection && document.selection.type != "Control") { + // IE < 9 + document.selection.createRange().pasteHTML(html); + } + }, + // 校验是否已经选择过此标签 + checkrepeat(){ + this.wajueList.forEach(item=>{ + item.disabled = false + }) + this.wajueList.forEach(item=>{ + this.dynamiclist.forEach(obj=>{ + if(item.id==obj.markid){ + item.disabled = true + } + }) + }) + }, + addItemFun(){ + this.dynamiclist.push({ + editValue: '',//匹配模型正则表达式 + markid:'', + level: '', + name:'' + }) + }, + delItemFun(index){ + this.wajueList.forEach(item=>{ + if(item.id==this.dynamiclist[index].markid){ + item.disabled = false + } + }) + this.dynamiclist.splice(index,1) + document.getElementById('huashuModel').focus(); // 防止插入到外面,造成不可删除的操作 + }, + // 基于保存的光标插入内容 --用于失去焦点后再继续插入内容 + insertContent(str) { + let selection, range = window._range;// 当前光标位置对象 + if (!window.getSelection) { + range.pasteHTML(str); + range.collapse(false); + range.select(); + } else { + selection = window.getSelection ? window.getSelection() : document.selection; + range.collapse(false); + let hasR = range.createContextualFragment(str); + let hasR_lastChild = hasR.lastChild; + while (hasR_lastChild && hasR_lastChild.nodeName.toLowerCase() == "br" && hasR_lastChild.previousSibling && hasR_lastChild.previousSibling.nodeName.toLowerCase() == "br") { + let e = hasR_lastChild; + hasR_lastChild = hasR_lastChild.previousSibling; + hasR.removeChild(e); + } + range.insertNode(hasR); + if (hasR_lastChild) { + range.setEndAfter(hasR_lastChild); + range.setStartAfter(hasR_lastChild); + } + selection.removeAllRanges(); + selection.addRange(range); + } + }, + // 失去焦点时保存光标位置,记录光标位置 + saveRange: () => { + let selection = window.getSelection ? window.getSelection() : document.selection; + if (!selection.rangeCount) return; + let range = selection.createRange ? selection.createRange() : selection.getRangeAt(0); + window._range = range; + }, + // 回显模型数据,Dialog 的内容是懒渲染的,即在第一次被打开之前,传入的默认 slot 不会被渲染到 DOM 上,so在 open 事件回调中进行 + openModel(){ + this.$nextTick(()=>{ + let huashuModel = document.getElementById('huashuModel') + huashuModel.innerHTML = this.form.originalExpression + }) + }, + //格式化粘贴文本方法 + onPaste(event) { + // var e = event || window.event + // // 阻止默认粘贴 + // e.preventDefault(); + // // 粘贴事件有一个clipboardData的属性,提供了对剪贴板的访问 + // // clipboardData的getData(fomat) 从剪贴板获取指定格式的数据 + // var text = (e.originalEvent || e).clipboardData.getData('text/plain') || prompt('在这里输入文本'); + // //清除回车 + // text = text.replace(/\[\d+\]|\n|\r/ig,"") + // // 插入 + // document.execCommand("insertText", false, text); + let e = event || window.event + let types = event.clipboardData.types + // 粘贴事件有一个clipboardData的属性,提供了对剪贴板的访问 + let flag = false + if (types && types.length > 0) { + types.forEach(ele => { + if (ele == 'Files') { + flag = true + } + }) + } + if (flag) { + event.preventDefault() + } + }, + myeditorenter(e) { + e.preventDefault(); + }, + // 插入节点 + insertHtmlAtCaret(html) { + document.getElementById('huashuModel').focus(); + var sel, range; + if (window.getSelection) { + // IE9 and non-IE + sel = window.getSelection(); + if (sel.getRangeAt && sel.rangeCount) { + range = sel.getRangeAt(0); + range.deleteContents(); + // Range.createContextualFragment() would be useful here but is + // non-standard and not supported in all browsers (IE9, for one) + var el = document.createElement("div"); + el.innerHTML = html; + var frag = document.createDocumentFragment(), + node, lastNode; + while ((node = el.firstChild)) { + lastNode = frag.appendChild(node); + } + range.insertNode(frag); + // Preserve the selection + if (lastNode) { + range = range.cloneRange(); + range.setStartAfter(lastNode); + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + } + } else if (document.selection && document.selection.type != "Control") { + // IE < 9 + document.selection.createRange().pasteHTML(html); + } + }, // 获取当前页面的显隐 setTableOption() { this.$db.getDataByKey(this.tableIdName).then((res) => { @@ -193,7 +649,6 @@ export default { houseId: this.houseId, words: this.words, }; - // exportMethodPost() exportMethodPost("autoSR/sensitivewords/export", "禁忌话术", obj); }, houseChange() { @@ -213,7 +668,6 @@ export default { } else { this.houseId = res.data[0].id; } - // this.houseId = res.data[0].id; this.taboofindbypagelist(); }); }, @@ -298,6 +752,7 @@ export default { .tabooadd({ houseId: this.houseId, words: this.ruleForm.words, + sceneDesc: this.ruleForm.sceneDesc// 场景描述 }) .then((res) => { if (res.code == 0) { @@ -368,6 +823,17 @@ export default {