|  |  |  | 
|---|
|  |  |  | regexno = regexno.slice(0, -1); | 
|---|
|  |  |  | hostregex = "(?=.*(?:" + `${regex}` + ")).*$"; | 
|---|
|  |  |  | hostregexno = "^(?!.(?:" + `${regexno}` + ")).*$"; | 
|---|
|  |  |  | this.TargetoptionList[index].hostregex = hostregex; | 
|---|
|  |  |  | this.TargetoptionList[index].hostregex2 = hostregexno; | 
|---|
|  |  |  | this.TargetoptionList[index].targetregex = hostregex; | 
|---|
|  |  |  | this.TargetoptionList[index].targetregex2 = hostregexno; | 
|---|
|  |  |  | console.log(hostregex, "确定字匹配"); | 
|---|
|  |  |  | console.log(hostregexno, "否定字匹配"); | 
|---|
|  |  |  | this.handleSelectionChange(); | 
|---|
|  |  |  | 
|---|
|  |  |  | const user = { | 
|---|
|  |  |  | state: { | 
|---|
|  |  |  | regular: [ | 
|---|
|  |  |  | { value: "1", label: "优" }, | 
|---|
|  |  |  | { value: "2", label: "美" }, | 
|---|
|  |  |  | { value: "3", label: "善" }, | 
|---|
|  |  |  | { value: "4", label: "美好" }, | 
|---|
|  |  |  | { value: "5", label: "幸福" }, | 
|---|
|  |  |  | { value: "6", label: "甜美" }, | 
|---|
|  |  |  | { value: "7", label: "可爱" }, | 
|---|
|  |  |  | { value: "8", label: "美满" }, | 
|---|
|  |  |  | { value: "9", label: "美丽" }, | 
|---|
|  |  |  | { value: "10", label: "快乐" }, | 
|---|
|  |  |  | { value: "11", label: "幸福美满" }, | 
|---|
|  |  |  | { value: "12", label: "美好幸福" }, | 
|---|
|  |  |  | { value: "13", label: "美满幸福" }, | 
|---|
|  |  |  | { value: "14", label: "美丽幸福" }, | 
|---|
|  |  |  | { value: "15", label: "美好快乐" }, | 
|---|
|  |  |  | { value: "16", label: "幸福快乐" }, | 
|---|
|  |  |  | { value: "17", label: "美满快乐" }, | 
|---|
|  |  |  | { value: "18", label: "美丽快乐" }, | 
|---|
|  |  |  | { value: "19", label: "美好甜美" }, | 
|---|
|  |  |  | { value: "20", label: "幸福甜美" }, | 
|---|
|  |  |  | { value: "21", label: "美满甜美" }, | 
|---|
|  |  |  | { value: "22", label: "美丽甜美" }, | 
|---|
|  |  |  | { value: "23", label: "善良美好" }, | 
|---|
|  |  |  | { value: "24", label: "优美幸福" }, | 
|---|
|  |  |  | { value: "25", label: "善良幸福" }, | 
|---|
|  |  |  | { value: "26", label: "优美快乐" }, | 
|---|
|  |  |  | { value: "27", label: "善良快乐" }, | 
|---|
|  |  |  | { value: "28", label: "优美甜美" }, | 
|---|
|  |  |  | { value: "29", label: "善良甜美" }, | 
|---|
|  |  |  | { value: "30", label: "美好可爱" }, | 
|---|
|  |  |  | { value: "1", label: "是" }, | 
|---|
|  |  |  | { value: "2", label: "对" }, | 
|---|
|  |  |  | { value: "3", label: "好" }, | 
|---|
|  |  |  | { value: "4", label: "确" }, | 
|---|
|  |  |  | { value: "5", label: "的确" }, | 
|---|
|  |  |  | { value: "6", label: "确定" }, | 
|---|
|  |  |  | { value: "7", label: "确认" }, | 
|---|
|  |  |  | { value: "8", label: "妥" }, | 
|---|
|  |  |  | { value: "9", label: "没问题" }, | 
|---|
|  |  |  | { value: "10", label: "是的" }, | 
|---|
|  |  |  | { value: "11", label: "确信" }, | 
|---|
|  |  |  | { value: "19", label: "确凿无疑" }, | 
|---|
|  |  |  | { value: "20", label: "确定不移" }, | 
|---|
|  |  |  | { value: "22", label: "确实如此" }, | 
|---|
|  |  |  | { value: "23", label: "确实无误" }, | 
|---|
|  |  |  | { value: "24", label: "确实无疑" }, | 
|---|
|  |  |  | { value: "25", label: "确实毋庸置疑" }, | 
|---|
|  |  |  | { value: "26", label: "确实如实" }, | 
|---|
|  |  |  | { value: "27", label: "确实如是" }, | 
|---|
|  |  |  | { value: "28", label: "确实正确" }, | 
|---|
|  |  |  | { value: "29", label: "确实正确无误" }, | 
|---|
|  |  |  | { value: "30", label: "确实正确无疑" }, | 
|---|
|  |  |  | { value: "31", label: "确实正确毋庸置疑" }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | noregular: [ | 
|---|
|  |  |  | { value: "1", label: "否" }, | 
|---|
|  |  |  | 
|---|
|  |  |  | <!-- <el-input v-model="indexform.userName" maxlength="30" /> --> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-form-item label="匹配文本" prop="desc"> | 
|---|
|  |  |  | <el-input | 
|---|
|  |  |  | type="textarea" | 
|---|
|  |  |  | placeholder="请输入匹配正则" | 
|---|
|  |  |  | v-model="ruleForm.selfRegex" | 
|---|
|  |  |  | ></el-input> | 
|---|
|  |  |  | <el-form-item label="关键字(含)" prop="desc"> | 
|---|
|  |  |  | <div class="xinz-inf"> | 
|---|
|  |  |  | <el-tag | 
|---|
|  |  |  | :key="crux" | 
|---|
|  |  |  | type="success" | 
|---|
|  |  |  | v-for="crux in ruleForm.dynamiccruxs" | 
|---|
|  |  |  | closable | 
|---|
|  |  |  | effect="dark" | 
|---|
|  |  |  | :disable-transitions="false" | 
|---|
|  |  |  | @close="handleClosecrux(crux, ruleForm, 1)" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {{ crux }} | 
|---|
|  |  |  | </el-tag> | 
|---|
|  |  |  | <el-select | 
|---|
|  |  |  | v-model="inputValue" | 
|---|
|  |  |  | v-if="inputVisible" | 
|---|
|  |  |  | @change="handleInputConfirm(ruleForm)" | 
|---|
|  |  |  | filterable | 
|---|
|  |  |  | remote | 
|---|
|  |  |  | allow-create | 
|---|
|  |  |  | reserve-keyword | 
|---|
|  |  |  | default-first-option | 
|---|
|  |  |  | :loading="loading" | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="ruleForms in regular" | 
|---|
|  |  |  | :key="ruleForms.label" | 
|---|
|  |  |  | :label="ruleForms.label" | 
|---|
|  |  |  | :value="ruleForms.label" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | <el-button | 
|---|
|  |  |  | v-else | 
|---|
|  |  |  | class="button-new-tag" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | @click="showInput(ruleForm)" | 
|---|
|  |  |  | >+ 新增</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="关键字(非)" prop="desc"> | 
|---|
|  |  |  | <div class="xinz-inf"> | 
|---|
|  |  |  | <el-tag | 
|---|
|  |  |  | :key="crux" | 
|---|
|  |  |  | type="warning" | 
|---|
|  |  |  | v-for="crux in ruleForm.nodynamiccruxs" | 
|---|
|  |  |  | closable | 
|---|
|  |  |  | effect="dark" | 
|---|
|  |  |  | :disable-transitions="false" | 
|---|
|  |  |  | @close="handleClosecrux(crux, ruleForm, 2)" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | {{ crux }} | 
|---|
|  |  |  | </el-tag> | 
|---|
|  |  |  | <el-select | 
|---|
|  |  |  | v-model="inputValue" | 
|---|
|  |  |  | v-if="noinputVisible" | 
|---|
|  |  |  | @change="handleInputConfirm(ruleForm)" | 
|---|
|  |  |  | filterable | 
|---|
|  |  |  | remote | 
|---|
|  |  |  | allow-create | 
|---|
|  |  |  | reserve-keyword | 
|---|
|  |  |  | default-first-option | 
|---|
|  |  |  | :loading="loading" | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-option | 
|---|
|  |  |  | v-for="ruleForms in noregular" | 
|---|
|  |  |  | :key="ruleForms.value" | 
|---|
|  |  |  | :label="ruleForms.label" | 
|---|
|  |  |  | :value="ruleForms.label" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | <el-button | 
|---|
|  |  |  | v-else | 
|---|
|  |  |  | class="button-new-tag" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | @click="showInputno(ruleForm)" | 
|---|
|  |  |  | >+ 新增</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item> | 
|---|
|  |  |  | <el-button type="primary" @click="submitForm('ruleForm')" | 
|---|
|  |  |  | 
|---|
|  |  |  | label: "结束语", | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | ruleForm: {}, | 
|---|
|  |  |  | ruleForm: { | 
|---|
|  |  |  | dynamiccruxs: [], | 
|---|
|  |  |  | nodynamiccruxs: [], | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | baseForm: { | 
|---|
|  |  |  | extName: "", | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | rules: {}, | 
|---|
|  |  |  | bases: {}, | 
|---|
|  |  |  | whether: 1, //1为关键词,2为否定关键词 | 
|---|
|  |  |  | inputValue: "", | 
|---|
|  |  |  | inputVisible: false, | 
|---|
|  |  |  | noinputVisible: false, | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | regular: [], | 
|---|
|  |  |  | noregular: [], | 
|---|
|  |  |  | nodynamiccruxs: ["别", "不"], | 
|---|
|  |  |  | dynamiccruxs: ["好"], | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | this.usable = store.getters.usablesz; | 
|---|
|  |  |  | this.languagelist = store.getters.languagelist; | 
|---|
|  |  |  | this.mode = store.getters.mode; | 
|---|
|  |  |  | this.regular = store.getters.regular; | 
|---|
|  |  |  | this.noregular = store.getters.noregular; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 正则----------------- | 
|---|
|  |  |  | // 生成正则 | 
|---|
|  |  |  | generateRegex(row) { | 
|---|
|  |  |  | let regex = ""; | 
|---|
|  |  |  | let regexno = ""; | 
|---|
|  |  |  | let hostregex = ""; | 
|---|
|  |  |  | let hostregexno = ""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (let i = 0; i < this.ruleForm.dynamiccruxs.length; i++) { | 
|---|
|  |  |  | regex += `${this.ruleForm.dynamiccruxs[i]}|`; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (let i = 0; i < this.ruleForm.nodynamiccruxs.length; i++) { | 
|---|
|  |  |  | regexno += `${this.ruleForm.nodynamiccruxs[i]}|`; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | regex = regex.slice(0, -1); | 
|---|
|  |  |  | regexno = regexno.slice(0, -1); | 
|---|
|  |  |  | hostregex = "(?=.*(?:" + `${regex}` + ")).*$"; | 
|---|
|  |  |  | hostregexno = "^(?!.(?:" + `${regexno}` + ")).*$"; | 
|---|
|  |  |  | this.ruleForm.selfRegex = hostregex; | 
|---|
|  |  |  | this.ruleForm.selfRegex2 = hostregexno; | 
|---|
|  |  |  | console.log(hostregex, "确定字匹配"); | 
|---|
|  |  |  | console.log(hostregexno, "否定字匹配"); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleClosecrux(crux, item, whether) { | 
|---|
|  |  |  | if (whether == 1) { | 
|---|
|  |  |  | item.dynamiccruxs.splice(item.dynamiccruxs.indexOf(crux), 1); | 
|---|
|  |  |  | console.log(1); | 
|---|
|  |  |  | console.log(item.dynamiccruxs); | 
|---|
|  |  |  | console.log(item.nodynamiccruxs); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | console.log(2); | 
|---|
|  |  |  | item.nodynamiccruxs.splice(item.nodynamiccruxs.indexOf(crux), 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.generateRegex(item); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleInputConfirm(row) { | 
|---|
|  |  |  | // let index = this.TargetoptionList.indexOf(row); | 
|---|
|  |  |  | console.log(this.ruleForm.dynamiccruxs); | 
|---|
|  |  |  | console.log(this.ruleForm.nodynamiccruxs); | 
|---|
|  |  |  | if (this.whether == 1 && this.inputValue) { | 
|---|
|  |  |  | console.log(1); | 
|---|
|  |  |  | if (this.ruleForm.dynamiccruxs.indexOf(this.inputValue) == -1) { | 
|---|
|  |  |  | this.ruleForm.dynamiccruxs.push(this.inputValue); | 
|---|
|  |  |  | console.log(2); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$message.error("关键字已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // this.inputVisible = false; | 
|---|
|  |  |  | this.inputVisible = false; | 
|---|
|  |  |  | } else if (this.whether == 2 && this.inputValue) { | 
|---|
|  |  |  | console.log(this.ruleForm.nodynamiccruxs.indexOf(this.inputValue)); | 
|---|
|  |  |  | if (this.ruleForm.nodynamiccruxs.indexOf(this.inputValue) == -1) { | 
|---|
|  |  |  | this.ruleForm.nodynamiccruxs.push(this.inputValue); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$message.error("关键字已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // this.noinputVisible = false; | 
|---|
|  |  |  | this.noinputVisible = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.generateRegex(row); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.inputValue = ""; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | showInput(row) { | 
|---|
|  |  |  | // let index = this.TargetoptionList.indexOf(row); | 
|---|
|  |  |  | this.inputVisible = true; | 
|---|
|  |  |  | // this.$set(this.ruleForm, "inputVisible", true); | 
|---|
|  |  |  | this.whether = 1; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | showInputno(row) { | 
|---|
|  |  |  | // let index = this.TargetoptionList.indexOf(row); | 
|---|
|  |  |  | this.noinputVisible = true; | 
|---|
|  |  |  | // this.$set(this.ruleForm, "noinputVisible", true); | 
|---|
|  |  |  | this.whether = 2; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | 
|---|
|  |  |  | .button-textsc { | 
|---|
|  |  |  | color: rgb(235, 23, 23); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .topicxq { | 
|---|
|  |  |  | background-color: #e2f5fc; | 
|---|
|  |  |  | border-radius: 4px; | 
|---|
|  |  |  | margin-top: 10px; | 
|---|
|  |  |  | padding: 10px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .el-tag + .el-tag { | 
|---|
|  |  |  | margin-left: 10px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .button-new-tag { | 
|---|
|  |  |  | margin-left: 10px; | 
|---|
|  |  |  | height: 32px; | 
|---|
|  |  |  | line-height: 30px; | 
|---|
|  |  |  | padding-top: 0; | 
|---|
|  |  |  | padding-bottom: 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .input-new-tag { | 
|---|
|  |  |  | width: 90px; | 
|---|
|  |  |  | margin-left: 10px; | 
|---|
|  |  |  | vertical-align: bottom; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ::v-deep.el-table .warning-row { | 
|---|
|  |  |  | background: rgb(193, 208, 250); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | // 发起ws请求 | 
|---|
|  |  |  | sendWebsocket( | 
|---|
|  |  |  | "ws://localhost:8089/chat?userId=1", | 
|---|
|  |  |  | "ws://192.168.2.8:8089/chat?userId=1", | 
|---|
|  |  |  | obj, | 
|---|
|  |  |  | this.wsMessage, | 
|---|
|  |  |  | this.wsError | 
|---|
|  |  |  | 
|---|
|  |  |  | dataJson = JSON.parse(dataJson); | 
|---|
|  |  |  | dataJson = JSON.parse(dataJson); | 
|---|
|  |  |  | console.log(dataJson, "数据"); | 
|---|
|  |  |  | // 首次接收数据 | 
|---|
|  |  |  | if (!this.Answerline[0]) { | 
|---|
|  |  |  | this.Answerline.push({ | 
|---|
|  |  |  | value: dataJson.kcb, | 
|---|
|  |  |  | isEat: 1, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.Answerline.push({ | 
|---|
|  |  |  | value: dataJson.nowQuestion.questionText, | 
|---|
|  |  |  | isEat: 1, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 优先加入通用库匹配文本 | 
|---|
|  |  |  | if (dataJson.nowQuestion.submoduleText) { | 
|---|
|  |  |  | this.Answerline.push({ | 
|---|
|  |  |  | value: dataJson.nowQuestion.submoduleText, | 
|---|
|  |  |  | isEat: 1, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 是否结束 | 
|---|
|  |  |  | if (!dataJson.jsy) { | 
|---|
|  |  |  | this.Answerline.push({ | 
|---|
|  |  |  | value: dataJson.nowQuestion.questionText, | 
|---|
|  |  |  | isEat: 1, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.Answerline.push({ | 
|---|
|  |  |  | value: dataJson.jsy, | 
|---|
|  |  |  | isEat: 1, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.questionList = dataJson.questionList; | 
|---|
|  |  |  | this.questionList = this.questionList.map((item) => { | 
|---|
|  |  |  | item.ivrLibaScriptTargetoptionList.forEach((row) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log(obj, "入参"); | 
|---|
|  |  |  | // 发起ws请求 | 
|---|
|  |  |  | sendWebsocket( | 
|---|
|  |  |  | "ws://localhost:8089/chat?userId=1", | 
|---|
|  |  |  | "ws://192.168.2.8:8089/chat?userId=1", | 
|---|
|  |  |  | obj, | 
|---|
|  |  |  | this.wsMessage, | 
|---|
|  |  |  | this.wsError | 
|---|