Browse Source

在当前页面新增标签

feature
mk 2 years ago
parent
commit
55a8f8b78c
  1. 16
      src/views/modules/communityService/labelConfig/addForm.vue

16
src/views/modules/communityService/labelConfig/addForm.vue

@ -7,28 +7,29 @@
class="div_form" class="div_form"
:rules="rules" :rules="rules"
> >
<!-- v-if="formType == 'info'&& addFormLabel" -->
<el-form-item <el-form-item
label="标签名称" label="标签名称"
label-width="100px" label-width="100px"
prop="tagName" prop="tagName"
v-if="formType == 'info'&& addFormLabel"
> >
<el-autocomplete <el-autocomplete
v-model="formData.tagName" v-model="formData.tagName"
value-key="tagName" value-key="tagName"
:fetch-suggestions="querySearchAsync" :fetch-suggestions="querySearchAsync"
@blur="handelChangeTagName"
placeholder="请输入内容进行搜索" placeholder="请输入内容进行搜索"
@select="handleSelect" @select="handleSelect"
></el-autocomplete> ></el-autocomplete>
</el-form-item> </el-form-item>
<el-form-item label="标签名称" label-width="100px" prop="tagName" v-else> <!-- <el-form-item label="标签名称(新增)" label-width="100px" prop="tagName" v-else>
<el-input <el-input
v-model="formData.tagName" v-model="formData.tagName"
placeholder="请输入内容" placeholder="请输入内容"
@blur="handelChangeTagName" @blur="handelChangeTagName"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item> -->
</el-form> </el-form>
<p style="margin-left: 15px"><b style="color: #f56c6c">*</b> 匹配数据</p> <p style="margin-left: 15px"><b style="color: #f56c6c">*</b> 匹配数据</p>
<el-table border :data="tableData" style="width: 100%" height="200"> <el-table border :data="tableData" style="width: 100%" height="200">
@ -292,6 +293,7 @@ export default {
methods: { methods: {
async initForm(type, row) { async initForm(type, row) {
this.formType = type; this.formType = type;
if (type == "info") { if (type == "info") {
await this.getFormEdit(row.tagId); await this.getFormEdit(row.tagId);
} else if (type == "edit") { } else if (type == "edit") {
@ -315,6 +317,7 @@ export default {
this.tableData = [] this.tableData = []
this.handleClickAddRow(); this.handleClickAddRow();
this.addFormLabel = false this.addFormLabel = false
this.formType = "add";
} else { } else {
this.formType = "info"; this.formType = "info";
} }
@ -324,8 +327,9 @@ export default {
}, 3000 * Math.random()); }, 3000 * Math.random());
}, },
handelChangeTagName(val){ handelChangeTagName(val){
if(this.formData.tagName.length == 0 && !this.addFormLabel){ if(this.formData.tagName.length == 0 ){
console.log('我在查看页面并且搜索框为空'); this.formType = 'info'
this.tableData = []
this.addFormLabel = true this.addFormLabel = true
} }
}, },
@ -336,7 +340,7 @@ export default {
}, },
async handleSelect(item) { async handleSelect(item) {
console.log(item); console.log(item);
await this.initForm("info", item); await this.initForm(item.editable?'edit':'info', item);
}, },
async getLabelList() { async getLabelList() {
const url = "/governance/resiSearchTag/listResiSearchTags"; const url = "/governance/resiSearchTag/listResiSearchTags";

Loading…
Cancel
Save