|
@@ -38,7 +38,25 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
|
<el-form-item label="自定义标签" prop="tag">
|
|
<el-form-item label="自定义标签" prop="tag">
|
|
|
- <!-- <el-input v-model="form.tag"></el-input> -->
|
|
|
|
|
|
|
+ <el-tag
|
|
|
|
|
+ :key="tag"
|
|
|
|
|
+ v-for="tag in form.tag"
|
|
|
|
|
+ closable
|
|
|
|
|
+ :disable-transitions="false"
|
|
|
|
|
+ @close="handleClose(tag)">
|
|
|
|
|
+ {{tag}}
|
|
|
|
|
+ </el-tag>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ class="input-new-tag"
|
|
|
|
|
+ v-if="inputVisible"
|
|
|
|
|
+ v-model="inputValue"
|
|
|
|
|
+ ref="saveTagInput"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @keyup.enter.native="handleInputConfirm"
|
|
|
|
|
+ @blur="handleInputConfirm"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New 标签</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -61,11 +79,13 @@ export default {
|
|
|
dialogTableVisible:false,
|
|
dialogTableVisible:false,
|
|
|
/* 当前选择的组 */
|
|
/* 当前选择的组 */
|
|
|
seleteGroup:'',
|
|
seleteGroup:'',
|
|
|
|
|
+ inputVisible: false,
|
|
|
|
|
+ inputValue: '',
|
|
|
form:{
|
|
form:{
|
|
|
sa_brandid:'',
|
|
sa_brandid:'',
|
|
|
groupname:'',
|
|
groupname:'',
|
|
|
itemno:'',
|
|
itemno:'',
|
|
|
- // tag:
|
|
|
|
|
|
|
+ tag:[]
|
|
|
},
|
|
},
|
|
|
rules:{
|
|
rules:{
|
|
|
sa_brandid: [
|
|
sa_brandid: [
|
|
@@ -84,11 +104,13 @@ export default {
|
|
|
watch: {
|
|
watch: {
|
|
|
seleteGroup: {
|
|
seleteGroup: {
|
|
|
handler(val) {
|
|
handler(val) {
|
|
|
|
|
+ console.log(val);
|
|
|
|
|
+
|
|
|
this.form = {
|
|
this.form = {
|
|
|
sa_brandid:val.sa_brandid,
|
|
sa_brandid:val.sa_brandid,
|
|
|
groupname:val.groupname,
|
|
groupname:val.groupname,
|
|
|
itemno:val.itemno,
|
|
itemno:val.itemno,
|
|
|
- // tag:
|
|
|
|
|
|
|
+ tag:val.tag1
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -108,7 +130,7 @@ export default {
|
|
|
"sa_brandid":this.form.sa_brandid,
|
|
"sa_brandid":this.form.sa_brandid,
|
|
|
"groupname":this.form.groupname,
|
|
"groupname":this.form.groupname,
|
|
|
"itemno":this.form.itemno,
|
|
"itemno":this.form.itemno,
|
|
|
- "tag": []
|
|
|
|
|
|
|
+ "tag": this.form.tag
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
console.log(res);
|
|
console.log(res);
|
|
@@ -122,6 +144,23 @@ export default {
|
|
|
editBtn() {
|
|
editBtn() {
|
|
|
this.dialogTableVisible = true
|
|
this.dialogTableVisible = true
|
|
|
this.seleteGroup = this.groupData
|
|
this.seleteGroup = this.groupData
|
|
|
|
|
+ },
|
|
|
|
|
+ handleClose(tag) {
|
|
|
|
|
+ this.form.tag.splice(this.form.tag.indexOf(tag), 1);
|
|
|
|
|
+ },
|
|
|
|
|
+ showInput() {
|
|
|
|
|
+ this.inputVisible = true;
|
|
|
|
|
+ this.$nextTick(_ => {
|
|
|
|
|
+ this.$refs.saveTagInput.$refs.input.focus();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ handleInputConfirm() {
|
|
|
|
|
+ let inputValue = this.inputValue;
|
|
|
|
|
+ if (inputValue) {
|
|
|
|
|
+ this.form.tag.push(inputValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.inputVisible = false;
|
|
|
|
|
+ this.inputValue = '';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -135,4 +174,28 @@ export default {
|
|
|
/deep/.dialog-footer {
|
|
/deep/.dialog-footer {
|
|
|
margin-top: 10px !important;
|
|
margin-top: 10px !important;
|
|
|
}
|
|
}
|
|
|
|
|
+/deep/.el-form-item__content {
|
|
|
|
|
+ width: calc(100% - 100px) !important;
|
|
|
|
|
+}
|
|
|
|
|
+/deep/.el-select {
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+}
|
|
|
|
|
+/deep/.el-form-item {
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+}
|
|
|
|
|
+.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;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|