|
@@ -11,38 +11,42 @@
|
11
|
11
|
</div>
|
12
|
12
|
</div>
|
13
|
13
|
<div class="flex">
|
14
|
|
- <el-button type="primary" size="mini" @click="addLableGroup">添加标签组</el-button>
|
|
14
|
+ <el-button type="primary" size="mini" @click="addLableGroup('add')">添加标签组</el-button>
|
15
|
15
|
</div>
|
16
|
16
|
</div>
|
17
|
17
|
<div class="tagListBox">
|
18
|
18
|
<div class="tagItemBox" v-for="(item,mIdx) in tableData" :key="item.group_id">
|
19
|
|
- <div style="width: 15%">
|
|
19
|
+ <div style="width: 15%;flex-shrink: 0">
|
20
|
20
|
<div class="fWeight600 c-333 f14">{{item.group_name?item.group_name:'-'}}</div>
|
21
|
21
|
<div class="c-666 f13 tMar10">共{{item.tag_num?item.tag_num:'-'}}个标签</div>
|
22
|
22
|
</div>
|
23
|
|
- <div class="flex-align-center">
|
|
23
|
+ <div class="flex-align-center" style="flex-wrap: wrap">
|
24
|
24
|
<div class="add" @click="addLable(item)">+ 添加</div>
|
25
|
|
- <el-input v-if="item.iptshow" v-focus class="ipt" v-model="item.addLableVal" placeholder="请输入标签" @blur="iptBlur(item)"></el-input>
|
|
25
|
+ <el-input v-if="item.iptshow" v-focus class="ipt" @input="forceUpdate" v-model="item.addLableVal" placeholder="请输入标签" @blur="iptBlur(item)"></el-input>
|
26
|
26
|
<div class="lableItem" v-for="t in item.tag_list" :key="t.tag_id">
|
27
|
27
|
{{t.tag_name}}
|
28
|
28
|
</div>
|
29
|
29
|
</div>
|
30
|
|
- <div class="flex-align-center lMarauto">
|
31
|
|
- <span class="pointer rMar7">
|
32
|
|
- <i class="el-icon-top f14 " :class="mIdx == 0 ? 'disCss' : ''" @click="upClick(mIdx)"></i>上移
|
33
|
|
- </span>
|
34
|
|
- <span class="pointer rMar7">
|
35
|
|
- <i class="el-icon-bottom f14 " :class="mIdx == tableData.length-1 ? 'disCss' : ''" @click="downClick(mIdx)"></i>上移
|
36
|
|
- </span>
|
37
|
|
- <span class="pointer rMar7">
|
38
|
|
- <i class="el-icon-edit f14"></i> 修改
|
39
|
|
- </span>
|
|
30
|
+ <div class="flex-align-center lMarauto editArea">
|
|
31
|
+ <div class="pointer rMar10 flex-align-center" @click="mIdx>0&&orderList(item.group_id)">
|
|
32
|
+ <img src="../../assets/img/upNone.png" alt="" v-if="mIdx == 0">
|
|
33
|
+ <img src="../../assets/img/up.png" alt="" v-if="mIdx > 0">
|
|
34
|
+ 上移
|
|
35
|
+ </div>
|
|
36
|
+ <div class="pointer rMar10 flex-align-center" @click="mIdx < tableData.length-1&&orderList(item.group_id)">
|
|
37
|
+ <img src="../../assets/img/downNone.png" alt="" v-if="mIdx == tableData.length-1">
|
|
38
|
+ <img src="../../assets/img/down.png" alt="" v-if="mIdx < tableData.length-1">
|
|
39
|
+ 上移
|
|
40
|
+ </div>
|
|
41
|
+ <div class="pointer flex-align-center" @click="addLableGroup('edit')">
|
|
42
|
+ <img src="../../assets/img/edit.png" alt="">
|
|
43
|
+ 修改
|
|
44
|
+ </div>
|
40
|
45
|
</div>
|
41
|
46
|
|
42
|
47
|
</div>
|
43
|
48
|
</div>
|
44
|
|
-
|
45
|
|
- <tagGroup ref="tagRef"></tagGroup>
|
|
49
|
+ <tagGroup ref="tagRef" :source="editOpa"></tagGroup>
|
46
|
50
|
|
47
|
51
|
</div>
|
48
|
52
|
</template>
|
|
@@ -58,8 +62,7 @@ export default {
|
58
|
62
|
tableData: [],
|
59
|
63
|
resetFlag: false,//重置
|
60
|
64
|
input_keyword: '',
|
61
|
|
- iptshow:false,
|
62
|
|
- moreLable:[],
|
|
65
|
+ editOpa:'add',//判断是新增标签组还是修改标签组
|
63
|
66
|
|
64
|
67
|
}
|
65
|
68
|
},
|
|
@@ -74,10 +77,17 @@ export default {
|
74
|
77
|
this.init(1)
|
75
|
78
|
},
|
76
|
79
|
methods: {
|
|
80
|
+ orderList(){
|
|
81
|
+
|
|
82
|
+ },
|
|
83
|
+ forceUpdate() {
|
|
84
|
+ this.$forceUpdate()
|
|
85
|
+ },
|
77
|
86
|
addTag(){
|
78
|
87
|
|
79
|
88
|
},
|
80
|
|
- addLableGroup(){
|
|
89
|
+ addLableGroup(opa){
|
|
90
|
+ this.editOpa = opa
|
81
|
91
|
this.$nextTick(()=>{
|
82
|
92
|
this.$refs.tagRef.lableGroup = true
|
83
|
93
|
})
|
|
@@ -91,17 +101,21 @@ export default {
|
91
|
101
|
item.iptshow = false
|
92
|
102
|
this.$forceUpdate()
|
93
|
103
|
if(item.addLableVal){
|
94
|
|
- this.$axios.post(this.URL.BASEURL + this.URL.addTag, {
|
95
|
|
- group_name: this.groupName,
|
96
|
|
- name:item.addLableVal
|
|
104
|
+ this.$axios.post(this.URL.BASEURL + this.URL.add_tag, {
|
|
105
|
+ group_id: item.group_id,
|
|
106
|
+ tag_name:item.addLableVal
|
97
|
107
|
}).then((res) => {
|
98
|
108
|
var res = res.data
|
|
109
|
+ if(res&&res.errno == 0){
|
|
110
|
+ item.tag_list.push({tag_name:item.addLableVal})
|
|
111
|
+ item.tag_num+=1
|
|
112
|
+ return
|
|
113
|
+ }
|
99
|
114
|
this.$message({
|
100
|
115
|
message: res.err,
|
101
|
|
- type: "warning"
|
|
116
|
+ type: "info"
|
102
|
117
|
})
|
103
|
118
|
})
|
104
|
|
- // this.lableArr.push({id:this.lableArr.length,name:this.addLableVal})
|
105
|
119
|
}
|
106
|
120
|
},
|
107
|
121
|
resetEvent () {//重置
|
|
@@ -138,20 +152,7 @@ export default {
|
138
|
152
|
handleCurrentChange (val) {
|
139
|
153
|
this.init(val)
|
140
|
154
|
},
|
141
|
|
- // 上移
|
142
|
|
- upClick(index) {
|
143
|
|
- if(index == 0){return false}
|
144
|
|
- this.moreLable = this.swapItems(this.moreLable, index, index - 1)
|
145
|
|
- },
|
146
|
|
- // 下移
|
147
|
|
- downClick(index) {
|
148
|
|
- if(index == this.moreLable.length-1){return false}
|
149
|
|
- this.moreLable = this.swapItems(this.moreLable, index, index + 1)
|
150
|
|
- },
|
151
|
|
- swapItems(arr, index1, index2) {
|
152
|
|
- arr[index1] = arr.splice(index2, 1, arr[index1])[0];
|
153
|
|
- return arr;
|
154
|
|
- },
|
|
155
|
+
|
155
|
156
|
}
|
156
|
157
|
}
|
157
|
158
|
</script>
|
|
@@ -166,6 +167,17 @@ export default {
|
166
|
167
|
line-height: 30px;
|
167
|
168
|
}
|
168
|
169
|
}
|
|
170
|
+ .editArea{
|
|
171
|
+ font-size: 13px;
|
|
172
|
+ flex-shrink: 0;
|
|
173
|
+ padding-left: 30px;
|
|
174
|
+ img{
|
|
175
|
+ width: 14px;
|
|
176
|
+ height: 14px;
|
|
177
|
+ flex-shrink: 0;
|
|
178
|
+ margin-right: 3px;
|
|
179
|
+ }
|
|
180
|
+ }
|
169
|
181
|
}
|
170
|
182
|
|
171
|
183
|
</style>
|