|
@@ -8,6 +8,21 @@ |
|
|
<el-radio-button :label="3">违禁词</el-radio-button> |
|
|
<el-radio-button :label="3">违禁词</el-radio-button> |
|
|
</el-radio-group> |
|
|
</el-radio-group> |
|
|
<el-input size="small" clearable style="margin: 0 10px;width: 220px" v-model="value" placeholder="标签名称"></el-input> |
|
|
<el-input size="small" clearable style="margin: 0 10px;width: 220px" v-model="value" placeholder="标签名称"></el-input> |
|
|
|
|
|
<el-select |
|
|
|
|
|
v-if="orgType==0" |
|
|
|
|
|
v-model="houseId" |
|
|
|
|
|
@change="houseChange" |
|
|
|
|
|
placeholder="请选择" |
|
|
|
|
|
filterable |
|
|
|
|
|
> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in houseList" |
|
|
|
|
|
:key="item.id" |
|
|
|
|
|
:label="item.propertyName" |
|
|
|
|
|
:value="item.id" |
|
|
|
|
|
> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
<el-button size="small" type="primary" @click="search()">筛选</el-button> |
|
|
<el-button size="small" type="primary" @click="search()">筛选</el-button> |
|
|
<el-button size="small" type="text" @click="Emptycondition()">清空筛选条件</el-button> |
|
|
<el-button size="small" type="text" @click="Emptycondition()">清空筛选条件</el-button> |
|
|
</div> |
|
|
</div> |
|
@@ -224,424 +239,439 @@ export default { |
|
|
keyType: 0, |
|
|
keyType: 0, |
|
|
loading: false, |
|
|
loading: false, |
|
|
currentPage: 1, |
|
|
currentPage: 1, |
|
|
tableData: [{}], |
|
|
|
|
|
|
|
|
tableData: [], |
|
|
type: '0', |
|
|
type: '0', |
|
|
pageNum:1, |
|
|
pageNum:1, |
|
|
pageSize:10, |
|
|
pageSize:10, |
|
|
houseId:'', |
|
|
|
|
|
total:0, |
|
|
total:0, |
|
|
huashu: '', |
|
|
huashu: '', |
|
|
wajueList: [], |
|
|
wajueList: [], |
|
|
level: '' |
|
|
|
|
|
|
|
|
level: '', |
|
|
|
|
|
houseId:'', |
|
|
|
|
|
orgType: '', |
|
|
|
|
|
houseList: [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
|
|
|
this.houseId=localStorage.getItem("houseId"); |
|
|
|
|
|
|
|
|
created(){ |
|
|
|
|
|
this.houseId=localStorage.getItem("houseId"); |
|
|
|
|
|
this.orgType = localStorage.getItem("orgType") |
|
|
|
|
|
this.orgType==0?this.zkhousePage():this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
// 获取项目列表 |
|
|
|
|
|
zkhousePage() { |
|
|
|
|
|
this.$api.api.findHouseByUser({ |
|
|
|
|
|
orgType: localStorage.getItem("orgType"), |
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
this.houseList = res.data; |
|
|
|
|
|
this.houseId = res.data[0].id; |
|
|
|
|
|
this.getorgCode(); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
houseChange(){ |
|
|
this.getorgCode() |
|
|
this.getorgCode() |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
|
|
|
// 校验是否已经选择过此标签 |
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
// 校验是否已经选择过此标签 |
|
|
|
|
|
checkrepeat(){ |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
item.disabled = false |
|
|
|
|
|
}) |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
this.dynamiclist.forEach(obj=>{ |
|
|
|
|
|
if(item.id==obj.markid){ |
|
|
|
|
|
item.disabled = true |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.dynamiclist.splice(index,1) |
|
|
|
|
|
document.getElementById('huashuModel').focus(); // 防止插入到外面,造成不可删除的操作 |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
// 基于保存的光标插入内容 --用于失去焦点后再继续插入内容 |
|
|
|
|
|
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); |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
// 失去焦点时保存光标位置,记录光标位置 |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
range.insertNode(hasR); |
|
|
|
|
|
if (hasR_lastChild) { |
|
|
|
|
|
range.setEndAfter(hasR_lastChild); |
|
|
|
|
|
range.setStartAfter(hasR_lastChild); |
|
|
} |
|
|
} |
|
|
} else if (document.selection && document.selection.type != "Control") { |
|
|
|
|
|
// IE < 9 |
|
|
|
|
|
document.selection.createRange().pasteHTML(html); |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
// 拿问题获取所在的标签数据 |
|
|
|
|
|
findKeywordsById(keywordsId){ |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keywords/findKeywordsById`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
houseId: this.houseId, |
|
|
|
|
|
keywordsId: keywordsId, |
|
|
|
|
|
level: 1 |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.code==0){ |
|
|
|
|
|
// console.log(res.data) |
|
|
|
|
|
this.wajueList = res.data |
|
|
|
|
|
if(this.wajueList&&this.wajueList.length){ |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
item.disabled = false |
|
|
|
|
|
}) |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
this.dynamiclist.forEach(obj=>{ |
|
|
|
|
|
if(item.id==obj.markid){ |
|
|
|
|
|
item.disabled = 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); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 拿问题获取所在的标签数据 |
|
|
|
|
|
findKeywordsById(keywordsId){ |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keywords/findKeywordsById`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
houseId: this.houseId, |
|
|
|
|
|
keywordsId: keywordsId, |
|
|
|
|
|
level: 1 |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.code==0){ |
|
|
|
|
|
// console.log(res.data) |
|
|
|
|
|
this.wajueList = res.data |
|
|
|
|
|
if(this.wajueList&&this.wajueList.length){ |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
item.disabled = false |
|
|
|
|
|
}) |
|
|
|
|
|
this.wajueList.forEach(item=>{ |
|
|
|
|
|
this.dynamiclist.forEach(obj=>{ |
|
|
|
|
|
if(item.id==obj.markid){ |
|
|
|
|
|
item.disabled = true |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
// 插入节点 |
|
|
|
|
|
insertTag(item,index){ |
|
|
|
|
|
if(index==4) {// answer |
|
|
|
|
|
this.huashu = '' |
|
|
|
|
|
this.innerVisible1 = true |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
// 插入节点 |
|
|
|
|
|
insertTag(item,index){ |
|
|
|
|
|
if(index==4) {// answer |
|
|
|
|
|
this.huashu = '' |
|
|
|
|
|
this.innerVisible1 = true |
|
|
|
|
|
}else{ |
|
|
|
|
|
if(window._range){ |
|
|
|
|
|
this.insertContent("<span contentEditable='false' style='color:red'>"+item.value+"</span><text> </text>"); |
|
|
}else{ |
|
|
}else{ |
|
|
if(window._range){ |
|
|
|
|
|
this.insertContent("<span contentEditable='false' style='color:red'>"+item.value+"</span><text> </text>"); |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.insertHtmlAtCaret("<span contentEditable='false' style='color:red'>"+item.value+"</span><text> </text>"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.insertHtmlAtCaret("<span contentEditable='false' style='color:red'>"+item.value+"</span><text> </text>"); |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
// 处理标签,删除不需要的标签格式 |
|
|
|
|
|
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) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 处理标签,删除不需要的标签格式 |
|
|
|
|
|
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("<text>"+this.huashu+"</text><span contentEditable='false' style='color:red'>answer</span><text> </text>"); |
|
|
|
|
|
}, |
|
|
|
|
|
search(){ |
|
|
|
|
|
this.pageNum = 1 |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
//点击编辑按钮 |
|
|
|
|
|
editFun(item){ |
|
|
|
|
|
this.dialogVisible = true |
|
|
|
|
|
this.form.id = item.id |
|
|
|
|
|
if(this.keyType==0){// 挖掘话术类型 |
|
|
|
|
|
// 回显标签模型数据 |
|
|
|
|
|
if(item.answerList&&item.answerList.length){ |
|
|
|
|
|
this.dynamiclist = item.answerList.map(obj=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
id: obj.id, |
|
|
|
|
|
mark: obj.level3Name?obj.level3Name:obj.level2Name, |
|
|
|
|
|
level: obj.level3Id?3:2, |
|
|
|
|
|
editValue: obj.originalExpression, |
|
|
|
|
|
markid: obj.level3Id?obj.level3Id:obj.level2Id |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
// console.log(this.dynamiclist) |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.dynamiclist = [] |
|
|
|
|
|
} |
|
|
|
|
|
this.form.keywordsName = item.level3Name |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level3Name |
|
|
|
|
|
this.level = item.level2Id?2:1 |
|
|
|
|
|
this.questionId = item.questionId |
|
|
|
|
|
this.form.keywordsId = item.level2Id?item.level2Id:item.level1Id |
|
|
|
|
|
this.findKeywordsById(item.level1Id)// 获取标签下拉数据 |
|
|
|
|
|
}else if(this.keyType==3){// 违禁词 |
|
|
|
|
|
this.form.keywordsName = item.level1Name |
|
|
|
|
|
this.level = 1 |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level1Name |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
hasStr(str) |
|
|
|
|
|
}, |
|
|
|
|
|
// 确认插入选择的话术 |
|
|
|
|
|
clickOK(){ |
|
|
|
|
|
this.innerVisible1 = false |
|
|
|
|
|
if(!this.huashu) {this.$message.error('请选择话术'); return ;} |
|
|
|
|
|
this.insertContent("<text>"+this.huashu+"</text><span contentEditable='false' style='color:red'>answer</span><text> </text>"); |
|
|
|
|
|
}, |
|
|
|
|
|
search(){ |
|
|
|
|
|
this.pageNum = 1 |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
//点击编辑按钮 |
|
|
|
|
|
editFun(item){ |
|
|
|
|
|
this.dialogVisible = true |
|
|
|
|
|
this.form.id = item.id |
|
|
|
|
|
if(this.keyType==0){// 挖掘话术类型 |
|
|
|
|
|
// 回显标签模型数据 |
|
|
|
|
|
if(item.answerList&&item.answerList.length){ |
|
|
|
|
|
this.dynamiclist = item.answerList.map(obj=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
id: obj.id, |
|
|
|
|
|
mark: obj.level3Name?obj.level3Name:obj.level2Name, |
|
|
|
|
|
level: obj.level3Id?3:2, |
|
|
|
|
|
editValue: obj.originalExpression, |
|
|
|
|
|
markid: obj.level3Id?obj.level3Id:obj.level2Id |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
// console.log(this.dynamiclist) |
|
|
|
|
|
}else{ |
|
|
this.dynamiclist = [] |
|
|
this.dynamiclist = [] |
|
|
|
|
|
} |
|
|
|
|
|
this.form.keywordsName = item.level3Name |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level3Name |
|
|
|
|
|
this.level = item.level2Id?2:1 |
|
|
|
|
|
this.questionId = item.questionId |
|
|
|
|
|
this.form.keywordsId = item.level2Id?item.level2Id:item.level1Id |
|
|
|
|
|
this.findKeywordsById(item.level1Id)// 获取标签下拉数据 |
|
|
|
|
|
}else if(this.keyType==3){// 违禁词 |
|
|
|
|
|
this.form.keywordsName = item.level1Name |
|
|
|
|
|
this.level = 1 |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level1Name |
|
|
|
|
|
this.dynamiclist = [] |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.form.keywordsId = item.level3Id?item.level3Id:item.level2Id |
|
|
|
|
|
this.level = item.level3Id?3:2 |
|
|
|
|
|
this.form.keywordsName = item.level3Name||item.level2Name |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level3Name||item.level2Name |
|
|
|
|
|
if(item.answerList&&item.answerList.length){ |
|
|
|
|
|
this.dynamiclist = item.answerList.map(obj=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
question: obj.question, |
|
|
|
|
|
editValue: obj.originalExpression |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}else{ |
|
|
}else{ |
|
|
this.form.keywordsId = item.level3Id?item.level3Id:item.level2Id |
|
|
|
|
|
this.level = item.level3Id?3:2 |
|
|
|
|
|
this.form.keywordsName = item.level3Name||item.level2Name |
|
|
|
|
|
this.form.distance = item.distance||10 |
|
|
|
|
|
this.form.originalExpression = item.originalExpression||item.level3Name||item.level2Name |
|
|
|
|
|
if(item.answerList&&item.answerList.length){ |
|
|
|
|
|
this.dynamiclist = item.answerList.map(obj=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
question: obj.question, |
|
|
|
|
|
editValue: obj.originalExpression |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.dynamiclist = [] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.dynamiclist = [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
|
|
|
// 删除列表 |
|
|
|
|
|
deleteFun(item){ |
|
|
|
|
|
this.$alert(item.keywordsName, '确定删除该条数据吗', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
callback: action => { |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/delKeywordsModel`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
id: item.id, |
|
|
|
|
|
houseId: this.houseId |
|
|
|
|
|
} |
|
|
|
|
|
}).then(data => { |
|
|
|
|
|
if(data.code==0){ |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
// 处理模型 关键词加#号 |
|
|
|
|
|
replaceFun(str){ |
|
|
|
|
|
let temp = str |
|
|
|
|
|
temp = temp.replace(/<text>\ \;<\/text>/g,''); |
|
|
|
|
|
temp = temp.replace(/\ \;/g,''); |
|
|
|
|
|
temp = temp.replace(/<text>/g,''); |
|
|
|
|
|
temp = temp.replace(/<\/text>/g,''); |
|
|
|
|
|
temp = temp.replace(/<span contenteditable="false" style="color:red">/g,' #');// 后台返回是这样的,变了,需要也处理一下 |
|
|
|
|
|
temp = temp.replace(/<span style="color:red" contenteditable="false">/g,' #'); |
|
|
|
|
|
temp = temp.replace(/<\/br>/g,'') |
|
|
|
|
|
temp = temp.replace(/<br>/g,'') |
|
|
|
|
|
temp = temp.replace(/<\/span>/g,'#') |
|
|
|
|
|
// console.log('处理前temp',temp); |
|
|
|
|
|
this.delMark(temp); |
|
|
|
|
|
// console.log(temp); |
|
|
|
|
|
return temp |
|
|
|
|
|
}, |
|
|
|
|
|
//修改保存标签模型 |
|
|
|
|
|
saveFun(){ |
|
|
|
|
|
if(this.cansave) return ; // 防止多次点击 |
|
|
|
|
|
this.cansave = true; |
|
|
|
|
|
let text = document.getElementById('huashuModel'); |
|
|
|
|
|
let answerList = [] |
|
|
|
|
|
// 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;} |
|
|
|
|
|
if(this.keyType==0){ |
|
|
|
|
|
for (var i=0;i<this.dynamiclist.length;i++){ |
|
|
|
|
|
// 使用for循环判断可以跳出循环 |
|
|
|
|
|
if(!this.dynamiclist[i].markid) {this.$message.error('请完善要选择的标签'); return ;} |
|
|
|
|
|
this.wajueList.map(item1=>{ |
|
|
|
|
|
if(item1.id==this.dynamiclist[i].markid){ |
|
|
|
|
|
this.dynamiclist[i].level = item1.level |
|
|
|
|
|
this.dynamiclist[i].name = item1.name |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let huashuModel = document.getElementById('huashuModel'+i); |
|
|
|
|
|
if(huashuModel.innerText=='') {this.$message.error('请完善选择的标签模型'); return ;} |
|
|
|
|
|
this.dynamiclist[i].editValue = huashuModel.innerHTML |
|
|
|
|
|
this.dynamiclist[i].editText = huashuModel.innerText |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
answerList = this.dynamiclist.map(item=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
keyType: 2, |
|
|
|
|
|
id: item.id||null, |
|
|
|
|
|
level: item.level, |
|
|
|
|
|
keywordsId: item.markid, |
|
|
|
|
|
showFormatExpression: item.editText,//文本形式 |
|
|
|
|
|
formatExpression: this.replaceFun(item.editValue),// 问题表达式,关键词加#号 |
|
|
|
|
|
originalExpression: item.editValue // html==带span标签 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 删除列表 |
|
|
|
|
|
deleteFun(item){ |
|
|
|
|
|
this.$alert(item.keywordsName, '确定删除该条数据吗', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
callback: action => { |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/delKeywordsModel`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
id: item.id, |
|
|
|
|
|
houseId: this.houseId |
|
|
|
|
|
} |
|
|
|
|
|
}).then(data => { |
|
|
|
|
|
if(data.code==0){ |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/updateKeywordsModel`, |
|
|
|
|
|
method: 'post', |
|
|
|
|
|
data: { |
|
|
|
|
|
id: this.form.id, |
|
|
|
|
|
questionId: this.keyType==0?this.questionId:'', |
|
|
|
|
|
houseId:this.houseId, |
|
|
|
|
|
keyType: this.keyType, |
|
|
|
|
|
level: this.level, |
|
|
|
|
|
keywordsId: this.form.keywordsId, |
|
|
|
|
|
keywordsName: this.form.keywordsName, |
|
|
|
|
|
formatExpression: this.replaceFun(temp),// 问题表达式,关键词加#号 |
|
|
|
|
|
originalExpression: temp, // html==带span标签 |
|
|
|
|
|
answerList: answerList, |
|
|
|
|
|
showFormatExpression: text.innerText, |
|
|
|
|
|
distance: this.form.distance // 距离 |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.cansave = false |
|
|
|
|
|
this.dialogVisible = false |
|
|
|
|
|
if(res.code==0){ |
|
|
|
|
|
this.$message.success(res.data) |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.$message.error(res.msg) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
|
this.cansave = false |
|
|
|
|
|
this.dialogVisible = false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
//清空筛选条件 |
|
|
|
|
|
Emptycondition(){ |
|
|
|
|
|
this.value=''; |
|
|
|
|
|
this.keyType = 0 |
|
|
|
|
|
this.pageNum =1; |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
//初始化 |
|
|
|
|
|
getorgCode(){ |
|
|
|
|
|
this.loading= true |
|
|
|
|
|
this.tableData=[]; |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/findKeywordsModel`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
houseId:this.houseId, |
|
|
|
|
|
pageNum:this.pageNum, |
|
|
|
|
|
pageSize:this.pageSize, |
|
|
|
|
|
keywordsName: this.value, |
|
|
|
|
|
keyType: this.keyType |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.loading= false |
|
|
|
|
|
if(res.code==0){ |
|
|
|
|
|
this.tableData=res.data.results; |
|
|
|
|
|
this.total=res.data.totalRecord; |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
|
this.loading= false |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
// 处理模型 关键词加#号 |
|
|
|
|
|
replaceFun(str){ |
|
|
|
|
|
let temp = str |
|
|
|
|
|
temp = temp.replace(/<text>\ \;<\/text>/g,''); |
|
|
|
|
|
temp = temp.replace(/\ \;/g,''); |
|
|
|
|
|
temp = temp.replace(/<text>/g,''); |
|
|
|
|
|
temp = temp.replace(/<\/text>/g,''); |
|
|
|
|
|
temp = temp.replace(/<span contenteditable="false" style="color:red">/g,' #');// 后台返回是这样的,变了,需要也处理一下 |
|
|
|
|
|
temp = temp.replace(/<span style="color:red" contenteditable="false">/g,' #'); |
|
|
|
|
|
temp = temp.replace(/<\/br>/g,'') |
|
|
|
|
|
temp = temp.replace(/<br>/g,'') |
|
|
|
|
|
temp = temp.replace(/<\/span>/g,'#') |
|
|
|
|
|
// console.log('处理前temp',temp); |
|
|
|
|
|
this.delMark(temp); |
|
|
|
|
|
// console.log(temp); |
|
|
|
|
|
return temp |
|
|
|
|
|
}, |
|
|
|
|
|
//修改保存标签模型 |
|
|
|
|
|
saveFun(){ |
|
|
|
|
|
if(this.cansave) return ; // 防止多次点击 |
|
|
|
|
|
this.cansave = true; |
|
|
|
|
|
let text = document.getElementById('huashuModel'); |
|
|
|
|
|
let answerList = [] |
|
|
|
|
|
// 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;} |
|
|
|
|
|
if(this.keyType==0){ |
|
|
|
|
|
for (var i=0;i<this.dynamiclist.length;i++){ |
|
|
|
|
|
// 使用for循环判断可以跳出循环 |
|
|
|
|
|
if(!this.dynamiclist[i].markid) {this.$message.error('请完善要选择的标签'); return ;} |
|
|
|
|
|
this.wajueList.map(item1=>{ |
|
|
|
|
|
if(item1.id==this.dynamiclist[i].markid){ |
|
|
|
|
|
this.dynamiclist[i].level = item1.level |
|
|
|
|
|
this.dynamiclist[i].name = item1.name |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let huashuModel = document.getElementById('huashuModel'+i); |
|
|
|
|
|
if(huashuModel.innerText=='') {this.$message.error('请完善选择的标签模型'); return ;} |
|
|
|
|
|
this.dynamiclist[i].editValue = huashuModel.innerHTML |
|
|
|
|
|
this.dynamiclist[i].editText = huashuModel.innerText |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
answerList = this.dynamiclist.map(item=>{ |
|
|
|
|
|
return { |
|
|
|
|
|
keyType: 2, |
|
|
|
|
|
id: item.id||null, |
|
|
|
|
|
level: item.level, |
|
|
|
|
|
keywordsId: item.markid, |
|
|
|
|
|
showFormatExpression: item.editText,//文本形式 |
|
|
|
|
|
formatExpression: this.replaceFun(item.editValue),// 问题表达式,关键词加#号 |
|
|
|
|
|
originalExpression: item.editValue // html==带span标签 |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
|
|
|
handleSizeChange(val) { |
|
|
|
|
|
console.log("每页条"+ val); |
|
|
|
|
|
this.pageSize=val; |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
|
console.log("当前页"+ val); |
|
|
|
|
|
this.pageNum=val; |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/updateKeywordsModel`, |
|
|
|
|
|
method: 'post', |
|
|
|
|
|
data: { |
|
|
|
|
|
id: this.form.id, |
|
|
|
|
|
questionId: this.keyType==0?this.questionId:'', |
|
|
|
|
|
houseId:this.houseId, |
|
|
|
|
|
keyType: this.keyType, |
|
|
|
|
|
level: this.level, |
|
|
|
|
|
keywordsId: this.form.keywordsId, |
|
|
|
|
|
keywordsName: this.form.keywordsName, |
|
|
|
|
|
formatExpression: this.replaceFun(temp),// 问题表达式,关键词加#号 |
|
|
|
|
|
originalExpression: temp, // html==带span标签 |
|
|
|
|
|
answerList: answerList, |
|
|
|
|
|
showFormatExpression: text.innerText, |
|
|
|
|
|
distance: this.form.distance // 距离 |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.cansave = false |
|
|
|
|
|
this.dialogVisible = false |
|
|
|
|
|
if(res.code==0){ |
|
|
|
|
|
this.$message.success(res.data) |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.$message.error(res.msg) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
|
this.cansave = false |
|
|
|
|
|
this.dialogVisible = false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
//清空筛选条件 |
|
|
|
|
|
Emptycondition(){ |
|
|
|
|
|
this.value=''; |
|
|
|
|
|
this.keyType = 0 |
|
|
|
|
|
this.pageNum =1; |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
//初始化 |
|
|
|
|
|
getorgCode(){ |
|
|
|
|
|
this.loading= true |
|
|
|
|
|
this.tableData=[]; |
|
|
|
|
|
axios({ |
|
|
|
|
|
url: `/autoSR/zk/keymodel/findKeywordsModel`, |
|
|
|
|
|
method: 'get', |
|
|
|
|
|
params: { |
|
|
|
|
|
houseId:this.houseId, |
|
|
|
|
|
pageNum:this.pageNum, |
|
|
|
|
|
pageSize:this.pageSize, |
|
|
|
|
|
keywordsName: this.value, |
|
|
|
|
|
keyType: this.keyType |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.loading= false |
|
|
|
|
|
if(res.code==0){ |
|
|
|
|
|
this.tableData=res.data.results; |
|
|
|
|
|
this.total=res.data.totalRecord; |
|
|
|
|
|
} |
|
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
|
this.loading= false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
handleSizeChange(val) { |
|
|
|
|
|
console.log("每页条"+ val); |
|
|
|
|
|
this.pageSize=val; |
|
|
|
|
|
this.getorgCode() |
|
|
|
|
|
}, |
|
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
|
console.log("当前页"+ val); |
|
|
|
|
|
this.pageNum=val; |
|
|
|
|
|
this.getorgCode() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|