zjf
2023-03-08 51468f93275c2bcfcc7ad25bf05f3d6a079ff764
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<template>
  <div class="edit-tag-dialog">
    <div class="title">
      <span
        class="el-icon-arrow-left"
        @click="back"/>
      <span>标签管理</span>
      <span
        class="el-icon-close rt"
        @click="close"/>
    </div>
    <div class="search">
      <el-input
        v-model="inputModel"
        :maxlength="10"
        size="mini"
        placeholder="输入标签名,最多十个字符"/>
    </div>
    <div class="content">
      <div
        v-for="(item, index) in list"
        :key="index"
        class="tag-list">
        <span
          :style="{'background': item.color ? item.color: '#ccc'}"
          class="tag-name">
          {{ item.name.length > 10 ? item.name.substring(0, 10) + '...' : item.name }}
        </span>
        <div class="rt">
          <span
            class="el-icon-edit"
            @click="editBtn(item)"/>
          <span
            class="el-icon-delete"
            @click="deleteBtn(item)"/>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  props: {
    editTagList: Array
  },
  data () {
    return {
      inputModel: '',
      list: this.editTagList
    }
  },
  watch: {
    inputModel: function (newVal) {
      this.list = this.editTagList.filter(item => {
        return item.name.indexOf(newVal) > -1
      })
    }
  },
  methods: {
    back () {
      this.$emit('back')
    },
    close () {
      this.$emit('close')
    },
    deleteBtn (item) {
      this.$emit('deleteBtn', item)
    },
    editBtn (item) {
      this.$emit('editBtn', item)
    }
  }
}
</script>
 
<style scoped lang="scss">
.edit-tag-dialog {
  overflow: hidden;
  // position: absolute;
  // top: 0;
  // left: -110px;
  // right: 0;
  background: #fff;
  min-height: 200px;
  // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
  .title {
    padding: 10px;
    border-bottom: 1px solid#E6E6E6;
    margin-bottom: 20px;
    .el-icon-close {
      margin-right: 0;
      cursor: pointer;
    }
    .el-icon-arrow-left {
      cursor: pointer;
    }
  }
  .search {
    .el-input {
      width: 90%;
      margin: 0 5%;
    }
    .el-input /deep/ .el-input__inner {
      border-radius: 15px;
    }
  }
  .content {
    margin: 10px 0;
    height: 196px;
    overflow: auto;
    .tag-list {
      padding: 5px 5%;
      .rt {
        margin-right: 0;
        color: #aaa;
        span {
          margin-right: 10px;
          cursor: pointer;
        }
      }
      .tag-name {
        font-size: 12px;
        border-radius: 3px;
        padding: 3px 10px;
        color: #fff;
      }
    }
    .tag-list:hover {
      background: #f7f8fa;
    }
  }
}
</style>