liuxiaolong
2019-05-06 d380e76ec9783bcd80eb42e495d6f8e1af0827b4
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
<div>
  <div class="flex-center">
    <upload-drag
      limitTypes=".jpg,.png"
      limitSize=""
      uploadBtntext="上传图片"
      uploadBtnIcon
      :isDrag="true"
      @addFilesBaBackFN="addFiles"
      @successFN="getPersonList"
    />
    <!-- <upload-common
      limitTypes=".jpg,.png"
      uploadBtntext="上传图片"
    ></upload-common> -->
  </div>
  <div class="list mt20" v-if="uploadSuList.length !== 0">
    <!-- 布控列表 start -->
    <div class="px-4 py-4 person-list">
      <div class="row">
        <div
          class="col-lg-3 col-md-4 col-sm-6 pb-2"
          v-for="(item,index) in uploadSuList"
          :key="index"
        >
          <div class="person-list-item px-2 py-3 border">
            <div class="d-flex">
              <div class="person-list-item-check pr-2">
                <el-checkbox v-model="item.isCheck" @change="handleChange(item)"/>
              </div>
              <div class="person-list-item-img flex-center">
                <httpImg :src="item.imgUrl" width="100px" height="100px" alt/>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 布控列表 end -->
  </div>
</div>
</template>
<script>
import { Table, TableColumn, Row, Col, Button, Input, Checkbox } from 'element-ui'
import uploadDrag from './uploadDrag'
import uploadCommon from './uploadCommon'
export default {
  props: {
 
  },
  components: {
    elCheckbox: Checkbox,
    elTable: Table,
    elRow: Row,
    elCol: Col,
    elButton: Button,
    elInput: Input,
    elTableColumn: TableColumn,
    uploadDrag,
    uploadCommon
  },
  computed: {
    orgId() {
      return this.$store.getters.basicUserInfo.orgId
    }
  },
  data() {
    return {
      /** 上传成功的list */
      uploadSuList: []
    }
  },
  methods: {
    /** 上传图片的回调 */
    addFiles(data) {
      console.log(data, 'data 上传图片')
      if (data) {
        if (data && data.fileList.length !== 0) {
          data.fileList.forEach(item => {
            this.$set(item, 'isCheck', false)
            this.$set(item, 'dataType', 'uploadSuList')
            this.$set(item, 'imgUrl', item.path)
          })
          this.uploadSuList = data.fileList
          console.log(this.uploadSuList, 'this.uploadSuList')
        }
      }
    },
    /** 上传成功后加载图片列表 */
    getPersonList(data) {
      console.log(data, 'data  getPersonList')
    },
    handleChange(data) {
      console.log(data, '从上传图片中选择')
      this.$emit('handleChange', data)
    }
  },
  mounted() {
 
  }
}
</script>
<style lang="scss" scoped>
.list{
}
.person-list {
  .person-list-item {
    overflow: auto;
    .person-list-item-check {
      display: flex;
      align-items: center;
    }
    .person-list-item-img {
      flex: 1 1 auto;
      text-align: center;
    }
    .person-list-item-info {
      flex: 1 1 auto;
      h6 {
        font-size: 16px;
        font-weight: 900;
      }
      h6,
      p {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin: 0 auto;
      }
      p.visibility {
        visibility: hidden;
      }
      p.none {
        display: none;
      }
      .btns {
        max-width: 100px;
        margin: 0 auto;
      }
      .btns span {
        padding: 0 2px;
        font-size: 15px;
        cursor: pointer;
        color: #35bde7;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }
    }
    .person-list-item-close{
      float: right;
    }
  }
}
</style>