| | |
| | | <!-- <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); |
| | | } |