|
@@ -18,6 +18,25 @@
|
18
|
18
|
<i v-else class="el-icon-plus avatar-uploader-icon"/>
|
19
|
19
|
</el-upload>
|
20
|
20
|
</el-form-item>
|
|
21
|
+ <el-form-item>
|
|
22
|
+ <el-tag
|
|
23
|
+ v-for="tag in dynamicTags"
|
|
24
|
+ :key="tag"
|
|
25
|
+ :disable-transitions="false"
|
|
26
|
+ closable
|
|
27
|
+ @close="handleClose(tag)">
|
|
28
|
+ {{ tag }}
|
|
29
|
+ </el-tag>
|
|
30
|
+ <el-input
|
|
31
|
+ v-if="inputVisible"
|
|
32
|
+ ref="saveTagInput"
|
|
33
|
+ v-model="inputValue"
|
|
34
|
+ size="small"
|
|
35
|
+ class="input-new-tag"
|
|
36
|
+ @keyup.enter.native="handleInputConfirm"
|
|
37
|
+ @blur="handleInputConfirm"/>
|
|
38
|
+ <el-button v-else class="button-new-tag" closable @click="showInput">+ 添加标签</el-button>
|
|
39
|
+ </el-form-item>
|
21
|
40
|
</el-form>
|
22
|
41
|
<div slot="footer" class="dialog-footer">
|
23
|
42
|
<el-button @click="dialogForm('0')">取 消</el-button>
|
|
@@ -81,7 +100,8 @@ export default {
|
81
|
100
|
id: '',
|
82
|
101
|
serviceName: '',
|
83
|
102
|
sort: '',
|
84
|
|
- serviceImageUrl: ''
|
|
103
|
+ serviceImageUrl: '',
|
|
104
|
+ labelList: []
|
85
|
105
|
},
|
86
|
106
|
uploadImgUrl: process.env.BASE_API + '/uploadimage',
|
87
|
107
|
dialogStatus: '',
|
|
@@ -92,7 +112,10 @@ export default {
|
92
|
112
|
bannerPositionArr: [
|
93
|
113
|
{ id: 1, value: '首页banner' },
|
94
|
114
|
{ id: 2, value: '服务banner' }
|
95
|
|
- ]
|
|
115
|
+ ],
|
|
116
|
+ dynamicTags: [],
|
|
117
|
+ inputVisible: false,
|
|
118
|
+ inputValue: ''
|
96
|
119
|
}
|
97
|
120
|
},
|
98
|
121
|
computed: {
|
|
@@ -132,6 +155,7 @@ export default {
|
132
|
155
|
createData() {
|
133
|
156
|
this.$refs['form'].validate((valid) => {
|
134
|
157
|
if (valid) {
|
|
158
|
+ this.form.labelList = this.dynamicTags
|
135
|
159
|
this.$store.dispatch('service/createService', this.form).then((res) => {
|
136
|
160
|
if (res.data.code === '0') {
|
137
|
161
|
this.$message({
|
|
@@ -148,6 +172,23 @@ export default {
|
148
|
172
|
})
|
149
|
173
|
}
|
150
|
174
|
})
|
|
175
|
+ },
|
|
176
|
+ handleClose(tag) {
|
|
177
|
+ this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
|
|
178
|
+ },
|
|
179
|
+ showInput() {
|
|
180
|
+ this.inputVisible = true
|
|
181
|
+ this.$nextTick(_ => {
|
|
182
|
+ this.$refs.saveTagInput.$refs.input.focus()
|
|
183
|
+ })
|
|
184
|
+ },
|
|
185
|
+ handleInputConfirm() {
|
|
186
|
+ const inputValue = this.inputValue
|
|
187
|
+ if (inputValue) {
|
|
188
|
+ this.dynamicTags.push(inputValue)
|
|
189
|
+ }
|
|
190
|
+ this.inputVisible = false
|
|
191
|
+ this.inputValue = ''
|
151
|
192
|
}
|
152
|
193
|
}
|
153
|
194
|
}
|
|
@@ -161,6 +202,21 @@ export default {
|
161
|
202
|
.dialog-footer {
|
162
|
203
|
text-align: center;
|
163
|
204
|
}
|
|
205
|
+.el-tag + .el-tag {
|
|
206
|
+ margin-left: 10px;
|
|
207
|
+ }
|
|
208
|
+ .button-new-tag {
|
|
209
|
+ margin-left: 10px;
|
|
210
|
+ height: 32px;
|
|
211
|
+ line-height: 30px;
|
|
212
|
+ padding-top: 0;
|
|
213
|
+ padding-bottom: 0;
|
|
214
|
+ }
|
|
215
|
+ .input-new-tag {
|
|
216
|
+ width: 90px;
|
|
217
|
+ margin-left: 10px;
|
|
218
|
+ vertical-align: bottom;
|
|
219
|
+ }
|
164
|
220
|
</style>
|
165
|
221
|
<style>
|
166
|
222
|
.avatar-uploader .el-upload {
|